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 Code to set PCI cfg xfer mo...



details:   https://anonhg.NetBSD.org/src/rev/07ee0c1d2da4
branches:  trunk
changeset: 756421:07ee0c1d2da4
user:      phx <phx%NetBSD.org@localhost>
date:      Sat Jul 17 14:15:34 2010 +0000

description:
Code to set PCI cfg xfer mode registers of 0680A IDE, to make sure the
chip is in PIO mode.
Patch submitted by Toru Nishimura.

diffstat:

 sys/arch/sandpoint/stand/netboot/pciide.c |  30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r a669d5c90e55 -r 07ee0c1d2da4 sys/arch/sandpoint/stand/netboot/pciide.c
--- a/sys/arch/sandpoint/stand/netboot/pciide.c Sat Jul 17 10:51:03 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/pciide.c Sat Jul 17 14:15:34 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.8 2010/06/26 21:45:49 phx Exp $ */
+/* $NetBSD: pciide.c,v 1.9 2010/07/17 14:15:34 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -41,7 +41,8 @@
        int (*chipfix)(struct dkdev_ata *);
        int (*presense)(struct dkdev_ata *, int);
 };
-static struct myops cmdideops = { NULL, NULL };
+static int cmdidefix(struct dkdev_ata *);
+static struct myops cmdideops = { cmdidefix, NULL };
 static struct myops *myops = &cmdideops;
 
 int pciide_match(unsigned, void *);
@@ -76,9 +77,6 @@
        l->iobuf = allocaligned(512, 16);
        l->tag = tag;
 
-       if (myops->chipfix)
-               (*myops->chipfix)(l);
-
        val = pcicfgread(tag, PCI_CLASS_REG);
        native = val & 03;
        if (native) {
@@ -119,5 +117,27 @@
                if (l->presense[n])
                        printf("channel %d present\n", n);
        }
+
+       /* make sure to have PIO0 */
+       if (myops->chipfix)
+               (*myops->chipfix)(l);
+
        return l;
 }
+
+static int
+cmdidefix(struct dkdev_ata *l)
+{
+       int v;
+
+       v = pcicfgread(l->tag, 0x80);
+       pcicfgwrite(l->tag, 0x80, (v & ~0xff) | 0x01);
+       v = pcicfgread(l->tag, 0x84);
+       pcicfgwrite(l->tag, 0x84, (v & ~0xff) | 0x01);
+       v = pcicfgread(l->tag, 0xa4);
+       pcicfgwrite(l->tag, 0xa4, (v & ~0xffff) | 0x328a);
+       v = pcicfgread(l->tag, 0xb4);
+       pcicfgwrite(l->tag, 0xb4, (v & ~0xffff) | 0x328a);
+
+       return 1;
+}



Home | Main Index | Thread Index | Old Index