1*0d6140beSAndroid Build Coastguard Worker======================== 2*0d6140beSAndroid Build Coastguard WorkerMiscellaneous Intel info 3*0d6140beSAndroid Build Coastguard Worker======================== 4*0d6140beSAndroid Build Coastguard Worker 5*0d6140beSAndroid Build Coastguard WorkerBBAR on ICH8 6*0d6140beSAndroid Build Coastguard Worker============ 7*0d6140beSAndroid Build Coastguard Worker 8*0d6140beSAndroid Build Coastguard WorkerThere is no sign of BBAR (BIOS Base Address Configuration Register) in the 9*0d6140beSAndroid Build Coastguard Workerpublic datasheet (or specification update) of the ICH8. Also, the offset of 10*0d6140beSAndroid Build Coastguard Workerthat register has changed between ICH7 (SPIBAR + 50h) and ICH9 (SPIBAR + 11*0d6140beSAndroid Build Coastguard WorkerA0h), so we have no clue if or where it is on ICH8. Out current policy is to 12*0d6140beSAndroid Build Coastguard Workernot touch it at all and assume/hope it is 0. 13*0d6140beSAndroid Build Coastguard Worker 14*0d6140beSAndroid Build Coastguard WorkerSoftware Sequencing vs. Hardware Sequencing and the "Opaque flash chip" 15*0d6140beSAndroid Build Coastguard Worker======================================================================= 16*0d6140beSAndroid Build Coastguard Worker 17*0d6140beSAndroid Build Coastguard WorkerSoftware sequencing and hardware sequencing are two methods used to interface 18*0d6140beSAndroid Build Coastguard Workerwith the SPI controller on Intel platforms. They can be selected using either 19*0d6140beSAndroid Build Coastguard Workerich_spi_mode=swseq or ich_spi_mode=hwseq programmer parameters. Flashrom will 20*0d6140beSAndroid Build Coastguard Workerattempt to automatically detect which mode to use. 21*0d6140beSAndroid Build Coastguard Worker 22*0d6140beSAndroid Build Coastguard WorkerSoftware sequencing is the traditional method whereby software running on the 23*0d6140beSAndroid Build Coastguard WorkerCPU handles most of the logic needed to interact with the flash chip. This 24*0d6140beSAndroid Build Coastguard Workeroffers good flexibility since the user can utilize any opcode available in the 25*0d6140beSAndroid Build Coastguard WorkerOPMENU registers, and OPMENU can be left unlocked or on coreboot-supported 26*0d6140beSAndroid Build Coastguard Workerplatforms the owner of the system may program it for their needs before locking 27*0d6140beSAndroid Build Coastguard Workerit. Advanced or non-standard features of a chip such as write protection and 28*0d6140beSAndroid Build Coastguard WorkerOTP may therefore be directly utilized by software. 29*0d6140beSAndroid Build Coastguard Worker 30*0d6140beSAndroid Build Coastguard WorkerHardware sequencing is a newer method (since around 2011) whereby most of the 31*0d6140beSAndroid Build Coastguard Workerlogic for interacting with the SPI flash chip is contained within the SPI 32*0d6140beSAndroid Build Coastguard Workercontroller itself and software such as flashrom may only select a few operations 33*0d6140beSAndroid Build Coastguard Workerchosen by Intel via the Flash Cycle (FCYCLE) field. The chip must conform to 34*0d6140beSAndroid Build Coastguard Workerspecifications from Intel for each chipset/PCH. The specs are given in the 35*0d6140beSAndroid Build Coastguard Worker"SPI Programming Guide" application note. See [SPI_PROG] cited at the bottom of 36*0d6140beSAndroid Build Coastguard Workerthis document for an example. 37*0d6140beSAndroid Build Coastguard Worker 38*0d6140beSAndroid Build Coastguard WorkerHardware sequencing simplifies things from a software perspective since the 39*0d6140beSAndroid Build Coastguard Workersoftware is guaranteed some minimal level of support and doesn't even need to 40*0d6140beSAndroid Build Coastguard Workerknow the chip's ID or opcodes; it just needs to tell the SPI controller to 41*0d6140beSAndroid Build Coastguard Workerperform a type of transaction such as "read", "4k block erase", etc. Hence when 42*0d6140beSAndroid Build Coastguard Workerusing hardware sequencing one will see "Opaque flash chip" as the chip's 43*0d6140beSAndroid Build Coastguard Workerdescription since software might not be able to identify the chip. The SPI 44*0d6140beSAndroid Build Coastguard Workercontroller can combine multiple physical flash chips to logically appear as a 45*0d6140beSAndroid Build Coastguard Workersingle large flash device, and in such cases it would not make sense for 46*0d6140beSAndroid Build Coastguard Workerflashrom to try to identify the chip. 47*0d6140beSAndroid Build Coastguard Worker 48*0d6140beSAndroid Build Coastguard WorkerIn many non-Intel systems the software has full control of a generic SPI 49*0d6140beSAndroid Build Coastguard Workercontroller where the software controls the SPI signals and also constructs the 50*0d6140beSAndroid Build Coastguard Workerdata payload including pre-op (e.g. write enable latch), opcode, address, and 51*0d6140beSAndroid Build Coastguard Workerdata. Intel SPI flash controllers are purpose-built for flash chip access and 52*0d6140beSAndroid Build Coastguard Workerthe software does not control the hardware directly. This makes Intel SPI 53*0d6140beSAndroid Build Coastguard Workercontrollers less flexible from a software standpoint, however there are some 54*0d6140beSAndroid Build Coastguard Workerbenefits such as guaranteed atomicity and multi-master arbitration needed for 55*0d6140beSAndroid Build Coastguard Workermodern Intel platforms where the CPU and various microprocessors can share the 56*0d6140beSAndroid Build Coastguard Workersame flash chip. 57*0d6140beSAndroid Build Coastguard Worker 58*0d6140beSAndroid Build Coastguard WorkerSMM BIOS Write Protection 59*0d6140beSAndroid Build Coastguard Worker========================= 60*0d6140beSAndroid Build Coastguard Worker 61*0d6140beSAndroid Build Coastguard WorkerSometimes a hardware vendor will enable "SMM BIOS Write Protect" (SMM_BWP) 62*0d6140beSAndroid Build Coastguard Workerin the firmware during boot time. The bits that control SMM_BWP are in the 63*0d6140beSAndroid Build Coastguard WorkerBIOS_CNTL register in the LPC interface. 64*0d6140beSAndroid Build Coastguard Worker 65*0d6140beSAndroid Build Coastguard WorkerWhen enabled, the SPI flash can only be written when the system is operating in 66*0d6140beSAndroid Build Coastguard Workerin System Management Mode (SMM). In other words, only certain code that was 67*0d6140beSAndroid Build Coastguard Workerinstalled by the BIOS can write to the flash chip. Programs that run in OS 68*0d6140beSAndroid Build Coastguard Workercontext such as flashrom can still read the flash chip, but cannot write to the 69*0d6140beSAndroid Build Coastguard Workerflash chip. 70*0d6140beSAndroid Build Coastguard Worker 71*0d6140beSAndroid Build Coastguard WorkerFlashrom will attempt to detect this and print a warning such as the following: 72*0d6140beSAndroid Build Coastguard Worker"Warning: BIOS region SMM protection is enabled!" 73*0d6140beSAndroid Build Coastguard Worker 74*0d6140beSAndroid Build Coastguard WorkerMany vendor-supplied firmware update utilities do not actually write to the ROM; 75*0d6140beSAndroid Build Coastguard Workerinstead they transfer data to/from memory which is read/written by a routine 76*0d6140beSAndroid Build Coastguard Workerrunning in SMM and is responsible for writing to the firmware ROM. This causes 77*0d6140beSAndroid Build Coastguard Workersevere system performance degradataion since all processors must be in SMM 78*0d6140beSAndroid Build Coastguard Workercontext (ring -2) instead of OS context (ring 0) while the firmware ROM is being 79*0d6140beSAndroid Build Coastguard Workerwritten. 80*0d6140beSAndroid Build Coastguard Worker 81*0d6140beSAndroid Build Coastguard WorkerAccesses beyond region bounds in descriptor mode 82*0d6140beSAndroid Build Coastguard Worker================================================ 83*0d6140beSAndroid Build Coastguard Worker 84*0d6140beSAndroid Build Coastguard WorkerIntel's flash image tool will always expand the last region so that it covers 85*0d6140beSAndroid Build Coastguard Workerthe whole flash chip, but some boards ship with a different configuration. 86*0d6140beSAndroid Build Coastguard WorkerIt seems that in descriptor mode all addresses outside the used regions can not 87*0d6140beSAndroid Build Coastguard Workerbe accessed whatsoever. This is not specified anywhere publicly as far as we 88*0d6140beSAndroid Build Coastguard Workercould tell. flashrom does not handle this explicitly yet. It will just fail 89*0d6140beSAndroid Build Coastguard Workerwhen trying to touch an address outside of any region. 90*0d6140beSAndroid Build Coastguard WorkerSee also http://www.flashrom.org/pipermail/flashrom/2011-August/007606.html 91*0d6140beSAndroid Build Coastguard Worker 92*0d6140beSAndroid Build Coastguard Worker(Un)locking the ME region 93*0d6140beSAndroid Build Coastguard Worker========================= 94*0d6140beSAndroid Build Coastguard Worker 95*0d6140beSAndroid Build Coastguard WorkerIf the ME region is locked by the FRAP register in descriptor mode, the host 96*0d6140beSAndroid Build Coastguard Workersoftware is not allowed to read or write any address inside that region. 97*0d6140beSAndroid Build Coastguard WorkerAlthough the chipset datasheets specify that "[t]he contents of this register 98*0d6140beSAndroid Build Coastguard Workerare that of the Flash Descriptor" [PANTHER], this is not entirely true. 99*0d6140beSAndroid Build Coastguard WorkerThe firmware has to fill at least some of the registers involved. It is not 100*0d6140beSAndroid Build Coastguard Workerknown when they become read-only or any other details, but there is at least 101*0d6140beSAndroid Build Coastguard Workerone HM67-based board, that provides an user-changeable setting in the firmware 102*0d6140beSAndroid Build Coastguard Workeruser interface to enable ME region updates that lead to a FRAP content that is 103*0d6140beSAndroid Build Coastguard Workernot equal to the descriptor region bits [NC9B]. 104*0d6140beSAndroid Build Coastguard Worker 105*0d6140beSAndroid Build Coastguard WorkerThere are different ways to unlock access: 106*0d6140beSAndroid Build Coastguard Worker 107*0d6140beSAndroid Build Coastguard Worker * A pin strap: Flash Descriptor Security Override Strap (as indicated by the 108*0d6140beSAndroid Build Coastguard Worker Flash Descriptor Override Pin Strap Status (FDOPSS) in HSFS. That pin is 109*0d6140beSAndroid Build Coastguard Worker probably not accessible to end users on consumer boards (every Intel doc i 110*0d6140beSAndroid Build Coastguard Worker have seen stresses that this is for debugging in manufacturing only and 111*0d6140beSAndroid Build Coastguard Worker should not be available for end users). 112*0d6140beSAndroid Build Coastguard Worker The ME indicates this in bits [19:16] (Operation Mode) in the HFS register of 113*0d6140beSAndroid Build Coastguard Worker the HECI/MEI PCI device by setting them to 4 (SECOVR_JMPR) [MODE_CTRL]. 114*0d6140beSAndroid Build Coastguard Worker 115*0d6140beSAndroid Build Coastguard Worker * Intel Management Engine BIOS Extension (MEBx) Disable 116*0d6140beSAndroid Build Coastguard Worker This option may be available to end users on some boards usually accessible 117*0d6140beSAndroid Build Coastguard Worker by hitting ctrl+p after BIOS POST. Quote: "'Disabling' the Intel ME does not 118*0d6140beSAndroid Build Coastguard Worker really disable it: it causes the Intel ME code to be halted at an early stage 119*0d6140beSAndroid Build Coastguard Worker of the Intel ME's booting so that the system has no traffic originating from 120*0d6140beSAndroid Build Coastguard Worker the Intel ME on any of the buses." [MEBX] The ME indicates this in 121*0d6140beSAndroid Build Coastguard Worker bits [19:16] (Operation Mode) in the HFS register of the HECI/MEI PCI device 122*0d6140beSAndroid Build Coastguard Worker by setting them to 3 (Soft Temporary Disable) [MODE_CTRL]. 123*0d6140beSAndroid Build Coastguard Worker 124*0d6140beSAndroid Build Coastguard Worker * Previous to Ibex Peak/5 Series chipsets removing the DIMM from slot (or 125*0d6140beSAndroid Build Coastguard Worker channel?) #0 disables the ME completely, which may give the host access to 126*0d6140beSAndroid Build Coastguard Worker the ME region. 127*0d6140beSAndroid Build Coastguard Worker 128*0d6140beSAndroid Build Coastguard Worker * HMRFPO (Host ME Region Flash Protection Override) Enable MEI command 129*0d6140beSAndroid Build Coastguard Worker This is the most interesting one because it allows to temporarily disable 130*0d6140beSAndroid Build Coastguard Worker the ME region protection by software. The ME indicates this in bits [19:16] 131*0d6140beSAndroid Build Coastguard Worker (Operation Mode) in the HFS register of the HECI/MEI PCI device by setting 132*0d6140beSAndroid Build Coastguard Worker them to 5 (SECOVER_MEI_MSG) [MODE_CTRL]. 133*0d6140beSAndroid Build Coastguard Worker 134*0d6140beSAndroid Build Coastguard WorkerMEI/HECI 135*0d6140beSAndroid Build Coastguard Worker======== 136*0d6140beSAndroid Build Coastguard Worker 137*0d6140beSAndroid Build Coastguard WorkerCommunication between the host software and the different services provided by 138*0d6140beSAndroid Build Coastguard Workerthe ME is done via a packet-based protocol that uses MMIO transfers to one or 139*0d6140beSAndroid Build Coastguard Workermore virtual PCI devices. Upon this layer there exist various services that can 140*0d6140beSAndroid Build Coastguard Workerbe used to read out hardware management values (e.g. temperatures, fan speeds 141*0d6140beSAndroid Build Coastguard Workeretc.). The lower levels of that protocol are well documented: 142*0d6140beSAndroid Build Coastguard WorkerThe locations/offsets of the PCI MMIO registers are noted in the chipset 143*0d6140beSAndroid Build Coastguard Workerdatasheets. The actually communication is documented in a whitepaper [DCMI] and 144*0d6140beSAndroid Build Coastguard Workeran outdated as well as a current Linux kernel implementation (currently in 145*0d6140beSAndroid Build Coastguard Workerstaging/ exist [KERNEL]. There exists a patch that re-implements this in user 146*0d6140beSAndroid Build Coastguard Workerspace (as part of flashrom). 147*0d6140beSAndroid Build Coastguard Worker 148*0d6140beSAndroid Build Coastguard WorkerProblems 149*0d6140beSAndroid Build Coastguard Worker======== 150*0d6140beSAndroid Build Coastguard Worker 151*0d6140beSAndroid Build Coastguard WorkerThe problem is that only very few higher level protocols are documented publicly, 152*0d6140beSAndroid Build Coastguard Workerespecially the bunch of messages that contain the HMRFPO commands is probably 153*0d6140beSAndroid Build Coastguard Workerwell protected and only documented in ME-specific docs and the BIOS writer's 154*0d6140beSAndroid Build Coastguard Workerguides. We are aware of a few leaked documents though that give us a few hints 155*0d6140beSAndroid Build Coastguard Workerabout it, but nothing substantial regarding its implementation. 156*0d6140beSAndroid Build Coastguard Worker 157*0d6140beSAndroid Build Coastguard WorkerThe documents are somewhat contradicting each other in various points which 158*0d6140beSAndroid Build Coastguard Workermight be due to factual changes in process of time or due to the different 159*0d6140beSAndroid Build Coastguard Workercapabilities of the ME firmwares, example: 160*0d6140beSAndroid Build Coastguard Worker 161*0d6140beSAndroid Build Coastguard WorkerIntel's Flash Programming Tool (FPT) "automatically stops ME writing to SPI 162*0d6140beSAndroid Build Coastguard WorkerME Region, to prevent both writing at the same time, causing data corruption." [ME8] 163*0d6140beSAndroid Build Coastguard Worker 164*0d6140beSAndroid Build Coastguard Worker"FPT is not HMRFPO-capable, so needs [the help of the FDOPS pin] HDA_SDO if 165*0d6140beSAndroid Build Coastguard Workerused to update the ME Region." [SPS] 166*0d6140beSAndroid Build Coastguard Worker 167*0d6140beSAndroid Build Coastguard WorkerWhen looking at the various ME firmware editions (and different chipsets), things 168*0d6140beSAndroid Build Coastguard Workerget very unclear. Some docs say that HMRFPO needs to be sent before End-of-POST 169*0d6140beSAndroid Build Coastguard Worker(EOP), others say that the ME region can be updated in the field or that some 170*0d6140beSAndroid Build Coastguard Workervendor tools use it for updates. This needs to be investigated further before 171*0d6140beSAndroid Build Coastguard Workerdrawing any conclusion. 172*0d6140beSAndroid Build Coastguard Worker 173*0d6140beSAndroid Build Coastguard Worker[PANTHER] 174*0d6140beSAndroid Build Coastguard Worker Intel 7 Series Chipset Family Platform Controller Hub (PCH) Datasheet 175*0d6140beSAndroid Build Coastguard Worker Document Number: 326776, April 2012, page 857 176*0d6140beSAndroid Build Coastguard Worker 177*0d6140beSAndroid Build Coastguard Worker[NC9B] 178*0d6140beSAndroid Build Coastguard Worker Jetway NC9B flashrom v0.9.5.2-r1517 log with ME region unlocked. 179*0d6140beSAndroid Build Coastguard Worker NB: "FRAP 0e0f" vs. "FLMSTR1 0a0b". 180*0d6140beSAndroid Build Coastguard Worker http://paste.flashrom.org/view.php?id=1215 181*0d6140beSAndroid Build Coastguard Worker 182*0d6140beSAndroid Build Coastguard Worker[MODE_CTRL] 183*0d6140beSAndroid Build Coastguard Worker Client Platform Enabling Tour: Platform Software 184*0d6140beSAndroid Build Coastguard Worker Document Number: 439167, Revision 1.2, page 52 185*0d6140beSAndroid Build Coastguard Worker 186*0d6140beSAndroid Build Coastguard Worker[MEBX] 187*0d6140beSAndroid Build Coastguard Worker Intel Management Engine BIOS Extension (MEBX) User's Guide 188*0d6140beSAndroid Build Coastguard Worker Revision 1.2, Section 3.1 and 3.5 189*0d6140beSAndroid Build Coastguard Worker 190*0d6140beSAndroid Build Coastguard Worker[DCMI] 191*0d6140beSAndroid Build Coastguard Worker DCMI Host Interface Specification 192*0d6140beSAndroid Build Coastguard Worker Revision 1.0 193*0d6140beSAndroid Build Coastguard Worker 194*0d6140beSAndroid Build Coastguard Worker[SPI_PROG] 195*0d6140beSAndroid Build Coastguard Worker Ibex Peak SPI Programming Guide 196*0d6140beSAndroid Build Coastguard Worker Document Number: 403598, Revision 1.3, page 79 197*0d6140beSAndroid Build Coastguard Worker 198*0d6140beSAndroid Build Coastguard Worker[ME8] 199*0d6140beSAndroid Build Coastguard Worker Manufacturing with Intel Management Engine (ME) Firmware 8.X on Intel 7 Series 200*0d6140beSAndroid Build Coastguard Worker Revision 2.0, page 59 201*0d6140beSAndroid Build Coastguard Worker 202*0d6140beSAndroid Build Coastguard Worker[SPS] 203*0d6140beSAndroid Build Coastguard Worker Manufacturing with Intel Management Engine (ME) on Intel C600 Series Chipset 1 204*0d6140beSAndroid Build Coastguard Worker for Romley Server 2 Platforms using Server Platform Services (SPS) Firmware 205*0d6140beSAndroid Build Coastguard Worker Revision 2.2, page 51 206