Module Name: src
Committed By: phx
Date: Sat Jul 17 14:15:34 UTC 2010
Modified Files:
src/sys/arch/sandpoint/stand/netboot: pciide.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/stand/netboot/pciide.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/pciide.c
diff -u src/sys/arch/sandpoint/stand/netboot/pciide.c:1.8 src/sys/arch/sandpoint/stand/netboot/pciide.c:1.9
--- src/sys/arch/sandpoint/stand/netboot/pciide.c:1.8 Sat Jun 26 21:45:49 2010
+++ src/sys/arch/sandpoint/stand/netboot/pciide.c Sat Jul 17 14:15:34 2010
@@ -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;
+}