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