summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/conf/GENERIC9
-rw-r--r--sys/arch/i386/conf/files.i38610
-rw-r--r--sys/arch/i386/i386/machdep.c25
-rw-r--r--sys/arch/i386/i386/rbus_machdep.c163
-rw-r--r--sys/arch/i386/include/bus.h5
-rw-r--r--sys/arch/i386/include/rbus_machdep.h53
6 files changed, 260 insertions, 5 deletions
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 8e2b6c63234..d1d635cbfa4 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.174 2000/04/07 22:25:43 aaron Exp $
+# $OpenBSD: GENERIC,v 1.175 2000/04/08 05:50:49 aaron Exp $
# $NetBSD: GENERIC,v 1.48 1996/05/20 18:17:23 mrg Exp $
#
# GENERIC -- everything that's currently supported
@@ -64,6 +64,12 @@ pcic2 at isa? port 0x3e4 iomem 0xe0000 iosiz 0x4000
# PCMCIA bus support
pcmcia* at pcic? controller ? socket ?
+# CardBus bus support
+#cardbus* at cardslot?
+#pcmcia* at cardslot?
+#cbb* at pci? dev ? function ?
+#cardslot* at cbb?
+
# PCI USB Controllers
#uhci* at pci? # Universal Host Controller (Intel)
#ohci* at pci? # Open Host Controller
@@ -260,6 +266,7 @@ sm* at pcmcia? function ? # PCMCIA based sm ethernet
xe* at pcmcia? function ? # Xircom ethernet
fpa* at pci? dev ? function ? # DEC DEFPA FDDI
xl* at pci? dev ? function ? # 3c9xx ethernet
+#xl* at cardbus? dev ? function ? # 3c575 ethernet
rl* at pci? dev ? function ? # RealTek 81[23]9 ethernet
tx* at pci? dev ? function ? # SMC 83C170 EPIC ethernet
tl* at pci? dev ? function ? # Compaq Thunderlan ethernet
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index 809930770b0..778c72658c1 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.63 2000/03/26 22:38:32 mickey Exp $
+# $OpenBSD: files.i386,v 1.64 2000/04/08 05:50:49 aaron Exp $
# $NetBSD: files.i386,v 1.73 1996/05/07 00:58:36 thorpej Exp $
#
# new style config file for i386 architecture
@@ -255,6 +255,12 @@ file arch/i386/i386/apmcall.S apm
file arch/i386/i386/bios32.c bios32
+#
+# CARDBUS
+#
+include "dev/cardbus/files.cardbus"
+file arch/i386/i386/rbus_machdep.c cardbus
+
# XXXX pcic here because it needs to be late. The catch: pcic needs
# to be late, so devices which attach to it are attached late. But it
# needs to be before its isa and pci attachments. This answer is
@@ -264,7 +270,7 @@ file arch/i386/i386/bios32.c bios32
# XXX this needs to be done very late, so it's done here. This feels
# like a kludge, but it might be for the best.
-device pcic {[controller = -1], [socket = -1]}
+device pcic: pcmciabus
file dev/ic/i82365.c pcic
# PCIC pcmcia controller on ISA bus.
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 7835c4c89d5..6dc18b614a0 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.128 2000/03/23 09:59:54 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.129 2000/04/08 05:50:50 aaron Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2387,6 +2387,29 @@ bus_space_map(t, bpa, size, cacheable, bshp)
}
int
+_bus_space_map(t, bpa, size, cacheable, bshp)
+ bus_space_tag_t t;
+ bus_addr_t bpa;
+ bus_size_t size;
+ int cacheable;
+ bus_space_handle_t *bshp;
+{
+ /*
+ * For I/O space, that's all she wrote.
+ */
+ if (t == I386_BUS_SPACE_IO) {
+ *bshp = bpa;
+ return (0);
+ }
+
+ /*
+ * For memory space, map the bus physical address to
+ * a kernel virtual address.
+ */
+ return (bus_mem_add_mapping(bpa, size, cacheable, bshp));
+}
+
+int
bus_space_alloc(t, rstart, rend, size, alignment, boundary, cacheable,
bpap, bshp)
bus_space_tag_t t;
diff --git a/sys/arch/i386/i386/rbus_machdep.c b/sys/arch/i386/i386/rbus_machdep.c
new file mode 100644
index 00000000000..d38072ea295
--- /dev/null
+++ b/sys/arch/i386/i386/rbus_machdep.c
@@ -0,0 +1,163 @@
+/* $OpenBSD: rbus_machdep.c,v 1.1 2000/04/08 05:50:50 aaron Exp $ */
+/* $NetBSD: rbus_machdep.c,v 1.2 1999/10/15 06:43:06 haya Exp $ */
+
+/*
+ * Copyright (c) 1999
+ * HAYAKAWA Koichi. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by HAYAKAWA Koichi.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
+ */
+
+/* $Id: rbus_machdep.c,v 1.1 2000/04/08 05:50:50 aaron Exp $ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_page.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <sys/sysctl.h>
+
+#include <machine/bus.h>
+#include <dev/cardbus/rbus.h>
+
+#include <sys/device.h>
+#include <dev/isa/isareg.h>
+#include <dev/isa/isavar.h>
+
+#include <dev/pci/pcivar.h>
+
+
+
+/**********************************************************************
+ * void _bus_space_unmap(bus_space_tag bst, bus_space_handle bsh,
+ * bus_size_t size, bus_addr_t *adrp)
+ *
+ * This function unmaps memory- or io-space mapped by the function
+ * _bus_space_map(). This function works nearly as same as
+ * bus_space_map(), but this function does not ask kernel
+ * built-in extents and returns physical address of the bus space,
+ * for the convenience of the extra extent manager.
+ *
+ * I suppose this function should be in arch/i386/i386/machdep.c,
+ * but it is not.
+ **********************************************************************/
+void
+_bus_space_unmap(t, bsh, size, adrp)
+ bus_space_tag_t t;
+ bus_space_handle_t bsh;
+ bus_size_t size;
+ bus_addr_t *adrp;
+{
+ u_long va, endva;
+ bus_addr_t bpa;
+
+ /*
+ * Find the correct extent and bus physical address.
+ */
+ if (t == I386_BUS_SPACE_IO) {
+ bpa = bsh;
+ } else if (t == I386_BUS_SPACE_MEM) {
+ if (bsh >= atdevbase && (bsh + size) <= (atdevbase + IOM_SIZE)) {
+ bpa = (bus_addr_t)ISA_PHYSADDR(bsh);
+ } else {
+
+ va = i386_trunc_page(bsh);
+ endva = i386_round_page(bsh + size);
+
+#ifdef DIAGNOSTIC
+ if (endva <= va) {
+ panic("_i386_memio_unmap: overflow");
+ }
+#endif
+
+#if __NetBSD_Version__ > 104050000
+ if (pmap_extract(pmap_kernel(), va, &bpa) == FALSE) {
+ panic("_i386_memio_unmap:i386/rbus_machdep.c wrong virtual address");
+ }
+ bpa += (bsh & PGOFSET);
+#else
+ bpa = pmap_extract(pmap_kernel(), va) + (bsh & PGOFSET);
+#endif
+
+ /*
+ * Free the kernel virtual mapping.
+ */
+ uvm_km_free(kernel_map, va, endva - va);
+ }
+ } else {
+ panic("_i386_memio_unmap: bad bus space tag");
+ }
+
+ if (adrp != NULL) {
+ *adrp = bpa;
+ }
+}
+
+
+
+
+/**********************************************************************
+ * rbus_tag_t rbus_fakeparent_mem(struct pci_attach_args *pa)
+ *
+ * This function allocates a memory space from 1 GB to 1.25 GB.
+ **********************************************************************/
+rbus_tag_t
+rbus_pccbb_parent_mem(pa)
+ struct pci_attach_args *pa;
+{
+ bus_addr_t start = 0x40000000; /* 1 GB */
+ bus_size_t size = 0x08000000; /* 128 MB */
+ bus_space_handle_t memh; /* fake */
+
+ start += pa->pa_function * size;
+
+ bus_space_map(pa->pa_memt, start, size, 0, &memh);
+
+ return rbus_new_root_delegate(pa->pa_memt, start, size, 0);
+}
+
+
+/**********************************************************************
+ * rbus_tag_t rbus_pccbb_parent_io(struct pci_attach_args *pa)
+ **********************************************************************/
+rbus_tag_t
+rbus_pccbb_parent_io(pa)
+ struct pci_attach_args *pa;
+{
+ bus_addr_t start = 0x2000;
+ bus_size_t size = 0x0800;
+ bus_space_handle_t ioh;
+
+ start += pa->pa_function * size;
+
+ bus_space_map(pa->pa_iot, start, size, 0, &ioh);
+
+ return rbus_new_root_delegate(pa->pa_iot, start, size, 0);
+}
diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h
index 0ee26b6ad18..99df8f1dd0a 100644
--- a/sys/arch/i386/include/bus.h
+++ b/sys/arch/i386/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.19 2000/03/15 03:56:49 todd Exp $ */
+/* $OpenBSD: bus.h,v 1.20 2000/04/08 05:50:50 aaron Exp $ */
/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */
/*-
@@ -95,6 +95,9 @@ typedef u_long bus_space_handle_t;
int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr,
bus_size_t size, int cacheable, bus_space_handle_t *bshp));
+/* like bus_space_map(), but without extent map checking/allocation */
+int _bus_space_map __P((bus_space_tag_t t, bus_addr_t addr,
+ bus_size_t size, int cacheable, bus_space_handle_t *bshp));
void bus_space_unmap __P((bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t size));
int bus_space_subregion __P((bus_space_tag_t t, bus_space_handle_t bsh,
diff --git a/sys/arch/i386/include/rbus_machdep.h b/sys/arch/i386/include/rbus_machdep.h
new file mode 100644
index 00000000000..7bb855d1589
--- /dev/null
+++ b/sys/arch/i386/include/rbus_machdep.h
@@ -0,0 +1,53 @@
+/* $OpenBSD: rbus_machdep.h,v 1.1 2000/04/08 05:50:50 aaron Exp $ */
+/* $NetBSD: rbus_machdep.h,v 1.2 1999/10/15 06:43:05 haya Exp $ */
+
+/*
+ * Copyright (c) 1999
+ * HAYAKAWA Koichi. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by HAYAKAWA Koichi.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
+ */
+
+
+#if !defined _ARCH_I386_I386_RBUS_MACHDEP_H_
+#define _ARCH_I386_I386_RBUS_MACHDEP_H_
+
+struct pci_attach_args; /* XXX */
+
+void _bus_space_unmap __P((bus_space_tag_t, bus_space_handle_t,
+ bus_size_t, bus_addr_t *));
+
+#define md_space_map(bt, physaddr, size, flags, bshp) \
+ _bus_space_map((bt), (physaddr), (size), (flags), (bshp))
+
+#define md_space_unmap(bt, bsh, size, adrp) \
+ _bus_space_unmap((bt), (bsh), (size), (adrp))
+
+
+rbus_tag_t rbus_pccbb_parent_io __P((struct pci_attach_args *pa));
+rbus_tag_t rbus_pccbb_parent_mem __P((struct pci_attach_args *pa));
+
+#endif /* _ARCH_I386_I386_RBUS_MACHDEP_H_ */