Re: current/macppc on Mac Mini
> Ha! This seems to assume that the (fdisk) DOS partition > is the 'i' partition in the disklabel - it is not; > I created a [c]ustom disklabel. A bunch of architectures work this way. And it is a quite normal expectation that the 'i' partition match the 'spoofed label' semantics. But for now I think you are the one who made the assumption that your machine can be setup *differently* .. and that everything would work. If you want to come up with a fix for the install script that can auto-determine the partition, we'll be waiting.
Re: current/macppc on Mac Mini
On Sat, Jul 20, 2013 at 08:23:35PM +0200, Jan Stary wrote: > On Jul 20 11:23:01, kwesterb...@rogers.com wrote: > > On Sat, Jul 20, 2013 at 11:45:07AM +0200, Jan Stary wrote: > > > > What troubles me is that whatever device (device name) I try, > > > > it is the 'ofwboot' which is not found. > > > > I don't mind calling my disk 'cd' in the boot sequence > > > > or altering the devaliases, or "setenv boot-device cd:,ofwboot", > > > > but that doesn't work either, as shown above. > > > > How can I make sure that the installer > > > > has actually put the ofwboot on my disk? > > > > > > I mean, the ofwboot is supposed to be _somewhere_ > > > on my disk, right? Where? In the small DOS partition > > > at the beginning of the disk? > > > > > > > Yes. From macppc install.md: > > > > md_installboot() { > > local _disk=$1 > > > > # If there is an MSDOS partition on the boot disk, copy ofwboot > > # into it. > > if fdisk $_disk | grep -q 'Signature: 0xAA55'; then > > if fdisk $_disk | grep -q '^..: 06 '; then > > if mount /dev/${_disk}i /mnt2 >/dev/null 2>&1; then > > # Use cat to avoid holes created by cp(1) > > cat /mnt/usr/mdec/ofwboot > /mnt2/ofwboot > > umount /mnt2 > > fi > > fi > > fi > > } > > > > Ha! This seems to assume that the (fdisk) DOS partition > is the 'i' partition in the disklabel - it is not; > I created a [c]ustom disklabel. It does make the assumption that the DOS partition is the first spoofed partition, i.e. 'i'. This should probably be revisited since we relaxed the rules on partition naming a while ago. > > When in the install sequence is this copy of ofwboot done? It's done at the very end in the finish_up() function in install.sub. > Even my real wd0i partition, which is /usr/xobj > (untouched since install) does not contain ofwboot. Your wd0i isn't an MBR partition. > That leads me to speculate that this ofwboot copy > is performed _before_ the installing user edits > the disklabel; but perhaps at that moment, > wd0i _is_ really the DOS partiton, and later > I can make the disklabel what I want? Nope. See above. :-) > > Or did I miss it somewhere in the macppc install documentation > to leave 'i' alone so that ofwboot gets copied to the right place? In INSTALL.macppc: "If you have DOS or Linux partitions defined on the disk, these will usually show up as 'i', 'j', and so on." and "If the disk is partitioned using MBR, the bootloader will be automatically installed if you setup a small (a few MB) MSDOS partition as position `i' in the label." > > Anyway, I tried getting to that copy ofwboot now, as follows: > I enlarged the disklabel-maintained area to the whole disk ('b') > and created a partion for the DOS piece of the disk. Looking at > > Disk: wd0 geometry: 155061/16/63 [156301488 Sectors] > Offset: 0 Signature: 0xAA55 > Starting Ending LBA Info: > #: id C H S - C H S [ start:size ] > --- > *0: 06 0 0 2 - 2 0 33 [ 1:2048 ] DOS > > 32MB > 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused > > 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused > > 3: A6 4 1 2 - 155060 15 63 [4096: 156297392 ] OpenBSD > > > I made the DOS partition start at 512 (and then 1024 > and then everything under 4096 wherethe obsd part starts), > but never could I mount that DOS partition ... > > I will reinstall again, leaving the [a]uto disklabel untouched. > Good plan. Ken
Re: current/macppc on Mac Mini
> I made the DOS partition start at 512 (and then 1024 > and then everything under 4096 wherethe obsd part starts), > but never could I mount that DOS partition ... Silly me, it's 1, not 512; and it mounts, and the ofwboot is NOT there, and not in the wd0i as designated by me either. So there is no copy of ofwboot on my disk. That is surely wrong. > I will reinstall again, leaving the [a]uto disklabel untouched. Yes, this creates an 'i' entry for the DOS partition, which gets the ofwboot alright, and I can boot it, - just have to call it cd:,ofwboot in my OpenFirmware (or setup a devalias). When I do edit the disklabel during the install, but leave the 'i' untouched, or set one up that spans the (fdisk) DOS partition, the ofwboot gets installed to the right place too. So my conclusion is that you _need_ to have this partition in your disklabel; right? And the hd/cd confusion of my OpenFirmware has nothing to do with this, right? That would make the following paragraph from INSTALL.macppc not entirely accurate: For dedicated disks, macppc port boots off a boot program in an MSDOS filesystem. This is set up by the install program and no special setup is required. If I am right, should the 'i' partition that seems to be needed for a proper copy of the ofwboot be mentioned in INSTALL.macppc or perhaps http://www.openbsd.org/faq/faq4.html#InstProb ? Would other architectures that require some special partition to boot be affected similarly? Jan
Re: current/macppc on Mac Mini
On Jul 20 11:23:01, kwesterb...@rogers.com wrote: > On Sat, Jul 20, 2013 at 11:45:07AM +0200, Jan Stary wrote: > > > What troubles me is that whatever device (device name) I try, > > > it is the 'ofwboot' which is not found. > > > I don't mind calling my disk 'cd' in the boot sequence > > > or altering the devaliases, or "setenv boot-device cd:,ofwboot", > > > but that doesn't work either, as shown above. > > > How can I make sure that the installer > > > has actually put the ofwboot on my disk? > > > > I mean, the ofwboot is supposed to be _somewhere_ > > on my disk, right? Where? In the small DOS partition > > at the beginning of the disk? > > > > Yes. From macppc install.md: > > md_installboot() { > local _disk=$1 > > # If there is an MSDOS partition on the boot disk, copy ofwboot > # into it. > if fdisk $_disk | grep -q 'Signature: 0xAA55'; then > if fdisk $_disk | grep -q '^..: 06 '; then > if mount /dev/${_disk}i /mnt2 >/dev/null 2>&1; then > # Use cat to avoid holes created by cp(1) > cat /mnt/usr/mdec/ofwboot > /mnt2/ofwboot > umount /mnt2 > fi > fi > fi > } > Ha! This seems to assume that the (fdisk) DOS partition is the 'i' partition in the disklabel - it is not; I created a [c]ustom disklabel. When in the install sequence is this copy of ofwboot done? Even my real wd0i partition, which is /usr/xobj (untouched since install) does not contain ofwboot. That leads me to speculate that this ofwboot copy is performed _before_ the installing user edits the disklabel; but perhaps at that moment, wd0i _is_ really the DOS partiton, and later I can make the disklabel what I want? Or did I miss it somewhere in the macppc install documentation to leave 'i' alone so that ofwboot gets copied to the right place? Anyway, I tried getting to that copy ofwboot now, as follows: I enlarged the disklabel-maintained area to the whole disk ('b') and created a partion for the DOS piece of the disk. Looking at Disk: wd0 geometry: 155061/16/63 [156301488 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start:size ] --- *0: 06 0 0 2 - 2 0 33 [ 1:2048 ] DOS > 32MB 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 3: A6 4 1 2 - 155060 15 63 [4096: 156297392 ] OpenBSD I made the DOS partition start at 512 (and then 1024 and then everything under 4096 wherethe obsd part starts), but never could I mount that DOS partition ... I will reinstall again, leaving the [a]uto disklabel untouched.
Re: current/macppc on Mac Mini
On Sat, Jul 20, 2013 at 11:45:07AM +0200, Jan Stary wrote: > > What troubles me is that whatever device (device name) I try, > > it is the 'ofwboot' which is not found. > > I don't mind calling my disk 'cd' in the boot sequence > > or altering the devaliases, or "setenv boot-device cd:,ofwboot", > > but that doesn't work either, as shown above. > > How can I make sure that the installer > > has actually put the ofwboot on my disk? > > I mean, the ofwboot is supposed to be _somewhere_ > on my disk, right? Where? In the small DOS partition > at the beginning of the disk? > Yes. From macppc install.md: md_installboot() { local _disk=$1 # If there is an MSDOS partition on the boot disk, copy ofwboot # into it. if fdisk $_disk | grep -q 'Signature: 0xAA55'; then if fdisk $_disk | grep -q '^..: 06 '; then if mount /dev/${_disk}i /mnt2 >/dev/null 2>&1; then # Use cat to avoid holes created by cp(1) cat /mnt/usr/mdec/ofwboot > /mnt2/ofwboot umount /mnt2 fi fi fi } Ken
Re: current/macppc on Mac Mini
> What troubles me is that whatever device (device name) I try, > it is the 'ofwboot' which is not found. > I don't mind calling my disk 'cd' in the boot sequence > or altering the devaliases, or "setenv boot-device cd:,ofwboot", > but that doesn't work either, as shown above. > How can I make sure that the installer > has actually put the ofwboot on my disk? I mean, the ofwboot is supposed to be _somewhere_ on my disk, right? Where? In the small DOS partition at the beginning of the disk?
Re: current/macppc on Mac Mini
The saga continues: I tried to reinstall with 5.4-beta, and have a similar, but different problem now. To recall the previous situation: the kernel was confused about what 'cd0' and 'hd0' is, and I had to hardcode the bootpath into the kernel config. A patch from mpieuc...@nolizard.org solved it for me, but it is still considered not quite the right thing: On Dec 26 20:54:34, m...@online.fr wrote: > I think I understand what goes wrong. The code responsible for matching > the boot device to the actual kernel device on macppc is quite crude, > especially for non-SCSI disks. > > Your bootpath specifies `disk@1' because the disk drive is the second > device (slave) on the ATA channel, the cdrom drive being master. > However, the kernel wants to match this information against a `wd1' > device (as if there were two hard disks on the ATA channel). > > The kernel code needs to be fixed to use device_register() to match the > boot path against actual attachment information, instead of walking the > device tree at the end of autoconf. If nobody beats me to do this, I'll > try to cook a diff in a few days. On May 23 09:29:25, h...@stare.cz wrote: > On May 23 08:41:50, mpieuc...@nolizard.org wrote: > > Were you thinking of something like that? It works for me (c) tm, with > > my PowerBooks (disk@0/wd0), I haven't tried NFS boot yet. > > Jan, does it improve something for you? > > Yes it does: with this patch, I don't need to hardcode > config bsd root on wd0a > into my kernel, it figures the bootpath itself. > > [ using 500872 bytes of bsd ELF symbol table ] > console out [ATY,RockHopper2_A]console in [keyboard] , using USB > using parent ATY,RockHopper2Paren:: memaddr 9800 size 800, : consaddr > 9c008000, : ioaddr 9002, size 2: memtag 8000, iotag 8000: width 1280 > linebytes 1280 height 1024 depth 8 > Copyright (c) 1982, 1986, 1989, 1991, 1993 > The Regents of the University of California. All rights reserved. > Copyright (c) 1995-2013 OpenBSD. All rights reserved. http://www.OpenBSD.org > > OpenBSD 5.3-current (GENERIC.MP) #5: Thu May 23 09:02:44 CEST 2013 > r...@www.stare.cz:/usr/src/sys/arch/macppc/compile/GENERIC.MP > real mem = 1073741824 (1024MB) > avail mem = 1032151040 (984MB) > mainbus0 at root: model PowerMac10,2 > cpu0 at mainbus0: 7447A (Revision 0x102): 1499 MHz: 512KB L2 cache > mem0 at mainbus0 > spdmem0 at mem0: 1GB DDR SDRAM non-parity PC3200CL3.0 > memc0 at mainbus0: uni-n rev 0xd2 > "hw-clock" at memc0 not configured > kiic0 at memc0 offset 0xf8001000 > iic0 at kiic0 > mpcpcibr0 at mainbus0 pci: uni-north > pci0 at mpcpcibr0 bus 0 > pchb0 at pci0 dev 11 function 0 "Apple UniNorth AGP" rev 0x00 > appleagp0 at pchb0 > agp0 at appleagp0: aperture at 0x0, size 0x1000 > vgafb0 at pci0 dev 16 function 0 "ATI Radeon 9200" rev 0x01, mmio > wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation) > mpcpcibr1 at mainbus0 pci: uni-north > pci1 at mpcpcibr1 bus 0 > pchb1 at pci1 dev 11 function 0 "Apple UniNorth PCI" rev 0x00 > bwi0 at pci1 dev 18 function 0 "Broadcom BCM4318" rev 0x02: irq 52, address > 00:11:24:bf:cb:2a > macobio0 at pci1 dev 23 function 0 "Apple Intrepid" rev 0x00 > openpic0 at macobio0 offset 0x4: version 0x4614 feature 3f0302 LE > macgpio0 at macobio0 offset 0x50 > "modem-reset" at macgpio0 offset 0x1d not configured > "modem-power" at macgpio0 offset 0x1c not configured > macgpio1 at macgpio0 offset 0x9 irq 47 > "programmer-switch" at macgpio0 offset 0x11 not configured > "gpio5" at macgpio0 offset 0x6f not configured > "gpio6" at macgpio0 offset 0x70 not configured > "extint-gpio15" at macgpio0 offset 0x67 not configured > "escc-legacy" at macobio0 offset 0x12000 not configured > zsc0 at macobio0 offset 0x13000: irq 22,23 > zstty0 at zsc0 channel 0 > zstty1 at zsc0 channel 1 > aoa0 at macobio0 offset 0x1: irq 30,1,2 > audio0 at aoa0 > "timer" at macobio0 offset 0x15000 not configured > adb0 at macobio0 offset 0x16000apm0 at adb0: battery flags 0x0, 0% charged > piic0 at adb0 > iic1 at piic0 > maxtmp0 at iic1 addr 0xc8: max6642 > kiic1 at macobio0 offset 0x18000 > iic2 at kiic1 > wdc0 at macobio0 offset 0x2 irq 24: DMA > ohci0 at pci1 dev 24 function 0 "Apple Intrepid USB" rev 0x00: couldn't map > interrupt > ohci1 at pci1 dev 25 function 0 "Apple Intrepid USB" rev 0x00: couldn't map > interrupt > ohci2 at pci1 dev 26 function 0 "Apple Intrepid USB" rev 0x00: irq 29, > version 1.0, legacy support > ohci3 at pci1 dev 27 function 0 "NEC USB" rev 0x43: irq 63, version 1.0 > ohci4 at pci1 dev 27 function 1 "NEC USB" rev 0x43: irq 63, version 1.0 > ehci0 at pci1 dev 27 function 2 "NEC USB" rev 0x04: irq 63 > usb0 at ehci0: USB revision 2.0 > uhub0 at usb0 "NEC EHCI root hub" rev 2.00/1.00 addr 1 > usb1 at ohci2: USB revision 1.0 > uhub1 at usb1 "Apple OHCI root hub" rev 1.00/1.00 addr 1 > usb2 at ohci3: USB revision 1.0 > uhub2 at usb2 "NEC OHCI root hub" rev 1.00/1.00 addr 1 > usb3 at ohci4: USB revision 1.0 > uhub3
Re: current/macppc on Mac Mini
On 23/05/13(Thu) 17:00, Miod Vallat wrote: > > Were you thinking of something like that? It works for me (c) tm, with > > my PowerBooks (disk@0/wd0), I haven't tried NFS boot yet. > > Not exactly, but your version is probably better than what I was > thinking of. However, it will not allow for root on the second wd disk > of a controller, or on any secondary pciide controller. > > Borrowing the sparc64 logic is a larger work but less error-prone. Indeed it is, but until someone does it, here's a slightly improved version that adds a check for the drive number. Jan does is still work for you? Index: macppc//autoconf.c === RCS file: /cvs/src/sys/arch/macppc/macppc/autoconf.c,v retrieving revision 1.39 diff -u -p -r1.39 autoconf.c --- macppc//autoconf.c 11 Nov 2010 17:58:21 - 1.39 +++ macppc//autoconf.c 29 May 2013 23:17:42 - @@ -62,13 +62,12 @@ #include #include -#include #include -#include +#include void dumpconf(void); static struct devmap *findtype(char **); -void makebootdev(char *cp); +void parseofwbp(char *); intgetpno(char **); /* @@ -79,6 +78,9 @@ int getpno(char **); intcold = 1; /* if 1, still working on cold-start */ char bootdev[16];/* to hold boot dev name */ struct device *bootdv = NULL; +enum devclass bootdev_class = DV_DULL; +intbootdev_type = 0; +intbootdev_unit = 0; struct dumpmem dumpmem[VM_PHYSSEG_MAX]; u_int ndumpmem; @@ -165,9 +167,9 @@ findtype(char **s) * '/ht@0,f200/pci@2/bcom5704@4/bsd' */ void -makebootdev(char *bp) +parseofwbp(char *bp) { - int unit, ptype; + int ptype; char *dev, *cp; struct devmap *dp; @@ -184,6 +186,8 @@ makebootdev(char *bp) } while((dp->type & T_IFACE) == 0); if (dp->att && dp->type == T_IFACE) { + bootdev_class = DV_IFNET; + bootdev_type = dp->type; strlcpy(bootdev, dp->dev, sizeof bootdev); return; } @@ -193,24 +197,9 @@ makebootdev(char *bp) ptype = dp->type; dp = findtype(&cp); if (dp->att && dp->type == T_DISK) { - unit = getpno(&cp); - if (ptype == T_SCSI) { - struct device *dv; - struct sd_softc *sd; - - TAILQ_FOREACH(dv, &alldevs, dv_list) { - if (dv->dv_class != DV_DISK || - strcmp(dv->dv_cfdata->cf_driver->cd_name, "sd")) - continue; - sd = (struct sd_softc *)dv; - if (sd->sc_link->target != unit) - continue; - snprintf(bootdev, sizeof bootdev, - "%s%c", dv->dv_xname, 'a'); - return; - } - } - snprintf(bootdev, sizeof bootdev, "%s%d%c", dev, unit, 'a'); + bootdev_class = DV_DISK; + bootdev_type = ptype; + bootdev_unit = getpno(&cp); return; } printf("Warning: boot device unrecognized: %s\n", bp); @@ -239,25 +228,43 @@ getpno(char **cp) void device_register(struct device *dev, void *aux) { + const char *drvrname = dev->dv_cfdata->cf_driver->cd_name; + const char *name = dev->dv_xname; + + if (bootdv != NULL || dev->dv_class != bootdev_class) + return; + + switch (bootdev_type) { + case T_SCSI: + if (strcmp(drvrname, "sd") == 0) { + struct scsi_attach_args *sa = aux; + + if (sa->sa_sc_link->target == bootdev_unit) + bootdv = dev; + } + case T_IDE: + if (strcmp(drvrname, "wd") == 0) { + struct ata_atapi_attach *aa = aux; + + if (aa->aa_drv_data->drive == bootdev_unit) + bootdv = dev; + } + break; + case T_IFACE: + if (strcmp(name, bootdev) == 0) + bootdv = dev; + break; + default: + break; + } } -/* - * Now that we are fully operational, we can checksum the - * disks, and using some heuristics, hopefully are able to - * always determine the correct root disk. - */ void diskconf(void) { - dev_t temp; - int part = 0; - printf("bootpath: %s\n", bootpath); - makebootdev(bootpath); - /* Lookup boot device from boot if not set by configuration */ - bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp); - setroot(bootdv, part, RB_USERREQ); + setroot(bootdv, 0, RB_USERREQ); dumpconf(); } Index: macppc//machdep.c =
Re: current/macppc on Mac Mini
> Were you thinking of something like that? It works for me (c) tm, with > my PowerBooks (disk@0/wd0), I haven't tried NFS boot yet. Not exactly, but your version is probably better than what I was thinking of. However, it will not allow for root on the second wd disk of a controller, or on any secondary pciide controller. Borrowing the sparc64 logic is a larger work but less error-prone. Miod > Index: autoconf.c > === > RCS file: /cvs/src/sys/arch/macppc/macppc/autoconf.c,v > retrieving revision 1.39 > diff -u -p -r1.39 autoconf.c > --- autoconf.c11 Nov 2010 17:58:21 - 1.39 > +++ autoconf.c22 May 2013 19:00:45 - > @@ -68,7 +68,7 @@ > > void dumpconf(void); > static struct devmap *findtype(char **); > -void makebootdev(char *cp); > +void parseofwbp(char *); > int getpno(char **); > > /* > @@ -79,6 +79,9 @@ int getpno(char **); > int cold = 1; /* if 1, still working on cold-start */ > char bootdev[16];/* to hold boot dev name */ > struct device *bootdv = NULL; > +enum devclass bootdev_class = DV_DULL; > +int bootdev_type = 0; > +int bootdev_unit = 0; > > struct dumpmem dumpmem[VM_PHYSSEG_MAX]; > u_int ndumpmem; > @@ -165,9 +168,9 @@ findtype(char **s) > *'/ht@0,f200/pci@2/bcom5704@4/bsd' > */ > void > -makebootdev(char *bp) > +parseofwbp(char *bp) > { > - int unit, ptype; > + int ptype; > char *dev, *cp; > struct devmap *dp; > > @@ -184,6 +187,8 @@ makebootdev(char *bp) > } while((dp->type & T_IFACE) == 0); > > if (dp->att && dp->type == T_IFACE) { > + bootdev_class = DV_IFNET; > + bootdev_type = dp->type; > strlcpy(bootdev, dp->dev, sizeof bootdev); > return; > } > @@ -193,24 +198,9 @@ makebootdev(char *bp) > ptype = dp->type; > dp = findtype(&cp); > if (dp->att && dp->type == T_DISK) { > - unit = getpno(&cp); > - if (ptype == T_SCSI) { > - struct device *dv; > - struct sd_softc *sd; > - > - TAILQ_FOREACH(dv, &alldevs, dv_list) { > - if (dv->dv_class != DV_DISK || > - strcmp(dv->dv_cfdata->cf_driver->cd_name, > "sd")) > - continue; > - sd = (struct sd_softc *)dv; > - if (sd->sc_link->target != unit) > - continue; > - snprintf(bootdev, sizeof bootdev, > - "%s%c", dv->dv_xname, 'a'); > - return; > - } > - } > - snprintf(bootdev, sizeof bootdev, "%s%d%c", dev, unit, 'a'); > + bootdev_class = DV_DISK; > + bootdev_type = ptype; > + bootdev_unit = getpno(&cp); > return; > } > printf("Warning: boot device unrecognized: %s\n", bp); > @@ -239,25 +229,44 @@ getpno(char **cp) > void > device_register(struct device *dev, void *aux) > { > + const char *drvrname = dev->dv_cfdata->cf_driver->cd_name; > + const char *name = dev->dv_xname; > + > + if (bootdv != NULL || dev->dv_class != bootdev_class) > + return; > + > + switch (bootdev_type) { > + case T_SCSI: > + if (strcmp(drvrname, "sd") == 0) { > + struct sd_softc *sd = (struct sd_softc *)dev; > + > + if (sd->sc_link->target == bootdev_unit) > + bootdv = dev; > + } > + case T_IDE: > + /* > + * Do not require the bootpath unit number to match > + * against the driver's one, a slave disk on the ATA > + * channel `disk@1' can attach as `wd0'. > + */ > + if (strcmp(drvrname, "wd") == 0) > + bootdv = dev; > + break; > + case T_IFACE: > + if (strcmp(name, bootdev) == 0) > + bootdv = dev; > + break; > + default: > + break; > + } > } > > -/* > - * Now that we are fully operational, we can checksum the > - * disks, and using some heuristics, hopefully are able to > - * always determine the correct root disk. > - */ > void > diskconf(void) > { > - dev_t temp; > - int part = 0; > - > printf("bootpath: %s\n", bootpath); > - makebootdev(bootpath); > > - /* Lookup boot device from boot if not set by configuration */ > - bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp); > - setroot(bootdv, part, RB_USERREQ); > + setroot(bootdv, 0, RB_USERREQ); > dumpconf(); > } > > Index: machdep.c > === > RCS file: /cvs/src/sys/arch/macppc/mac
Re: current/macppc on Mac Mini
On May 23 08:41:50, mpieuc...@nolizard.org wrote: > On 26/12/12(Wed) 20:54, Miod Vallat wrote: > > > Just upgraded to a current again, with the same problem, > > > and the same solution: > > > > [...] > > > wdc1 at kauaiata0 irq 39: DMA > > > atapiscsi0 at wdc1 channel 0 drive 0 > > > scsibus0 at atapiscsi0: 2 targets > > > cd0 at scsibus0 targ 0 lun 0: ATAPI > > > 5/cdrom removable > > > wd0 at wdc1 channel 0 drive 1: > > > wd0: 16-sector PIO, LBA, 76319MB, 156301488 sectors > > [...] > > > bootpath: /pci@f400/ata-6@d/disk@1:/bsd > > > > I think I understand what goes wrong. The code responsible for matching > > the boot device to the actual kernel device on macppc is quite crude, > > especially for non-SCSI disks. > > > > Your bootpath specifies `disk@1' because the disk drive is the second > > device (slave) on the ATA channel, the cdrom drive being master. > > However, the kernel wants to match this information against a `wd1' > > device (as if there were two hard disks on the ATA channel). > > > > The kernel code needs to be fixed to use device_register() to match the > > boot path against actual attachment information, instead of walking the > > device tree at the end of autoconf. If nobody beats me to do this, I'll > > try to cook a diff in a few days. > > Were you thinking of something like that? It works for me (c) tm, with > my PowerBooks (disk@0/wd0), I haven't tried NFS boot yet. > > Jan, does it improve something for you? Yes it does: with this patch, I don't need to hardcode config bsd root on wd0a into my kernel, it figures the bootpath itself. Thank you! Jan [ using 500872 bytes of bsd ELF symbol table ] console out [ATY,RockHopper2_A]console in [keyboard] , using USB using parent ATY,RockHopper2Paren:: memaddr 9800 size 800, : consaddr 9c008000, : ioaddr 9002, size 2: memtag 8000, iotag 8000: width 1280 linebytes 1280 height 1024 depth 8 Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. Copyright (c) 1995-2013 OpenBSD. All rights reserved. http://www.OpenBSD.org OpenBSD 5.3-current (GENERIC.MP) #5: Thu May 23 09:02:44 CEST 2013 r...@www.stare.cz:/usr/src/sys/arch/macppc/compile/GENERIC.MP real mem = 1073741824 (1024MB) avail mem = 1032151040 (984MB) mainbus0 at root: model PowerMac10,2 cpu0 at mainbus0: 7447A (Revision 0x102): 1499 MHz: 512KB L2 cache mem0 at mainbus0 spdmem0 at mem0: 1GB DDR SDRAM non-parity PC3200CL3.0 memc0 at mainbus0: uni-n rev 0xd2 "hw-clock" at memc0 not configured kiic0 at memc0 offset 0xf8001000 iic0 at kiic0 mpcpcibr0 at mainbus0 pci: uni-north pci0 at mpcpcibr0 bus 0 pchb0 at pci0 dev 11 function 0 "Apple UniNorth AGP" rev 0x00 appleagp0 at pchb0 agp0 at appleagp0: aperture at 0x0, size 0x1000 vgafb0 at pci0 dev 16 function 0 "ATI Radeon 9200" rev 0x01, mmio wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation) mpcpcibr1 at mainbus0 pci: uni-north pci1 at mpcpcibr1 bus 0 pchb1 at pci1 dev 11 function 0 "Apple UniNorth PCI" rev 0x00 bwi0 at pci1 dev 18 function 0 "Broadcom BCM4318" rev 0x02: irq 52, address 00:11:24:bf:cb:2a macobio0 at pci1 dev 23 function 0 "Apple Intrepid" rev 0x00 openpic0 at macobio0 offset 0x4: version 0x4614 feature 3f0302 LE macgpio0 at macobio0 offset 0x50 "modem-reset" at macgpio0 offset 0x1d not configured "modem-power" at macgpio0 offset 0x1c not configured macgpio1 at macgpio0 offset 0x9 irq 47 "programmer-switch" at macgpio0 offset 0x11 not configured "gpio5" at macgpio0 offset 0x6f not configured "gpio6" at macgpio0 offset 0x70 not configured "extint-gpio15" at macgpio0 offset 0x67 not configured "escc-legacy" at macobio0 offset 0x12000 not configured zsc0 at macobio0 offset 0x13000: irq 22,23 zstty0 at zsc0 channel 0 zstty1 at zsc0 channel 1 aoa0 at macobio0 offset 0x1: irq 30,1,2 audio0 at aoa0 "timer" at macobio0 offset 0x15000 not configured adb0 at macobio0 offset 0x16000apm0 at adb0: battery flags 0x0, 0% charged piic0 at adb0 iic1 at piic0 maxtmp0 at iic1 addr 0xc8: max6642 kiic1 at macobio0 offset 0x18000 iic2 at kiic1 wdc0 at macobio0 offset 0x2 irq 24: DMA ohci0 at pci1 dev 24 function 0 "Apple Intrepid USB" rev 0x00: couldn't map interrupt ohci1 at pci1 dev 25 function 0 "Apple Intrepid USB" rev 0x00: couldn't map interrupt ohci2 at pci1 dev 26 function 0 "Apple Intrepid USB" rev 0x00: irq 29, version 1.0, legacy support ohci3 at pci1 dev 27 function 0 "NEC USB" rev 0x43: irq 63, version 1.0 ohci4 at pci1 dev 27 function 1 "NEC USB" rev 0x43: irq 63, version 1.0 ehci0 at pci1 dev 27 function 2 "NEC USB" rev 0x04: irq 63 usb0 at ehci0: USB revision 2.0 uhub0 at usb0 "NEC EHCI root hub" rev 2.00/1.00 addr 1 usb1 at ohci2: USB revision 1.0 uhub1 at usb1 "Apple OHCI root hub" rev 1.00/1.00 addr 1 usb2 at ohci3: USB revision 1.0 uhub2 at usb2 "NEC OHCI root hub" rev 1.00/1.00 addr 1 usb3 at ohci4: USB revision 1.0 uhub3 at usb3 "NEC OHCI root hub" rev 1.00/1.00 addr 1
Re: current/macppc on Mac Mini
On 26/12/12(Wed) 20:54, Miod Vallat wrote: > > Just upgraded to a current again, with the same problem, > > and the same solution: > > [...] > > wdc1 at kauaiata0 irq 39: DMA > > atapiscsi0 at wdc1 channel 0 drive 0 > > scsibus0 at atapiscsi0: 2 targets > > cd0 at scsibus0 targ 0 lun 0: ATAPI 5/cdrom > > removable > > wd0 at wdc1 channel 0 drive 1: > > wd0: 16-sector PIO, LBA, 76319MB, 156301488 sectors > [...] > > bootpath: /pci@f400/ata-6@d/disk@1:/bsd > > I think I understand what goes wrong. The code responsible for matching > the boot device to the actual kernel device on macppc is quite crude, > especially for non-SCSI disks. > > Your bootpath specifies `disk@1' because the disk drive is the second > device (slave) on the ATA channel, the cdrom drive being master. > However, the kernel wants to match this information against a `wd1' > device (as if there were two hard disks on the ATA channel). > > The kernel code needs to be fixed to use device_register() to match the > boot path against actual attachment information, instead of walking the > device tree at the end of autoconf. If nobody beats me to do this, I'll > try to cook a diff in a few days. Were you thinking of something like that? It works for me (c) tm, with my PowerBooks (disk@0/wd0), I haven't tried NFS boot yet. Jan, does it improve something for you? Index: autoconf.c === RCS file: /cvs/src/sys/arch/macppc/macppc/autoconf.c,v retrieving revision 1.39 diff -u -p -r1.39 autoconf.c --- autoconf.c 11 Nov 2010 17:58:21 - 1.39 +++ autoconf.c 22 May 2013 19:00:45 - @@ -68,7 +68,7 @@ void dumpconf(void); static struct devmap *findtype(char **); -void makebootdev(char *cp); +void parseofwbp(char *); intgetpno(char **); /* @@ -79,6 +79,9 @@ int getpno(char **); intcold = 1; /* if 1, still working on cold-start */ char bootdev[16];/* to hold boot dev name */ struct device *bootdv = NULL; +enum devclass bootdev_class = DV_DULL; +intbootdev_type = 0; +intbootdev_unit = 0; struct dumpmem dumpmem[VM_PHYSSEG_MAX]; u_int ndumpmem; @@ -165,9 +168,9 @@ findtype(char **s) * '/ht@0,f200/pci@2/bcom5704@4/bsd' */ void -makebootdev(char *bp) +parseofwbp(char *bp) { - int unit, ptype; + int ptype; char *dev, *cp; struct devmap *dp; @@ -184,6 +187,8 @@ makebootdev(char *bp) } while((dp->type & T_IFACE) == 0); if (dp->att && dp->type == T_IFACE) { + bootdev_class = DV_IFNET; + bootdev_type = dp->type; strlcpy(bootdev, dp->dev, sizeof bootdev); return; } @@ -193,24 +198,9 @@ makebootdev(char *bp) ptype = dp->type; dp = findtype(&cp); if (dp->att && dp->type == T_DISK) { - unit = getpno(&cp); - if (ptype == T_SCSI) { - struct device *dv; - struct sd_softc *sd; - - TAILQ_FOREACH(dv, &alldevs, dv_list) { - if (dv->dv_class != DV_DISK || - strcmp(dv->dv_cfdata->cf_driver->cd_name, "sd")) - continue; - sd = (struct sd_softc *)dv; - if (sd->sc_link->target != unit) - continue; - snprintf(bootdev, sizeof bootdev, - "%s%c", dv->dv_xname, 'a'); - return; - } - } - snprintf(bootdev, sizeof bootdev, "%s%d%c", dev, unit, 'a'); + bootdev_class = DV_DISK; + bootdev_type = ptype; + bootdev_unit = getpno(&cp); return; } printf("Warning: boot device unrecognized: %s\n", bp); @@ -239,25 +229,44 @@ getpno(char **cp) void device_register(struct device *dev, void *aux) { + const char *drvrname = dev->dv_cfdata->cf_driver->cd_name; + const char *name = dev->dv_xname; + + if (bootdv != NULL || dev->dv_class != bootdev_class) + return; + + switch (bootdev_type) { + case T_SCSI: + if (strcmp(drvrname, "sd") == 0) { + struct sd_softc *sd = (struct sd_softc *)dev; + + if (sd->sc_link->target == bootdev_unit) + bootdv = dev; + } + case T_IDE: + /* +* Do not require the bootpath unit number to match +* against the driver's one, a slave disk on the ATA +* channel `disk@1' can attach as `wd0'. +*/ + if (strcmp(drvrname, "wd") == 0) + bootdv = dev; + break; + case T_IFACE: +
Re: current/macppc on Mac Mini
> Just upgraded to a current again, with the same problem, > and the same solution: [...] > wdc1 at kauaiata0 irq 39: DMA > atapiscsi0 at wdc1 channel 0 drive 0 > scsibus0 at atapiscsi0: 2 targets > cd0 at scsibus0 targ 0 lun 0: ATAPI 5/cdrom > removable > wd0 at wdc1 channel 0 drive 1: > wd0: 16-sector PIO, LBA, 76319MB, 156301488 sectors [...] > bootpath: /pci@f400/ata-6@d/disk@1:/bsd I think I understand what goes wrong. The code responsible for matching the boot device to the actual kernel device on macppc is quite crude, especially for non-SCSI disks. Your bootpath specifies `disk@1' because the disk drive is the second device (slave) on the ATA channel, the cdrom drive being master. However, the kernel wants to match this information against a `wd1' device (as if there were two hard disks on the ATA channel). The kernel code needs to be fixed to use device_register() to match the boot path against actual attachment information, instead of walking the device tree at the end of autoconf. If nobody beats me to do this, I'll try to cook a diff in a few days. Miod
Re: current/macppc on Mac Mini
On Jun 13 14:12:45, h...@stare.cz wrote: > This is current/macppc on a "late 2005" Mac Mini, > which is PowerMac10,2. > > I needed to hardcode the root device into the kernel config, > otherwise boot stops with unknown root device, as discussed > in the misc thread that starts at > http://marc.info/?l=openbsd-misc&m=133932614509618&w=2 > - probably a discrepancy in what ofw passes to the kernel. Just upgraded to a current again, with the same problem, and the same solution: Index: GENERIC === RCS file: /cvs/src/sys/arch/macppc/conf/GENERIC,v retrieving revision 1.216 diff -u -p -r1.216 GENERIC --- GENERIC 4 Dec 2012 10:58:05 - 1.216 +++ GENERIC 26 Dec 2012 14:46:06 - @@ -27,7 +27,7 @@ optionWSDISPLAY_COMPAT_RAWKBD # provid option USER_PCICONF# user-space PCI configuration -config bsd swap generic +config bsd root on wd0a mainbus0 at root cpu* at mainbus0 [ using 501892 bytes of bsd ELF symbol table ] console out [ATY,RockHopper2_A]console in [keyboard] , using USB using parent ATY,RockHopper2Paren:: memaddr 9800 size 800, : consaddr 9c008000, : ioaddr 9002, size 2: memtag 8000, iotag 8000: width 800 linebytes 1024 height 600 depth 8 Copyright (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.2-current (GENERIC.MP) #4: Wed Dec 26 15:08:07 CET 2012 r...@www.stare.cz:/usr/src/sys/arch/macppc/compile/GENERIC.MP real mem = 1073741824 (1024MB) avail mem = 1032146944 (984MB) mainbus0 at root: model PowerMac10,2 cpu0 at mainbus0: 7447A (Revision 0x102): 1499 MHz: 512KB L2 cache mem0 at mainbus0 spdmem0 at mem0: 1GB DDR SDRAM non-parity PC3200CL3.0 memc0 at mainbus0: uni-n rev 0xd2 "hw-clock" at memc0 not configured kiic0 at memc0 offset 0xf8001000 iic0 at kiic0 mpcpcibr0 at mainbus0 pci: uni-north, Revision 0xff pci0 at mpcpcibr0 bus 0 pchb0 at pci0 dev 11 function 0 "Apple UniNorth AGP" rev 0x00 appleagp0 at pchb0 agp0 at appleagp0: aperture at 0x0, size 0x1000 vgafb0 at pci0 dev 16 function 0 "ATI Radeon 9200" rev 0x01, mmio wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation) mpcpcibr1 at mainbus0 pci: uni-north, Revision 0x5 pci1 at mpcpcibr1 bus 0 pchb1 at pci1 dev 11 function 0 "Apple UniNorth PCI" rev 0x00 bwi0 at pci1 dev 18 function 0 "Broadcom BCM4318" rev 0x02: irq 52, address 00:11:24:bf:cb:2a macobio0 at pci1 dev 23 function 0 "Apple Intrepid" rev 0x00 openpic0 at macobio0 offset 0x4: version 0x4614 feature 3f0302 LE macgpio0 at macobio0 offset 0x50 "modem-reset" at macgpio0 offset 0x1d not configured "modem-power" at macgpio0 offset 0x1c not configured macgpio1 at macgpio0 offset 0x9 irq 47 "programmer-switch" at macgpio0 offset 0x11 not configured "gpio5" at macgpio0 offset 0x6f not configured "gpio6" at macgpio0 offset 0x70 not configured "extint-gpio15" at macgpio0 offset 0x67 not configured "escc-legacy" at macobio0 offset 0x12000 not configured zsc0 at macobio0 offset 0x13000: irq 22,23 zstty0 at zsc0 channel 0 zstty1 at zsc0 channel 1 aoa0 at macobio0 offset 0x1: irq 30,1,2 audio0 at aoa0 "timer" at macobio0 offset 0x15000 not configured adb0 at macobio0 offset 0x16000 irq 25: via-pmu, 0 targets apm0 at adb0: battery flags 0x0, 0% charged piic0 at adb0 iic1 at piic0 maxtmp0 at iic1 addr 0xc8: max6642 kiic1 at macobio0 offset 0x18000 iic2 at kiic1 wdc0 at macobio0 offset 0x2 irq 24: DMA ohci0 at pci1 dev 24 function 0 "Apple Intrepid USB" rev 0x00: couldn't map interrupt ohci1 at pci1 dev 25 function 0 "Apple Intrepid USB" rev 0x00: couldn't map interrupt ohci2 at pci1 dev 26 function 0 "Apple Intrepid USB" rev 0x00: irq 29, version 1.0, legacy support ohci3 at pci1 dev 27 function 0 "NEC USB" rev 0x43: irq 63, version 1.0 ohci4 at pci1 dev 27 function 1 "NEC USB" rev 0x43: irq 63, version 1.0 ehci0 at pci1 dev 27 function 2 "NEC USB" rev 0x04: irq 63 usb0 at ehci0: USB revision 2.0 uhub0 at usb0 "NEC EHCI root hub" rev 2.00/1.00 addr 1 usb1 at ohci2: USB revision 1.0 uhub1 at usb1 "Apple OHCI root hub" rev 1.00/1.00 addr 1 usb2 at ohci3: USB revision 1.0 uhub2 at usb2 "NEC OHCI root hub" rev 1.00/1.00 addr 1 usb3 at ohci4: USB revision 1.0 uhub3 at usb3 "NEC OHCI root hub" rev 1.00/1.00 addr 1 mpcpcibr2 at mainbus0 pci: uni-north, Revision 0x6 pci2 at mpcpcibr2 bus 0 pchb2 at pci2 dev 11 function 0 "Apple UniNorth PCI" rev 0x00 kauaiata0 at pci2 dev 13 function 0 "Apple Intrepid ATA" rev 0x00 wdc1 at kauaiata0 irq 39: DMA atapiscsi0 at wdc1 channel 0 drive 0 scsibus0 at atapiscsi0: 2 targets cd0 at scsibus0 targ 0 lun 0: ATAPI 5/cdrom removable wd0 at wdc1 channel 0 drive 1: wd0: 16-sector PIO, LBA, 76319MB, 156301488 sectors cd0(wdc1:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4 wd0(wdc1:0:1): using PIO mode 4, DMA mode 2, Ultra-