summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-09-19 01:28:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-09-19 01:28:05 +0000
commit46911b0071ccd5e207be26083b1d9b72aa6625f5 (patch)
treef2c4eca541bfba15862b333fb96748cebd739264 /sys
parentb579d725ddc6e1ea153c58b780804b32d0ad0d2a (diff)
floppy support; form@openbsd.ru
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/machdep.c4
-rw-r--r--sys/arch/amd64/conf/GENERIC12
-rw-r--r--sys/arch/amd64/include/ioctl_fd.h130
-rw-r--r--sys/arch/amd64/include/isa_machdep.h74
-rw-r--r--sys/arch/amd64/isa/isa_machdep.c24
-rw-r--r--sys/arch/amd64/pci/pcib.c146
-rw-r--r--sys/dev/isa/fd.c4
-rw-r--r--sys/dev/isa/fdc.c6
8 files changed, 328 insertions, 72 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 6a8a2746e9d..152a13c6701 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.35 2005/08/06 14:26:50 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.36 2005/09/19 01:28:04 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -1377,6 +1377,7 @@ init_x86_64(first_avail)
printf("WARNING: CAN'T ALLOCATE EXTENDED MEMORY FROM "
"IOMEM EXTENT MAP!\n");
}
+#if 0
#if NISADMA > 0
/*
* Some motherboards/BIOSes remap the 384K of RAM that would
@@ -1399,6 +1400,7 @@ init_x86_64(first_avail)
biosextmem = (15*1024);
}
#endif
+#endif
mem_clusters[1].start = IOM_END;
mem_clusters[1].size = trunc_page(KBTOB(biosextmem));
physmem += atop(mem_clusters[1].size);
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index 700e2b260a8..939ed18e735 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.79 2005/08/07 20:08:45 mickey Exp $
+# $OpenBSD: GENERIC,v 1.80 2005/09/19 01:28:04 deraadt Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -38,7 +38,7 @@ mainbus0 at root
cpu0 at mainbus?
isa0 at mainbus0
-#isa0 at pcib?
+isa0 at pcib?
pci* at mainbus0
#acpi0 at mainbus?
@@ -55,7 +55,7 @@ pchb* at pci? # PCI-Host bridges
ppb* at pci? # PCI-PCI bridges
pci* at ppb?
pci* at pchb?
-#pcib* at pci? # PCI-ISA bridge
+pcib* at pci? # PCI-ISA bridge
# power management and other environmental stuff
#amdpm* at pci? # AMD768MPX
@@ -153,7 +153,7 @@ ural* at uhub? # Ralink RT2500
puc* at pci? # PCI "universal" communication device
-#isadma0 at isa?
+isadma0 at isa?
option WSDISPLAY_COMPAT_USL # VT handling
option WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
@@ -241,9 +241,9 @@ safte* at scsibus? # SCSI accessed fault-tolerant encl
ses* at scsibus? # SCSI enclosure services
uk* at scsibus? # unknown SCSI
-#fdc0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy controllers
+fdc0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy controllers
#fdc1 at isa? port 0x370
-#fd* at fdc? flags 0x00
+fd* at fdc? flags 0x00
# IDE controllers
pciide* at pci? flags 0x0000
diff --git a/sys/arch/amd64/include/ioctl_fd.h b/sys/arch/amd64/include/ioctl_fd.h
new file mode 100644
index 00000000000..51f95755e5d
--- /dev/null
+++ b/sys/arch/amd64/include/ioctl_fd.h
@@ -0,0 +1,130 @@
+/* $OpenBSD: ioctl_fd.h,v 1.1 2005/09/19 01:28:04 deraadt Exp $ */
+
+/*
+ * Copyright (C) 1992-1994 by Joerg Wunsch, Dresden
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * From: Id: ioctl_fd.h,v 1.7 1994/10/30 19:17:39 joerg Exp
+ */
+
+#ifndef _AMD64_IOCTL_FD_H_
+#define _AMD64_IOCTL_FD_H_
+
+#include <sys/ioccom.h>
+
+#define FD_FORMAT_VERSION 110 /* used to validate before formatting */
+#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */
+ /* 2.88 MB drives */
+
+struct fd_formb {
+ int format_version; /* == FD_FORMAT_VERSION */
+ int cyl, head;
+ int transfer_rate; /* fdreg.h: FDC_???KBPS */
+
+ union {
+ struct fd_form_data {
+ /*
+ * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS
+ * it is hardware-dependant since it exactly
+ * matches the byte sequence to write to FDC
+ * during its `format track' operation
+ */
+ u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */
+ u_char nsecs; /* must be <= FD_MAX_NSEC */
+ u_char gaplen; /* GAP 3 length; usually 84 */
+ u_char fillbyte; /* usually 0xf6 */
+ struct fd_idfield_data {
+ /*
+ * data to write into id fields;
+ * for obscure formats, they mustn't match
+ * the real values (but mostly do)
+ */
+ u_char cylno; /* 0 thru 79 (or 39) */
+ u_char headno; /* 0, or 1 */
+ u_char secno; /* starting at 1! */
+ u_char secsize; /* usually 2 */
+ } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */
+ } structured;
+ u_char raw[1]; /* to have continuous indexed access */
+ } format_info;
+};
+
+/* make life easier */
+# define fd_formb_secshift format_info.structured.secshift
+# define fd_formb_nsecs format_info.structured.nsecs
+# define fd_formb_gaplen format_info.structured.gaplen
+# define fd_formb_fillbyte format_info.structured.fillbyte
+/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */
+# define fd_formb_cylno(i) format_info.structured.idfields[i].cylno
+# define fd_formb_headno(i) format_info.structured.idfields[i].headno
+# define fd_formb_secno(i) format_info.structured.idfields[i].secno
+# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize
+
+/*
+ * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how
+ * we tell them apart.
+ */
+struct fd_type {
+ int sectrac; /* sectors per track */
+ int heads; /* number of heads */
+ int seccyl; /* sectors per cylinder */
+ int secsize; /* size code for sectors */
+ int datalen; /* data len when secsize = 0 */
+ int steprate; /* step rate and head unload time */
+ int gap1; /* gap len between sectors */
+ int gap2; /* formatting gap */
+ int tracks; /* total num of tracks */
+ int size; /* size of disk in sectors */
+ int step; /* steps per cylinder */
+ int rate; /* transfer speed code */
+ char *name;
+};
+
+
+#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */
+#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */
+#define FD_STYPE _IOW('F', 63, struct fd_type) /* set drive type */
+
+#define FD_GOPTS _IOR('F', 64, int) /* drive options, see below */
+#define FD_SOPTS _IOW('F', 65, int)
+
+#define FDOPT_NORETRY 0x0001 /* no retries on failure (cleared on close) */
+
+/*
+ * The following definitions duplicate those in sys/i386/isa/fdreg.h
+ * They are here since their values are to be used in the above
+ * structure when formatting a floppy. For very obvious reasons, both
+ * definitions must match ;-)
+ */
+#ifndef FDC_500KBPS
+#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
+#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
+#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
+#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
+ /* for some controllers 1MPBS instead */
+#endif /* FDC_500KBPS */
+
+
+#endif /* !_AMD64_IOCTL_FD_H__ */
diff --git a/sys/arch/amd64/include/isa_machdep.h b/sys/arch/amd64/include/isa_machdep.h
index 306eed9ef8e..01b139bd707 100644
--- a/sys/arch/amd64/include/isa_machdep.h
+++ b/sys/arch/amd64/include/isa_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.h,v 1.1 2004/01/28 01:39:39 mickey Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.2 2005/09/19 01:28:04 deraadt Exp $ */
/* $NetBSD: isa_machdep.h,v 1.2 2003/05/09 23:51:28 fvdl Exp $ */
/*-
@@ -118,53 +118,6 @@ int isa_mem_alloc(bus_space_tag_t, bus_size_t, bus_size_t,
bus_addr_t, int, bus_addr_t *, bus_space_handle_t *);
void isa_mem_free(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-#define isa_dmainit(ic, bst, dmat, d) \
- _isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
-#define isa_dmacascade(ic, c) \
- _isa_dmacascade(&(ic)->ic_dmastate, (c))
-#define isa_dmamaxsize(ic, c) \
- _isa_dmamaxsize(&(ic)->ic_dmastate, (c))
-#define isa_dmamap_create(ic, c, s, f) \
- _isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
-#define isa_dmamap_destroy(ic, c) \
- _isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
-#define isa_dmastart(ic, c, a, n, p, f, bf) \
- _isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
-#define isa_dmaabort(ic, c) \
- _isa_dmaabort(&(ic)->ic_dmastate, (c))
-#define isa_dmacount(ic, c) \
- _isa_dmacount(&(ic)->ic_dmastate, (c))
-#define isa_dmafinished(ic, c) \
- _isa_dmafinished(&(ic)->ic_dmastate, (c))
-#define isa_dmadone(ic, c) \
- _isa_dmadone(&(ic)->ic_dmastate, (c))
-#define isa_dmafreeze(ic) \
- _isa_dmafreeze(&(ic)->ic_dmastate)
-#define isa_dmathaw(ic) \
- _isa_dmathaw(&(ic)->ic_dmastate)
-#define isa_dmamem_alloc(ic, c, s, ap, f) \
- _isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
-#define isa_dmamem_free(ic, c, a, s) \
- _isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
-#define isa_dmamem_map(ic, c, a, s, kp, f) \
- _isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
-#define isa_dmamem_unmap(ic, c, k, s) \
- _isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
-#define isa_dmamem_mmap(ic, c, a, s, o, p, f) \
- _isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
-#define isa_drq_alloc(ic, c) \
- _isa_drq_alloc(&(ic)->ic_dmastate, c)
-#define isa_drq_free(ic, c) \
- _isa_drq_free(&(ic)->ic_dmastate, c)
-#define isa_drq_isfree(ic, c) \
- _isa_drq_isfree(&(ic)->ic_dmastate, (c))
-#define isa_malloc(ic, c, s, p, f) \
- _isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
-#define isa_free(a, p) \
- _isa_free((a), (p))
-#define isa_mappage(m, o, p) \
- _isa_mappage((m), (o), (p))
-
int isa_intr_check(isa_chipset_tag_t, int, int);
/*
@@ -181,6 +134,31 @@ void isa_reinit_irq(void);
extern struct x86_bus_dma_tag isa_bus_dma_tag;
/*
+ * Cookie used by ISA dma. A pointer to one of these it stashed in
+ * the DMA map.
+ */
+struct x86_isa_dma_cookie {
+ int id_flags; /* flags; see below */
+
+ void *id_origbuf; /* pointer to orig buffer if
+ bouncing */
+ bus_size_t id_origbuflen; /* ...and size */
+
+ void *id_bouncebuf; /* pointer to the bounce buffer */
+ bus_size_t id_bouncebuflen; /* ...and size */
+ int id_nbouncesegs; /* number of valid bounce segs */
+ bus_dma_segment_t id_bouncesegs[0]; /* array of bounce buffer
+ physical memory segments */
+};
+
+/* id_flags */
+#define ID_MIGHT_NEED_BOUNCE 0x01 /* map could need bounce buffers */
+#define ID_HAS_BOUNCE 0x02 /* map currently has bounce buffers */
+#define ID_IS_BOUNCING 0x04 /* map is bouncing current xfer */
+
+
+
+/*
* XXX Various seemingly PC-specific constants, some of which may be
* unnecessary anyway.
*/
diff --git a/sys/arch/amd64/isa/isa_machdep.c b/sys/arch/amd64/isa/isa_machdep.c
index 4487ec16026..1bcbac3d90d 100644
--- a/sys/arch/amd64/isa/isa_machdep.c
+++ b/sys/arch/amd64/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.3 2004/06/28 01:52:26 deraadt Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.4 2005/09/19 01:28:04 deraadt Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
#define ISA_DMA_STATS
@@ -126,7 +126,7 @@
#include <uvm/uvm_extern.h>
-#define _I386_BUS_DMA_PRIVATE
+#define _X86_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <machine/intr.h>
@@ -194,7 +194,7 @@ void _isa_dma_free_bouncebuf(bus_dma_tag_t, bus_dmamap_t);
* the generic functions that understand how to deal with bounce
* buffers, if necessary.
*/
-struct i386_bus_dma_tag isa_bus_dma_tag = {
+struct x86_bus_dma_tag isa_bus_dma_tag = {
NULL, /* _cookie */
_isa_bus_dmamap_create,
_isa_bus_dmamap_destroy,
@@ -519,7 +519,7 @@ _isa_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
int flags;
bus_dmamap_t *dmamp;
{
- struct i386_isa_dma_cookie *cookie;
+ struct x86_isa_dma_cookie *cookie;
bus_dmamap_t map;
int error, cookieflags;
void *cookiestore;
@@ -534,7 +534,7 @@ _isa_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
map = *dmamp;
map->_dm_cookie = NULL;
- cookiesize = sizeof(struct i386_isa_dma_cookie);
+ cookiesize = sizeof(struct x86_isa_dma_cookie);
/*
* ISA only has 24-bits of address space. This means
@@ -575,7 +575,7 @@ _isa_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
goto out;
}
bzero(cookiestore, cookiesize);
- cookie = (struct i386_isa_dma_cookie *)cookiestore;
+ cookie = (struct x86_isa_dma_cookie *)cookiestore;
cookie->id_flags = cookieflags;
map->_dm_cookie = cookie;
@@ -607,7 +607,7 @@ _isa_bus_dmamap_destroy(t, map)
bus_dma_tag_t t;
bus_dmamap_t map;
{
- struct i386_isa_dma_cookie *cookie = map->_dm_cookie;
+ struct x86_isa_dma_cookie *cookie = map->_dm_cookie;
/*
* Free any bounce pages this map might hold.
@@ -631,7 +631,7 @@ _isa_bus_dmamap_load(t, map, buf, buflen, p, flags)
struct proc *p;
int flags;
{
- struct i386_isa_dma_cookie *cookie = map->_dm_cookie;
+ struct x86_isa_dma_cookie *cookie = map->_dm_cookie;
int error;
STAT_INCR(isa_dma_stats_loads);
@@ -744,7 +744,7 @@ _isa_bus_dmamap_unload(t, map)
bus_dma_tag_t t;
bus_dmamap_t map;
{
- struct i386_isa_dma_cookie *cookie = map->_dm_cookie;
+ struct x86_isa_dma_cookie *cookie = map->_dm_cookie;
/*
* If we have bounce pages, free them, unless they're
@@ -773,7 +773,7 @@ _isa_bus_dmamap_sync(t, map, offset, len, op)
bus_size_t len;
int op;
{
- struct i386_isa_dma_cookie *cookie = map->_dm_cookie;
+ struct x86_isa_dma_cookie *cookie = map->_dm_cookie;
#ifdef DEBUG
if ((op & (BUS_DMASYNC_PREWRITE|BUS_DMASYNC_POSTREAD)) != 0) {
@@ -982,7 +982,7 @@ _isa_dma_alloc_bouncebuf(t, map, size, flags)
bus_size_t size;
int flags;
{
- struct i386_isa_dma_cookie *cookie = map->_dm_cookie;
+ struct x86_isa_dma_cookie *cookie = map->_dm_cookie;
int error = 0;
cookie->id_bouncebuflen = round_page(size);
@@ -1014,7 +1014,7 @@ _isa_dma_free_bouncebuf(t, map)
bus_dma_tag_t t;
bus_dmamap_t map;
{
- struct i386_isa_dma_cookie *cookie = map->_dm_cookie;
+ struct x86_isa_dma_cookie *cookie = map->_dm_cookie;
STAT_DECR(isa_dma_stats_nbouncebufs);
diff --git a/sys/arch/amd64/pci/pcib.c b/sys/arch/amd64/pci/pcib.c
new file mode 100644
index 00000000000..85e3c35e5c1
--- /dev/null
+++ b/sys/arch/amd64/pci/pcib.c
@@ -0,0 +1,146 @@
+/* $OpenBSD: pcib.c,v 1.1 2005/09/19 01:28:04 deraadt Exp $ */
+/* $NetBSD: pcib.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+#include <dev/isa/isavar.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+
+#include <dev/pci/pcidevs.h>
+
+#include "isa.h"
+
+int pcibmatch(struct device *, void *, void *);
+void pcibattach(struct device *, struct device *, void *);
+void pcib_callback(struct device *);
+int pcib_print(void *, const char *);
+
+struct cfattach pcib_ca = {
+ sizeof(struct device), pcibmatch, pcibattach
+};
+
+struct cfdriver pcib_cd = {
+ NULL, "pcib", DV_DULL
+};
+
+int
+pcibmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct pci_attach_args *pa = aux;
+
+ switch (PCI_VENDOR(pa->pa_id)) {
+ case PCI_VENDOR_INTEL:
+ switch (PCI_PRODUCT(pa->pa_id)) {
+ case PCI_PRODUCT_INTEL_SIO:
+ case PCI_PRODUCT_INTEL_82371MX:
+ case PCI_PRODUCT_INTEL_82371AB_ISA:
+ case PCI_PRODUCT_INTEL_82440MX_ISA:
+ /* The above bridges mis-identify themselves */
+ return (1);
+ }
+ case PCI_VENDOR_SIS:
+ switch (PCI_PRODUCT(pa->pa_id)) {
+ case PCI_PRODUCT_SIS_85C503:
+ /* mis-identifies itself as a miscellaneous prehistoric */
+ return (1);
+ }
+ case PCI_VENDOR_VIATECH:
+ switch (PCI_PRODUCT(pa->pa_id)) {
+ case PCI_PRODUCT_VIATECH_VT82C686A_SMB:
+ /* mis-identifies itself as a ISA bridge */
+ return (0);
+ }
+ }
+
+ if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE &&
+ PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_ISA)
+ return (1);
+
+ return (0);
+}
+
+void
+pcibattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ /*
+ * Cannot attach isa bus now; must postpone for various reasons
+ */
+ printf("\n");
+
+ config_defer(self, pcib_callback);
+}
+
+void
+pcib_callback(self)
+ struct device *self;
+{
+ struct isabus_attach_args iba;
+
+ /*
+ * Attach the ISA bus behind this bridge.
+ */
+ memset(&iba, 0, sizeof(iba));
+ iba.iba_busname = "isa";
+ iba.iba_iot = X86_BUS_SPACE_IO;
+ iba.iba_memt = X86_BUS_SPACE_MEM;
+#if NISADMA > 0
+ iba.iba_dmat = &isa_bus_dma_tag;
+#endif
+ config_found(self, &iba, pcib_print);
+}
+
+int
+pcib_print(aux, pnp)
+ void *aux;
+ const char *pnp;
+{
+ /* Only ISAs can attach to pcib's; easy. */
+ if (pnp)
+ printf("isa at %s", pnp);
+ return (UNCONF);
+}
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c
index de6ca86611f..c5d812f9ce9 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.50 2005/03/16 19:58:40 miod Exp $ */
+/* $OpenBSD: fd.c,v 1.51 2005/09/19 01:28:04 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */
/*-
@@ -70,7 +70,7 @@
#include <dev/isa/isadmavar.h>
#include <dev/isa/fdreg.h>
-#if defined(i386)
+#if defined(__i386__) || defined(__amd64__) /* XXX */
#include <i386/isa/nvram.h>
#endif
diff --git a/sys/dev/isa/fdc.c b/sys/dev/isa/fdc.c
index 293312183a7..e7c159dee4f 100644
--- a/sys/dev/isa/fdc.c
+++ b/sys/dev/isa/fdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdc.c,v 1.16 2003/06/02 23:28:02 millert Exp $ */
+/* $OpenBSD: fdc.c,v 1.17 2005/09/19 01:28:04 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */
/*-
@@ -69,7 +69,7 @@
#include <dev/isa/isadmavar.h>
#include <dev/isa/fdreg.h>
-#if defined(i386)
+#if defined(__i386__) || defined(__amd64__) /* XXX */
#include <dev/ic/mc146818reg.h> /* for NVRAM access */
#include <i386/isa/nvram.h>
#endif
@@ -169,7 +169,7 @@ fdcattach(parent, self, aux)
fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
IPL_BIO, fdcintr, fdc, fdc->sc_dev.dv_xname);
-#if defined(i386)
+#if defined(__i386__) || defined(__amd64__)
/*
* The NVRAM info only tells us about the first two disks on the
* `primary' floppy controller.