* Read SPI BAR offset 0x10 throwing processor exception
@ 2022-01-28 12:47 Rao G
2022-01-28 12:59 ` [edk2-devel] " Michael Brown
0 siblings, 1 reply; 4+ messages in thread
From: Rao G @ 2022-01-28 12:47 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 617 bytes --]
Hi All,
Attempting to Read SPIBAR 0x10 from BUS 0 Dev 1F Func 5
>>
ScSpiBar0 = MmioRead32 (SpiInstance->PchSpiBase +
PCI_BASE_ADDRESSREG_OFFSET) & 0xFFFFF000;
>>
The above code is throwing exception
PchSpiBase at 0xC00FD000
!!!! X64 Exception Type - 0E(#PF - Page-Fault) CPU Apic ID - 00000000 !!!!
ExceptionData - 0000000000000000 I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SGX:0
RIP - 00000000771903D0, CS - 0000000000000038, RFLAGS - 0000000000010046
>From the shell the value at offset 0x10 is 0xFE010000
Any clues on why the processor is throwing exception while accessing the
value PchSpiBase+0x10 ?
Thanks
Ranga
[-- Attachment #2: Type: text/html, Size: 891 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] Read SPI BAR offset 0x10 throwing processor exception
2022-01-28 12:47 Read SPI BAR offset 0x10 throwing processor exception Rao G
@ 2022-01-28 12:59 ` Michael Brown
2022-01-28 13:08 ` Rao G
0 siblings, 1 reply; 4+ messages in thread
From: Michael Brown @ 2022-01-28 12:59 UTC (permalink / raw)
To: devel, grao.v80
On 28/01/2022 12:47, Rao G wrote:
> Attempting to Read SPIBAR 0x10 from BUS 0 Dev 1F Func 5
>
> >>
> ScSpiBar0 = MmioRead32 (SpiInstance->PchSpiBase +
> PCI_BASE_ADDRESSREG_OFFSET) & 0xFFFFF000;
> >>
>
> The above code is throwing exception
>
> PchSpiBase at 0xC00FD000
> !!!! X64 Exception Type - 0E(#PF - Page-Fault) CPU Apic ID - 00000000 !!!!
> ExceptionData - 0000000000000000 I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SGX:0
> RIP - 00000000771903D0, CS - 0000000000000038, RFLAGS - 0000000000010046
>
> From the shell the value at offset 0x10 is 0xFE010000
>
> Any clues on why the processor is throwing exception while accessing the
> value PchSpiBase+0x10 ?
PCI_BASE_ADDRESSREG_OFFSET is an offset within PCI configuration space.
It looks as though you are trying to use an MMIO access to read from
PCI configuration space, which is not a valid thing to do.
I suspect you may want to use EFI_PCI_IO_PROTOCOL.Pci.Read() instead.
HTH,
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] Read SPI BAR offset 0x10 throwing processor exception
2022-01-28 12:59 ` [edk2-devel] " Michael Brown
@ 2022-01-28 13:08 ` Rao G
2022-01-29 5:49 ` Jeff Fan
0 siblings, 1 reply; 4+ messages in thread
From: Rao G @ 2022-01-28 13:08 UTC (permalink / raw)
To: Michael Brown; +Cc: devel
[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]
Hi Michael,
SpiInstance->PchSpiBase = MmPciBase (
DEFAULT_PCI_BUS_NUMBER_PCH,
PCI_DEVICE_NUMBER_PCH_SPI,
PCI_FUNCTION_NUMBER_PCH_SPI
);
DEBUG ((DEBUG_INFO, "PchSpiBase at 0x%x\n", SpiInstance->PchSpiBase));
>> returns PchSpiBase as 0xC00FD000 (Bus 0 Dev 1F Func 0)
ScSpiBar0 = MmioRead32 (SpiInstance->PchSpiBase +
PCI_BASE_ADDRESSREG_OFFSET) & 0xFFFFF000;
>> this should return value at 0xC00FD010
Hope it appears to be a standard code and accessing through MMIO library
should work
Thanks
Ranga
On Fri, Jan 28, 2022 at 12:59 PM Michael Brown <mcb30@ipxe.org> wrote:
> On 28/01/2022 12:47, Rao G wrote:
> > Attempting to Read SPIBAR 0x10 from BUS 0 Dev 1F Func 5
> >
> > >>
> > ScSpiBar0 = MmioRead32 (SpiInstance->PchSpiBase +
> > PCI_BASE_ADDRESSREG_OFFSET) & 0xFFFFF000;
> > >>
> >
> > The above code is throwing exception
> >
> > PchSpiBase at 0xC00FD000
> > !!!! X64 Exception Type - 0E(#PF - Page-Fault) CPU Apic ID - 00000000
> !!!!
> > ExceptionData - 0000000000000000 I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SGX:0
> > RIP - 00000000771903D0, CS - 0000000000000038, RFLAGS -
> 0000000000010046
> >
> > From the shell the value at offset 0x10 is 0xFE010000
> >
> > Any clues on why the processor is throwing exception while accessing the
> > value PchSpiBase+0x10 ?
>
> PCI_BASE_ADDRESSREG_OFFSET is an offset within PCI configuration space.
> It looks as though you are trying to use an MMIO access to read from
> PCI configuration space, which is not a valid thing to do.
>
> I suspect you may want to use EFI_PCI_IO_PROTOCOL.Pci.Read() instead.
>
> HTH,
>
> Michael
>
[-- Attachment #2: Type: text/html, Size: 2418 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] Read SPI BAR offset 0x10 throwing processor exception
2022-01-28 13:08 ` Rao G
@ 2022-01-29 5:49 ` Jeff Fan
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Fan @ 2022-01-29 5:49 UTC (permalink / raw)
To: devel@edk2.groups.io, grao.v80, Michael Brown; +Cc: devel@edk2.groups.io
[-- Attachment #1: Type: text/plain, Size: 2085 bytes --]
Ranga,
What's CR2 value in Exception dump information?It holds the actual address occurred PF exception.
ExceptionData - 0000000000000000 P:0 means no page transition in page table.
Jeff
fanjianfeng@byosoft.com.cn
From: Rao G
Date: 2022-01-28 21:08
To: Michael Brown
CC: devel
Subject: Re: [edk2-devel] Read SPI BAR offset 0x10 throwing processor exception
Hi Michael,
SpiInstance->PchSpiBase = MmPciBase (
DEFAULT_PCI_BUS_NUMBER_PCH,
PCI_DEVICE_NUMBER_PCH_SPI,
PCI_FUNCTION_NUMBER_PCH_SPI
);
DEBUG ((DEBUG_INFO, "PchSpiBase at 0x%x\n", SpiInstance->PchSpiBase));
>> returns PchSpiBase as 0xC00FD000 (Bus 0 Dev 1F Func 0)
ScSpiBar0 = MmioRead32 (SpiInstance->PchSpiBase + PCI_BASE_ADDRESSREG_OFFSET) & 0xFFFFF000;
>> this should return value at 0xC00FD010
Hope it appears to be a standard code and accessing through MMIO library should work
Thanks
Ranga
On Fri, Jan 28, 2022 at 12:59 PM Michael Brown <mcb30@ipxe.org> wrote:
On 28/01/2022 12:47, Rao G wrote:
> Attempting to Read SPIBAR 0x10 from BUS 0 Dev 1F Func 5
>
> >>
> ScSpiBar0 = MmioRead32 (SpiInstance->PchSpiBase +
> PCI_BASE_ADDRESSREG_OFFSET) & 0xFFFFF000;
> >>
>
> The above code is throwing exception
>
> PchSpiBase at 0xC00FD000
> !!!! X64 Exception Type - 0E(#PF - Page-Fault) CPU Apic ID - 00000000 !!!!
> ExceptionData - 0000000000000000 I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SGX:0
> RIP - 00000000771903D0, CS - 0000000000000038, RFLAGS - 0000000000010046
>
> From the shell the value at offset 0x10 is 0xFE010000
>
> Any clues on why the processor is throwing exception while accessing the
> value PchSpiBase+0x10 ?
PCI_BASE_ADDRESSREG_OFFSET is an offset within PCI configuration space.
It looks as though you are trying to use an MMIO access to read from
PCI configuration space, which is not a valid thing to do.
I suspect you may want to use EFI_PCI_IO_PROTOCOL.Pci.Read() instead.
HTH,
Michael
[-- Attachment #2: Type: text/html, Size: 4475 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-29 5:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 12:47 Read SPI BAR offset 0x10 throwing processor exception Rao G
2022-01-28 12:59 ` [edk2-devel] " Michael Brown
2022-01-28 13:08 ` Rao G
2022-01-29 5:49 ` Jeff Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox