Skip to content

read firmware command uses 4B mode for flash chips >32MB #79

@prockallsyms

Description

@prockallsyms

When attempting to ./culvert -vv read firmware, it seems as though everything is working as intended:

[root@localhost ~]# ./culvert -vv read firmware
[*] Found 5 registered bridge drivers
[*] Trying bridge driver l2a
[*] Failed to initialise L2A bridge: -95
[*] Trying bridge driver ilpc
[*] Probing ilpc
[*] Probing 0x2e for SuperIO
[*] Unlocking SuperIO: 0
[*] Selecting SuperIO device 2 (SUART1): 0
[*] Found device 255 selected: 0
[*] Locking SuperIO
[*] Probing 0x4e for SuperIO
[*] Unlocking SuperIO: 0
[*] Selecting SuperIO device 2 (SUART1): 0
[*] Found device 2 selected: 0
[*] Selecting SuperIO device 12 (SUART4): 0
[*] Found device 12 selected: 0
[*] Locking SuperIO
[*] Found SuperIO device at 0x4e
[*] Probing for SoC revision registers
[*] ahb_readl: 0x1e6e2004: 0xf70ea198
[*] ahb_readl: 0x1e6e207c: 0x04030303
[*] Found revision 0x4030303
[*] Trying bridge driver devmem
[*] failed to initialise devmem bridge: -1
[*] Trying bridge driver debug-uart
[*] Unrecognised argument list for debug interface (0)
[*] Trying bridge driver p2a
[*] Failed to initialise P2A bridge: -2
[*] Accessing the BMC's AHB via the ilpc bridge
[*] Probing for SoC revision registers
[*] ahb_readl: 0x1e6e2004: 0xf70ea198
[*] ahb_readl: 0x1e6e207c: 0x04030303
[*] Found revision 0x4030303
[*] Selected devicetree for SoC 'aspeed,ast2500'
[*] Found 16 registered drivers
[*] Processing devicetree node at /aliases
[*] Processing devicetree node at /memory@80000000
[*] Processing devicetree node at /ahb
[*] Processing devicetree node at /ahb/sram@1e720000
[*] Processing devicetree node at /ahb/bus-controller@1e600000
[*] Bound trace driver to /ahb/bus-controller@1e600000
[*] Processing devicetree node at /ahb/apb
[*] Processing devicetree node at /ahb/apb/spi@1e620000
[*] Bound sfc driver to /ahb/apb/spi@1e620000
[*] Processing devicetree node at /ahb/apb/spi@1e630000
[*] Bound sfc driver to /ahb/apb/spi@1e630000
[*] Processing devicetree node at /ahb/apb/spi@1e631000
[*] Bound sfc driver to /ahb/apb/spi@1e631000
[*] Processing devicetree node at /ahb/apb/memory-controller@1e6e0000
[*] Bound sdmc driver to /ahb/apb/memory-controller@1e6e0000
[*] Processing devicetree node at /ahb/apb/syscon@1e6e2000
[*] Processing devicetree node at /ahb/apb/syscon@1e6e2000/clock
[*] Bound clk driver to /ahb/apb/syscon@1e6e2000/clock
[*] Processing devicetree node at /ahb/apb/syscon@1e6e2000/strapping
[*] Bound strap driver to /ahb/apb/syscon@1e6e2000/strapping
[*] Processing devicetree node at /ahb/apb/syscon@1e6e2000/superio
[*] Bound sioctl driver to /ahb/apb/syscon@1e6e2000/superio
[*] Processing devicetree node at /ahb/apb/syscon@1e6e2000/bridge-controller
[*] Bound bridge-controller driver to /ahb/apb/syscon@1e6e2000/bridge-controller
[*] Processing devicetree node at /ahb/apb/syscon@1e6e2000/debug-bridge-controller
[*] Bound debugctl driver to /ahb/apb/syscon@1e6e2000/debug-bridge-controller
[*] Processing devicetree node at /ahb/apb/syscon@1e6e2000/pcie-bridge-controller
[*] Bound pciectl driver to /ahb/apb/syscon@1e6e2000/pcie-bridge-controller
[*] Bound scu driver to /ahb/apb/syscon@1e6e2000
[*] Processing devicetree node at /ahb/apb/jtag@1e6e4000
[*] Bound jtag driver to /ahb/apb/jtag@1e6e4000
[*] Processing devicetree node at /ahb/apb/watchdog@1e785000
[*] Bound wdt driver to /ahb/apb/watchdog@1e785000
[*] Processing devicetree node at /ahb/apb/watchdog@1e785020
[*] Bound wdt driver to /ahb/apb/watchdog@1e785020
[*] Processing devicetree node at /ahb/apb/watchdog@1e785040
[*] Bound wdt driver to /ahb/apb/watchdog@1e785040
[*] Processing devicetree node at /ahb/apb/serial@1e787000
[*] Bound vuart driver to /ahb/apb/serial@1e787000
[*] Processing devicetree node at /ahb/apb/lpc@1e789000
[*] Processing devicetree node at /ahb/apb/lpc@1e789000/bridge-controller
[*] Bound ilpcctl driver to /ahb/apb/lpc@1e789000/bridge-controller
[*] Bound uart-mux driver to /ahb/apb/lpc@1e789000
[*] Initialising flash controller
[*] fdt: Looking up device name 'fmc'
[*] fdt: Locating node with device path '/ahb/apb/spi@1e620000'
[*] ahb_readl: 0x1e6e2000: 0x00000000
[*] Unlocking SCU
[*] ahb_writel: 0x1e6e2000: 0x1688a8a8
[*] Initialised scu driver
[*] Initialised clk driver
[*] ahb_readl: 0x1e6e2070: 0xf40f92be
[*] ahb_readl: 0x1e620010: 0x30bb2441
[*] ahb_readl: 0x1e620000: 0x8007002a
[*] ahb_writel: 0x1e620000: 0x8007002a
[*] ahb_writel: 0x1e620010: 0x00000400
[*] ahb_writel: 0x1e620094: 0x00000000
[*] Initialised sfc driver
[*] Initialising flash chip
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000403
[*] ahb_readl: 0x20000000: 0x00000000
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000400
[*] LIBFLASH: Init status: 00
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000403
[*] ahb_readl: 0x20000000: 0x001940ef
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000400
[*] LIBFLASH: Flash ID: ef.40.19 (ef4019)
[*] LIBFLASH: Found chip Winbond W25Q256BV size 32M erase granule: 4K
[*] LIBFLASH: Flash >16MB, enabling 4B mode...
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000403
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000400
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000403
[*] ahb_readl: 0x20000000: 0x02020202
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000400
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000403
[*] ahb_writel: 0x1e620010: 0x00000407
[*] ahb_writel: 0x1e620010: 0x00000400
[*] LIBFLASH: Enabling controller 4B mode...
[*] ahb_readl: 0x1e620004: 0x00000701
[*] ahb_writel: 0x1e620010: 0x00002400
[*] ahb_writel: 0x1e620004: 0x00000701
[*] Write-protecting all chip-selects
[*] ahb_readl: 0x1e620000: 0x8007002a
[*] ahb_writel: 0x1e620000: 0x8007002a
[*] Exfiltrating BMC flash to stdout

