Module Name:    src
Committed By:   phx
Date:           Mon Jan 10 20:13:47 UTC 2011

Modified Files:
        src/sys/arch/sandpoint/stand/netboot: globals.h siisata.c

Log Message:
Make disk-booting work on Synology by using a PIO ATA-read command (0x20)
instead of the DMA read command (0xc8). This should work for all platforms.
Included the soft-reset in the siisata driver.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/netboot/globals.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sandpoint/stand/netboot/siisata.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/netboot/globals.h
diff -u src/sys/arch/sandpoint/stand/netboot/globals.h:1.18 src/sys/arch/sandpoint/stand/netboot/globals.h:1.19
--- src/sys/arch/sandpoint/stand/netboot/globals.h:1.18	Sat Jun 26 21:45:49 2010
+++ src/sys/arch/sandpoint/stand/netboot/globals.h	Mon Jan 10 20:13:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.h,v 1.18 2010/06/26 21:45:49 phx Exp $ */
+/* $NetBSD: globals.h,v 1.19 2011/01/10 20:13:47 phx Exp $ */
 
 /* clock feed */
 #ifndef EXT_CLK_FREQ
@@ -135,24 +135,24 @@
 struct fs_ops *dsk_fsops(struct open_file *);
 
 /* status */
-#define ATA_STS_BUSY	0x80
-#define ATA_STS_DRDY	0x40
-#define ATA_STS_ERR 	0x01
+#define ATA_STS_BUSY		0x80
+#define ATA_STS_DRDY		0x40
+#define ATA_STS_ERR 		0x01
 /* command */
-#define ATA_CMD_IDENT	0xec
-#define ATA_CMD_READ	0xc8
-#define ATA_CMD_READ_EXT 0x24
-#define ATA_CMD_SETF	0xef
+#define ATA_CMD_IDENT		0xec
+#define ATA_CMD_READ		0x20
+#define ATA_CMD_READ_EXT	0x24
+#define ATA_CMD_SETF		0xef
 /* device */
-#define ATA_DEV_LBA	0xe0
-#define ATA_DEV_OBS	0x90
+#define ATA_DEV_LBA		0xe0
+#define ATA_DEV_OBS		0x90
 /* control */
-#define ATA_DREQ	0x08
-#define ATA_SRST	0x04
+#define ATA_DREQ		0x08
+#define ATA_SRST		0x04
 
-#define ATA_XFER	0x03
-#define XFER_PIO4	0x0c
-#define XFER_PIO0	0x08
+#define ATA_XFER		0x03
+#define XFER_PIO4		0x0c
+#define XFER_PIO0		0x08
 
 struct dvata_chan {
 	uint32_t cmd, ctl, alt, dma;

Index: src/sys/arch/sandpoint/stand/netboot/siisata.c
diff -u src/sys/arch/sandpoint/stand/netboot/siisata.c:1.13 src/sys/arch/sandpoint/stand/netboot/siisata.c:1.14
--- src/sys/arch/sandpoint/stand/netboot/siisata.c:1.13	Sun Aug  8 11:58:26 2010
+++ src/sys/arch/sandpoint/stand/netboot/siisata.c	Mon Jan 10 20:13:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.13 2010/08/08 11:58:26 phx Exp $ */
+/* $NetBSD: siisata.c,v 1.14 2011/01/10 20:13:47 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -83,11 +83,10 @@
 		l->chan[1].cmd = l->bar[2];
 		l->chan[1].ctl = l->chan[1].alt = l->bar[3] | 02;
 		l->chan[1].dma = l->bar[4] + 0x8;
-		/* assume BA5 access is possible */
 		nchan = 2;
 	}
 	else {
-		/* 3114 */
+		/* 3114 - assume BA5 access is possible XXX */
 		l->chan[0].cmd = l->bar[5] + 0x080;
 		l->chan[0].ctl = l->chan[0].alt = (l->bar[5] + 0x088) | 02;
 		l->chan[1].cmd = l->bar[5] + 0x0c0;
@@ -98,10 +97,16 @@
 		l->chan[3].ctl = l->chan[3].alt = (l->bar[5] + 0x2c8) | 02;
 		nchan = 4;
 	}
+
 	for (n = 0; n < nchan; n++) {
-		l->presense[n] = satapresense(l, n);
-		if (l->presense[n])
-			printf("port %d device present\n", n);
+		if (satapresense(l, n)) {
+			/* drive present, now check whether soft reset works */
+			if (perform_atareset(l, n)) {
+				printf("port %d device present\n", n);
+				l->presense[n] = 1;
+			}
+		} else
+			l->presense[n] = 0;
 	}
 	return l;
 }

Reply via email to