Module Name:    src
Committed By:   phx
Date:           Wed Jun  8 18:06:02 UTC 2011

Modified Files:
        src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Support disk units from multiple IDE/SATA PCI controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sandpoint/stand/altboot/dsk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.5 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.6
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.5	Sun Mar  6 13:55:12 2011
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Wed Jun  8 18:06:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.5 2011/03/06 13:55:12 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.6 2011/06/08 18:06:02 phx Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 };
 static int ndskdv = sizeof(ldskdv)/sizeof(ldskdv[0]);
 
-static int disk_scan(void *);
+static void disk_scan(void *);
 static int probe_drive(struct dkdev_ata *, int);
 static void drive_ident(struct disk *, char *);
 static char *mkident(char *, int);
@@ -80,7 +80,8 @@
 static void issue28(struct dvata_chan *, int64_t, int);
 static struct disk *lookup_disk(int);
 
-static struct disk ldisk[4];
+#define MAX_UNITS 8
+static struct disk ldisk[MAX_UNITS];
 
 int
 dskdv_init(void *self)
@@ -103,15 +104,15 @@
 	return 1;
 }
 
-static int
+static void
 disk_scan(void *drv)
 {
 	struct dkdev_ata *l = drv;
 	struct disk *d;
-	int n, ndrive;
+	static int ndrive = 0;
+	int n;
 
-	ndrive = 0;
-	for (n = 0; n < 4; n++) {
+	for (n = 0; n < 4 && ndrive < MAX_UNITS; n++) {
 		if (l->presense[n] == 0)
 			continue;
 		if (probe_drive(l, n) == 0) {
@@ -127,7 +128,6 @@
 		decode_dlabel(d, l->iobuf);
 		ndrive += 1;
 	}
-	return ndrive;
 }
 
 int

Reply via email to