<meta http-equiv="Content-Type" content="text/html; charset=GB18030"><div>Hi Mr. Andrew Jeffery</div><div><div><br></div><div>Thank you for your help. Sorry for late response. After getting your replay, I read AST2500 spec and OpenBMC linux kernel again.</div><div>I found a "SuperIO controller" in AST2500 spec and "aspeed-lpc-ctrl.c" in linux kernel.</div><div><br></div><div>1. I found there is a logical device "iLPC2AHB" in SuperIO controller, and it is said the register can be accessed by Host CPU through LPC bus(I am not sure but I think the SuperIO controller will be used for Host CPU, and no BMC driver will use it). I also found "SIO iLPC2AHB address" register in SuperIO controller. Given that this register can be accessed by Host CPU, can I think that the Host CPU firstly configure the "SIO iLPC2AHB address" register, then if the LPC slave controller is configured rightly, Host CPU can access the BMC's memory space by using memory reading or writing to the address written to "SIO iLPC2AHB address" register?</div><div>If I am right, what does SuperIO controller do, is it between Host's LPC bus and BMC's LPC slave controller like:</div><div>Host-->LPC bus-->SuperIO controller-->LPC slave controller-->LPC2AHB bridge-->SPI Flash mapping</div><div>or SuperIO controller is independent of LPC slave controller like:</div><div>Host-->LPC bus-->SuperIO controller</div><div>Host-->LPC bus-->LPC slave contrller-->LPC2AHB bridge-->SPI Flash mapping</div><div><br></div><div>2. I found "aspeed-lpc-ctrl.c" in linux kernel source code. Although I am not very familar with this driver, I found that by configuring the LPC slave controller's host interface control register, this driver can decide which BMC's memory space can be mapper to Host CPU.</div><div>And In the picture you draw for me</div><div>Host CPU<br>    -> LPC FW<br>        -> LPC2AHB Bridge<br>            -> SPI flash mapping<br>                -> SPI Flash</div><div>Does the "LPC FW" means aspeed-lpc-ctrl driver?</div><div><br></div><div>Best Regards!</div><div>Liu Hongwei</div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;"><span style="font-family: Verdana; font-size: 14px;">>Hi Liu Hongwei,</span></div><br>>On Fri, 24 Apr 2020, at 23:58, 掴勸ムルシエラゴ wrote:<br>>> Hi, Greetings<br>>>  A BMC usually uses aspeed's chip. To learn BMC I read the spec of <br>>> aspeed's AST2500. I have long been confused by two questions when I am <br>>> learning BMC.<br><br>>>  1. One is that: How can the host access BMC's SPI Flash via LPC? I <br>>> read from AST2500's spec that the host can update the BIOS stored in <br>>> the SPI flash via LPC.<br><br>>Okay first thing to address is separation of concerns: There are separate<br>>SPI controllers for the BMC and host firmware.<br><br>>> I also seen from AST2500's spec that the SPI <br>>> controller in AST2500 can be access by host through LPC. It seems like <br>>> the architecture is as below.<br>>>  Host CPU---->LPC---->SPI controller---->SPI Flash[BIOS]<br><br>>Roughly, yes. There are a couple of other critical pieces of the puzzle:<br><br>>1. The SPI-attached storage is mapped into the BMC's physical address<br>>space<br>>2. The BMC's LPC slave controller contains a bridge that allows host<br>>accesses to the LPC FW space to be converted to accesses to the <br>>BMC's physical address space.<br><br>>So the picture looks like:<br><br>>Host CPU<br>>    -> LPC FW<br>>        -> LPC2AHB Bridge<br>>            -> SPI flash mapping<br>>                -> SPI Flash<br><br>>>  I do not know how it works, does this need to install a LPC driver in <br>>> host OS and openbmc OS? And does this need software intervention?<br><br>>The host OS or firmware likely already knows how to drive the LPC bus. The<br>>LPC bus is typically part of the host's boot path, particularly if the BIOS is<br>>stored on SPI flash attached to the BMC (though on Intel systems eSPI<br>>supersedes LPC, but the concepts are roughly the same).<br><br>>>  2. The other is that: How does BMC's CPU read uboot code from SPI <br>>> flash when power up? I know that the uboot(act as bootloader) is stored <br>>> in a SPI flash, and uboot is the first code that is executed by BMC's <br>>> CPU. I do not know whether it is right or wrong but I think BMC's CPU <br>>> can only execute the code stored in DRAM.<br><br>>This is where you're falling down. In theory the BMC can execute<br>>instructions from anywhere in its physical address space. DRAM is<br>>located somewhere in that physical address space (on the AST2500,<br>>it is located at 0x80000000), however there are other areas of interest<br>>in the physical address space, namely the mapping of the BMC flash<br>>to 0x0. This is the reset vector for the ARM core, so when it is released<br>>from reset it starts executing whatever instructions are present at 0x0.<br>>The SoC hardware design handles the fact that the instructions at 0x0<br>>are fetched from the BMC's SPI flash so no driver is needed.<br><br>>Andrew<br></div>