summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-31 11:03:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-31 11:03:04 +0000
commitcb80d106aae3b78c45f5a8b3e460630c6b1b3ef8 (patch)
treec45b623b736cdb38f1ab01c5ea9c087fc74c6c39 /sys/arch
parenta298b2b29b94ed97b586eab2b4ccf19e291949b5 (diff)
use isa hook to enable IDE port on machines where it exists. Niklas
wrote this as a driver, but the change has to be done earlier. alpha:/usr/obj is now IDE.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/pci/sio.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/sys/arch/alpha/pci/sio.c b/sys/arch/alpha/pci/sio.c
index 414d6b27ccc..a8cf141dff4 100644
--- a/sys/arch/alpha/pci/sio.c
+++ b/sys/arch/alpha/pci/sio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio.c,v 1.9 1997/01/24 19:57:57 niklas Exp $ */
+/* $OpenBSD: sio.c,v 1.10 1997/07/31 11:03:03 deraadt Exp $ */
/* $NetBSD: sio.c,v 1.15 1996/12/05 01:39:36 cgd Exp $ */
/*
@@ -94,6 +94,7 @@ void sio_eisa_attach_hook __P((struct device *, struct device *,
struct eisabus_attach_args *));
int sio_eisa_maxslots __P((void *));
int sio_eisa_intr_map __P((void *, u_int, eisa_intr_handle_t *));
+void siocfiddle __P((struct isabus_attach_args *iba));
void sio_bridge_callback __P((void *));
@@ -213,8 +214,7 @@ sio_isa_attach_hook(parent, self, iba)
struct device *parent, *self;
struct isabus_attach_args *iba;
{
-
- /* Nothing to do. */
+ siocfiddle(iba);
}
void
@@ -256,3 +256,48 @@ sio_eisa_intr_map(v, irq, ihp)
*ihp = irq;
return 0;
}
+
+
+/*
+ * Look for and gently fondle the 87312 Super I/O chip.
+ */
+
+#define SIOC_IDE_ENABLE 0x40
+#define SIOC_NPORTS 2
+void
+siocfiddle(iba)
+ struct isabus_attach_args *iba;
+{
+ bus_space_tag_t iot = iba->iba_iot;
+ bus_space_handle_t ioh;
+ extern int cputype;
+ int addr;
+ u_int8_t reg0;
+
+ /* Decide based on machine type */
+ switch (cputype) {
+ case 11: /* DEC AXPpci */
+ case 12: /* DEC 2100 A50 */
+ addr = 0x26e;
+ break;
+ case 26: /* DEC EB164 */
+ addr = 0x398;
+ break;
+ default:
+ return;
+ }
+
+ if (bus_space_map(iot, addr, SIOC_NPORTS, 0, &ioh))
+ return;
+
+ /* select and read register 0 */
+ bus_space_write_1(iot, ioh, 0, 0);
+ reg0 = bus_space_read_1(iot, ioh, 1);
+
+ /* write back with IDE enabled flag set, and do it twice! */
+ bus_space_write_1(iot, ioh, 0, 0);
+ bus_space_write_1(iot, ioh, 1, reg0 | SIOC_IDE_ENABLE);
+ bus_space_write_1(iot, ioh, 1, reg0 | SIOC_IDE_ENABLE);
+
+ bus_space_unmap(iot, ioh, SIOC_NPORTS);
+}