diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-02-28 15:26:24 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-02-28 15:26:24 +0000 |
commit | dc88c9ee946a8fcfdf23c2ed2dcde2fffa33044a (patch) | |
tree | 71362c625e5cb3208018d0a12d7f40f9ba9fdd50 /sys | |
parent | 9abcd296518d58c0a266bec4849120b4a52fcd9d (diff) |
remove non-typo changes. sorry folks
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/ami_pci.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/auvia.c | 139 | ||||
-rw-r--r-- | sys/dev/pci/auviavar.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/bha_pci.c | 16 | ||||
-rw-r--r-- | sys/dev/pci/files.pci | 22 | ||||
-rw-r--r-- | sys/dev/pci/isp_pci.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/pci.c | 16 | ||||
-rw-r--r-- | sys/dev/pci/pci_map.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/pcivar.h | 207 |
9 files changed, 280 insertions, 140 deletions
diff --git a/sys/dev/pci/ami_pci.c b/sys/dev/pci/ami_pci.c index 97080343462..3f560e8ecb1 100644 --- a/sys/dev/pci/ami_pci.c +++ b/sys/dev/pci/ami_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami_pci.c,v 1.14 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: ami_pci.c,v 1.15 2003/02/28 15:26:23 mickey Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -203,7 +203,7 @@ ami_pci_attach(parent, self, aux) bus_space_unmap(sc->iot, sc->ioh, size); } - printf(": %s\n", intrstr); + printf(": %s", intrstr); csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG); for (ssp = ami_pci_subsys; ssp->id; ssp++) @@ -245,7 +245,7 @@ ami_pci_attach(parent, self, aux) default: lhc = "32b"; } - sprintf(sc->sc_raidconfig.rc_name, "%s/%s", model, lhc); + printf(" %s/%s\n%s", model, lhc, sc->sc_dev.dv_xname); if (ami_attach(sc)) { pci_intr_disestablish(pa->pa_pc, sc->sc_ih); diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c index 6e38f7bad23..443c78a34d0 100644 --- a/sys/dev/pci/auvia.c +++ b/sys/dev/pci/auvia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auvia.c,v 1.22 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: auvia.c,v 1.23 2003/02/28 15:26:23 mickey Exp $ */ /* $NetBSD: auvia.c,v 1.7 2000/11/15 21:06:33 jdolecek Exp $ */ /*- @@ -132,49 +132,41 @@ struct cfattach auvia_ca = { #define AUVIA_PCICONF_ACFM 0x00000200 /* FM enab */ #define AUVIA_PCICONF_ACSB 0x00000100 /* SB enab */ -#define AUVIA_PLAY_BASE 0x00 -#define AUVIA_RECORD_BASE 0x10 +#define AUVIA_PLAY_BASE 0x00 +#define AUVIA_RECORD_BASE 0x10 -#define AUVIA_RP_STAT 0x00 -#define AUVIA_RPSTAT_INTR 0x03 -#define AUVIA_RP_CONTROL 0x01 -#define AUVIA_RPCTRL_START 0x80 -#define AUVIA_RPCTRL_TERMINATE 0x40 -#define AUVIA_RPCTRL_AUTOSTART 0x20 +#define AUVIA_RP_STAT 0x00 +#define AUVIA_RPSTAT_INTR 0x03 +#define AUVIA_RP_CONTROL 0x01 +#define AUVIA_RPCTRL_START 0x80 +#define AUVIA_RPCTRL_TERMINATE 0x40 +#define AUVIA_RPCTRL_AUTOSTART 0x20 /* The following are 8233 specific */ -#define AUVIA_RPCTRL_STOP 0x04 -#define AUVIA_RPCTRL_EOL 0x02 -#define AUVIA_RPCTRL_FLAG 0x01 -#define AUVIA_RP_MODE 0x02 -#define AUVIA_RPMODE_INTR_FLAG 0x01 -#define AUVIA_RPMODE_INTR_EOL 0x02 -#define AUVIA_RPMODE_STEREO 0x10 -#define AUVIA_RPMODE_16BIT 0x20 -#define AUVIA_RPMODE_AUTOSTART 0x80 -#define AUVIA_RP_DMAOPS_BASE 0x04 -#define AUVIA_RPDMAOP_PTR 0x00 -#define AUVIA_RPDMAOP_IDX 0x04 -#define AUVIA_RPDMAOP_CNT 0x08 -#define AUVIA_RPDMAOP_CHIDX 0x0f - -#define VIA8233_RP_DXS_LVOL 0x02 -#define VIA8233_RP_DXS_RVOL 0x03 -#define VIA8233_RP_RATEFMT 0x08 +#define AUVIA_RPCTRL_STOP 0x04 +#define AUVIA_RPCTRL_EOL 0x02 +#define AUVIA_RPCTRL_FLAG 0x01 +#define AUVIA_RP_MODE 0x02 +#define AUVIA_RPMODE_INTR_FLAG 0x01 +#define AUVIA_RPMODE_INTR_EOL 0x02 +#define AUVIA_RPMODE_STEREO 0x10 +#define AUVIA_RPMODE_16BIT 0x20 +#define AUVIA_RPMODE_AUTOSTART 0x80 +#define AUVIA_RP_DMAOPS_BASE 0x04 + +#define VIA8233_RP_DXS_LVOL 0x02 +#define VIA8233_RP_DXS_RVOL 0x03 +#define VIA8233_RP_RATEFMT 0x08 #define VIA8233_RATEFMT_48K 0xfffff #define VIA8233_RATEFMT_STEREO 0x00100000 #define VIA8233_RATEFMT_16BIT 0x00200000 -#define AUVIA_MPB_BASE 0x40 -#define AUVIA_MPBMODE_16BIT 0x80 -#define AUVIA_MPBMODE_CHMASK 0x70 +#define VIA_RP_DMAOPS_COUNT 0x0C -#define AUVIA_CAPTURE_BASE 0x60 - -#define AUVIA_CODEC_CTL 0x80 -#define AUVIA_CODEC_READ 0x00800000 -#define AUVIA_CODEC_BUSY 0x01000000 -#define AUVIA_CODEC_PRIVALID 0x02000000 -#define AUVIA_CODEC_INDEX(x) ((x)<<16) +#define AUVIA_CODEC_CTL 0x80 +#define AUVIA_CODEC_READ 0x00800000 +#define AUVIA_CODEC_BUSY 0x01000000 +#define AUVIA_CODEC_PRIVALID 0x02000000 +#define AUVIA_CODEC_INDEX(x) ((x)<<16) #define TIMEOUT 50 @@ -238,7 +230,6 @@ auvia_attach(struct device *parent, struct device *self, void *aux) pcitag_t pt = pa->pa_tag; pci_intr_handle_t ih; bus_size_t iosize; - const char *p; pcireg_t pr; int r, i; @@ -275,21 +266,6 @@ auvia_attach(struct device *parent, struct device *self, void *aux) printf(": %s\n", intrstr); - switch (PCI_REVISION(pa->pa_class) & 0xf0) { - case 0x10: p = "pre-8233"; break; - case 0x20: p = "8233C"; break; - case 0x30: p = "8233"; break; - case 0x50: p = "8235"; break; - case 0x40: p = "8233A"; - sc->sc_flags |= AUVIA_FLAGS_MPB; - break; - } - - sprintf(sc->sc_audev.name, "%s AC97", p); - sprintf(sc->sc_audev.version, "0x%x", - PCI_REVISION(pa->pa_class) & 0xf); - strcpy(sc->sc_audev.config, sc->sc_dev.dv_xname); - /* disable SBPro compat & others */ pr = pci_conf_read(pc, pt, AUVIA_PCICONF_JUNK); @@ -571,33 +547,10 @@ auvia_set_params(void *addr, int setmode, int usemode, v |= VIA8233_RATEFMT_48K * (p->sample_rate / 20) / (48000 / 20); - if (mode == AUMODE_PLAY && - sc->sc_flags & AUVIA_FLAGS_MPB) { - static const u_int32_t nch2sl[] = { - 0, 1, 0x21, 0, - 0x4321, 0, 0x436521 - }; - int slots; - - bus_space_write_1(sc->sc_iot, sc->sc_ioh, - AUVIA_MPB_BASE + AUVIA_RP_MODE, - (p->precision == 16? AUVIA_MPBMODE_16BIT:0) - | (p->channels << 4)); - - if (p->channels < - sizeof(nch2sl) / sizeof(*nch2sl)) - slots = 0; - else - slots = nch2sl[p->channels]; - bus_space_write_4(sc->sc_iot, sc->sc_ioh, - AUVIA_RP_DMAOPS_BASE + AUVIA_RPDMAOP_IDX, - slots | 0xff000000); - } else { - if (p->channels == 2) - v |= VIA8233_RATEFMT_STEREO; - if (p->precision == 16) - v |= VIA8233_RATEFMT_16BIT; - } + if (p->channels == 2) + v |= VIA8233_RATEFMT_STEREO; + if (p->precision == 16) + v |= VIA8233_RATEFMT_16BIT; bus_space_write_4(sc->sc_iot, sc->sc_ioh, base + VIA8233_RP_RATEFMT, v); @@ -699,10 +652,18 @@ auvia_halt_input(void *addr) int -auvia_getdev(void *v, struct audio_device *adp) +auvia_getdev(void *addr, struct audio_device *retp) { - struct auvia_softc *sc = v; - *adp = sc->sc_audev; + struct auvia_softc *sc = addr; + + if (retp) { + strncpy(retp->name, + sc->sc_flags & AUVIA_FLAGS_VT8233? "VIA VT8233" : + "VIA VT82C686A", sizeof(retp->name)); + strncpy(retp->version, sc->sc_revision, sizeof(retp->version)); + strncpy(retp->config, "auvia", sizeof(retp->config)); + } + return 0; } @@ -997,7 +958,7 @@ auvia_intr(void *arg) { struct auvia_softc *sc = arg; u_int8_t r; - int base, i = 0; + int i = 0; r = bus_space_read_1(sc->sc_iot, sc->sc_ioh, AUVIA_RECORD_BASE + AUVIA_RP_STAT); @@ -1011,19 +972,15 @@ auvia_intr(void *arg) i++; } - - if (sc->sc_flags & AUVIA_FLAGS_MPB) - base = AUVIA_MPB_BASE; - else - base = AUVIA_PLAY_BASE; - r = bus_space_read_1(sc->sc_iot, sc->sc_ioh, base + AUVIA_RP_STAT); + r = bus_space_read_1(sc->sc_iot, sc->sc_ioh, + AUVIA_PLAY_BASE + AUVIA_RP_STAT); if (r & AUVIA_RPSTAT_INTR) { if (sc->sc_play.sc_intr) sc->sc_play.sc_intr(sc->sc_play.sc_arg); /* clear interrupts */ bus_space_write_1(sc->sc_iot, sc->sc_ioh, - base + AUVIA_RP_STAT, AUVIA_RPSTAT_INTR); + AUVIA_PLAY_BASE + AUVIA_RP_STAT, AUVIA_RPSTAT_INTR); i++; } diff --git a/sys/dev/pci/auviavar.h b/sys/dev/pci/auviavar.h index 3cf252b1e33..67203d24a8c 100644 --- a/sys/dev/pci/auviavar.h +++ b/sys/dev/pci/auviavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: auviavar.h,v 1.6 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: auviavar.h,v 1.7 2003/02/28 15:26:23 mickey Exp $ */ /* $NetBSD: auviavar.h,v 1.1 2000/03/31 04:45:29 tsarna Exp $ */ /*- @@ -53,12 +53,11 @@ struct auvia_softc_chan { struct auvia_softc { struct device sc_dev; - struct audio_device sc_audev; void *sc_ih; /* interrupt handle */ + char sc_revision[8]; u_int sc_flags; #define AUVIA_FLAGS_VT8233 0x0001 -#define AUVIA_FLAGS_MPB 0x0002 /* use multi-pb */ pci_chipset_tag_t sc_pc; pcitag_t sc_pt; diff --git a/sys/dev/pci/bha_pci.c b/sys/dev/pci/bha_pci.c index c17be5f3985..03a9f859ec1 100644 --- a/sys/dev/pci/bha_pci.c +++ b/sys/dev/pci/bha_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bha_pci.c,v 1.5 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: bha_pci.c,v 1.6 2003/02/28 15:26:23 mickey Exp $ */ /* $NetBSD: bha_pci.c,v 1.16 1998/08/15 10:10:53 mycroft Exp $ */ /*- @@ -79,8 +79,6 @@ bha_pci_match(parent, match, aux) void *match, *aux; { struct pci_attach_args *pa = aux; - pci_chipset_tag_t pc = pa->pa_pc; - pcireg_t csr; bus_space_tag_t iot; bus_space_handle_t ioh; bus_size_t iosize; @@ -94,10 +92,6 @@ bha_pci_match(parent, match, aux) NULL, &iosize, 0)) return (0); - csr = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); - pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, - csr | PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE); - rv = bha_find(iot, ioh, NULL); bus_space_unmap(iot, ioh, iosize); @@ -136,10 +130,6 @@ bha_pci_attach(parent, self, aux) return; } - csr = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); - pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, - csr | PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE); - sc->sc_iot = iot; sc->sc_ioh = ioh; sc->sc_dmat = pa->pa_dmat; @@ -151,6 +141,10 @@ bha_pci_attach(parent, self, aux) sc->sc_dmaflags = 0; + csr = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); + pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, + csr | PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE); + if (pci_intr_map(pa, &ih)) { printf(": couldn't map interrupt\n"); bus_space_unmap(iot, ioh, iosize); diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index ecdc646784f..87db32e979a 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.145 2003/02/28 15:14:08 mickey Exp $ +# $OpenBSD: files.pci,v 1.146 2003/02/28 15:26:23 mickey Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config file and device description for machine-independent PCI code. @@ -24,10 +24,6 @@ file dev/ic/bt463.c tga file dev/ic/bt485.c tga file dev/ic/ibm561.c tga -# HP graphics (CRX, Visualize) -attach sti at pci with sti_pci -file dev/pci/sti_pci.c sti_pci - # Cypress 82c693 hyperCache(tm) Stand-Alone PCI Peripheral Controller # with USB. This is a combo chip: # @@ -91,16 +87,11 @@ file dev/pci/eso.c eso attach opl at eso with opl_eso file dev/pci/opl_eso.c opl_eso -# Intel 810/820/440MX ICH AC'97 +# Intel 810/820/440MX ICH audio with AC'97 device auich: audio, auconv, mulaw, ac97 attach auich at pci file dev/pci/auich.c auich -# AUREAL Vortex1 -device aureal: audio, auconv, mulaw, ac97 -attach aureal at pci -file dev/pci/aureal.c aureal - # Creative Labs EMU10k1 (SBLive! series and PCI512) device emu: audio, auconv, mulaw, ac97 attach emu at pci @@ -150,11 +141,6 @@ device auvia: audio, auconv, mulaw, ac97 attach auvia at pci file dev/pci/auvia.c auvia -# BrookTree 878 Audio device -device aubktr: audio, auconv, mulaw -attach aubktr at pci -file dev/pci/aubktr.c aubktr - # ICP Vortex GDT PCI RAID controllers # device declaration in sys/conf/files attach gdt at pci with gdt_pci @@ -312,10 +298,6 @@ file dev/pci/if_ti.c ti attach ne at pci with ne_pci: rtl80x9 file dev/pci/if_ne_pci.c ne_pci -# i82596-based PCI Ethernet cards -attach ie at pci with ie_pci -file dev/pci/if_ie_pci.c ie_pci - # Sun GEM ethernet attach gem at pci with gem_pci file dev/pci/if_gem_pci.c gem_pci diff --git a/sys/dev/pci/isp_pci.c b/sys/dev/pci/isp_pci.c index 8b05606ee22..16b736e65f8 100644 --- a/sys/dev/pci/isp_pci.c +++ b/sys/dev/pci/isp_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_pci.c,v 1.30 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: isp_pci.c,v 1.31 2003/02/28 15:26:23 mickey Exp $ */ /* * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. * @@ -621,6 +621,9 @@ isp_pci_attach(struct device *parent, struct device *self, void *aux) if (IS_23XX(isp)) { isp->isp_touched = 1; } + if (IS_23XX(isp)) { + isp->isp_touched = 1; + } data |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_INVALIDATE_ENABLE; /* diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 710dc806d7d..a7698ca5979 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.31 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: pci.c,v 1.32 2003/02/28 15:26:23 mickey Exp $ */ /* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */ /* @@ -409,10 +409,10 @@ pci_matchbyid(struct pci_attach_args *pa, const struct pci_matchid *ids, #include <sys/pciio.h> #include <sys/fcntl.h> -#ifdef PCI_DEBUG -#define DPRINTF(x) printf x +#ifdef DEBUG +#define PCIDEBUG(x) printf x #else -#define DPRINTF(x) +#define PCIDEBUG(x) #endif @@ -423,7 +423,7 @@ int pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p); int pciopen(dev_t dev, int oflags, int devtype, struct proc *p) { - DPRINTF(("pciopen ndevs: %d\n" , pci_cd.cd_ndevs)); + PCIDEBUG(("pciopen ndevs: %d\n" , pci_cd.cd_ndevs)); #ifndef APERTURE if ((oflags & FWRITE) && securelevel > 0) { @@ -440,7 +440,7 @@ pciopen(dev_t dev, int oflags, int devtype, struct proc *p) int pciclose(dev_t dev, int flag, int devtype, struct proc *p) { - DPRINTF(("pciclose\n")); + PCIDEBUG(("pciclose\n")); return 0; } @@ -455,9 +455,9 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) io = (struct pci_io *)data; - DPRINTF(("pciioctl cmd %s", cmd == PCIOCREAD ? "pciocread" + PCIDEBUG(("pciioctl cmd %s", cmd == PCIOCREAD ? "pciocread" : cmd == PCIOCWRITE ? "pciocwrite" : "unknown")); - DPRINTF((" bus %d dev %d func %d reg %x\n", io->pi_sel.pc_bus, + PCIDEBUG((" bus %d dev %d func %d reg %x\n", io->pi_sel.pc_bus, io->pi_sel.pc_dev, io->pi_sel.pc_func, io->pi_reg)); if (io->pi_sel.pc_bus >= pci_cd.cd_ndevs) { diff --git a/sys/dev/pci/pci_map.c b/sys/dev/pci/pci_map.c index c9e31d29835..7fc81130bb2 100644 --- a/sys/dev/pci/pci_map.c +++ b/sys/dev/pci/pci_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_map.c,v 1.8 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: pci_map.c,v 1.9 2003/02/28 15:26:23 mickey Exp $ */ /* $NetBSD: pci_map.c,v 1.7 2000/05/10 16:58:42 thorpej Exp $ */ /*- @@ -208,7 +208,7 @@ nbsd_pci_mem_find(pc, tag, reg, type, basep, sizep, flagsp) *sizep = PCI_MAPREG_MEM64_SIZE(wmask); } if (flagsp != 0) - *flagsp = 0 /*PCI_MAPREG_MEM_CACHEABLE(address)*/ + *flagsp = PCI_MAPREG_MEM_CACHEABLE(address) #ifndef __OpenBSD__ ? BUS_SPACE_MAP_CACHEABLE : 0 #endif diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index bb288b13be4..2a896263c2e 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -1,4 +1,209 @@ -/* $OpenBSD: pcivar.h,v 1.27 2003/02/28 15:14:08 mickey Exp $ */ +/* $OpenBSD: pcivar.h,v 1.28 2003/02/28 15:26:23 mickey Exp $ */ +/* $NetBSD: pcivar.h,v 1.23 1997/06/06 23:48:05 thorpej Exp $ */ + +/* + * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. + * Copyright (c) 1994 Charles Hannum. 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 Charles Hannum. + * 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 _DEV_PCI_PCIVAR_H_ +#define _DEV_PCI_PCIVAR_H_ + +/* + * Definitions for PCI autoconfiguration. + * + * This file describes types and functions which are used for PCI + * configuration. Some of this information is machine-specific, and is + * provided by pci_machdep.h. + */ + +#include <machine/bus.h> +#include <dev/pci/pcireg.h> + +/* + * Structures and definitions needed by the machine-dependent header. + */ +typedef u_int32_t pcireg_t; /* configuration space register XXX */ +struct pcibus_attach_args; + +/* + * Machine-dependent definitions. + */ +#if (__alpha__ + __atari__ + __i386__ + __arc__ + __powerpc__ + __galileo__ + __sparc64__ + __hppa__!= 1) +ERROR: COMPILING FOR UNSUPPORTED MACHINE, OR MORE THAN ONE. +#endif +#if __alpha__ +#include <alpha/pci/pci_machdep.h> +#endif +#if __atari__ +#include <atari/pci/pci_machdep.h> +#endif +#if __i386__ +#include <i386/pci/pci_machdep.h> +#endif +#if __arc__ +#include <arc/pci/pci_machdep.h> +#endif +#if __powerpc__ +#include <powerpc/pci/pci_machdep.h> +#endif +#if __galileo__ +#include <galileo/pci/pci_machdep.h> +#endif +#if __hppa__ +#include <hppa/include/pci_machdep.h> +#endif +#if __sparc64__ +#include <sparc64/include/pci_machdep.h> +#endif + +/* + * PCI bus attach arguments. + */ +struct pcibus_attach_args { + char *pba_busname; /* XXX should be common */ + bus_space_tag_t pba_iot; /* pci i/o space tag */ + bus_space_tag_t pba_memt; /* pci mem space tag */ + bus_dma_tag_t pba_dmat; /* DMA tag */ + pci_chipset_tag_t pba_pc; + + int pba_bus; /* PCI bus number */ + + /* + * Interrupt swizzling information. These fields + * are only used by secondary busses. + */ + u_int pba_intrswiz; /* how to swizzle pins */ + pcitag_t pba_intrtag; /* intr. appears to come from here */ +}; + +/* + * PCI device attach arguments. + */ +struct pci_attach_args { + bus_space_tag_t pa_iot; /* pci i/o space tag */ + bus_space_tag_t pa_memt; /* pci mem space tag */ + bus_dma_tag_t pa_dmat; /* DMA tag */ + pci_chipset_tag_t pa_pc; + int pa_flags; /* flags; see below */ + + u_int pa_device; + u_int pa_bus; + u_int pa_function; + pcitag_t pa_tag; + pcireg_t pa_id, pa_class; + + /* + * Interrupt information. + * + * "Intrline" is used on systems whose firmware puts + * the right routing data into the line register in + * configuration space. The rest are used on systems + * that do not. + */ + u_int pa_intrswiz; /* how to swizzle pins if ppb */ + pcitag_t pa_intrtag; /* intr. appears to come from here */ + pci_intr_pin_t pa_intrpin; /* intr. appears on this pin */ + pci_intr_line_t pa_intrline; /* intr. routing information */ +}; + +/* + * Flags given in the bus and device attachment args. + * + * OpenBSD doesn't actually use them yet -- csapuntz@cvs.openbsd.org + */ +#define PCI_FLAGS_IO_ENABLED 0x01 /* I/O space is enabled */ +#define PCI_FLAGS_MEM_ENABLED 0x02 /* memory space is enabled */ + +/* + * + */ +struct pci_quirkdata { + pci_vendor_id_t vendor; /* Vendor ID */ + pci_product_id_t product; /* Product ID */ + int quirks; /* quirks; see below */ +}; +#define PCI_QUIRK_MULTIFUNCTION 0x00000001 + +/* + * Locators devices that attach to 'pcibus', as specified to config. + */ +#define pcibuscf_bus cf_loc[0] +#define PCIBUS_UNK_BUS -1 /* wildcarded 'bus' */ + +/* + * Locators for PCI devices, as specified to config. + */ +#define pcicf_dev cf_loc[0] +#define PCI_UNK_DEV -1 /* wildcarded 'dev' */ + +#define pcicf_function cf_loc[1] +#define PCI_UNK_FUNCTION -1 /* wildcarded 'function' */ + +/* + * Configuration space access and utility functions. (Note that most, + * e.g. make_tag, conf_read, conf_write are declared by pci_machdep.h.) + */ +pcireg_t pci_mapreg_type(pci_chipset_tag_t, pcitag_t, int); +int pci_mapreg_info(pci_chipset_tag_t, pcitag_t, int, pcireg_t, + bus_addr_t *, bus_size_t *, int *); +int pci_mapreg_map(struct pci_attach_args *, int, pcireg_t, int, + bus_space_tag_t *, bus_space_handle_t *, bus_addr_t *, + bus_size_t *, bus_size_t); + + +int pci_io_find(pci_chipset_tag_t, pcitag_t, int, bus_addr_t *, + bus_size_t *); +int pci_mem_find(pci_chipset_tag_t, pcitag_t, int, bus_addr_t *, + bus_size_t *, int *); + +int pci_get_capability(pci_chipset_tag_t, pcitag_t, int, + int *, pcireg_t *); + +struct pci_matchid { + pci_vendor_id_t pm_vid; + pci_product_id_t pm_pid; +}; + +int pci_matchbyid(struct pci_attach_args *, const struct pci_matchid *, int); + +/* + * Helper functions for autoconfiguration. + */ +const char *pci_findvendor(pcireg_t); +void pci_devinfo(pcireg_t, pcireg_t, int, char *); +void set_pci_isa_bridge_callback(void (*)(void *), void *); +const struct pci_quirkdata * + pci_lookup_quirkdata(pci_vendor_id_t, pci_product_id_t); +void pciagp_set_pchb(struct pci_attach_args *); + +#endif /* _DEV_PCI_PCIVAR_H_ */ +/* $OpenBSD: pcivar.h,v 1.28 2003/02/28 15:26:23 mickey Exp $ */ /* $NetBSD: pcivar.h,v 1.23 1997/06/06 23:48:05 thorpej Exp $ */ /* |