However, the resulting 32MB firmware blob seems to be a sequence of 4-byte repeats:

[root@localhost ~]# head -c 512 fw.bin | hexdump -C
00000000  15 15 15 15 14 14 14 14  14 14 14 14 14 14 14 14  |................|
00000010  14 14 14 14 14 14 14 14  14 14 14 14 14 14 14 14  |................|
00000020  c0 c0 c0 c0 20 20 20 20  80 80 80 80 e0 e0 e0 e0  |....    ........|
00000030  40 40 40 40 a0 a0 a0 a0  00 00 00 00 78 78 78 78  |@@@@........xxxx|
00000040  00 00 00 00 90 90 90 90  d8 d8 d8 d8 00 00 00 00  |................|
00000050  de de de de de de de de  de de de de 00 00 00 00  |................|
00000060  3f 3f 3f 3f d3 d3 d3 d3  00 00 00 00 00 00 00 00  |????............|
00000070  17 17 17 17 17 17 17 17  10 10 10 10 23 23 23 23  |............####|
00000080  87 87 87 87 02 02 02 02  01 01 01 01 03 03 03 03  |................|
00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000a0  10 10 10 10 00 00 00 00  00 00 00 00 ef ef ef ef  |................|
000000b0  4a 4a 4a 4a 0e 0e 0e 0e  00 00 00 00 00 00 00 00  |JJJJ............|
000000c0  70 70 70 70 00 00 00 00  00 00 00 00 04 04 04 04  |pppp............|
000000d0  13 13 13 13 0d 0d 0d 0d  0f 0f 0f 0f 0e 0e 0e 0e  |................|
000000e0  48 48 48 48 ff ff ff ff  98 98 98 98 0c 0c 0c 0c  |HHHH............|
000000f0  48 48 48 48 34 34 34 34  0e 0e 0e 0e 0f 0f 0f 0f  |HHHH4444........|
00000100  0d 0d 0d 0d 9a 9a 9a 9a  00 00 00 00 00 00 00 00  |................|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000120  04 04 04 04 00 00 00 00  d8 d8 d8 d8 00 00 00 00  |................|
00000130  00 00 00 00 04 04 04 04  00 00 00 00 00 00 00 00  |................|
00000140  04 04 04 04 48 48 48 48  ff ff ff ff fc fc fc fc  |....HHHH........|
00000150  0c 0c 0c 0c 48 48 48 48  34 34 34 34 0e 0e 0e 0e  |....HHHH4444....|
00000160  0f 0f 0f 0f 0d 0d 0d 0d  89 89 89 89 00 00 00 00  |................|
00000170  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000180  30 30 30 30 00 00 00 00  00 00 00 00 04 04 04 04  |0000............|
00000190  13 13 13 13 0d 0d 0d 0d  0f 0f 0f 0f 0e 0e 0e 0e  |................|
000001a0  48 48 48 48 ff ff ff ff  58 58 58 58 0c 0c 0c 0c  |HHHH....XXXX....|
000001b0  48 48 48 48 34 34 34 34  0e 0e 0e 0e 0f 0f 0f 0f  |HHHH4444........|
000001c0  0d 0d 0d 0d 7a 7a 7a 7a  00 00 00 00 00 00 00 00  |....zzzz........|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001e0  90 90 90 90 00 00 00 00  00 00 00 00 04 04 04 04  |................|
000001f0  13 13 13 13 0d 0d 0d 0d  0f 0f 0f 0f 0e 0e 0e 0e  |................|

I was hoping to inquire what 4B mode is, and how this could possibly be affecting the firmware read process?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions