On Mon, Oct 14, 2019 at 03:08:54PM +0200, Mark Kettenis wrote: > > Date: Mon, 14 Oct 2019 18:44:08 +1000 > > From: Jonathan Matthew <[email protected]> > > > > Recently I discovered that (some?) mpii(4) controllers fill in > > link->port_wwn > > with a fake wwn (4433221102000000) for sata devices. When you're trying to > > boot a sparc64 box off a sata device attached to such a controller, this > > means > > the bootpath matching in device_register() doesn't work, so you have to > > enter > > the root device manually, which is unfun. > > > > By the time the device is being registered, scsi_probedev has filled in the > > devid, so we can use that to match against the boot path if link->port_wwn > > doesn't work. > > > > This makes life a lot easier on this controller in my S7-2: > > mpii0 at pci19 dev 0 function 0 "Symbios Logic SAS3008" rev 0x02a > > mpii0: ORCL-INT-SAS3, firmware 9.0.0.0, MPI 2.5 > > scsibus2 at mpii0: 1024 targets > > > > ok? > > > > > > Index: autoconf.c > > =================================================================== > > RCS file: /cvs/src/sys/arch/sparc64/sparc64/autoconf.c,v > > retrieving revision 1.132 > > diff -u -p -r1.132 autoconf.c > > --- autoconf.c 25 Jul 2019 22:45:53 -0000 1.132 > > +++ autoconf.c 14 Oct 2019 03:34:08 -0000 > > @@ -1459,6 +1459,16 @@ device_register(struct device *dev, void > > if (bp->val[0] == sl->port_wwn && lun == sl->lun) { > > nail_bootdev(dev, bp); > > } > > + > > + /* > > + * sata devices on some controllers don't get > > + * port_wwn filled in, so look at devid too. > > + */ > > + if (sl->id && sl->id->d_len == 8 && > > + sl->id->d_type == DEVID_NAA) { > > + if (memcmp(sl->id + 1, &bp->val[0], 8) == 0) > > + nail_bootdev(dev, bp); > > The nested if statements look a bit weird. ANy reason why you're not > using a single if-statement here? > > Otherwise this looks good to me.
Good point. Initially I had something more complicated in there, then dlg pointed out memcmp would work just as well. Moving it into the first if statement works, and it looks cleaner too.
