Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sandpoint/stand/netboot Make disk-booting work on S...



details:   https://anonhg.NetBSD.org/src/rev/14511d637fb4
branches:  trunk
changeset: 760676:14511d637fb4
user:      phx <phx%NetBSD.org@localhost>
date:      Mon Jan 10 20:13:47 2011 +0000

description:
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.

diffstat:

 sys/arch/sandpoint/stand/netboot/globals.h |  30 +++++++++++++++---------------
 sys/arch/sandpoint/stand/netboot/siisata.c |  17 +++++++++++------
 2 files changed, 26 insertions(+), 21 deletions(-)

diffs (90 lines):

diff -r 14b37e5db909 -r 14511d637fb4 sys/arch/sandpoint/stand/netboot/globals.h
--- a/sys/arch/sandpoint/stand/netboot/globals.h        Mon Jan 10 19:51:37 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/globals.h        Mon Jan 10 20:13:47 2011 +0000
@@ -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;
diff -r 14b37e5db909 -r 14511d637fb4 sys/arch/sandpoint/stand/netboot/siisata.c
--- a/sys/arch/sandpoint/stand/netboot/siisata.c        Mon Jan 10 19:51:37 2011 +0000
+++ b/sys/arch/sandpoint/stand/netboot/siisata.c        Mon Jan 10 20:13:47 2011 +0000
@@ -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;
 }



Home | Main Index | Thread Index | Old Index