summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Reindl <martin@cvs.openbsd.org>2005-05-09 21:55:13 +0000
committerMartin Reindl <martin@cvs.openbsd.org>2005-05-09 21:55:13 +0000
commit390474309a49bee35f12d6c59d4382a1c1dfcef8 (patch)
tree1085a15c1b7b333b6eace80f204cc5c97e996284 /sys
parent6bfc8041f8bed2c0b102f16274ae576676e2df62 (diff)
fixes and updates for root device detection from NetBSD:
- remove unneeded checks and variables - use strncasecmp() to check b->protocol because the case is dependant on the firmware revision - check logical unit numbers - consistently check PCI function numbers - on the 6600 models check which PCI hierarchy is looked at - makes root device detection on DS20 (6600) work testing by claudio, xsa and miod; ok miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/dec_1000a.c91
-rw-r--r--sys/arch/alpha/alpha/dec_2100_a50.c91
-rw-r--r--sys/arch/alpha/alpha/dec_550.c117
-rw-r--r--sys/arch/alpha/alpha/dec_6600.c136
-rw-r--r--sys/arch/alpha/alpha/dec_axppci_33.c91
-rw-r--r--sys/arch/alpha/alpha/dec_eb164.c117
-rw-r--r--sys/arch/alpha/alpha/dec_eb64plus.c91
-rw-r--r--sys/arch/alpha/alpha/dec_kn20aa.c91
8 files changed, 315 insertions, 510 deletions
diff --git a/sys/arch/alpha/alpha/dec_1000a.c b/sys/arch/alpha/alpha/dec_1000a.c
index 109ddedbb80..8c0162d06e1 100644
--- a/sys/arch/alpha/alpha/dec_1000a.c
+++ b/sys/arch/alpha/alpha/dec_1000a.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_1000a.c,v 1.2 2002/10/12 01:09:43 krw Exp $ */
+/* $OpenBSD: dec_1000a.c,v 1.3 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_1000a.c,v 1.14 2001/06/05 04:53:11 thorpej Exp $ */
/*
@@ -249,8 +249,8 @@ dec_1000a_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, netboot;
- static struct device *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -260,11 +260,11 @@ dec_1000a_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
+ printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
#endif
initted =1;
}
@@ -280,84 +280,61 @@ dec_1000a_device_register(dev, aux)
pcidev = dev;
#if 0
- printf("\npcidev = %s\n", pcidev->dv_xname);
+ printf("\npcidev = %s\n", dev->dv_xname);
#endif
return;
}
}
- if (scsiboot && (scsidev == NULL)) {
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if ((b->slot % 1000) != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
- /* XXX function? */
-
- scsidev = dev;
+ if (netboot) {
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", dev->dv_xname);
+#endif
+ found = 1;
+ } else {
+ ctrlrdev = dev;
#if 0
- printf("\nscsidev = %s\n", scsidev->dv_xname);
+ printf("\nctrlrdev = %s\n", dev->dv_xname);
#endif
+ }
return;
}
}
- if (scsiboot &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
- struct scsibus_attach_args *sa = aux;
+ if (!diskboot)
+ return;
- if (parent->dv_parent != scsidev)
- return;
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ if (parent->dv_parent != ctrlrdev)
return;
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
- }
/* we've found it! */
booted_device = dev;
#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
+ printf("\nbooted_device = %s\n", dev->dv_xname);
#endif
found = 1;
}
-
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if ((b->slot % 1000) != pa->pa_device)
- return;
-
- /* XXX function? */
-
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
-#endif
- found = 1;
- return;
- }
- }
}
diff --git a/sys/arch/alpha/alpha/dec_2100_a50.c b/sys/arch/alpha/alpha/dec_2100_a50.c
index 4c4cfcb79ad..cbf973d09b3 100644
--- a/sys/arch/alpha/alpha/dec_2100_a50.c
+++ b/sys/arch/alpha/alpha/dec_2100_a50.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_2100_a50.c,v 1.16 2002/06/25 21:33:19 miod Exp $ */
+/* $OpenBSD: dec_2100_a50.c,v 1.17 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_2100_a50.c,v 1.43 2000/05/22 20:13:31 thorpej Exp $ */
/*
@@ -168,8 +168,8 @@ dec_2100_a50_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, netboot;
- static struct device *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -179,11 +179,11 @@ dec_2100_a50_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
+ printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
#endif
initted =1;
}
@@ -199,84 +199,61 @@ dec_2100_a50_device_register(dev, aux)
pcidev = dev;
#if 0
- printf("\npcidev = %s\n", pcidev->dv_xname);
+ printf("\npcidev = %s\n", dev->dv_xname);
#endif
return;
}
}
- if (scsiboot && (scsidev == NULL)) {
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if ((b->slot % 1000) != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
-
- /* XXX function? */
- scsidev = dev;
+ if (netboot) {
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", dev->dv_xname);
+#endif
+ found = 1;
+ } else {
+ ctrlrdev = dev;
#if 0
- printf("\nscsidev = %s\n", scsidev->dv_xname);
+ printf("\nctrlrdev = %s\n", dev->dv_xname);
#endif
+ }
return;
}
}
- if (scsiboot &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
- struct scsibus_attach_args *sa = aux;
+ if (!diskboot)
+ return;
- if (parent->dv_parent != scsidev)
- return;
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ if (parent->dv_parent != ctrlrdev)
return;
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
- }
/* we've found it! */
booted_device = dev;
#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
+ printf("\nbooted_device = %s\n", dev->dv_xname);
#endif
found = 1;
}
-
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if ((b->slot % 1000) != pa->pa_device)
- return;
-
- /* XXX function? */
-
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
-#endif
- found = 1;
- return;
- }
- }
}
diff --git a/sys/arch/alpha/alpha/dec_550.c b/sys/arch/alpha/alpha/dec_550.c
index 4ad6dd1824b..dbbf15277a2 100644
--- a/sys/arch/alpha/alpha/dec_550.c
+++ b/sys/arch/alpha/alpha/dec_550.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_550.c,v 1.8 2002/06/25 21:33:19 miod Exp $ */
+/* $OpenBSD: dec_550.c,v 1.9 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_550.c,v 1.10 2000/06/20 03:48:53 matt Exp $ */
/*
@@ -160,8 +160,8 @@ dec_550_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, ideboot, netboot;
- static struct device *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -171,17 +171,12 @@ dec_550_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
- /*
- * Add an extra check to boot from ide drives:
- * Newer SRM firmware use the protocol identifier IDE,
- * older SRM firmware use the protocol identifier SCSI.
- */
- ideboot = (strcmp(b->protocol, "IDE") == 0);
- DR_VERBOSE(printf("scsiboot = %d, ideboot = %d, netboot = %d\n",
- scsiboot, ideboot, netboot));
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0) ||
+ (strncasecmp(b->protocol, "IDE", 3) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
+ DR_VERBOSE(printf("diskboot = %d, netboot = %d\n", diskboot,
+ netboot));
initted = 1;
}
@@ -195,76 +190,70 @@ dec_550_device_register(dev, aux)
return;
pcidev = dev;
- DR_VERBOSE(printf("\npcidev = %s\n",
- pcidev->dv_xname));
+ DR_VERBOSE(printf("\npcidev = %s\n", pcidev->dv_xname));
return;
}
}
- if ((ideboot || scsiboot) && (scsidev == NULL)) {
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if ((b->slot % 1000) != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
- /* XXX function? */
-
- scsidev = dev;
- DR_VERBOSE(printf("\nscsidev = %s\n",
- scsidev->dv_xname));
+ if (netboot) {
+ booted_device = dev;
+ DR_VERBOSE(printf("\nbooted_device = %s\n",
+ dev->dv_xname));
+ found = 1;
+ } else {
+ ctrlrdev = dev;
+ DR_VERBOSE(printf("\nctrlrdev = %s\n",
+ dev->dv_xname));
+ }
return;
}
}
- if ((ideboot || scsiboot) &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
- struct scsibus_attach_args *sa = aux;
+ if (!diskboot)
+ return;
- if (parent->dv_parent != scsidev)
- return;
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ if (parent->dv_parent != ctrlrdev)
return;
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
- }
/* we've found it! */
booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- booted_device->dv_xname));
+ DR_VERBOSE(printf("\nbooted_device = %s\n", dev->dv_xname));
found = 1;
}
/*
* Support to boot from IDE drives.
*/
- if ((ideboot || scsiboot) && !strcmp(cd->cd_name, "wd")) {
+ if (!strcmp(cd->cd_name, "wd")) {
struct ata_atapi_attach *aa_link = aux;
- if ((strncmp("pciide", parent->dv_xname, 6) != 0)) {
+
+ if ((strncmp("pciide", parent->dv_xname, 6) != 0))
return;
- } else {
- if (parent != scsidev)
- return;
- }
+ if (parent != ctrlrdev)
+ return;
+
DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
aa_link->aa_drv_data->drive, aa_link->aa_channel));
DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
@@ -275,29 +264,9 @@ dec_550_device_register(dev, aux)
/* we've found it! */
booted_device = dev;
- DR_VERBOSE(printf("booted_device = %s\n",
- booted_device->dv_xname));
+ DR_VERBOSE(printf("booted_device = %s\n", dev->dv_xname));
found = 1;
}
-
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if ((b->slot % 1000) != pa->pa_device)
- return;
-
- /* XXX function? */
-
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- booted_device->dv_xname));
- found = 1;
- return;
- }
- }
}
static void
diff --git a/sys/arch/alpha/alpha/dec_6600.c b/sys/arch/alpha/alpha/dec_6600.c
index 8f7b7c4452b..704cd7cf8b5 100644
--- a/sys/arch/alpha/alpha/dec_6600.c
+++ b/sys/arch/alpha/alpha/dec_6600.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_6600.c,v 1.7 2004/07/06 21:53:59 deraadt Exp $ */
+/* $OpenBSD: dec_6600.c,v 1.8 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_6600.c,v 1.7 2000/06/20 03:48:54 matt Exp $ */
/*
@@ -161,8 +161,8 @@ dec_6600_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, ideboot, netboot;
- static struct device *primarydev, *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *primarydev, *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -172,19 +172,15 @@ dec_6600_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
- /*
- * Add an extra check to boot from ide drives:
- * Newer SRM firmware use the protocol identifier IDE,
- * older SRM firmware use the protocol identifier SCSI.
- */
- ideboot = (strcmp(b->protocol, "IDE") == 0);
- DR_VERBOSE(printf("scsiboot = %d, ideboot = %d, netboot = %d\n",
- scsiboot, ideboot, netboot));
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0) ||
+ (strncasecmp(b->protocol, "IDE", 3) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
+ DR_VERBOSE(printf("diskboot = %d, netboot = %d\n", diskboot,
+ netboot));
initted = 1;
}
+
if (primarydev == NULL) {
if (strcmp(cd->cd_name, "tsp"))
return;
@@ -195,15 +191,25 @@ dec_6600_device_register(dev, aux)
return;
primarydev = dev;
DR_VERBOSE(printf("\nprimarydev = %s\n",
- primarydev->dv_xname));
+ dev->dv_xname));
return;
}
}
+
if (pcidev == NULL) {
- if (parent != primarydev)
- return;
if (strcmp(cd->cd_name, "pci"))
return;
+ /*
+ * Try to find primarydev anywhere in the ancestry. This is
+ * necessary if the PCI bus is hidden behind a bridge.
+ */
+ while (parent) {
+ if (parent == primarydev)
+ break;
+ parent = parent->dv_parent;
+ }
+ if (!parent)
+ return;
else {
struct pcibus_attach_args *pba = aux;
@@ -211,75 +217,70 @@ dec_6600_device_register(dev, aux)
return;
pcidev = dev;
- DR_VERBOSE(printf("\npcidev = %s\n",
- pcidev->dv_xname));
+ DR_VERBOSE(printf("\npcidev = %s\n", dev->dv_xname));
return;
}
}
- if ((ideboot || scsiboot) && (scsidev == NULL)) {
+
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if (b->slot % 1000 / 100 != pa->pa_function)
- return;
- if (b->slot % 100 != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
- scsidev = dev;
- DR_VERBOSE(printf("\nscsidev = %s\n",
- scsidev->dv_xname));
+ if (netboot) {
+ booted_device = dev;
+ DR_VERBOSE(printf("\nbooted_device = %s\n",
+ dev->dv_xname));
+ found = 1;
+ } else {
+ ctrlrdev = dev;
+ DR_VERBOSE(printf("\nctrlrdev = %s\n",
+ dev->dv_xname));
+ }
return;
}
}
- if ((ideboot || scsiboot) &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
+
+ if (!diskboot)
+ return;
+
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (parent->dv_parent != scsidev)
+ if (parent->dv_parent != ctrlrdev)
return;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
-
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
- return;
- }
-
/* we've found it! */
booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- booted_device->dv_xname));
+ DR_VERBOSE(printf("\nbooted_device = %s\n", dev->dv_xname));
found = 1;
}
/*
* Support to boot from IDE drives.
*/
- if ((ideboot || scsiboot) && !strcmp(cd->cd_name, "wd")) {
+ if (!strcmp(cd->cd_name, "wd")) {
struct ata_atapi_attach *aa_link = aux;
- if ((strncmp("pciide", parent->dv_xname, 6) != 0)) {
+
+ if ((strncmp("pciide", parent->dv_xname, 6) != 0))
return;
- } else {
- if (parent != scsidev)
- return;
- }
+ if (parent != ctrlrdev)
+ return;
+
DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
aa_link->aa_drv_data->drive, aa_link->aa_channel));
DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
@@ -290,26 +291,7 @@ dec_6600_device_register(dev, aux)
/* we've found it! */
booted_device = dev;
- DR_VERBOSE(printf("booted_device = %s\n",
- booted_device->dv_xname));
+ DR_VERBOSE(printf("booted_device = %s\n", dev->dv_xname));
found = 1;
}
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if (b->slot % 1000 / 100 != pa->pa_function)
- return;
- if ((b->slot % 100) != pa->pa_device)
- return;
-
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- booted_device->dv_xname));
- found = 1;
- return;
- }
- }
}
diff --git a/sys/arch/alpha/alpha/dec_axppci_33.c b/sys/arch/alpha/alpha/dec_axppci_33.c
index 0b8845b9d29..5385a486ded 100644
--- a/sys/arch/alpha/alpha/dec_axppci_33.c
+++ b/sys/arch/alpha/alpha/dec_axppci_33.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_axppci_33.c,v 1.17 2002/06/25 21:33:19 miod Exp $ */
+/* $OpenBSD: dec_axppci_33.c,v 1.18 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_axppci_33.c,v 1.44 2000/05/22 20:13:32 thorpej Exp $ */
/*
@@ -202,8 +202,8 @@ dec_axppci_33_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, netboot;
- static struct device *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -213,11 +213,11 @@ dec_axppci_33_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
+ printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
#endif
initted =1;
}
@@ -233,84 +233,61 @@ dec_axppci_33_device_register(dev, aux)
pcidev = dev;
#if 0
- printf("\npcidev = %s\n", pcidev->dv_xname);
+ printf("\npcidev = %s\n", dev->dv_xname);
#endif
return;
}
}
- if (scsiboot && (scsidev == NULL)) {
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if ((b->slot % 1000) != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
-
- /* XXX function? */
- scsidev = dev;
+ if (netboot) {
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", dev->dv_xname);
+#endif
+ found = 1;
+ } else {
+ ctrlrdev = dev;
#if 0
- printf("\nscsidev = %s\n", scsidev->dv_xname);
+ printf("\nctrlrdev = %s\n", dev->dv_xname);
#endif
+ }
return;
}
}
- if (scsiboot &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
- struct scsibus_attach_args *sa = aux;
+ if (!diskboot)
+ return;
- if (parent->dv_parent != scsidev)
- return;
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ if (parent->dv_parent != ctrlrdev)
return;
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
- }
/* we've found it! */
booted_device = dev;
#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
+ printf("\nbooted_device = %s\n", dev->dv_xname);
#endif
found = 1;
}
-
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if ((b->slot % 1000) != pa->pa_device)
- return;
-
- /* XXX function? */
-
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
-#endif
- found = 1;
- return;
- }
- }
}
diff --git a/sys/arch/alpha/alpha/dec_eb164.c b/sys/arch/alpha/alpha/dec_eb164.c
index c17ea6afcf2..b01dc6a25e4 100644
--- a/sys/arch/alpha/alpha/dec_eb164.c
+++ b/sys/arch/alpha/alpha/dec_eb164.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_eb164.c,v 1.11 2002/06/25 21:33:19 miod Exp $ */
+/* $OpenBSD: dec_eb164.c,v 1.12 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_eb164.c,v 1.33 2000/05/22 20:13:32 thorpej Exp $ */
/*
@@ -153,8 +153,8 @@ dec_eb164_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, ideboot, netboot;
- static struct device *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -164,17 +164,12 @@ dec_eb164_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
- /*
- * Add an extra check to boot from ide drives:
- * Newer SRM firmware use the protocol identifier IDE,
- * older SRM firmware use the protocol identifier SCSI.
- */
- ideboot = (strcmp(b->protocol, "IDE") == 0);
- DR_VERBOSE(printf("scsiboot = %d, ideboot = %d, netboot = %d\n",
- scsiboot, ideboot, netboot));
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0) ||
+ (strncasecmp(b->protocol, "IDE", 3) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
+ DR_VERBOSE(printf("diskboot = %d, netboot = %d\n", diskboot,
+ netboot));
initted = 1;
}
@@ -188,76 +183,70 @@ dec_eb164_device_register(dev, aux)
return;
pcidev = dev;
- DR_VERBOSE(printf("\npcidev = %s\n",
- pcidev->dv_xname));
+ DR_VERBOSE(printf("\npcidev = %s\n", dev->dv_xname));
return;
}
}
- if ((ideboot || scsiboot) && (scsidev == NULL)) {
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if (b->slot % 1000 / 100 != pa->pa_function)
- return;
- if (b->slot % 100 != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
- scsidev = dev;
- DR_VERBOSE(printf("\nscsidev = %s\n",
- scsidev->dv_xname));
+ if (netboot) {
+ booted_device = dev;
+ DR_VERBOSE(printf("\nbooted_device = %s\n",
+ dev->dv_xname));
+ found = 1;
+ } else {
+ ctrlrdev = dev;
+ DR_VERBOSE(printf("\nctrlrdev = %s\n",
+ dev->dv_xname));
+ }
return;
}
}
- if (scsiboot &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
- struct scsibus_attach_args *sa = aux;
+ if (!diskboot)
+ return;
- if (parent->dv_parent != scsidev)
- return;
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ if (parent->dv_parent != ctrlrdev)
return;
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
- }
/* we've found it! */
booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- booted_device->dv_xname));
+ DR_VERBOSE(printf("\nbooted_device = %s\n", dev->dv_xname));
found = 1;
}
/*
* Support to boot from IDE drives.
*/
- if ((ideboot || scsiboot) && !strcmp(cd->cd_name, "wd")) {
+ if (!strcmp(cd->cd_name, "wd")) {
struct ata_atapi_attach *aa_link = aux;
- if ((strncmp("pciide", parent->dv_xname, 6) != 0)) {
+
+ if ((strncmp("pciide", parent->dv_xname, 6) != 0))
return;
- } else {
- if (parent != scsidev)
- return;
- }
+ if (parent != ctrlrdev)
+ return;
+
DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
aa_link->aa_drv_data->drive, aa_link->aa_channel));
DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
@@ -268,27 +257,7 @@ dec_eb164_device_register(dev, aux)
/* we've found it! */
booted_device = dev;
- DR_VERBOSE(printf("booted_device = %s\n",
- booted_device->dv_xname));
+ DR_VERBOSE(printf("booted_device = %s\n", dev->dv_xname));
found = 1;
}
-
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if ((b->slot % 1000) != pa->pa_device)
- return;
-
- /* XXX function? */
-
- booted_device = dev;
- DR_VERBOSE(printf("\nbooted_device = %s\n",
- booted_device->dv_xname));
- found = 1;
- return;
- }
- }
}
diff --git a/sys/arch/alpha/alpha/dec_eb64plus.c b/sys/arch/alpha/alpha/dec_eb64plus.c
index ef8eca63319..cfb8fd8708e 100644
--- a/sys/arch/alpha/alpha/dec_eb64plus.c
+++ b/sys/arch/alpha/alpha/dec_eb64plus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_eb64plus.c,v 1.3 2002/06/25 21:33:19 miod Exp $ */
+/* $OpenBSD: dec_eb64plus.c,v 1.4 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_eb64plus.c,v 1.25 2001/06/05 04:53:11 thorpej Exp $ */
/*
@@ -161,8 +161,8 @@ dec_eb64plus_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, netboot;
- static struct device *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -172,11 +172,11 @@ dec_eb64plus_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
+ printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
#endif
initted =1;
}
@@ -192,84 +192,61 @@ dec_eb64plus_device_register(dev, aux)
pcidev = dev;
#if 0
- printf("\npcidev = %s\n", pcidev->dv_xname);
+ printf("\npcidev = %s\n", dev->dv_xname);
#endif
return;
}
}
- if (scsiboot && (scsidev == NULL)) {
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if ((b->slot % 1000) != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
-
- /* XXX function? */
- scsidev = dev;
+ if (netboot) {
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", dev->dv_xname);
+#endif
+ found = 1;
+ } else {
+ ctrlrdev = dev;
#if 0
- printf("\nscsidev = %s\n", scsidev->dv_xname);
+ printf("\nctrlrdev = %s\n", dev->dv_xname);
#endif
+ }
return;
}
}
- if (scsiboot &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
- struct scsibus_attach_args *sa = aux;
+ if (!diskboot)
+ return;
- if (parent->dv_parent != scsidev)
- return;
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ if (parent->dv_parent != ctrlrdev)
return;
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
- }
/* we've found it! */
booted_device = dev;
#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
+ printf("\nbooted_device = %s\n", dev->dv_xname);
#endif
found = 1;
}
-
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if ((b->slot % 1000) != pa->pa_device)
- return;
-
- /* XXX function? */
-
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
-#endif
- found = 1;
- return;
- }
- }
}
diff --git a/sys/arch/alpha/alpha/dec_kn20aa.c b/sys/arch/alpha/alpha/dec_kn20aa.c
index 80ec7727f6a..cd545c112c1 100644
--- a/sys/arch/alpha/alpha/dec_kn20aa.c
+++ b/sys/arch/alpha/alpha/dec_kn20aa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dec_kn20aa.c,v 1.15 2002/06/25 21:33:19 miod Exp $ */
+/* $OpenBSD: dec_kn20aa.c,v 1.16 2005/05/09 21:55:12 martin Exp $ */
/* $NetBSD: dec_kn20aa.c,v 1.42 2000/05/22 20:13:32 thorpej Exp $ */
/*
@@ -159,8 +159,8 @@ dec_kn20aa_device_register(dev, aux)
struct device *dev;
void *aux;
{
- static int found, initted, scsiboot, netboot;
- static struct device *pcidev, *scsidev;
+ static int found, initted, diskboot, netboot;
+ static struct device *pcidev, *ctrlrdev;
struct bootdev_data *b = bootdev_data;
struct device *parent = dev->dv_parent;
struct cfdata *cf = dev->dv_cfdata;
@@ -170,11 +170,11 @@ dec_kn20aa_device_register(dev, aux)
return;
if (!initted) {
- scsiboot = (strcmp(b->protocol, "SCSI") == 0);
- netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
- (strcmp(b->protocol, "MOP") == 0);
+ diskboot = (strncasecmp(b->protocol, "SCSI", 4) == 0);
+ netboot = (strncasecmp(b->protocol, "BOOTP", 5) == 0) ||
+ (strncasecmp(b->protocol, "MOP", 3) == 0);
#if 0
- printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot);
+ printf("diskboot = %d, netboot = %d\n", diskboot, netboot);
#endif
initted =1;
}
@@ -190,84 +190,61 @@ dec_kn20aa_device_register(dev, aux)
pcidev = dev;
#if 0
- printf("\npcidev = %s\n", pcidev->dv_xname);
+ printf("\npcidev = %s\n", dev->dv_xname);
#endif
return;
}
}
- if (scsiboot && (scsidev == NULL)) {
+ if (ctrlrdev == NULL) {
if (parent != pcidev)
return;
else {
struct pci_attach_args *pa = aux;
+ int slot;
- if ((b->slot % 1000) != pa->pa_device)
+ slot = pa->pa_bus * 1000 + pa->pa_function * 100 +
+ pa->pa_device;
+ if (b->slot != slot)
return;
-
- /* XXX function? */
- scsidev = dev;
+ if (netboot) {
+ booted_device = dev;
+#if 0
+ printf("\nbooted_device = %s\n", dev->dv_xname);
+#endif
+ found = 1;
+ } else {
+ ctrlrdev = dev;
#if 0
- printf("\nscsidev = %s\n", scsidev->dv_xname);
+ printf("\nctrlrdev = %s\n", dev->dv_xname);
#endif
+ }
return;
}
}
- if (scsiboot &&
- (!strcmp(cd->cd_name, "sd") ||
- !strcmp(cd->cd_name, "st") ||
- !strcmp(cd->cd_name, "cd"))) {
- struct scsibus_attach_args *sa = aux;
+ if (!diskboot)
+ return;
- if (parent->dv_parent != scsidev)
- return;
+ if (!strcmp(cd->cd_name, "sd") || !strcmp(cd->cd_name, "st") ||
+ !strcmp(cd->cd_name, "cd")) {
+ struct scsibus_attach_args *sa = aux;
+ struct scsi_link *periph = sa->sa_sc_link;
+ int unit;
- if (b->unit / 100 != sa->sa_sc_link->target)
+ if (parent->dv_parent != ctrlrdev)
return;
- /* XXX LUN! */
-
- switch (b->boot_dev_type) {
- case 0:
- if (strcmp(cd->cd_name, "sd") &&
- strcmp(cd->cd_name, "cd"))
- return;
- break;
- case 1:
- if (strcmp(cd->cd_name, "st"))
- return;
- break;
- default:
+ unit = periph->target * 100 + periph->lun;
+ if (b->unit != unit)
return;
- }
/* we've found it! */
booted_device = dev;
#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
+ printf("\nbooted_device = %s\n", dev->dv_xname);
#endif
found = 1;
}
-
- if (netboot) {
- if (parent != pcidev)
- return;
- else {
- struct pci_attach_args *pa = aux;
-
- if ((b->slot % 1000) != pa->pa_device)
- return;
-
- /* XXX function? */
-
- booted_device = dev;
-#if 0
- printf("\nbooted_device = %s\n", booted_device->dv_xname);
-#endif
- found = 1;
- return;
- }
- }
}