From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from blyat.fensystems.co.uk (blyat.fensystems.co.uk [54.246.183.96]) by mx.groups.io with SMTP id smtpd.web10.6500.1643374769071103982 for ; Fri, 28 Jan 2022 04:59:29 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: ipxe.org, ip: 54.246.183.96, mailfrom: mcb30@ipxe.org) Received: from pudding.home (unknown [188.94.42.109]) by blyat.fensystems.co.uk (Postfix) with ESMTPSA id 7C599439EE; Fri, 28 Jan 2022 12:59:25 +0000 (UTC) Subject: Re: [edk2-devel] Read SPI BAR offset 0x10 throwing processor exception To: devel@edk2.groups.io, grao.v80@gmail.com References: From: "Michael Brown" Message-ID: <735241e7-8ada-0fb0-e035-0a88d0800403@ipxe.org> Date: Fri, 28 Jan 2022 12:59:24 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on blyat.fensystems.co.uk Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 28/01/2022 12:47, Rao G wrote: > Attempting to Read SPIBAR 0x10 from BUS 0 Dev 1F Func 5 >=20 > >> > ScSpiBar0 =3D MmioRead32 (SpiInstance->PchSpiBase +=20 > PCI_BASE_ADDRESSREG_OFFSET) & 0xFFFFF000; > >> >=20 > The above code is throwing exception >=20 > PchSpiBase at 0xC00FD000 > !!!! X64 Exception Type - 0E(#PF - Page-Fault) =C2=A0CPU Apic ID - 0000= 0000 !!!! > ExceptionData - 0000000000000000 =C2=A0I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SG= X:0 > RIP =C2=A0- 00000000771903D0, CS =C2=A0- 0000000000000038, RFLAGS - 000= 0000000010046 >=20 > From the shell the value at offset 0x10 is 0xFE010000 >=20 > Any clues on why the processor is throwing exception while accessing th= e=20 > value PchSpiBase+0x10 ? PCI_BASE_ADDRESSREG_OFFSET is an offset within PCI configuration space.=20 It looks as though you are trying to use an MMIO access to read from=20 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