diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-11-12 20:31:03 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-11-12 20:31:03 +0000 |
commit | a28e6fb87d02d75afe3900d71afc22960b5174d6 (patch) | |
tree | 4d9f54a0f06fbad7e91e3a483ee689abd1ffd6a2 /sys/arch | |
parent | 030da3d388a3705c405337441dab3316fe86ab88 (diff) |
s/bus.h/bus.old.h/ to make the transit to the bus_space bus.h an easy road
possibly taken in small steps
Diffstat (limited to 'sys/arch')
28 files changed, 739 insertions, 47 deletions
diff --git a/sys/arch/alpha/include/bus.old.h b/sys/arch/alpha/include/bus.old.h new file mode 100644 index 00000000000..a133e382e92 --- /dev/null +++ b/sys/arch/alpha/include/bus.old.h @@ -0,0 +1,219 @@ +/* $OpenBSD: bus.old.h,v 1.1 1996/11/12 20:29:27 niklas Exp $ */ +/* $NetBSD: bus.h,v 1.4 1996/06/11 21:16:21 cgd Exp $ */ + +/* + * Copyright (c) 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#ifndef _ALPHA_BUS_H_ +#define _ALPHA_BUS_H_ + +/* + * I/O addresses (in bus space) + */ +typedef u_long bus_io_addr_t; +typedef u_long bus_io_size_t; + +/* + * Memory addresses (in bus space) + */ +typedef u_long bus_mem_addr_t; +typedef u_long bus_mem_size_t; + +/* + * Access methods for bus resources, I/O space, and memory space. + */ +typedef struct alpha_bus_chipset *bus_chipset_tag_t; +typedef u_long bus_io_handle_t; +typedef u_long bus_mem_handle_t; + +struct alpha_bus_chipset { + /* I/O-space cookie */ + void *bc_i_v; + + /* I/O-space control functions */ + int (*bc_i_map) __P((void *v, bus_io_addr_t port, + bus_io_size_t size, bus_io_handle_t *iohp)); + void (*bc_i_unmap) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t size)); + int (*bc_i_subregion) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t offset, bus_io_size_t size, + bus_io_handle_t *nioh)); + + /* I/O-space read functions */ + u_int8_t (*bc_ir1) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off)); + u_int16_t (*bc_ir2) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off)); + u_int32_t (*bc_ir4) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off)); + u_int64_t (*bc_ir8) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off)); + + /* I/O-space read-multiple functions */ + void (*bc_irm1) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int8_t *addr, + bus_io_size_t count)); + void (*bc_irm2) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int16_t *addr, + bus_io_size_t count)); + void (*bc_irm4) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int32_t *addr, + bus_io_size_t count)); + void (*bc_irm8) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int64_t *addr, + bus_io_size_t count)); + + /* I/O-space write functions */ + void (*bc_iw1) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int8_t val)); + void (*bc_iw2) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int16_t val)); + void (*bc_iw4) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int32_t val)); + void (*bc_iw8) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, u_int64_t val)); + + /* I/O-space write-multiple functions */ + void (*bc_iwm1) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, const u_int8_t *addr, + bus_io_size_t count)); + void (*bc_iwm2) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, const u_int16_t *addr, + bus_io_size_t count)); + void (*bc_iwm4) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, const u_int32_t *addr, + bus_io_size_t count)); + void (*bc_iwm8) __P((void *v, bus_io_handle_t ioh, + bus_io_size_t off, const u_int64_t *addr, + bus_io_size_t count)); + + /* Mem-space cookie */ + void *bc_m_v; + + /* Mem-space control functions */ + int (*bc_m_map) __P((void *v, bus_mem_addr_t buspa, + bus_mem_size_t size, int cacheable, + bus_mem_handle_t *mhp)); + void (*bc_m_unmap) __P((void *v, bus_mem_handle_t mh, + bus_mem_size_t size)); + int (*bc_m_subregion) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t offset, bus_mem_size_t size, + bus_mem_handle_t *nmemh)); + + /* Mem-space read functions */ + u_int8_t (*bc_mr1) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off)); + u_int16_t (*bc_mr2) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off)); + u_int32_t (*bc_mr4) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off)); + u_int64_t (*bc_mr8) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off)); + + /* Mem-space write functions */ + void (*bc_mw1) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off, u_int8_t val)); + void (*bc_mw2) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off, u_int16_t val)); + void (*bc_mw4) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off, u_int32_t val)); + void (*bc_mw8) __P((void *v, bus_mem_handle_t memh, + bus_mem_size_t off, u_int64_t val)); + + /* XXX THIS DOES NOT YET BELONG HERE */ + vm_offset_t (*bc_XXX_dmamap) __P((void *addr)); +}; + +#define __bc_CONCAT(A,B) __CONCAT(A,B) +#define __bc_ABC(A,B,C) __bc_CONCAT(A,__bc_CONCAT(B,C)) +#define __bc_ABCD(A,B,C,D) __bc_CONCAT(__bc_ABC(A,B,C),D) + +#define __bc_rd(t, h, o, sz, sp) \ + (*(t)->__bc_ABCD(bc_,sp,r,sz))((t)->__bc_ABC(bc_,sp,_v), h, o) + +#define __bc_wr(t, h, o, v, sz, sp) \ + (*(t)->__bc_ABCD(bc_,sp,w,sz))((t)->__bc_ABC(bc_,sp,_v), h, o, v) + +#define bus_io_map(t, port, size, iohp) \ + (*(t)->bc_i_map)((t)->bc_i_v, (port), (size), (iohp)) +#define bus_io_unmap(t, ioh, size) \ + (*(t)->bc_i_unmap)((t)->bc_i_v, (ioh), (size)) +#define bus_io_subregion(t, ioh, offset, size, nioh) \ + (*(t)->bc_i_unmap)((t)->bc_i_v, (ioh), (offset), (size), (nioh)) + +#define __bc_io_multi(t, h, o, a, s, dir, sz) \ + (*(t)->__bc_ABCD(bc_i,dir,m,sz))((t)->bc_i_v, h, o, a, s) + +#define bus_io_read_1(t, h, o) __bc_rd((t),(h),(o),1,i) +#define bus_io_read_2(t, h, o) __bc_rd((t),(h),(o),2,i) +#define bus_io_read_4(t, h, o) __bc_rd((t),(h),(o),4,i) +#define bus_io_read_8(t, h, o) __bc_rd((t),(h),(o),8,i) + +#define bus_io_read_multi_1(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),r,1) +#define bus_io_read_multi_2(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),r,2) +#define bus_io_read_multi_4(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),r,4) +#define bus_io_read_multi_8(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),r,8) + +#define bus_io_write_1(t, h, o, v) __bc_wr((t),(h),(o),(v),1,i) +#define bus_io_write_2(t, h, o, v) __bc_wr((t),(h),(o),(v),2,i) +#define bus_io_write_4(t, h, o, v) __bc_wr((t),(h),(o),(v),4,i) +#define bus_io_write_8(t, h, o, v) __bc_wr((t),(h),(o),(v),8,i) + +#define bus_io_write_multi_1(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),w,1) +#define bus_io_write_multi_2(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),w,2) +#define bus_io_write_multi_4(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),w,4) +#define bus_io_write_multi_8(t, h, o, a, s) \ + __bc_io_multi((t),(h),(o),(a),(s),w,8) + +#define bus_mem_map(t, bpa, size, cacheable, mhp) \ + (*(t)->bc_m_map)((t)->bc_m_v, (bpa), (size), (cacheable), (mhp)) +#define bus_mem_unmap(t, memh, size) \ + (*(t)->bc_m_unmap)((t)->bc_m_v, (memh), (size)) +#define bus_mem_subregion(t, memh, offset, size, nmemh) \ + (*(t)->bc_m_unmap)((t)->bc_i_v, (memh), (offset), (size), (nmemh)) + +#define bus_mem_read_1(t, h, o) __bc_rd((t),(h),(o),1,m) +#define bus_mem_read_2(t, h, o) __bc_rd((t),(h),(o),2,m) +#define bus_mem_read_4(t, h, o) __bc_rd((t),(h),(o),4,m) +#define bus_mem_read_8(t, h, o) __bc_rd((t),(h),(o),8,m) + +#define bus_mem_write_1(t, h, o, v) __bc_wr((t),(h),(o),(v),1,m) +#define bus_mem_write_2(t, h, o, v) __bc_wr((t),(h),(o),(v),2,m) +#define bus_mem_write_4(t, h, o, v) __bc_wr((t),(h),(o),(v),4,m) +#define bus_mem_write_8(t, h, o, v) __bc_wr((t),(h),(o),(v),8,m) + +/* XXX THIS DOES NOT BELONG HERE YET. */ +#define __alpha_bus_XXX_dmamap(t, va) (*(t)->bc_XXX_dmamap)((va)) + +#endif /* _ALPHA_BUS_H_ */ diff --git a/sys/arch/alpha/isa/mcclock_isa.c b/sys/arch/alpha/isa/mcclock_isa.c index 11667b25338..69ec713f3e4 100644 --- a/sys/arch/alpha/isa/mcclock_isa.c +++ b/sys/arch/alpha/isa/mcclock_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mcclock_isa.c,v 1.3 1996/10/30 22:39:39 niklas Exp $ */ +/* $OpenBSD: mcclock_isa.c,v 1.4 1996/11/12 20:29:31 niklas Exp $ */ /* $NetBSD: mcclock_isa.c,v 1.2 1996/04/17 22:22:46 cgd Exp $ */ /* @@ -33,7 +33,7 @@ #include <sys/systm.h> #include <sys/device.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <alpha/alpha/clockvar.h> #include <alpha/alpha/mcclockvar.h> diff --git a/sys/arch/alpha/isa/pckbd.c b/sys/arch/alpha/isa/pckbd.c index f43a4961137..481c707ec84 100644 --- a/sys/arch/alpha/isa/pckbd.c +++ b/sys/arch/alpha/isa/pckbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbd.c,v 1.6 1996/10/30 22:39:40 niklas Exp $ */ +/* $OpenBSD: pckbd.c,v 1.7 1996/11/12 20:29:32 niklas Exp $ */ /* $NetBSD: pckbd.c,v 1.9 1996/10/13 02:59:56 christos Exp $ */ /*- @@ -54,7 +54,7 @@ #include <sys/device.h> #include <machine/intr.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <dev/isa/isareg.h> #include <dev/isa/isavar.h> diff --git a/sys/arch/alpha/pci/apecs_lca_bus_io.c b/sys/arch/alpha/pci/apecs_lca_bus_io.c index 8b2fa459a34..cb38a68f56c 100644 --- a/sys/arch/alpha/pci/apecs_lca_bus_io.c +++ b/sys/arch/alpha/pci/apecs_lca_bus_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apecs_lca_bus_io.c,v 1.3 1996/10/30 22:39:48 niklas Exp $ */ +/* $OpenBSD: apecs_lca_bus_io.c,v 1.4 1996/11/12 20:29:33 niklas Exp $ */ /* $NetBSD: apecs_lca_bus_io.c,v 1.4 1996/08/27 16:29:23 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #include <sys/device.h> #include <vm/vm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <alpha/pci/apecsreg.h> #include <alpha/pci/lcareg.h> diff --git a/sys/arch/alpha/pci/apecs_lca_bus_mem.c b/sys/arch/alpha/pci/apecs_lca_bus_mem.c index e06744504ac..e0d00e83b6e 100644 --- a/sys/arch/alpha/pci/apecs_lca_bus_mem.c +++ b/sys/arch/alpha/pci/apecs_lca_bus_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apecs_lca_bus_mem.c,v 1.3 1996/10/30 22:39:48 niklas Exp $ */ +/* $OpenBSD: apecs_lca_bus_mem.c,v 1.4 1996/11/12 20:29:34 niklas Exp $ */ /* $NetBSD: apecs_lca_bus_mem.c,v 1.5 1996/08/27 16:29:24 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #include <sys/device.h> #include <vm/vm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <alpha/pci/apecsreg.h> #include <alpha/pci/lcareg.h> diff --git a/sys/arch/alpha/pci/cia_bus_io.c b/sys/arch/alpha/pci/cia_bus_io.c index 75f7d27fc1e..6623986cfa0 100644 --- a/sys/arch/alpha/pci/cia_bus_io.c +++ b/sys/arch/alpha/pci/cia_bus_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cia_bus_io.c,v 1.3 1996/10/30 22:39:54 niklas Exp $ */ +/* $OpenBSD: cia_bus_io.c,v 1.4 1996/11/12 20:29:35 niklas Exp $ */ /* $NetBSD: cia_bus_io.c,v 1.5 1996/08/27 16:29:25 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #include <sys/device.h> #include <vm/vm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <alpha/pci/ciareg.h> #include <alpha/pci/ciavar.h> diff --git a/sys/arch/alpha/pci/cia_bus_mem.c b/sys/arch/alpha/pci/cia_bus_mem.c index 47d83a467fc..2293e001d09 100644 --- a/sys/arch/alpha/pci/cia_bus_mem.c +++ b/sys/arch/alpha/pci/cia_bus_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cia_bus_mem.c,v 1.3 1996/10/30 22:39:55 niklas Exp $ */ +/* $OpenBSD: cia_bus_mem.c,v 1.4 1996/11/12 20:29:36 niklas Exp $ */ /* $NetBSD: cia_bus_mem.c,v 1.5 1996/08/27 16:29:26 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #include <sys/device.h> #include <vm/vm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <alpha/pci/ciareg.h> #include <alpha/pci/ciavar.h> diff --git a/sys/arch/alpha/pci/pci_2100_a50.c b/sys/arch/alpha/pci/pci_2100_a50.c index 1fa315bd8ae..01cacb4fb4b 100644 --- a/sys/arch/alpha/pci/pci_2100_a50.c +++ b/sys/arch/alpha/pci/pci_2100_a50.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_2100_a50.c,v 1.7 1996/10/30 22:40:03 niklas Exp $ */ +/* $OpenBSD: pci_2100_a50.c,v 1.8 1996/11/12 20:29:37 niklas Exp $ */ /* $NetBSD: pci_2100_a50.c,v 1.10 1996/10/13 03:00:09 christos Exp $ */ /* @@ -37,7 +37,7 @@ #include <vm/vm.h> #include <machine/autoconf.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/isa/isavar.h> diff --git a/sys/arch/alpha/pci/pci_axppci_33.c b/sys/arch/alpha/pci/pci_axppci_33.c index 2cf58634136..2808568bb69 100644 --- a/sys/arch/alpha/pci/pci_axppci_33.c +++ b/sys/arch/alpha/pci/pci_axppci_33.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_axppci_33.c,v 1.6 1996/10/30 22:40:05 niklas Exp $ */ +/* $OpenBSD: pci_axppci_33.c,v 1.7 1996/11/12 20:29:38 niklas Exp $ */ /* $NetBSD: pci_axppci_33.c,v 1.8 1996/10/13 03:00:11 christos Exp $ */ /* @@ -37,7 +37,7 @@ #include <vm/vm.h> #include <machine/autoconf.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/isa/isavar.h> diff --git a/sys/arch/alpha/pci/sio.c b/sys/arch/alpha/pci/sio.c index 0923402ac7f..4dfca1d5e64 100644 --- a/sys/arch/alpha/pci/sio.c +++ b/sys/arch/alpha/pci/sio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio.c,v 1.5 1996/10/30 22:40:14 niklas Exp $ */ +/* $OpenBSD: sio.c,v 1.6 1996/11/12 20:29:39 niklas Exp $ */ /* $NetBSD: sio.c,v 1.11 1996/10/13 03:00:18 christos Exp $ */ /* @@ -34,7 +34,7 @@ #include <sys/device.h> #include <machine/intr.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <dev/isa/isavar.h> #include <dev/eisa/eisavar.h> diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c index 0a6952ea2a3..2eb744515ab 100644 --- a/sys/arch/alpha/pci/sio_pic.c +++ b/sys/arch/alpha/pci/sio_pic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio_pic.c,v 1.6 1996/10/30 22:40:15 niklas Exp $ */ +/* $OpenBSD: sio_pic.c,v 1.7 1996/11/12 20:29:39 niklas Exp $ */ /* $NetBSD: sio_pic.c,v 1.13 1996/10/13 03:00:20 christos Exp $ */ /* @@ -35,7 +35,7 @@ #include <sys/syslog.h> #include <machine/intr.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <dev/isa/isareg.h> #include <dev/isa/isavar.h> diff --git a/sys/arch/alpha/pci/tga.c b/sys/arch/alpha/pci/tga.c index 7f5b1a12560..ac4f6d976dd 100644 --- a/sys/arch/alpha/pci/tga.c +++ b/sys/arch/alpha/pci/tga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tga.c,v 1.5 1996/10/30 22:40:19 niklas Exp $ */ +/* $OpenBSD: tga.c,v 1.6 1996/11/12 20:29:41 niklas Exp $ */ /* $NetBSD: tga.c,v 1.10 1996/10/13 03:00:22 christos Exp $ */ /* @@ -37,7 +37,7 @@ #include <sys/conf.h> #include <sys/ioctl.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/pci/pcireg.h> diff --git a/sys/arch/alpha/tc/cfb.c b/sys/arch/alpha/tc/cfb.c index 0f78f75e769..b415f314504 100644 --- a/sys/arch/alpha/tc/cfb.c +++ b/sys/arch/alpha/tc/cfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfb.c,v 1.3 1996/10/30 22:41:01 niklas Exp $ */ +/* $OpenBSD: cfb.c,v 1.4 1996/11/12 20:29:42 niklas Exp $ */ /* $NetBSD: cfb.c,v 1.5 1996/10/13 03:00:27 christos Exp $ */ /* @@ -37,7 +37,7 @@ #include <sys/conf.h> #include <sys/ioctl.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/tc/tcvar.h> diff --git a/sys/arch/alpha/tc/sfb.c b/sys/arch/alpha/tc/sfb.c index 1d6abccf59b..16c14521d80 100644 --- a/sys/arch/alpha/tc/sfb.c +++ b/sys/arch/alpha/tc/sfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sfb.c,v 1.3 1996/10/30 22:41:14 niklas Exp $ */ +/* $OpenBSD: sfb.c,v 1.4 1996/11/12 20:29:43 niklas Exp $ */ /* $NetBSD: sfb.c,v 1.5 1996/10/13 03:00:35 christos Exp $ */ /* @@ -37,7 +37,7 @@ #include <sys/conf.h> #include <sys/ioctl.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/tc/tcvar.h> diff --git a/sys/arch/alpha/tc/tc_bus_io.c b/sys/arch/alpha/tc/tc_bus_io.c index 731d237b820..ad0ff6f5dc6 100644 --- a/sys/arch/alpha/tc/tc_bus_io.c +++ b/sys/arch/alpha/tc/tc_bus_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tc_bus_io.c,v 1.3 1996/10/30 22:41:20 niklas Exp $ */ +/* $OpenBSD: tc_bus_io.c,v 1.4 1996/11/12 20:29:44 niklas Exp $ */ /* $NetBSD: tc_bus_io.c,v 1.3 1996/07/09 00:55:31 cgd Exp $ */ /* @@ -40,7 +40,7 @@ #include <sys/device.h> #include <vm/vm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <dev/tc/tcvar.h> int tc_io_map __P((void *, bus_io_addr_t, bus_io_size_t, diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c index 558dd764c0f..90087369d6c 100644 --- a/sys/arch/alpha/tc/tc_bus_mem.c +++ b/sys/arch/alpha/tc/tc_bus_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tc_bus_mem.c,v 1.3 1996/10/30 22:41:21 niklas Exp $ */ +/* $OpenBSD: tc_bus_mem.c,v 1.4 1996/11/12 20:29:45 niklas Exp $ */ /* $NetBSD: tc_bus_mem.c,v 1.7 1996/07/09 00:55:33 cgd Exp $ */ /* @@ -39,7 +39,7 @@ #include <sys/device.h> #include <vm/vm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <dev/tc/tcvar.h> int tc_mem_map __P((void *, bus_mem_addr_t, bus_mem_size_t, diff --git a/sys/arch/amiga/include/bus.old.h b/sys/arch/amiga/include/bus.old.h new file mode 100644 index 00000000000..6e4dc4a5560 --- /dev/null +++ b/sys/arch/amiga/include/bus.old.h @@ -0,0 +1,198 @@ +/* $OpenBSD: bus.old.h,v 1.1 1996/11/12 20:29:46 niklas Exp $ */ + +/* + * Copyright (c) 1996 Niklas Hallqvist. + * 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 the Niklas Hallqvist. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. + */ + +#ifndef _MACHINE_BUS_H_ +#define _MACHINE_BUS_H_ + +/* I/O access types. */ +typedef u_long bus_io_addr_t; +typedef u_long bus_io_size_t; +typedef u_long bus_io_handle_t; + +/* Memory access types. */ +typedef u_long bus_mem_addr_t; +typedef u_long bus_mem_size_t; +typedef u_long bus_mem_handle_t; + +/* + * The big switch, that delegates each bus operation to the right + * implementation. + */ +typedef struct amiga_bus_chipset *bus_chipset_tag_t; + +struct amiga_bus_chipset { + void *bc_data; + + int (*bc_io_map)(bus_chipset_tag_t, bus_io_addr_t, bus_io_size_t, + bus_io_handle_t *); + int (*bc_io_unmap)(bus_io_handle_t, bus_io_size_t); + + u_int8_t (*bc_io_read_1)(bus_io_handle_t, bus_io_size_t); + u_int16_t (*bc_io_read_2)(bus_io_handle_t, bus_io_size_t); + u_int32_t (*bc_io_read_4)(bus_io_handle_t, bus_io_size_t); + u_int64_t (*bc_io_read_8)(bus_io_handle_t, bus_io_size_t); + + void (*bc_io_read_multi_1)(bus_io_handle_t, bus_io_size_t, + u_int8_t *, bus_io_size_t); + void (*bc_io_read_multi_2)(bus_io_handle_t, bus_io_size_t, + u_int16_t *, bus_io_size_t); + void (*bc_io_read_multi_4)(bus_io_handle_t, bus_io_size_t, + u_int32_t *, bus_io_size_t); + void (*bc_io_read_multi_8)(bus_io_handle_t, bus_io_size_t, + u_int64_t *, bus_io_size_t); + + void (*bc_io_write_1)(bus_io_handle_t, bus_io_size_t, u_int8_t); + void (*bc_io_write_2)(bus_io_handle_t, bus_io_size_t, u_int16_t); + void (*bc_io_write_4)(bus_io_handle_t, bus_io_size_t, u_int32_t); + void (*bc_io_write_8)(bus_io_handle_t, bus_io_size_t, u_int64_t); + + void (*bc_io_write_multi_1)(bus_io_handle_t, bus_io_size_t, + const u_int8_t *, bus_io_size_t); + void (*bc_io_write_multi_2)(bus_io_handle_t, bus_io_size_t, + const u_int16_t *, bus_io_size_t); + void (*bc_io_write_multi_4)(bus_io_handle_t, bus_io_size_t, + const u_int32_t *, bus_io_size_t); + void (*bc_io_write_multi_8)(bus_io_handle_t, bus_io_size_t, + const u_int64_t *, bus_io_size_t); + + int (*bc_mem_map)(bus_chipset_tag_t, bus_mem_addr_t, + bus_mem_size_t, int, bus_mem_handle_t *); + int (*bc_mem_unmap)(bus_mem_handle_t, bus_mem_size_t); + + u_int8_t (*bc_mem_read_1)(bus_mem_handle_t, bus_mem_size_t); + u_int16_t (*bc_mem_read_2)(bus_mem_handle_t, bus_mem_size_t); + u_int32_t (*bc_mem_read_4)(bus_mem_handle_t, bus_mem_size_t); + u_int64_t (*bc_mem_read_8)(bus_mem_handle_t, bus_mem_size_t); + + void (*bc_mem_write_1)(bus_mem_handle_t, bus_mem_size_t, u_int8_t); + void (*bc_mem_write_2)(bus_mem_handle_t, bus_mem_size_t, u_int16_t); + void (*bc_mem_write_4)(bus_mem_handle_t, bus_mem_size_t, u_int32_t); + void (*bc_mem_write_8)(bus_mem_handle_t, bus_mem_size_t, u_int64_t); + + /* These are extensions to the general NetBSD bus interface. */ + void (*bc_io_read_raw_multi_2)(bus_io_handle_t, bus_io_size_t, + u_int8_t *, bus_io_size_t); + void (*bc_io_read_raw_multi_4)(bus_io_handle_t, bus_io_size_t, + u_int8_t *, bus_io_size_t); + void (*bc_io_read_raw_multi_8)(bus_io_handle_t, bus_io_size_t, + u_int8_t *, bus_io_size_t); + + void (*bc_io_write_raw_multi_2)(bus_io_handle_t, bus_io_size_t, + const u_int8_t *, bus_io_size_t); + void (*bc_io_write_raw_multi_4)(bus_io_handle_t, bus_io_size_t, + const u_int8_t *, bus_io_size_t); + void (*bc_io_write_raw_multi_8)(bus_io_handle_t, bus_io_size_t, + const u_int8_t *, bus_io_size_t); +}; + +#define bus_io_map(t, port, size, iohp) \ + (*(t)->bc_io_map)((t), (port), (size), (iohp)) +#define bus_io_unmap(t, iohp, size) \ + (*(t)->bc_io_unmap)((iohp), (size)) + +#define bus_io_read_1(t, h, o) \ + (*(t)->bc_io_read_1)((h), (o)) +#define bus_io_read_2(t, h, o) \ + (*(t)->bc_io_read_2)((h), (o)) +#define bus_io_read_4(t, h, o) \ + (*(t)->bc_io_read_4)((h), (o)) +#define bus_io_read_8(t, h, o) \ + (*(t)->bc_io_read_8)((h), (o)) + +#define bus_io_read_multi_1(t, h, o, a, s) \ + (*(t)->bc_io_read_multi_1)((h), (o), (a), (s)) +#define bus_io_read_multi_2(t, h, o, a, s) \ + (*(t)->bc_io_read_multi_2)((h), (o), (a), (s)) +#define bus_io_read_multi_4(t, h, o, a, s) \ + (*(t)->bc_io_read_multi_4)((h), (o), (a), (s)) +#define bus_io_read_multi_8(t, h, o, a, s) \ + (*(t)->bc_io_read_multi_8)((h), (o), (a), (s)) + +#define bus_io_write_1(t, h, o, v) \ + (*(t)->bc_io_write_1)((h), (o), (v)) +#define bus_io_write_2(t, h, o, v) \ + (*(t)->bc_io_write_2)((h), (o), (v)) +#define bus_io_write_4(t, h, o, v) \ + (*(t)->bc_io_write_4)((h), (o), (v)) +#define bus_io_write_8(t, h, o, v) \ + (*(t)->bc_io_write_8)((h), (o), (v)) + +#define bus_io_write_multi_1(t, h, o, a, s) \ + (*(t)->bc_io_write_multi_1)((h), (o), (a), (s)) +#define bus_io_write_multi_2(t, h, o, a, s) \ + (*(t)->bc_io_write_multi_2)((h), (o), (a), (s)) +#define bus_io_write_multi_4(t, h, o, a, s) \ + (*(t)->bc_io_write_multi_4)((h), (o), (a), (s)) +#define bus_io_write_multi_8(t, h, o, a, s) \ + (*(t)->bc_io_write_multi_8)((h), (o), (a), (s)) + +#define bus_mem_map(t, port, size, cacheable, mhp) \ + (*(t)->bc_mem_map)((t), (port), (size), (cacheable), (mhp)) +#define bus_mem_unmap(t, mhp, size) \ + (*(t)->bc_mem_unmap)((mhp), (size)) + +#define bus_mem_read_1(t, h, o) \ + (*(t)->bc_mem_read_1)((h), (o)) +#define bus_mem_read_2(t, h, o) \ + (*(t)->bc_mem_read_2)((h), (o)) +#define bus_mem_read_4(t, h, o) \ + (*(t)->bc_mem_read_4)((h), (o)) +#define bus_mem_read_8(t, h, o) \ + (*(t)->bc_mem_read_8)((h), (o)) + +#define bus_mem_write_1(t, h, o, v) \ + (*(t)->bc_mem_write_1)((h), (o), (v)) +#define bus_mem_write_2(t, h, o, v) \ + (*(t)->bc_mem_write_2)((h), (o), (v)) +#define bus_mem_write_4(t, h, o, v) \ + (*(t)->bc_mem_write_4)((h), (o), (v)) +#define bus_mem_write_8(t, h, o, v) \ + (*(t)->bc_mem_write_8)((h), (o), (v)) + +/* OpenBSD extensions */ +#define bus_io_read_raw_multi_2(t, h, o, a, s) \ + (*(t)->bc_io_read_raw_multi_2)((h), (o), (a), (s)) +#define bus_io_read_raw_multi_4(t, h, o, a, s) \ + (*(t)->bc_io_read_raw_multi_4)((h), (o), (a), (s)) +#define bus_io_read_raw_multi_8(t, h, o, a, s) \ + (*(t)->bc_io_read_raw_multi_8)((h), (o), (a), (s)) + +#define bus_io_write_raw_multi_2(t, h, o, a, s) \ + (*(t)->bc_io_write_raw_multi_2)((h), (o), (a), (s)) +#define bus_io_write_raw_multi_4(t, h, o, a, s) \ + (*(t)->bc_io_write_raw_multi_4)((h), (o), (a), (s)) +#define bus_io_write_raw_multi_8(t, h, o, a, s) \ + (*(t)->bc_io_write_raw_multi_8)((h), (o), (a), (s)) + +#endif /* _MACHINE_BUS_H_ */ diff --git a/sys/arch/amiga/isa/cross.c b/sys/arch/amiga/isa/cross.c index 22f5fded230..00bd72a2f25 100644 --- a/sys/arch/amiga/isa/cross.c +++ b/sys/arch/amiga/isa/cross.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cross.c,v 1.5 1996/08/04 01:30:48 niklas Exp $ */ +/* $OpenBSD: cross.c,v 1.6 1996/11/12 20:29:47 niklas Exp $ */ /* * Copyright (c) 1994, 1996 Niklas Hallqvist, Carsten Hammer @@ -37,7 +37,7 @@ #include <sys/syslog.h> #include <sys/systm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/cpu.h> #include <machine/intr.h> diff --git a/sys/arch/amiga/isa/ggbus.c b/sys/arch/amiga/isa/ggbus.c index 7864220395a..f3dd8323a55 100644 --- a/sys/arch/amiga/isa/ggbus.c +++ b/sys/arch/amiga/isa/ggbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ggbus.c,v 1.5 1996/08/04 01:30:49 niklas Exp $ */ +/* $OpenBSD: ggbus.c,v 1.6 1996/11/12 20:29:49 niklas Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Niklas Hallqvist @@ -37,7 +37,7 @@ #include <sys/syslog.h> #include <sys/systm.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/cpu.h> #include <machine/intr.h> diff --git a/sys/arch/amiga/isa/if_isaed.c b/sys/arch/amiga/isa/if_isaed.c index ab7c1149f0e..fbc720e52fc 100644 --- a/sys/arch/amiga/isa/if_isaed.c +++ b/sys/arch/amiga/isa/if_isaed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_isaed.c,v 1.12 1996/10/05 00:08:41 niklas Exp $ */ +/* $OpenBSD: if_isaed.c,v 1.13 1996/11/12 20:29:51 niklas Exp $ */ /* * Derived from sys/dev/isa/if_ed.c: @@ -53,7 +53,7 @@ #endif #include <machine/cpu.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/isa/isareg.h> diff --git a/sys/arch/arc/dev/ace.c b/sys/arch/arc/dev/ace.c index 6820a2e9b39..f5e22feb9a9 100644 --- a/sys/arch/arc/dev/ace.c +++ b/sys/arch/arc/dev/ace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ace.c,v 1.6 1996/09/14 15:58:21 pefo Exp $ */ +/* $OpenBSD: ace.c,v 1.7 1996/11/12 20:29:53 niklas Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /*- @@ -58,7 +58,7 @@ #include <sys/device.h> #include <arc/arc/arctype.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/isa/isavar.h> diff --git a/sys/arch/arc/dev/lpr.c b/sys/arch/arc/dev/lpr.c index 7f84a7b96b6..6c5e6d61d7c 100644 --- a/sys/arch/arc/dev/lpr.c +++ b/sys/arch/arc/dev/lpr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpr.c,v 1.2 1996/09/14 15:58:21 pefo Exp $ */ +/* $OpenBSD: lpr.c,v 1.3 1996/11/12 20:29:54 niklas Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. @@ -65,7 +65,7 @@ #include <sys/conf.h> #include <sys/syslog.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <dev/isa/isavar.h> diff --git a/sys/arch/arc/include/bus.old.h b/sys/arch/arc/include/bus.old.h new file mode 100644 index 00000000000..fbf8f293bab --- /dev/null +++ b/sys/arch/arc/include/bus.old.h @@ -0,0 +1,140 @@ +/* $OpenBSD: bus.old.h,v 1.1 1996/11/12 20:29:56 niklas Exp $ */ + +/* + * Copyright (c) 1996 Christopher G. Demetriou. 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 Christopher G. Demetriou + * for the NetBSD Project. + * 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. + */ + +#ifndef _ARC_BUS_H_ +#define _ARC_BUS_H_ + +#include <machine/autoconf.h> +#include <machine/pio.h> + +/* + * I/O addresses (in bus space) + */ +typedef u_long bus_io_addr_t; +typedef u_long bus_io_size_t; +typedef u_long bus_io_handle_t; + +/* + * Memory addresses (in bus space) + */ +typedef u_long bus_mem_addr_t; +typedef u_long bus_mem_size_t; +typedef caddr_t bus_mem_handle_t; + +/* + * Access methods for bus resources, I/O space, and memory space. + */ +typedef +struct arc_isa_busmap { + void *isa_io_base; + void *isa_mem_base; +} *bus_chipset_tag_t; + + +#define bus_io_map(t, port, size, iohp) \ + (*iohp = (t == NULL ? port : port + (ulong)(t->isa_io_base)), 0) +#define bus_io_unmap(t, ioh, size) + +#define bus_io_read_1(t, h, o) inb((h) + (o)) +#define bus_io_read_2(t, h, o) inw((h) + (o)) +#define bus_io_read_4(t, h, o) inl((h) + (o)) +#if 0 /* Cause a link error for bus_io_read_8 */ +#define bus_io_read_8(t, h, o) !!! bus_io_read_8 unimplemented !!! +#endif + +#define bus_io_read_multi_1(t, h, o, a, c) \ + insb((h) + (o), (a), (c)) +#define bus_io_read_multi_2(t, h, o, a, c) \ + insw((h) + (o), (a), (c)) +#define bus_io_read_multi_4(t, h, o, a, c) \ + insl((h) + (o), (a), (c)) +#if 0 /* Cause a link error for bus_io_read_multi_8 */ +#define bus_io_read_multi_8(t, h, o, a, c) \ + !!! bus_io_read_multi_8 unimplemented !!! +#endif + +#define bus_io_write_1(t, h, o, v) outb((h) + (o), (v)) +#define bus_io_write_2(t, h, o, v) outw((h) + (o), (v)) +#define bus_io_write_4(t, h, o, v) outl((h) + (o), (v)) +#if 0 /* Cause a link error for bus_io_write_8 */ +#define bus_io_write_8(t, h, o, v) !!! bus_io_write_8 unimplemented !!! +#endif + +#define bus_io_write_multi_1(t, h, o, a, c) \ + outsb((h) + (o), (a), (c)) +#define bus_io_write_multi_2(t, h, o, a, c) \ + outsw((h) + (o), (a), (c)) +#define bus_io_write_multi_4(t, h, o, a, c) \ + outsl((h) + (o), (a), (c)) +#if 0 /* Cause a link error for bus_io_write_multi_8 */ +#define bus_io_write_multi_8(t, h, o, a, c) \ + !!! bus_io_write_multi_8 unimplimented !!! +#endif + +#define bus_mem_map(t, addr, size, cacheable, mhp) \ + (*mhp = (bus_mem_handle_t)(t == NULL ? addr : addr + (ulong)(t->isa_mem_base)), 0) +#define bus_mem_unmap(t, ioh, size) + +#define bus_mem_read_1(t, h, o) (*(volatile u_int8_t *)((h) + (o))) +#define bus_mem_read_2(t, h, o) (*(volatile u_int16_t *)((h) + (o))) +#define bus_mem_read_4(t, h, o) (*(volatile u_int32_t *)((h) + (o))) +#define bus_mem_read_8(t, h, o) (*(volatile u_int64_t *)((h) + (o))) + +#define bus_mem_write_1(t, h, o, v) \ + ((void)(*(volatile u_int8_t *)((h) + (o)) = (v))) +#define bus_mem_write_2(t, h, o, v) \ + ((void)(*(volatile u_int16_t *)((h) + (o)) = (v))) +#define bus_mem_write_4(t, h, o, v) \ + ((void)(*(volatile u_int32_t *)((h) + (o)) = (v))) +#define bus_mem_write_8(t, h, o, v) \ + ((void)(*(volatile u_int64_t *)((h) + (o)) = (v))) + +/* These are extensions to the general NetBSD bus interface. */ +#define bus_io_read_raw_multi_2(t, h, o, a, c) \ + insw((h) + (o), (a), ((c) >> 1)) +#define bus_io_read_raw_multi_4(t, h, o, a, c) \ + insl((h) + (o), (a), ((c) >> 2)) +#if 0 /* Cause a link error for bus_io_read_raw_multi_8 */ +#define bus_io_read_raw_multi_8(t, h, o, a, c) \ + !!! bus_io_read_raw_multi_8 unimplemented !!! +#endif + +#define bus_io_write_raw_multi_2(t, h, o, a, c) \ + outsw((h) + (o), (a), ((c) >> 1)) +#define bus_io_write_raw_multi_4(t, h, o, a, c) \ + outsl((h) + (o), (a), ((c) >> 2)) +#if 0 /* Cause a link error for bus_io_write_raw_multi_8 */ +#define bus_io_write_raw_multi_8(t, h, o, a, c) \ + !!! bus_io_write_raw_multi_8 unimplimented !!! +#endif + +#endif /* _ARC_BUS_H_ */ diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c index a7cfcf65def..a8b3951f0bd 100644 --- a/sys/arch/i386/i386/mainbus.c +++ b/sys/arch/i386/i386/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.5 1996/05/30 09:30:08 deraadt Exp $ */ +/* $OpenBSD: mainbus.c,v 1.6 1996/11/12 20:29:57 niklas Exp $ */ /* $NetBSD: mainbus.c,v 1.8 1996/04/11 22:13:37 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #include <sys/systm.h> #include <sys/device.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <dev/isa/isavar.h> #include <dev/eisa/eisavar.h> diff --git a/sys/arch/i386/include/bus.old.h b/sys/arch/i386/include/bus.old.h new file mode 100644 index 00000000000..93b8c496b1f --- /dev/null +++ b/sys/arch/i386/include/bus.old.h @@ -0,0 +1,135 @@ +/* $OpenBSD: bus.old.h,v 1.1 1996/11/12 20:29:58 niklas Exp $ */ +/* $NetBSD: bus.h,v 1.3 1996/05/03 19:22:18 christos Exp $ */ + +/* + * Copyright (c) 1996 Christopher G. Demetriou. 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 Christopher G. Demetriou + * for the NetBSD Project. + * 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. + */ + +#ifndef _I386_BUS_H_ +#define _I386_BUS_H_ + +#include <machine/pio.h> + +/* + * I/O addresses (in bus space) + */ +typedef u_long bus_io_addr_t; +typedef u_long bus_io_size_t; + +/* + * Memory addresses (in bus space) + */ +typedef u_long bus_mem_addr_t; +typedef u_long bus_mem_size_t; + +/* + * Access methods for bus resources, I/O space, and memory space. + */ +typedef void *bus_chipset_tag_t; +typedef u_long bus_io_handle_t; +typedef caddr_t bus_mem_handle_t; + +#define bus_io_map(t, port, size, iohp) \ + ((void) t, *iohp = port, 0) +#define bus_io_unmap(t, ioh, size) + +#define bus_io_read_1(t, h, o) ((void) t, inb((h) + (o))) +#define bus_io_read_2(t, h, o) ((void) t, inw((h) + (o))) +#define bus_io_read_4(t, h, o) ((void) t, inl((h) + (o))) +#if 0 /* Cause a link error for bus_io_read_8 */ +#define bus_io_read_8(t, h, o) !!! bus_io_read_8 unimplemented !!! +#endif + +#define bus_io_read_multi_1(t, h, o, a, c) \ + ((void) t, insb((h) + (o), (a), (c))) +#define bus_io_read_multi_2(t, h, o, a, c) \ + ((void) t, insw((h) + (o), (a), (c))) +#define bus_io_read_multi_4(t, h, o, a, c) \ + ((void) t, insl((h) + (o), (a), (c))) +#if 0 /* Cause a link error for bus_io_read_multi_8 */ +#define bus_io_read_multi_8(t, h, o, a, c) \ + !!! bus_io_read_multi_8 unimplemented !!! +#endif + +#define bus_io_write_1(t, h, o, v) ((void) t, outb((h) + (o), (v))) +#define bus_io_write_2(t, h, o, v) ((void) t, outw((h) + (o), (v))) +#define bus_io_write_4(t, h, o, v) ((void) t, outl((h) + (o), (v))) +#if 0 /* Cause a link error for bus_io_write_8 */ +#define bus_io_write_8(t, h, o, v) !!! bus_io_write_8 unimplemented !!! +#endif + +#define bus_io_write_multi_1(t, h, o, a, c) \ + ((void) t, outsb((h) + (o), (a), (c))) +#define bus_io_write_multi_2(t, h, o, a, c) \ + ((void) t, outsw((h) + (o), (a), (c))) +#define bus_io_write_multi_4(t, h, o, a, c) \ + ((void) t, outsl((h) + (o), (a), (c))) +#if 0 /* Cause a link error for bus_io_write_multi_8 */ +#define bus_io_write_multi_8(t, h, o, a, c) \ + !!! bus_io_write_multi_8 unimplimented !!! +#endif + +int bus_mem_map __P((bus_chipset_tag_t t, bus_mem_addr_t bpa, + bus_mem_size_t size, int cacheable, bus_mem_handle_t *mhp)); +void bus_mem_unmap __P((bus_chipset_tag_t t, bus_mem_handle_t memh, + bus_mem_size_t size)); + +#define bus_mem_read_1(t, h, o) ((void) t, (*(volatile u_int8_t *)((h) + (o)))) +#define bus_mem_read_2(t, h, o) ((void) t, (*(volatile u_int16_t *)((h) + (o)))) +#define bus_mem_read_4(t, h, o) ((void) t, (*(volatile u_int32_t *)((h) + (o)))) +#define bus_mem_read_8(t, h, o) ((void) t, (*(volatile u_int64_t *)((h) + (o)))) + +#define bus_mem_write_1(t, h, o, v) \ + ((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v)))) +#define bus_mem_write_2(t, h, o, v) \ + ((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v)))) +#define bus_mem_write_4(t, h, o, v) \ + ((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v)))) +#define bus_mem_write_8(t, h, o, v) \ + ((void) t, ((void)(*(volatile u_int64_t *)((h) + (o)) = (v)))) + +#define bus_io_read_raw_multi_2(t, h, o, a, c) \ + ((void) t, insw((h) + (o), (a), (c) >> 1)) +#define bus_io_read_raw_multi_4(t, h, o, a, c) \ + ((void) t, insl((h) + (o), (a), (c) >> 2)) +#if 0 /* Cause a link error for bus_io_read_raw_multi_8 */ +#define bus_io_read_raw_multi_8(t, h, o, a, c) \ + !!! bus_io_read_multi_8 unimplemented !!! +#endif + +#define bus_io_write_raw_multi_2(t, h, o, a, c) \ + ((void) t, outsw((h) + (o), (a), (c) >> 1)) +#define bus_io_write_raw_multi_4(t, h, o, a, c) \ + ((void) t, outsl((h) + (o), (a), (c) >> 2)) +#if 0 /* Cause a link error for bus_io_write_raw_multi_8 */ +#define bus_io_write_raw_multi_8(t, h, o, a, c) \ + !!! bus_io_write_multi_8 unimplimented !!! +#endif + +#endif /* _I386_BUS_H_ */ diff --git a/sys/arch/i386/isa/ahc_isa.c b/sys/arch/i386/isa/ahc_isa.c index 3efe4ec3827..30bcb3a771f 100644 --- a/sys/arch/i386/isa/ahc_isa.c +++ b/sys/arch/i386/isa/ahc_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahc_isa.c,v 1.1 1996/10/04 02:51:20 deraadt Exp $ */ +/* $OpenBSD: ahc_isa.c,v 1.2 1996/11/12 20:30:00 niklas Exp $ */ /* $NetBSD: ahc_isa.c,v 1.1 1996/08/05 21:14:29 soda Exp $ */ /* @@ -70,7 +70,7 @@ #include <sys/queue.h> #include <sys/malloc.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <scsi/scsi_all.h> diff --git a/sys/arch/i386/isa/lms.c b/sys/arch/i386/isa/lms.c index 6d8b997034c..13e56adaa9e 100644 --- a/sys/arch/i386/isa/lms.c +++ b/sys/arch/i386/isa/lms.c @@ -37,7 +37,7 @@ #include <sys/device.h> #include <machine/cpu.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <machine/intr.h> #include <machine/mouse.h> #include <machine/conf.h> diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c index cd819913d99..2beaeb78ba5 100644 --- a/sys/arch/i386/isa/pccom.c +++ b/sys/arch/i386/isa/pccom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pccom.c,v 1.5 1996/11/09 21:56:22 tholo Exp $ */ +/* $OpenBSD: pccom.c,v 1.6 1996/11/12 20:30:05 niklas Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /*- @@ -57,7 +57,7 @@ #include <sys/device.h> #include <machine/intr.h> -#include <machine/bus.h> +#include <machine/bus.old.h> #include <dev/isa/isavar.h> #include <dev/isa/comreg.h> |