Mars启动时遇到奇怪的bug

现象
开发板断电很长时间后再上电能启动成功,如果上了电后断电再重新上电或者进入系统后重启系统,都是会卡在uboot

外设连接
PCIE网卡,EMMC模块

故障日志
U-Boot SPL 2021.10 (May 31 2023 - 16:54:00 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI

OpenSBI v1.2


/ __ \ / | _ _ |
| | | |
__ ___ _ __ | (
| |
) || |
| | | | '_ \ / _ \ '_ \ ___ | _ < | |
| || | |) | __/ | | |) | |) || |
_
/| ./ _|| ||/|/___|
| |
|_|

Platform Name : Milk-V Mars
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 4000000Hz
Platform Console Device : uart8250
Platform HSM Device : —
Platform PMU Device : —
Platform Reboot Device : pm-reset
Platform Shutdown Device : pm-reset
Platform Suspend Device : —
Firmware Base : 0x40000000
Firmware Size : 392 KB
Firmware RW Offset : 0x40000
Runtime SBI Version : 1.0

Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region01 : 0x0000000040000000-0x000000004003ffff M: (R,X) S/U: ()
Domain0 Region02 : 0x0000000040040000-0x000000004007ffff M: (R,W) S/U: ()
Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)
Domain0 Next Address : 0x0000000040200000
Domain0 Next Arg1 : 0x0000000042200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Domain0 SysSuspend : yes

Boot HART ID : 1
Boot HART Domain : root
Boot HART Priv Version : v1.11
Boot HART Base ISA : rv64imafdcbx
Boot HART ISA Extensions : none
Boot HART PMP Count : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109

U-Boot 2021.10 (Jul 22 2023 - 09:37:08 +0000)

CPU: rv64imacu
Model: Milk-V Mars
DRAM: 4 GiB
MMC: sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash… SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

StarFive EEPROM format v2

--------EEPROM INFO--------
Vendor : MILK-V
Product full SN: MARS-V11-2326-D004E000-0000003F
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:75:d5
--------EEPROM INFO--------

In: serial
Out: serial
Err: serial
Model: Milk-V Mars
Net: eth0: ethernet@16030000, eth1: ethernet@16040000
switch to partitions #0, OK
mmc0(part 0) is current device
bootmode flash device 0
** Invalid partition 3 **
Couldn’t find partition mmc 0:3
Can’t set block device
** Invalid partition 3 **
Couldn’t find partition mmc 0:3
Can’t set block device
Hit any key to stop autoboot: 0
** Invalid partition 3 **
Couldn’t find partition mmc 0:3
Can’t set block device
Importing environment from mmc0 …

Warning: Input data exceeds 1048576 bytes - truncated

Info: input data size = 1048578 = 0x100002

Error: “boot2” not defined

** Invalid partition 3 **
Couldn’t find partition mmc 0:3
Can’t set block device

Warning: defaulting to text format

switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1…
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
** Unable to read file ubootefi.var **
Failed to load EFI variables
starfive_pcie pcie@2C000000: Starfive PCIe bus probed.
PCI: Failed autoconfig bar 10
PCI: Failed autoconfig bar 10
ethernet@16030000 Waiting for PHY auto negotiation to complete… TIMEOUT !
phy_startup() failed: -110FAILED: -110EQOS_DMA_MODE_SWR stuckFAILED: -110ethernet@16030000 Waiting for PHY auto negotiation to complete… TIMEOUT !
phy_startup() failed: -110FAILED: -110EQOS_DMA_MODE_SWR stuckFAILED: -110StarFive #
StarFive #
StarFive #
StarFive #
StarFive #
StarFive #
StarFive #

此bug已解决,升级bootloader即可,不进入系统升级bootloader的方法和刷固件到EMMC方法类似。