(Ivan: would be nice if you could test it and tell us about any
success/failure)
socppc saves registers r3 (fwfdtsave) and r29 (fwargsave) in locore.S.
initppc() checks for the absence of a flat device tree structure, in
which
case it uses the older bd_t aka bootinfo.
It then checks whether the FDT checksum is valid and eventually uses
that.
If fwfdtsave (r3) contains rubbish and u-boot does not supply a valid
FDT, it will go into neither branch, doesn't set the amount of memory
and silently panics in pmap.c.
This diff changes the logic to first try the FDT and
unconditionally fall back to bootinfo. If that doesn't work, we're toast
anyway.
I suspect r3 was zero by pure chance and the code works on a different
model. The one I have here has a 8 pin serial connector, unlike what's
described in the install document.
U-boot's README.standalone only mentions r29 being set and I can't find
any reference where it sets r3 in do_go().
Can a kind soul please tell me how to cross-compile a RAMDISK kernel? I
keep running into errors no matter which way I try. It would be nice to
install it, now that it boots :-)
Index: socppc/machdep.c
===================================================================
RCS file: /home/vcs/cvs/openbsd/src/sys/arch/socppc/socppc/machdep.c,v
retrieving revision 1.33
diff -u -p -r1.33 machdep.c
--- socppc/machdep.c 29 Aug 2011 20:21:44 -0000 1.33
+++ socppc/machdep.c 10 Mar 2012 20:52:06 -0000
@@ -177,21 +177,6 @@ initppc(u_int startkernel, u_int endkern
/* Make a copy of the args! */
strlcpy(bootpathbuf, args ? args : "wd0a", sizeof bootpathbuf);
- if (fwfdtsave == NULL) {
- /*
- * We were loaded by an old U-Boot that didn't provide
- * a flattened device tree. It should have provided a
- * valid bootinfo structure which we'll use to build
- * such a device tree ourselves.
- *
- * XXX We don't build a flattened device tree yet.
- */
- memcpy(&bootinfo, *fwargsave, sizeof bootinfo);
-
- extern uint8_t dt_blob_start[];
- fdt_init(&dt_blob_start);
- }
-
if (fwfdtsave && fwfdtsave->fh_magic == FDT_MAGIC) {
/*
* Save the FDT firmware blob passed by the bootloader
@@ -231,6 +216,19 @@ initppc(u_int startkernel, u_int endkern
if (fdt_node_property(node, "mac-address", &addr))
memcpy(bootinfo.bi_enetaddr, addr, 6);
}
+ } else {
+ /*
+ * We were loaded by an old U-Boot that didn't provide
+ * a flattened device tree. It should have provided a
+ * valid bootinfo structure which we'll use to build
+ * such a device tree ourselves.
+ *
+ * XXX We don't build a flattened device tree yet.
+ */
+ memcpy(&bootinfo, *fwargsave, sizeof bootinfo);
+
+ extern uint8_t dt_blob_start[];
+ fdt_init(&dt_blob_start);
}
proc0.p_cpu = &cpu_info[0];
U-Boot 1.1.3 (FSL Development) (Feb 6 2007 - 12:26:26) MPC83XX
Clock configuration:
Coherent System Bus: 266 MHz
Core: 266 MHz
Local Bus Controller: 266 MHz
Local Bus: 33 MHz
DDR: 266 MHz
I2C: 266 MHz
TSEC1: 266 MHz
TSEC2: 266 MHz
USB MPH: 88 MHz
USB DR: 88 MHz
CPU: MPC83xx, Rev: 11 at 266.666 MHz
Board: Thecus N1200
I2C: ready
DRAM: SDRAM on Local Bus is NOT available!
DDR RAM: 128 MB
FLASH: 8 MB
PCI1 32bit on PMC1 & PMC2 & PMC3
In: serial
Out: serial
Err: serial
Net: Freescale TSEC0: PHY is Realtek RTL8211B (1cc912)
Freescale TSEC1: PHY id 1410c87 is not supported!
Freescale TSEC1: No PHY found
Freescale TSEC0, Freescale TSEC1
Thecus Version: 4, PIC version: 4
Hit any key to stop autoboot: 0
=> boot
Speed: 100, full duplex
Using Freescale TSEC0 device
TFTP from server 10.0.0.10; our IP address is 10.0.0.129
Filename 'bsd.bin.socppc'.
Load address: 0x200000
Loading:
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
####################################
done
Bytes transferred = 3507336 (358488 hex)
## Starting application at 0x00200000 ...
initppc()
fwfdtsave=0x00000001
fwargsave=0x07fb0f60
fwfdtsave->fh_magic=0x3143a660
bi_memstart=0x00000000
bi_memsize=0x08000000
bi_flashstart=0xfe000000
bi_flashsize=0x00800000
bi_flashoffset=0x00028000
bi_sramstart=0x00000000
bi_sramsize=0x00000000
bi_immr_base=0xe0000000
bi_bootflags=0x00000001
bi_ip_addr=0x0a000081
bi_ethspeed=0x0fe502a8
call pmap_bootstrap()
pmap_bootstrap(0x00200000, 0x005ccf50)
pmap_avail_setup()
uboot_mem_regions()
uboot_mem[0].start=0x00000000
uboot_mem[0].size=0x08000000
leave uboot_mem_regions()
physmem=0x00008000 dumpmem[ndumpmem].start=0x00000000
dumpmem[ndumpmem].end=0x00008000
leave pmap_bootdebug()
return pmap_bootstrap()
qCopyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights
reserved.
Copyright (c) 1995-2012 OpenBSD. All rights reserved.
http://www.OpenBSD.org
OpenBSD 5.1-current (GENERIC) #28: Sat Mar 10 18:48:56 CET 2012
tobi...@uran.tmux.org:/usr/src/sys/arch/socppc/compile/GENERIC
real mem = 134217728 (128MB)
avail mem = 124538880 (118MB)
mainbus0 at root
cpu0 at mainbus0: 8347
obio0 at mainbus0
"wdt" at obio0 offset 0x00200 not configured
sociic0 at obio0 offset 0x03000 ivec 14
iic0 at sociic0
ricohrtc0 at iic0 addr 0x32: RICOH RS5C372[AB] Real-time Clock
fintek0 at iic0 addr 0x2e: F75375 rev 1.5
sociic1 at obio0 offset 0x03100 ivec 15
iic1 at sociic1
ehci0 at obio0 offset 0x22000 ivec 39
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Freescale EHCI root hub" rev 2.00/1.00 addr 1
tsec0 at obio0 offset 0x24000 ivec 32: address 00:14:fd:10:fd:54
rgephy0 at tsec0 phy 17: RTL8169S/8110S PHY, rev. 2
tsec1 at obio0 offset 0x25000 ivec 35: address 00:14:fd:10:fd:55
ukphy0 at tsec1 phy 5: Generic IEEE 802.3u media interface, rev. 0: OUI
0x001400, model 0x0005
ifmedia_set: no match for 0x20/0xffffffff
com0 at obio0 offset 0x04500 ivec 9: st16650, no working fifo
com0: console
ipic0 at obio0 offset 0x00700
socpcic0 at mainbus0
pci0 at socpcic0 bus 0
"Freescale MPC8347 PBGA" rev 0x11 at pci0 dev 0 function 0 not configured
pciide0 at pci0 dev 16 function 0 "CMD Technology SiI3512 SATA" rev
0x01: DMA
pciide0: using ivec 20 for native-PCI interrupt
pciide0: port 0: device present, speed: 1.5Gb/s
wd0 at pciide0 channel 0 drive 0: <ST3250620NS>
wd0: 16-sector PIO, LBA48, 238475MB, 488397168 sectors
wd0(pciide0:0:0): using BIOS timings, Ultra-DMA mode 6
/dev/ksyms: Symbol table not valid.
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
scsibus1 at softraid0: 256 targets
root on wd0a swap on wd0b dump on wd0b
panic: root filesystem has size 0
Stopped at 0x447abc: lwz r0,20(r1)
RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS
PANIC!
DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION!
ddb>