Subject: port-alpha/21470: Change request for dec_550au bootdevice detection
To: None <gnats-bugs@gnats.netbsd.org>
From: None <imago@13thmonkey.org>
List: netbsd-bugs
Date: 05/06/2003 01:30:33
>Number:         21470
>Category:       port-alpha
>Synopsis:       Change request for dec_550au bootdevice detection
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-alpha-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 05 23:31:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Reinoud Zandijk
>Release:        NetBSD 1.6R
>Organization:
NetBSD
	
>Environment:
An DEC Alpha 550au machine with no SCSI harddisc (was too noisy) but with 
two ATAPI CD/DVD and one IDE harddisc; plenty of disc and memory.

>Description:
When i boot with `boot dka0' it will start the kernel fine and detects all 
fine but it fails to recognize its boot-device. This is pretty much a PITA 
for you can never do a `shutdown -r' for it allways keeps on asking for the 
boot-device.

>How-To-Repeat:
Boot from an IDE disc with `boot dka0' flags -a
>Fix:

It is fixed with the following patch :
Index: autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/alpha/autoconf.c,v
retrieving revision 1.39
diff -c -r1.39 autoconf.c
*** autoconf.c	2002/09/06 13:18:53	1.39
--- autoconf.c	2003/05/05 23:22:24
***************
*** 160,167 ****
  	bd.boot_dev_type = atoi(boot_fields[6]);
  	bd.ctrl_dev_type = boot_fields[7];
  
! #if 0
! 	printf("parsed: proto = %s, bus = %d, slot = %d, channel = %d,\n",
  	    bd.protocol, bd.bus, bd.slot, bd.channel);
  	printf("\tremote = %s, unit = %d, dev_type = %d, ctrl_type = %s\n",
  	    bd.remote_address, bd.unit, bd.boot_dev_type, bd.ctrl_dev_type);
--- 160,168 ----
  	bd.boot_dev_type = atoi(boot_fields[6]);
  	bd.ctrl_dev_type = boot_fields[7];
  
! #if 1
! 	printf("parsed prom bootinfo: ");
! 	printf("proto = %s, bus = %d, slot = %d, channel = %d,\n",
  	    bd.protocol, bd.bus, bd.slot, bd.channel);
  	printf("\tremote = %s, unit = %d, dev_type = %d, ctrl_type = %s\n",
  	    bd.remote_address, bd.unit, bd.boot_dev_type, bd.ctrl_dev_type);
Index: dec_550.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/alpha/dec_550.c,v
retrieving revision 1.20
diff -c -r1.20 dec_550.c
*** dec_550.c	2002/09/27 15:35:34	1.20
--- dec_550.c	2003/05/05 23:22:26
***************
*** 80,85 ****
--- 80,86 ----
  static int comcnrate = CONSPEED;
  
  #define	DR_VERBOSE(f) while (0)
+ /* #define	DR_VERBOSE(f) f; */
  
  void dec_550_init __P((void));
  static void dec_550_cons_init __P((void));
***************
*** 187,193 ****
  	void *aux;
  {
  	static int found, initted, scsiboot, ideboot, netboot;
! 	static struct device *pcidev, *scsipidev;
  	struct bootdev_data *b = bootdev_data;
  	struct device *parent = dev->dv_parent;
  	struct cfdata *cf = dev->dv_cfdata;
--- 188,194 ----
  	void *aux;
  {
  	static int found, initted, scsiboot, ideboot, netboot;
! 	static struct device *pcidev, *scsipidev, *pciidedev;
  	struct bootdev_data *b = bootdev_data;
  	struct device *parent = dev->dv_parent;
  	struct cfdata *cf = dev->dv_cfdata;
***************
*** 211,315 ****
  		initted = 1;
  	}
  
! 	if (pcidev == NULL) {
! 		if (strcmp(name, "pci"))
! 			return;
! 		else {
! 			struct pcibus_attach_args *pba = aux;
  
! 			if ((b->slot / 1000) != pba->pba_bus)
! 				return;
! 	
! 			pcidev = dev;
! 			DR_VERBOSE(printf("\npcidev = %s\n",
! 			    pcidev->dv_xname));
! 			return;
! 		}
! 	}
  
! 	if ((ideboot || scsiboot) && (scsipidev == NULL)) {
! 		if (parent != pcidev)
! 			return;
! 		else {
! 			struct pci_attach_args *pa = aux;
  
! 			if ((b->slot % 1000) != pa->pa_device)
! 				return;
  
! 			/* XXX function? */
! 	
! 			scsipidev = dev;
! 			DR_VERBOSE(printf("\nscsipidev = %s\n",
! 			    scsipidev->dv_xname));
! 			return;
! 		}
! 	}
  
! 	if ((ideboot || scsiboot) &&
! 	    (!strcmp(name, "sd") ||
! 	     !strcmp(name, "st") ||
! 	     !strcmp(name, "cd"))) {
! 		struct scsipibus_attach_args *sa = aux;
  
! 		if (parent->dv_parent != scsipidev)
! 			return;
  
! 		if ((sa->sa_periph->periph_channel->chan_bustype->bustype_type
! 		     == SCSIPI_BUSTYPE_SCSI ||
! 		     sa->sa_periph->periph_channel->chan_bustype->bustype_type
! 		     == SCSIPI_BUSTYPE_ATAPI)
! 		    && b->unit / 100 != sa->sa_periph->periph_target)
! 			return;
  
! 		/* XXX LUN! */
  
! 		switch (b->boot_dev_type) {
! 		case 0:
! 			if (strcmp(name, "sd") &&
! 			    strcmp(name, "cd"))
! 				return;
! 			break;
! 		case 1:
! 			if (strcmp(name, "st"))
  				return;
! 			break;
! 		default:
  			return;
! 		}
! 
! 		/* we've found it! */
! 		booted_device = dev;
! 		DR_VERBOSE(printf("\nbooted_device = %s\n",
! 		    booted_device->dv_xname));
! 		found = 1;
! 	}
  
! 	/*
! 	 * Support to boot from IDE drives.
! 	 */
! 	if ((ideboot || scsiboot) && !strcmp(name, "wd")) {
! 		struct ata_device *adev = aux;
! 		if ((strncmp("pciide", parent->dv_xname, 6) != 0)) {
! 			return;
  		} else {
! 			if (parent != scsipidev)
  				return;
! 		}
! 		DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
! 		    adev->adev_drv_data->drive, adev->adev_channel));
! 		DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n",
! 		    b->unit, b->channel));
! 		if (b->unit != adev->adev_drv_data->drive ||
! 		    b->channel != adev->adev_channel)
! 			return;
  
  		/* we've found it! */
  		booted_device = dev;
! 		DR_VERBOSE(printf("booted_device = %s\n",
! 		    booted_device->dv_xname));
  		found = 1;
- 	}
  
  	if (netboot) {
  		if (parent != pcidev)
  			return;
--- 212,303 ----
  		initted = 1;
  	}
  
! 	if (strcmp(name, "pci") == 0) {
! 		struct pcibus_attach_args *pba;
! 		pba = aux;
! 
! 		DR_VERBOSE(printf("\nb->slot = %d, pba->pba_bus = %d\n", b->slot, pba->pba_bus));
! 		pcidev = dev;
! 		DR_VERBOSE(printf("\npcidev = %s\n", pcidev->dv_xname));
! 		return;
! 	};
  
! 	/* in this machine all is on PCI */
! 	if (pcidev == NULL) return;
  
! 	if (strncmp(name, "scsibus", 7) ==0) {
! 		struct pci_attach_args *pa = aux;
  
! 		DR_VERBOSE(printf("\nNOT checking b->slot (%d) compared to (%d)\n", b->slot, pa->pa_device));
! /* XXX */
! 		if ((b->slot % 1000) != pa->pa_device) return;
  
! 		scsipidev = dev;
! 		DR_VERBOSE(printf("\nscsipidev = %s\n", scsipidev->dv_xname));
  
! 		return;
! 	};
  
! 	if (strncmp(name, "pciide", 6) == 0) {
! 		pciidedev = dev;
! 		DR_VERBOSE(printf("\npciidedev = %s\n", pciidedev->dv_xname));
  
! 		return;
! 	};
  
! 	if (((parent == pciidedev) || (parent == scsipidev)) && (parent)) {
! 		struct ata_device *adev = aux;
! 		struct scsipibus_attach_args *sa = aux;
  
! 		DR_VERBOSE(printf("Bootdev info: unit: %d, channel: %d\n", b->unit, b->channel));
! 		if (!strncmp(name, "sd", 2) ||
! 		    !strncmp(name, "wd", 2) ||
! 		    !strncmp(name, "st", 2) ||
! 		    !strncmp(name, "cd", 2))
! 		{
! 			switch (b->boot_dev_type) {
! 			case 0:
! 				if (strncmp(name, "sd", 2) &&
! 				    strncmp(name, "cd", 2) &&
! 				    strncmp(name, "wd", 2)) return;
! 				break;
! 			case 1:
! 				if (strncmp(name, "st", 2)) return;
! 				break;
! 			default:
! 				printf("WARNING: unknown boot device type %d\n", b->boot_dev_type);
  				return;
! 			};
! 		} else {
! 			printf("WARNING: unknown device %s on the idebus; skipped\n", name);
  			return;
! 		};
  
! 		if (parent == pciidedev) {
! 			DR_VERBOSE(printf("\nAtapi info: drive: %d, channel %d\n",
! 			    adev->adev_drv_data->drive, adev->adev_channel));
! 			if (b->unit != adev->adev_drv_data->drive || b->channel != adev->adev_channel)
! 				return;
  		} else {
! 			struct pcibus_attach_args *pba;
! 			pba = aux;
! 
! 			DR_VERBOSE(printf("\nSCSI info: target = %d\n", sa->sa_periph->periph_target));
! 			if ((b->slot / 100) != pba->pba_bus)
  				return;
! 			if (b->unit / 100 != sa->sa_periph->periph_target)
! 				return;
! 		};
  
  		/* we've found it! */
  		booted_device = dev;
! 		DR_VERBOSE(printf("\nbooted_device = %s\n", booted_device->dv_xname));
  		found = 1;
  
+ 		return;
+ 	};
+ 
+ 	DR_VERBOSE(printf("checking for netboot\n"));
  	if (netboot) {
  		if (parent != pcidev)
  			return;

-----

end of PR

>Release-Note:
>Audit-Trail:
>Unformatted: