gm45_remove_me.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <style type="text/css">
  7. @import url('../css/main.css');
  8. </style>
  9. <title>GM45 chipsets: remove the ME (manageability engine)</title>
  10. </head>
  11. <body>
  12. <div class="section">
  13. <h1 id="pagetop">GM45 chipsets: remove the ME (manageability engine)</h1>
  14. <p>
  15. This sections relates to disabling and removing the ME (Intel <b>M</b>anagement <b>E</b>ngine) on
  16. GM45. This was originally done on the ThinkPad X200, and later adapted for the ThinkPad R400/T400/T500. It can
  17. in principle be done on any GM45 or GS45 system.
  18. </p>
  19. <p>
  20. The ME is a blob that typically must be left inside the flash chip (in the ME region, as outlined
  21. by the default descriptor). On GM45, it is possible to remove it without any ill effects. All
  22. other parts of coreboot on GM45 systems (provided GMA MHD4500 / Intel graphics) can be blob-free,
  23. so removing the ME was the last obstacle to
  24. make GM45 a feasible target in libreboot (the systems can also work without the microcode blobs).
  25. </p>
  26. <p>
  27. The ME is removed and disabled in libreboot by modifying the descriptor. More info about
  28. this can be found in the ich9deblob/ich9gen source code in resources/utilities/ich9deblob/
  29. in libreboot, or more generally on this page.
  30. </p>
  31. <p>
  32. More information about the ME can be found at
  33. <a href="http://www.coreboot.org/Intel_Management_Engine">http://www.coreboot.org/Intel_Management_Engine</a>
  34. and <a href="http://me.bios.io/Main_Page">http://me.bios.io/Main_Page</a>.
  35. </p>
  36. <p>
  37. Another project recently found:
  38. <a href="http://io.smashthestack.org/me/">http://io.smashthestack.org/me/</a>
  39. </p>
  40. <p>
  41. <a href="index.html">Back to previous index</a>.
  42. </p>
  43. </div>
  44. <div class="section">
  45. <h1 id="ich9gen">ICH9 gen utility</h1>
  46. <p>
  47. It is no longer necessary to use <a href="#ich9deblob">ich9deblob</a> to generate
  48. a deblobbed descriptor+gbe image for GM45 targets. ich9gen is a small utility within
  49. ich9deblob that can generate them from scratch, without a factory.bin dump.
  50. </p>
  51. <p>
  52. ich9gen executables can be found under ./ich9deblob/ statically compiled in
  53. libreboot_util. If you are using src or git, build ich9gen from source with:<br/>
  54. $ <b>./build module ich9deblob</b><br/>
  55. The executable will appear under resources/utilities/ich9deblob/
  56. </p>
  57. <p>
  58. Run:<br/>
  59. $ <b>./ich9gen</b>
  60. </p>
  61. <p>
  62. Running ich9gen this way (without any arguments) generates
  63. a default descriptor+gbe image with a generic MAC address.
  64. You probably don't want to use the generic one; the ROM images
  65. in libreboot contain a descriptor+gbe image by default (already
  66. inserted) just to prevent or mitigate the risk of bricking
  67. your laptop, but with the generic MAC address (the libreboot
  68. project does not know what your real MAC address is).
  69. </p>
  70. <p>
  71. You can find out your MAC address from <b>ip addr</b> or <b>ifconfig</b> in GNU/Linux.
  72. Alternatively, if you are running libreboot already (with the correct MAC address in your
  73. ROM), dump it (flashrom -r) and read the first 6 bytes from position 0x1000 (or 0x2000) in a hex editor
  74. (or, rename it to factory.rom and run it in ich9deblob: in the newly created mkgbe.c
  75. will be the individual bytes of your MAC address). If you are currently running the stock firmware
  76. and haven't installed libreboot yet, you can also run that through ich9deblob to get the mac address.
  77. </p>
  78. <p>
  79. An even simpler way to get the MAC address would be to read what's on the little sticker on
  80. the bottom/base of the laptop.
  81. </p>
  82. <p>
  83. On GM45 laptops that use flash descriptors, the MAC address
  84. or the onboard ethernet chipset is flashed (inside the ROM image).
  85. You should generate a descriptor+gbe image with your own MAC address
  86. inside (with the Gbe checksum updated to match). Run:<br/>
  87. $ <b>./ich9gen --macaddress XX:XX:XX:XX:XX:XX</b><br/>
  88. (replace the XX chars with the hexadecimal chars in the MAC address that you want)
  89. </p>
  90. <p>
  91. Two new files will be created:
  92. </p>
  93. <ul>
  94. <li><b>ich9fdgbe_4m.bin</b>: this is for GM45 laptops with the 4MB flash chip.</li>
  95. <li><b>ich9fdgbe_8m.bin</b>: this is for GM45 laptops with the 8MB flash chip.</li>
  96. </ul>
  97. <p>
  98. Two other files will also be created, for the ThinkPad R500 which has a different NIC and, therefore,
  99. no GbE region (for this laptop, it is not necessary to change the MAC address in the flash chip, because
  100. it's burned into the NIC):
  101. </p>
  102. <ul>
  103. <li><b>ich9fdnogbe_4m.bin</b>: this is for ThinkPad R500 laptops with the 4MB flash chip, where no GbE region is to be defined.</li>
  104. <li><b>ich9fdnogbe_8m.bin</b>: this is for ThinkPad R500 laptops with the 8MB flash chip, where no GbE region is to be defined
  105. - <b>NOTE: No actual R500 laptops with 8MiB are believed to exist. It is believed, that all R500 laptops have 4MiB flash chips</b>.</li>
  106. </ul>
  107. <p>
  108. Assuming that your libreboot image is named <b>libreboot.rom</b>, copy
  109. the file to where <b>libreboot.rom</b> is located
  110. and then insert the descriptor+gbe file into the ROM image. For 8MiB flash chips:<br/>
  111. $ <b>dd if=ich9fdgbe_8m.bin of=libreboot.rom bs=1 count=12k conv=notrunc</b><br/>
  112. For 4MiB flash chips:<br/>
  113. $ <b>dd if=ich9fdgbe_4m.bin of=libreboot.rom bs=1 count=12k conv=notrunc</b><br/>
  114. </p>
  115. <p>
  116. <b>For the ThinkPad R500, do this instead:</b><br/>
  117. For 8MiB flash chips (<b>highly unlikely on the ThinkPad R500)</b>:<br/>
  118. $ <b>dd if=ich9fdnogbe_8m.bin of=libreboot.rom bs=1 count=4k conv=notrunc</b><br/>
  119. For 4MiB flash chips (<b>You probably have this)</b>:<br/>
  120. $ <b>dd if=ich9fdnogbe_4m.bin of=libreboot.rom bs=1 count=4k conv=notrunc</b><br/>
  121. NOTE: This shouldn't be necessary. Libreboot ROM images already contain a descriptor embedded inside
  122. the ROM images for GM45, generated by the ich9gen utility. It's only desirable to re-insert your own
  123. when changing the MAC address, which is unnecessary (actually impossible) on the R500, because on that laptop,
  124. as already stated, the NIC already has the correct MAC address burned in, along with along configuration data.
  125. </p>
  126. <p>
  127. Your libreboot.rom image is now ready to be flashed on the system. Refer back to
  128. <a href="../install/index.html#flashrom">../install/index.html#flashrom</a>
  129. for how to flash it.
  130. </p>
  131. <h2>
  132. Write-protecting the flash chip
  133. </h2>
  134. <p>
  135. Look in <i>resources/utilities/ich9deblob/src/descriptor/descriptor.c</i>
  136. for the following lines in the <i>descriptorHostRegionsUnlocked</i> function:
  137. </p>
  138. <pre>
  139. descriptorStruct.masterAccessSection.flMstr1.fdRegionWriteAccess = 0x1;
  140. descriptorStruct.masterAccessSection.flMstr1.biosRegionWriteAccess = 0x1;
  141. descriptorStruct.masterAccessSection.flMstr1.meRegionWriteAccess = 0x1;
  142. descriptorStruct.masterAccessSection.flMstr1.gbeRegionWriteAccess = 0x1;
  143. descriptorStruct.masterAccessSection.flMstr1.pdRegionWriteAccess = 0x1;
  144. </pre>
  145. <p>
  146. Also look in <i>resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.c</i>
  147. for the following lines:
  148. </p>
  149. <pre>
  150. descriptorStruct.masterAccessSection.flMstr1.fdRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */
  151. descriptorStruct.masterAccessSection.flMstr1.biosRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */
  152. descriptorStruct.masterAccessSection.flMstr1.meRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */
  153. descriptorStruct.masterAccessSection.flMstr1.gbeRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */
  154. descriptorStruct.masterAccessSection.flMstr1.pdRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */
  155. </pre>
  156. <p style="font-size:2em;">
  157. NOTE: When you write-protect the flash chip, re-flashing is no longer possible unless you
  158. use dedicated external equipment, which also means disassembling the laptop. The same equipment
  159. can also be used to remove the write-protection later on, if you choose to do so. *Only* write-protect
  160. the chip if you have the right equipment for external flashing later on; for example, see
  161. <a href="../install/bbb_setup.html">../install/bbb_setup.html</a>.
  162. </p>
  163. <p>
  164. Change them all to 0x0, then re-compile ich9gen. After you have done that,
  165. follow the notes in <a href="#ich9gen">#ich9gen</a> to generate a new
  166. descriptor+gbe image and insert that into your ROM image, then flash it.
  167. The next time you boot, the flash chip will be read-only in software
  168. (hardware re-flashing will still work, which you will need for re-flashing
  169. the chip after write-protecting it, to clear the write protection or
  170. to flash yet another ROM image with write protection set in the descriptor).
  171. </p>
  172. <p>
  173. Flashrom will tell you that you can still forcefully re-flash, using <i>-p internal:ich_spi_force=yes</i> but
  174. this won't actually work; it'll just brick your laptop.
  175. </p>
  176. <p>
  177. For external flashing guides, refer to <a href="../install/index.html">../install/index.html</a>.
  178. </p>
  179. </div>
  180. <div class="section">
  181. <h1 id="ich9deblob">ICH9 deblob utility</h1>
  182. <p>
  183. <b>This is no longer strictly necessary. Libreboot ROM images for GM45 systems now
  184. contain the 12KiB descriptor+gbe generated from ich9gen, by default.</b>
  185. </p>
  186. <p>
  187. This was the tool originally used to disable the ME on X200 (later adapted for other systems that use the
  188. GM45 chipset). <a href="#ich9gen">ich9gen</a> now supersedes it;
  189. ich9gen is better because it does not rely on dumping the factory.rom image (whereas, ich9deblob does).
  190. </p>
  191. <p>
  192. This is what you will use to generate the deblobbed descriptor+gbe regions for your libreboot ROM image.
  193. </p>
  194. <p>
  195. If you are working with libreboot_src (or git), you can find the source under resources/utilities/ich9deblob/
  196. and will already be compiled if you ran <b>./build module all</b> or <b>./build module ich9deblob</b> from the main directory (./),
  197. otherwise you can build it like so:<br/>
  198. $ <b>./build module ich9deblob</b><br/>
  199. An executable file named <b>ich9deblob</b> will now appear under resources/utilities/ich9deblob/
  200. </p>
  201. <p>
  202. If you are working with libreboot_util release archive, you can find the utility included, statically compiled
  203. (for i686 and x86_64 on GNU/Linux) under ./ich9deblob/.
  204. </p>
  205. <p>
  206. Place the factory.rom from your system
  207. (can be obtained using the external flashing guides for GM45 targets linked <a href="../install/index.html">../install/index.html</a>) in
  208. the directory where you have your ich9deblob executable, then run the tool:<br/>
  209. $ <b>./ich9deblob</b>
  210. </p>
  211. <p>
  212. A 12kiB file named <b>deblobbed_descriptor.bin</b> will now appear. <b>Keep this and the factory.rom stored in a safe location!</b>
  213. The first 4KiB contains the descriptor data region for your system, and the next 8KiB contains the gbe region (config data for your
  214. gigabit NIC). These 2 regions could actually be separate files, but they are joined into 1 file in this case.
  215. </p>
  216. <p>
  217. A 4KiB file named <b>deblobbed_4kdescriptor.bin</b> will alternatively appear, if no GbE region was detected inside the ROM image.
  218. This is usually the case, when a discrete NIC is used (eg Broadcom) instead of Intel. Only the Intel NICs need a GbE region in
  219. the flash chip.
  220. </p>
  221. <p>
  222. Assuming that your libreboot image is named <b>libreboot.rom</b>, copy
  223. the <b>deblobbed_descriptor.bin</b> file to where <b>libreboot.rom</b> is located
  224. and then run:<br/>
  225. $ <b>dd if=deblobbed_descriptor.bin of=libreboot.rom bs=1 count=12k conv=notrunc</b>
  226. </p>
  227. <p>
  228. Alternatively, if you got a the <b>deblobbed_4kdescriptor.bin</b> file (no GbE defined),
  229. do this:
  230. $ <b>dd if=deblobbed_4kdescriptor.bin of=libreboot.rom bs=1 count=4k conv=notrunc</b>
  231. </p>
  232. <p>
  233. </p>
  234. <p>
  235. The utility will also generate 4 additional files:
  236. </p>
  237. <ul>
  238. <li>mkdescriptor.c</li>
  239. <li>mkdescriptor.h</li>
  240. <li>mkgbe.c</li>
  241. <li>mkgbe.h</li>
  242. </ul>
  243. <p>
  244. These are C source files that can re-generate the very same Gbe and Descriptor structs
  245. (from ich9deblob/ich9gen). To use these, place them in src/ich9gen/ in ich9deblob, then re-build.
  246. The newly built <b>ich9gen</b> executable will be able to re-create the very same 12KiB file from scratch,
  247. based on the C structs, this time <b>without</b> the need for a factory.rom dump!
  248. </p>
  249. <p>
  250. You should now have a <b>libreboot.rom</b> image containing the correct 4K descriptor and 8K gbe regions, which
  251. will then be safe to flash. Refer back to <a href="../install/index.html#flashrom">../install/index.html#flashrom</a>
  252. for how to flash it.
  253. </p>
  254. </div>
  255. <div class="section">
  256. <h1 id="demefactory">demefactory utility</h1>
  257. <p>
  258. This takes a factory.rom dump and disables the ME/TPM, but leaves the region intact.
  259. It also sets all regions read-write.
  260. </p>
  261. <p>
  262. The ME interferes with flash read/write in flashrom, and the default descriptor
  263. locks some regions. The idea is that doing this will remove all of those restrictions.
  264. </p>
  265. <p>
  266. Simply run (with factory.rom in the same directory):<br/>
  267. $ <b>./demefactory</b>
  268. </p>
  269. <p>
  270. It will generate a 4KiB descriptor file (only the descriptor, no GbE). Insert that into
  271. a factory.rom image (NOTE: do this on a copy of it. Keep the original factory.rom stored
  272. safely somewhere):<br/>
  273. $ <b>dd if=demefactory_4kdescriptor.bin of=factory_nome.rom bs=1 count=4k conv=notrunc</b>
  274. </p>
  275. <p>
  276. TODO: test this.<br/>
  277. TODO: lenovobios (GM45 thinkpads) still write-protects parts of the flash. Modify the assembly code
  278. inside.
  279. Note: the factory.rom (BIOS region) from lenovobios is in a compressed format, which you have to extract.
  280. bios_extract upstream won't work, but the following was said in #coreboot on freenode IRC:
  281. </p>
  282. <pre>
  283. &lt;roxfan&gt; fchmmr: try bios_extract with ffv patch <a href="http://patchwork.coreboot.org/patch/3444/">http://patchwork.coreboot.org/patch/3444/</a>
  284. &lt;roxfan&gt; or <a href="https://github.com/coreboot/bios_extract/blob/master/phoenix_extract.py">https://github.com/coreboot/bios_extract/blob/master/phoenix_extract.py</a>
  285. &lt;roxfan&gt; what are you looking for specifically, btw?
  286. 0x74: 0x9fff03e0 PR0: Warning: 0x003e0000-0x01ffffff is read-only.
  287. 0x84: 0x81ff81f8 PR4: Warning: 0x001f8000-0x001fffff is locked.
  288. </pre>
  289. <p>
  290. Use-case: a factory.rom image modified in this way would theoretically have no
  291. flash protections whatsoever, making it easy to quickly switch between factory/libreboot
  292. in software, without ever having to disassemble and re-flash externally unless you brick
  293. the device.
  294. </p>
  295. <p>
  296. demefactory is part of the ich9deblob src, found at <i>resources/utilities/ich9deblob/</i>
  297. </p>
  298. </div>
  299. <div class="section">
  300. <p>
  301. The sections below are adapted from (mostly) IRC logs related to early development getting the ME removed on GM45.
  302. They are useful for background information. This could not have been done without sgsit's help.
  303. </p>
  304. <div class="subsection">
  305. <h2 id="early_notes">Early notes</h2>
  306. <ul>
  307. <li>
  308. <a href="http://www.intel.co.uk/content/dam/doc/datasheet/io-controller-hub-10-family-datasheet.pdf">http://www.intel.co.uk/content/dam/doc/datasheet/io-controller-hub-10-family-datasheet.pdf</a>
  309. page 230 mentions about descriptor and non-descriptor mode (which wipes out gbe and ME/AMT).
  310. </li>
  311. <li>
  312. <s><b>See reference to HDA_SDO (disable descriptor security)</b></s>
  313. strap connected GPIO33 pin is it on ICH9-M (X200). HDA_SDO applies to later chipsets (series 6 or higher).
  314. Disabling descriptor security also disables the ethernet according to sgsit. sgsit's method
  315. involves use of 'soft straps' (see IRC logs below) instead of disabling the descriptor.
  316. </li>
  317. <li>
  318. <b>and the location of GPIO33 on the x200s: (was an external link. Putting it here instead)</b>
  319. <a href="images/x200/gpio33_location.jpg">images/x200/gpio33_location.jpg</a>
  320. - it's above the number 7 on TP37 (which is above the big intel chip at the bottom)
  321. </li>
  322. <li>
  323. The ME datasheet may not be for the mobile chipsets but it doesn't vary that much.
  324. This one gives some detail and covers QM67 which is what the X201 uses:
  325. <a href="http://www.intel.co.uk/content/dam/www/public/us/en/documents/datasheets/6-chipset-c200-chipset-datasheet.pdf">http://www.intel.co.uk/content/dam/www/public/us/en/documents/datasheets/6-chipset-c200-chipset-datasheet.pdf</a>
  326. </li>
  327. </ul>
  328. </div>
  329. </div>
  330. <div class="section">
  331. <div class="subsection">
  332. <h2 id="flashchips">Flash chips</h2>
  333. <ul>
  334. <li>
  335. Schematics for X200 laptop: <a href="http://pdf.datasheetarchive.com/indexerfiles/Datasheets-USER/DSAUPLD00006075.pdf">http://pdf.datasheetarchive.com/indexerfiles/Datasheets-USER/DSAUPLD00006075.pdf</a>
  336. <b><s>- Page 20 and page 9 refer to SDA_HDO or SDA_HDOUT</s></b> only on series 6 or higher chipsets. ICH9-M (X200) does it with a strap connected to GPIO33 pin (see IRC notes below)<br/>
  337. - According to page 29, the X200 can have any of the following flash chips:
  338. <ul>
  339. <li>ATMEL AT26DF321-SU 72.26321.A01 - this is a 32Mb (4MiB) chip</li>
  340. <li>MXIC (Macronix?) MX25L3205DM2I-12G 72.25325.A01 - another 32Mb (4MiB) chip</li>
  341. <li>MXIC (Macronix?) MX25L6405DMI-12G 41R0820AA - this is a 64Mb (8MiB) chip</li>
  342. <li>Winbond W25X64VSFIG 41R0820BA - another 64Mb (8MiB) chip</li>
  343. </ul>
  344. sgsit says that the X200s with the 64Mb flash chips are (probably) the ones with AMT (alongside the ME), whereas
  345. the 32Mb chips contain only the ME.
  346. </li>
  347. <li>
  348. Schematics for X200s laptop: <a href="http://pdf.datasheetarchive.com/indexerfiles/Datasheets-USER/DSAUPLD00006104.pdf">http://pdf.datasheetarchive.com/indexerfiles/Datasheets-USER/DSAUPLD00006104.pdf</a>.
  349. </li>
  350. </ul>
  351. </div>
  352. </div>
  353. <div class="section">
  354. <h2 id="early_development_notes">Early development notes</h2>
  355. <pre>
  356. <i>
  357. Start (hex) End (hex) Length (hex) Area Name
  358. ----------- --------- ------------ ---------
  359. 00000000 003FFFFF 00400000 Flash Image
  360. 00000000 00000FFF 00001000 Descriptor Region
  361. 00000004 0000000F 0000000C Descriptor Map
  362. 00000010 0000001B 0000000C Component Section
  363. 00000040 0000004F 00000010 Region Section
  364. 00000060 0000006B 0000000C Master Access Section
  365. 00000060 00000063 00000004 CPU/BIOS
  366. 00000064 00000067 00000004 Manageability Engine (ME)
  367. 00000068 0000006B 00000004 GbE LAN
  368. 00000100 00000103 00000004 ICH Strap 0
  369. 00000104 00000107 00000004 ICH Strap 1
  370. 00000200 00000203 00000004 MCH Strap 0
  371. 00000EFC 00000EFF 00000004 Descriptor Map 2
  372. 00000ED0 00000EF7 00000028 ME VSCC Table
  373. 00000ED0 00000ED7 00000008 Flash device 1
  374. 00000ED8 00000EDF 00000008 Flash device 2
  375. 00000EE0 00000EE7 00000008 Flash device 3
  376. 00000EE8 00000EEF 00000008 Flash device 4
  377. 00000EF0 00000EF7 00000008 Flash device 5
  378. 00000F00 00000FFF 00000100 OEM Section
  379. 00001000 001F5FFF 001F5000 ME Region
  380. 001F6000 001F7FFF 00002000 GbE Region
  381. 001F8000 001FFFFF 00008000 PDR Region
  382. 00200000 003FFFFF 00200000 BIOS Region
  383. Start (hex) End (hex) Length (hex) Area Name
  384. ----------- --------- ------------ ---------
  385. 00000000 003FFFFF 00400000 Flash Image
  386. 00000000 00000FFF 00001000 Descriptor Region
  387. 00000004 0000000F 0000000C Descriptor Map
  388. 00000010 0000001B 0000000C Component Section
  389. 00000040 0000004F 00000010 Region Section
  390. 00000060 0000006B 0000000C Master Access Section
  391. 00000060 00000063 00000004 CPU/BIOS
  392. 00000064 00000067 00000004 Manageability Engine (ME)
  393. 00000068 0000006B 00000004 GbE LAN
  394. 00000100 00000103 00000004 ICH Strap 0
  395. 00000104 00000107 00000004 ICH Strap 1
  396. 00000200 00000203 00000004 MCH Strap 0
  397. 00000ED0 00000EF7 00000028 ME VSCC Table
  398. 00000ED0 00000ED7 00000008 Flash device 1
  399. 00000ED8 00000EDF 00000008 Flash device 2
  400. 00000EE0 00000EE7 00000008 Flash device 3
  401. 00000EE8 00000EEF 00000008 Flash device 4
  402. 00000EF0 00000EF7 00000008 Flash device 5
  403. 00000EFC 00000EFF 00000004 Descriptor Map 2
  404. 00000F00 00000FFF 00000100 OEM Section
  405. 00001000 00002FFF 00002000 GbE Region
  406. 00003000 00202FFF 00200000 BIOS Region
  407. Build Settings
  408. --------------
  409. Flash Erase Size = 0x1000
  410. </i>
  411. </pre>
  412. <p>
  413. It's a utility called 'Flash Image Tool' for ME 4.x that was used for this. You drag a complete
  414. image into in and the utility decomposes the various components, allowing you to set soft straps.
  415. </p>
  416. <p>
  417. This tool is proprietary, for Windows only, but was used to deblob the X200. End justified means, and
  418. the utility is no longer needed since the ich9deblob utility (documented on this page) can now be
  419. used to create deblobbed descriptors.
  420. </p>
  421. </div>
  422. <div class="section">
  423. <h2 id="gbe_region">
  424. GBE (gigabit ethernet) region in SPI flash
  425. </h2>
  426. <p>
  427. Of the 8K, about 95% is 0xFF.
  428. The data is the gbe region is fully documented in this public datasheet:
  429. <a href="http://www.intel.co.uk/content/dam/doc/application-note/i-o-controller-hub-9m-82567lf-lm-v-nvm-map-appl-note.pdf">http://www.intel.co.uk/content/dam/doc/application-note/i-o-controller-hub-9m-82567lf-lm-v-nvm-map-appl-note.pdf</a>
  430. </p>
  431. <p>
  432. The only actual content found was:
  433. </p>
  434. <pre>
  435. <i>
  436. 00 1F 1F 1F 1F 1F 00 08 FF FF 83 10 FF FF FF FF
  437. 08 10 FF FF C3 10 EE 20 AA 17 F5 10 86 80 00 00
  438. 01 0D 00 00 00 00 05 06 20 30 00 0A 00 00 8B 8D
  439. 02 06 40 2B 43 00 00 00 F5 10 AD BA F5 10 BF 10
  440. AD BA CB 10 AD BA AD BA 00 00 00 00 00 00 00 00
  441. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  442. 00 01 00 40 28 12 07 40 FF FF FF FF FF FF FF FF
  443. FF FF FF FF FF FF FF FF FF FF FF FF FF FF D9 F0
  444. 20 60 1F 00 02 00 13 00 00 80 1D 00 FF 00 16 00
  445. DD CC 18 00 11 20 17 00 DD DD 18 00 12 20 17 00
  446. 00 80 1D 00 00 00 1F
  447. </i>
  448. </pre>
  449. <p>
  450. The first part is the MAC address set to all 0x1F. It's repeated haly way through
  451. the 8K area, and the rest is all 0xFF. This is all documented in the datasheet.
  452. </p>
  453. <p>
  454. The GBe region starts at 0x20A000 bytes from the *end* of a factory image and is 0x2000 bytes long.
  455. In libreboot (deblobbed) the descriptor is set to put gbe directly after the initial 4K flash descriptor.
  456. So the first 4K of the ROM is the descriptor, and then the next 8K is the gbe region.
  457. </p>
  458. <div class="subsection">
  459. <h3 id="gbe_region_changemacaddress">GBE region: change MAC address</h3>
  460. <p>
  461. According to the datasheet, it's supposed to add up to 0xBABA but can actually be others on the X200.
  462. <a href="https://communities.intel.com/community/wired/blog/2010/10/14/how-to-basic-eeprom-checksums">https://communities.intel.com/community/wired/blog/2010/10/14/how-to-basic-eeprom-checksums</a>
  463. </p>
  464. <p>
  465. <i>&quot;One of those engineers loves classic rock music, so he selected 0xBABA&quot;</i>
  466. </p>
  467. <p>In honour of the song <i>Baba O'Reilly</i> by <i>The Who</i> apparently. We're not making this stuff up...</p>
  468. <p>
  469. 0x3ABA, 0x34BA, 0x40BA and more have been observed in the main Gbe regions on the X200 factory.rom dumps.
  470. The checksums of the backup regions match BABA, however.
  471. </p>
  472. <p>
  473. By default, the X200 (as shipped by Lenovo) actually has an invalid main gbe checksum. The backup gbe region is correct,
  474. and is what these systems default to. Basically, you should do what you need on the *backup* gbe region, and
  475. then correct the main one by copying from the backup.
  476. </p>
  477. <p>
  478. Look at resources/utilities/ich9deblob/ich9deblob.c.
  479. </p>
  480. <ul>
  481. <li>Add the first 0x3F 16bit numbers (unsigned) of the GBe descriptor together (this includes the checksum value)
  482. and that has to add up to 0xBABA. In other words, the checksum is 0xBABA minus the total of the first
  483. 0x3E 16bit numbers (unsigned), ignoring any overflow.</li>
  484. </ul>
  485. </div>
  486. </div>
  487. <div class="section">
  488. <h2 id="flash_descriptor_region">Flash descriptor region</h2>
  489. <p>
  490. <a href="http://www.intel.co.uk/content/dam/doc/datasheet/io-controller-hub-9-datasheet.pdf">http://www.intel.co.uk/content/dam/doc/datasheet/io-controller-hub-9-datasheet.pdf</a>
  491. from page 850 onwards. This explains everything that is in the flash descriptor, which can be used to understand what libreboot
  492. is doing about modifying it.
  493. </p>
  494. <p>
  495. How to deblob:
  496. </p>
  497. <ul>
  498. <li>patch the number of regions present in the descriptor from 5 - 3</li>
  499. <li>originally descriptor + bios + me + gbe + platform</li>
  500. <li>modified = descriptor + bios + gbe</li>
  501. <li>the next stage is to patch the part of the descriptor which defines the start and end point of each section</li>
  502. <li>then cut out the gbe region and insert it just after the region</li>
  503. <li>all this can be substantiated with public docs (ICH9 datasheet)</li>
  504. <li>the final part is flipping 2 bits. Halting the ME via 1 MCH soft strap and 1 ICH soft strap</li>
  505. <li>the part of the descriptor described there gives the base address and length of each region (bits 12:24 of each address)</li>
  506. <li>to disable a region, you set the base address to 0xFFF and the length to 0</li>
  507. <li>and you change the number of regions from 4 (zero based) to 2</li>
  508. </ul>
  509. <p>
  510. There's an interesting parameter called 'ME Alternate disable', which allows the ME to only handle hardware errata in the southbridge,
  511. but disables any other functionality. This is similar to the 'ignition' in the 5 series and higher but using the standard firmware
  512. instead of a small 128K version. Useless for libreboot, though.
  513. </p>
  514. <p>
  515. To deblob GM45, you chop out the platform and ME regions and correct the addresses in flReg1-4.
  516. Then you set meDisable to 1 in ICHSTRAP0 and MCHSTRAP0.
  517. </p>
  518. <p>How to patch the descriptor from the factory.rom dump</p>
  519. <ul>
  520. <li>map the first 4k into the struct (minus the gbe region)</li>
  521. <li>set NR in FLMAP0 to 2 (from 4)</li>
  522. <li>adjust BASE and LIMIT in flReg1,2,3,4 to reflect the new location of each region (or remove them in the case of Platform and ME)</li>
  523. <li>set meDisable to 1/true in ICHSTRAP0 and MCHSTRAP0</li>
  524. <li>extract the 8k GBe region and append that to the end of the 4k descriptor</li>
  525. <li>output the 12k concatenated chunk</li>
  526. <li>Then it can be dd'd into the first 12K part of a coreboot image.</li>
  527. <li>the GBe region always starts 0x20A000 bytes from the end of the ROM</li>
  528. </ul>
  529. <p>
  530. This means that libreboot's descriptor region will simply define the following regions:
  531. </p>
  532. <ul>
  533. <li>descriptor (4K)</li>
  534. <li>gbe (8K)</li>
  535. <li>bios (rest of flash chip. CBFS also set to occupy this whole size)</li>
  536. </ul>
  537. <p>
  538. The data in the descriptor region is little endian, and it represents bits 24:12 of the address
  539. (bits 12-24, written this way since bit 24 is nearer to left than bit 12 in the binary representation).
  540. </p>
  541. <p>
  542. So, <i>x &lt;&lt; 12 = address</i>
  543. </p>
  544. <p>
  545. If it's in descriptor mode, then the first 4 bytes will be 5A A5 F0 0F.
  546. </p>
  547. </div>
  548. <div class="section">
  549. <h2 id="platform_data_region">platform data partition in boot flash (factory.rom / lenovo bios)</h2>
  550. <p>
  551. Basically useless for libreboot, since it appears to be a blob.
  552. Removing it didn't cause any issues in libreboot.
  553. </p>
  554. <p>
  555. This is a 32K region from the factory image. It could be data
  556. (non-functional) that the original Lenovo BIOS used, but we don't know.
  557. </p>
  558. <p>
  559. It has only a 448 byte fragment different from 0x00 or 0xFF.
  560. </p>
  561. </div>
  562. <div class="section">
  563. <p>
  564. Copyright &copy; 2014, 2015 Francis Rowe &lt;info@gluglug.org.uk&gt;<br/>
  565. Permission is granted to copy, distribute and/or modify this document
  566. under the terms of the GNU Free Documentation License, Version 1.3
  567. or any later version published by the Free Software Foundation;
  568. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
  569. A copy of the license can be found at <a href="../gfdl-1.3.txt">../gfdl-1.3.txt</a>
  570. </p>
  571. <p>
  572. Updated versions of the license (when available) can be found at
  573. <a href="https://www.gnu.org/licenses/licenses.html">https://www.gnu.org/licenses/licenses.html</a>
  574. </p>
  575. <p>
  576. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
  577. EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
  578. AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
  579. ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
  580. IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
  581. WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
  582. PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
  583. ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
  584. KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
  585. ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
  586. </p>
  587. <p>
  588. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
  589. TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
  590. NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
  591. INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
  592. COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
  593. USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
  594. ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
  595. DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
  596. IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
  597. </p>
  598. <p>
  599. The disclaimer of warranties and limitation of liability provided
  600. above shall be interpreted in a manner that, to the extent
  601. possible, most closely approximates an absolute disclaimer and
  602. waiver of all liability.
  603. </p>
  604. </div>
  605. </body>
  606. </html>