diff options
author | Nathan Binkert <nate@cvs.openbsd.org> | 2001-10-26 01:28:07 +0000 |
---|---|---|
committer | Nathan Binkert <nate@cvs.openbsd.org> | 2001-10-26 01:28:07 +0000 |
commit | 17959c041a742b16ab2422cff8775ac92ff015c0 (patch) | |
tree | 7d12e180e149953a11188ca60919f41ff0cbaf0e /sys/arch/alpha | |
parent | 20e08fcb211a654a427c41d04318e7ae669d1a81 (diff) |
First cut at a port of isadma and floppy driver. ok art@
From NetBSD via jay@rootaction.net
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r-- | sys/arch/alpha/alpha/conf.c | 11 | ||||
-rw-r--r-- | sys/arch/alpha/conf/GENERIC | 6 | ||||
-rw-r--r-- | sys/arch/alpha/conf/files.alpha | 18 | ||||
-rw-r--r-- | sys/arch/alpha/include/bus.h | 4 | ||||
-rw-r--r-- | sys/arch/alpha/include/conf.h | 33 | ||||
-rw-r--r-- | sys/arch/alpha/include/ioctl_fd.h | 129 | ||||
-rw-r--r-- | sys/arch/alpha/isa/isa_machdep.h | 5 | ||||
-rw-r--r-- | sys/arch/alpha/isa/isapnp_machdep.c | 79 | ||||
-rw-r--r-- | sys/arch/alpha/isa/isapnp_machdep.h | 42 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c | 35 | ||||
-rw-r--r-- | sys/arch/alpha/pci/sio.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/sio_pic.c | 5 |
12 files changed, 287 insertions, 90 deletions
diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c index 3b0a2428a5a..395ca9bff15 100644 --- a/sys/arch/alpha/alpha/conf.c +++ b/sys/arch/alpha/alpha/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.33 2001/10/26 00:41:46 nate Exp $ */ +/* $OpenBSD: conf.c,v 1.34 2001/10/26 01:28:06 nate Exp $ */ /* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */ /*- @@ -46,6 +46,8 @@ #include "wd.h" bdev_decl(wd); +#include "fd.h" +bdev_decl(fd); #include "st.h" #include "cd.h" #include "sd.h" @@ -62,7 +64,7 @@ struct bdevsw bdevsw[] = bdev_swap_init(1,sw), /* 1: swap pseudo-device */ bdev_tape_init(NST,st), /* 2: SCSI tape */ bdev_disk_init(NCD,cd), /* 3: SCSI CD-ROM */ - bdev_notdef(), /* 4 */ + bdev_disk_init(NFD,fd), /* 4: Floppy disk */ bdev_notdef(), /* 5 */ bdev_disk_init(NRD,rd), /* 6: ram disk driver */ bdev_disk_init(NCCD,ccd), /* 7: concatenated disk driver */ @@ -105,6 +107,7 @@ cdev_decl(com); cdev_decl(lpt); cdev_decl(prom); /* XXX XXX XXX */ cdev_decl(wd); +cdev_decl(fd); #include "cy.h" cdev_decl(cy); #ifdef XFS @@ -174,7 +177,7 @@ struct cdevsw cdevsw[] = cdev_random_init(1,random), /* 34: random data source */ cdev_pf_init(NPF, pf), /* 35: packet filter */ cdev_disk_init(NWD,wd), /* 36: ST506/ESDI/IDE disk */ - cdev_notdef(), /* 37 */ + cdev_disk_init(NFD,fd), /* 37: Floppy disk */ cdev_tty_init(NCY,cy), /* 38: Cyclom serial port */ cdev_ksyms_init(NKSYMS,ksyms), /* 39: Kernel symbols device */ cdev_notdef(), /* 40 */ @@ -284,7 +287,7 @@ static int chrtoblktbl[] = { /* 34 */ NODEV, /* 35 */ NODEV, /* 36 */ 0, - /* 37 */ 4, + /* 37 */ 4, /* fd */ /* 38 */ NODEV, /* 39 */ NODEV, /* 40 */ NODEV, diff --git a/sys/arch/alpha/conf/GENERIC b/sys/arch/alpha/conf/GENERIC index 2cc2b35b854..e26aa1f94e2 100644 --- a/sys/arch/alpha/conf/GENERIC +++ b/sys/arch/alpha/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.90 2001/10/26 00:49:20 nate Exp $ +# $OpenBSD: GENERIC,v 1.91 2001/10/26 01:28:06 nate Exp $ # $NetBSD: GENERIC,v 1.31 1996/12/03 17:25:29 cgd Exp $ machine alpha @@ -205,6 +205,8 @@ ukphy* at mii? phy ? # "unknown" PHYs isa* at pceb? eisa* at pceb? isa* at sio? +isadma0 at isa? +isapnp0 at isa? # ISA devices mcclock* at isa? port 0x70 @@ -227,6 +229,8 @@ ep* at isa? port ? irq ? # 3C509 ethernet cards #wss* at isa? port 0x530 irq 9 drq 0 # Windows Sound System cy0 at isa? iomem 0xd4000 irq 12 # ISA cyclom card +fdc0 at isa? port 0x3f0 irq 6 drq 2 # floppy controller +fd* at fdc? drive ? #aic0 at isa? port 0x340 irq 11 # Adaptec 152[02] SCSI #scsibus* at aic? diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha index 446bc1e7bd3..ccb6c16595d 100644 --- a/sys/arch/alpha/conf/files.alpha +++ b/sys/arch/alpha/conf/files.alpha @@ -1,4 +1,4 @@ -# $OpenBSD: files.alpha,v 1.50 2001/06/26 02:37:28 mickey Exp $ +# $OpenBSD: files.alpha,v 1.51 2001/10/26 01:28:06 nate Exp $ # $NetBSD: files.alpha,v 1.32 1996/11/25 04:03:21 cgd Exp $ # # alpha-specific configuration info @@ -132,6 +132,11 @@ major { wd = 0 } # file arch/alpha/isa/isa_machdep.c isa +define isadma_bounce +file arch/alpha/isa/isadmabounce.c isadma_bounce + +device isabeep +attach isabeep at pcppi include "dev/pckbc/files.pckbc" @@ -144,6 +149,17 @@ attach ed at pcmcia with ed_pcmcia attach ed at pci with ed_pci file dev/isa/if_ed.c ed & (ed_isa | ed_pcmcia | ed_pci) needs-flag +# Floppy disk controller +#device fdc {drive = -1}: isa_dma +device fdc {drive = -1} +attach fdc at isa +file dev/isa/fdc.c fdc needs-flag + +device fd: disk, isa_dma +attach fd at fdc +file dev/isa/fd.c fd needs-flag +major {fd = 4} + # # EISA Bus support # diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index e6e920cb21d..2c6070bcfc3 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.13 2001/01/15 12:03:42 art Exp $ */ +/* $OpenBSD: bus.h,v 1.14 2001/10/26 01:28:06 nate Exp $ */ /* $NetBSD: bus.h,v 1.10 1996/12/02 22:19:32 cgd Exp $ */ /* @@ -211,8 +211,10 @@ struct alpha_bus_space { */ #define bus_space_map(t, a, s, c, hp) \ (*(t)->abs_map)((t)->abs_cookie, (a), (s), (c), (hp)) +#define alpha_bus_space_map_noacct bus_space_map #define bus_space_unmap(t, h, s) \ (*(t)->abs_unmap)((t)->abs_cookie, (h), (s)) +#define alpha_bus_space_unmap_noacct bus_space_unmap #define bus_space_subregion(t, h, o, s, hp) \ (*(t)->abs_subregion)((t)->abs_cookie, (h), (o), (s), (hp)) diff --git a/sys/arch/alpha/include/conf.h b/sys/arch/alpha/include/conf.h new file mode 100644 index 00000000000..d6fc9570f37 --- /dev/null +++ b/sys/arch/alpha/include/conf.h @@ -0,0 +1,33 @@ +/* $OpenBSD: conf.h,v 1.1 2001/10/26 01:28:06 nate Exp $ */ +/* + * Copyright (c) 2001 Nathan L. Binkert + * All rights reserved. + * + * Permission to redistribute, use, copy, and modify this software + * without fee is hereby granted, provided that the following + * conditions are met: + * + * 1. This entire notice is included in all source code copies of any + * software which is or includes a copy or modification of this + * software. + * 2. 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. + */ + +#include <sys/conf.h> + +bdev_decl(fd); +cdev_decl(fd); diff --git a/sys/arch/alpha/include/ioctl_fd.h b/sys/arch/alpha/include/ioctl_fd.h new file mode 100644 index 00000000000..bb715cee889 --- /dev/null +++ b/sys/arch/alpha/include/ioctl_fd.h @@ -0,0 +1,129 @@ +/* $OpenBSD: ioctl_fd.h,v 1.1 2001/10/26 01:28:06 nate Exp $ */ +/* from: ioctl_fd.h,v 1.4 1995/06/29 03:49:32 jtk 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 _ALPHA_IOCTL_FD_H_ +#define _ALPHA_IOCTL_FD_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 /* !_ALPHA_IOCTL_FD_H__ */ diff --git a/sys/arch/alpha/isa/isa_machdep.h b/sys/arch/alpha/isa/isa_machdep.h index cf2ed3c0fc0..cba9d560f33 100644 --- a/sys/arch/alpha/isa/isa_machdep.h +++ b/sys/arch/alpha/isa/isa_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isa_machdep.h,v 1.7 2000/11/16 04:33:47 ericj Exp $ */ +/* $OpenBSD: isa_machdep.h,v 1.8 2001/10/26 01:28:06 nate Exp $ */ /* $NetBSD: isa_machdep.h,v 1.3 1996/11/19 04:53:07 cgd Exp $ */ /* @@ -41,6 +41,7 @@ struct alpha_isa_chipset { void *(*ic_intr_establish) __P((void *, int, int, int, int (*)(void *), void *, char *)); void (*ic_intr_disestablish) __P((void *, void *)); + int (*ic_intr_alloc) __P((isa_chipset_tag_t *, int, int, int *)); }; /* @@ -52,6 +53,8 @@ struct alpha_isa_chipset { (*(c)->ic_intr_establish)((c)->ic_v, (i), (t), (l), (f), (a), (nm)) #define isa_intr_disestablish(c, h) \ (*(c)->ic_intr_disestablish)((c)->ic_v, (h)) +#define isa_intr_alloc(c, m, t, i) \ + (*(c)->ic_intr_alloc)((c)->ic_v, (m), (t), (i)) #define __NO_ISA_INTR_CHECK diff --git a/sys/arch/alpha/isa/isapnp_machdep.c b/sys/arch/alpha/isa/isapnp_machdep.c index 2f50564b5ed..d95d3a1eba5 100644 --- a/sys/arch/alpha/isa/isapnp_machdep.c +++ b/sys/arch/alpha/isa/isapnp_machdep.c @@ -1,13 +1,12 @@ -/* $OpenBSD: isapnp_machdep.c,v 1.1 1998/01/06 23:37:57 niklas Exp $ */ -/* $NetBSD: isapnp_machdep.c,v 1.5 1997/10/04 17:32:30 thorpej Exp $ */ +/* $NetBSD: isapnp_machdep.c,v 1.3 1998/09/05 15:28:04 christos Exp $ */ /*- - * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. + * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. + * NASA Ames Research Center and by Christos Zoulas. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,35 +38,6 @@ */ /* - * Copyright (c) 1996 Christos Zoulas. 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 Christos Zoulas. - * 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. - */ - -/* * Machine-dependent portions of ISA PnP bus autoconfiguration. * * N.B. This file exists mostly to get around some lameness surrounding @@ -88,9 +58,11 @@ #include <machine/bus.h> -#include <dev/isa/isapnpreg.h> #include <dev/isa/isavar.h> +#include <dev/isa/isapnpreg.h> +/* #include <dev/isapnp/isapnpvar.h> */ + /* isapnp_map(): * Map I/O regions used by PnP */ @@ -98,7 +70,21 @@ int isapnp_map(sc) struct isapnp_softc *sc; { - return (1); + int error; + + error = alpha_bus_space_map_noacct(sc->sc_iot, ISAPNP_ADDR, 1, 0, + &sc->sc_addr_ioh); + if (error) + return (error); + + error = alpha_bus_space_map_noacct(sc->sc_iot, ISAPNP_WRDATA, 1, 0, + &sc->sc_wrdata_ioh); + if (error) { + alpha_bus_space_unmap_noacct(sc->sc_iot, sc->sc_addr_ioh, 1); + return (error); + } + + return (0); } /* isapnp_unmap(): @@ -108,7 +94,9 @@ void isapnp_unmap(sc) struct isapnp_softc *sc; { - /* Do nothing. */ + + alpha_bus_space_unmap_noacct(sc->sc_iot, sc->sc_addr_ioh, 1); + alpha_bus_space_unmap_noacct(sc->sc_iot, sc->sc_wrdata_ioh, 1); } /* isapnp_map_readport(): @@ -121,7 +109,24 @@ int isapnp_map_readport(sc) struct isapnp_softc *sc; { - return (1); +#ifdef _KERNEL + int error; +#endif + +#ifdef _KERNEL + /* Check if some other device has already claimed this port. */ + if ((error = bus_space_map(sc->sc_iot, sc->sc_read_port, 1, 0, + &sc->sc_read_ioh)) != 0) + return error; + + /* + * XXX: We unmap the port because it can and will be used by other + * devices such as a joystick. We need a better port accounting + * scheme with read and write ports. + */ + bus_space_unmap(sc->sc_iot, sc->sc_read_ioh, 1); +#endif + return 0; } /* isapnp_unmap_readport(): diff --git a/sys/arch/alpha/isa/isapnp_machdep.h b/sys/arch/alpha/isa/isapnp_machdep.h index d257c3c2d63..02ba074bba1 100644 --- a/sys/arch/alpha/isa/isapnp_machdep.h +++ b/sys/arch/alpha/isa/isapnp_machdep.h @@ -1,5 +1,4 @@ -/* $OpenBSD: isapnp_machdep.h,v 1.1 1998/01/06 23:37:58 niklas Exp $ */ -/* $NetBSD: isapnp_machdep.h,v 1.2 1997/10/04 17:32:32 thorpej Exp $ */ +/* $NetBSD: isapnp_machdep.h,v 1.5 2000/06/01 00:04:50 cgd Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -7,7 +6,7 @@ * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. + * NASA Ames Research Center and by Christos Zoulas. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,38 +38,9 @@ */ /* - * Copyright (c) 1996 Christos Zoulas. 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 Christos Zoulas. - * 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. - */ - -/* * Functions provided to machine-independent ISA PnP code. */ -int isapnp_map __P((struct isapnp_softc *)); -void isapnp_unmap __P((struct isapnp_softc *)); -int isapnp_map_readport __P((struct isapnp_softc *)); -void isapnp_unmap_readport __P((struct isapnp_softc *)); +int isapnp_map(struct isapnp_softc *); +void isapnp_unmap(struct isapnp_softc *); +int isapnp_map_readport(struct isapnp_softc *); +void isapnp_unmap_readport(struct isapnp_softc *); diff --git a/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c b/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c index f2546f850ab..ef4e52593d7 100644 --- a/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c +++ b/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_bwx_bus_mem_chipdep.c,v 1.2 2000/11/08 20:59:25 ericj Exp $ */ +/* $OpenBSD: pci_bwx_bus_mem_chipdep.c,v 1.3 2001/10/26 01:28:06 nate Exp $ */ /* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */ /* @@ -361,9 +361,34 @@ __C(CHIP,_mem_alloc)(v, rstart, rend, size, align, boundary, cacheable, int cacheable; bus_space_handle_t *bshp; { + bus_addr_t memaddr; + int error; + + /* + * Do the requested allocation. + */ +#ifdef EXTENT_DEBUG + printf("mem: allocating from 0x%lx to 0x%lx\n", rstart, rend); +#endif + error = extent_alloc_subregion(CHIP_MEM_EXTENT(v), rstart, rend, + size, align, 0, boundary, + EX_FAST | EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0), + &memaddr); + if (error) { +#ifdef EXTENT_DEBUG + printf("mem: allocation failed (%d)\n", error); + extent_print(CHIP_MEM_EXTENT(v)); +#endif + } + +#ifdef EXTENT_DEBUG + printf("mem: allocated 0x%lx to 0x%lx\n", memaddr, memaddr + size - 1); +#endif - /* XXX XXX XXX XXX XXX XXX */ - panic("%s not implemented", __S(__C(CHIP,_mem_alloc))); + *addrp = memaddr; + *bshp = ALPHA_PHYS_TO_K0SEG(CHIP_MEM_SYS_START(v)) + memaddr; + + return (0); } void @@ -373,8 +398,8 @@ __C(CHIP,_mem_free)(v, bsh, size) bus_size_t size; { - /* XXX XXX XXX XXX XXX XXX */ - panic("%s not implemented", __S(__C(CHIP,_mem_free))); + /* Unmap does all we need to do. */ + __C(CHIP,_mem_unmap)(v, bsh, size); } inline void diff --git a/sys/arch/alpha/pci/sio.c b/sys/arch/alpha/pci/sio.c index e0477a542d7..af0bb024cd9 100644 --- a/sys/arch/alpha/pci/sio.c +++ b/sys/arch/alpha/pci/sio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio.c,v 1.24 2001/08/17 22:55:09 mickey Exp $ */ +/* $OpenBSD: sio.c,v 1.25 2001/10/26 01:28:06 nate Exp $ */ /* $NetBSD: sio.c,v 1.15 1996/12/05 01:39:36 cgd Exp $ */ /* @@ -49,6 +49,7 @@ struct sio_softc { struct device sc_dv; bus_space_tag_t sc_iot, sc_memt; + bus_dma_tag_t sc_dmat; int sc_haseisa; }; @@ -59,6 +60,9 @@ int siomatch __P((struct device *, struct cfdata *, void *)); #endif void sioattach __P((struct device *, struct device *, void *)); +extern int sio_intr_alloc __P((isa_chipset_tag_t *, int, int, int *)); + + struct cfattach sio_ca = { sizeof(struct sio_softc), siomatch, sioattach, }; @@ -154,6 +158,7 @@ sioattach(parent, self, aux) sc->sc_iot = pa->pa_iot; sc->sc_memt = pa->pa_memt; + sc->sc_dmat = pa->pa_dmat; sc->sc_haseisa = (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL && PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_PCEB); @@ -193,10 +198,13 @@ sio_bridge_callback(v) ic.ic_attach_hook = sio_isa_attach_hook; ic.ic_intr_establish = sio_intr_establish; ic.ic_intr_disestablish = sio_intr_disestablish; + ic.ic_intr_alloc = sio_intr_alloc; sa.sa_iba.iba_busname = "isa"; sa.sa_iba.iba_iot = sc->sc_iot; sa.sa_iba.iba_memt = sc->sc_memt; + sa.sa_iba.iba_dmat = + alphabus_dma_get_tag(sc->sc_dmat, ALPHA_BUS_ISA); sa.sa_iba.iba_ic = ⁣ config_found(&sc->sc_dv, &sa.sa_iba, sioprint); } diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c index c4f2442f705..4fb58f64ddc 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.18 2001/08/17 22:26:58 mickey Exp $ */ +/* $OpenBSD: sio_pic.c,v 1.19 2001/10/26 01:28:06 nate Exp $ */ /* $NetBSD: sio_pic.c,v 1.28 2000/06/06 03:10:13 thorpej Exp $ */ /*- @@ -123,6 +123,7 @@ u_int8_t initial_elcr[2]; #endif void sio_setirqstat __P((int, int, int)); +int sio_intr_alloc __P((void *, int, int, int *)); u_int8_t (*sio_read_elcr) __P((int)); void (*sio_write_elcr) __P((int, u_int8_t)); @@ -565,7 +566,6 @@ sio_iointr(framep, vec) #define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != 2) -#ifdef notyet int sio_intr_alloc(v, mask, type, irq) void *v; @@ -638,7 +638,6 @@ sio_intr_alloc(v, mask, type, irq) return (0); } -#endif static void specific_eoi(irq) |