diff options
author | jhay <jhay@FreeBSD.org> | 2001-01-30 10:05:44 +0000 |
---|---|---|
committer | jhay <jhay@FreeBSD.org> | 2001-01-30 10:05:44 +0000 |
commit | d692564caf2a8d032840da3aff642bbd4a3f59b8 (patch) | |
tree | 520005fe346921a27688851f01b5772f681f1525 /sys/pci | |
parent | 20531fb538e4bd455aac5804cb27948306e8977f (diff) | |
download | FreeBSD-src-d692564caf2a8d032840da3aff642bbd4a3f59b8.zip FreeBSD-src-d692564caf2a8d032840da3aff642bbd4a3f59b8.tar.gz |
The ar and sr devices have moved to sys/dev/.
Diffstat (limited to 'sys/pci')
-rw-r--r-- | sys/pci/if_ar_p.c | 170 | ||||
-rw-r--r-- | sys/pci/if_sr_p.c | 138 |
2 files changed, 0 insertions, 308 deletions
diff --git a/sys/pci/if_ar_p.c b/sys/pci/if_ar_p.c deleted file mode 100644 index ad2bfa0..0000000 --- a/sys/pci/if_ar_p.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 1999 - 2001 John Hay. - * 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. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/resource.h> -#include <machine/bus_pio.h> -#include <machine/bus_memio.h> -#include <sys/rman.h> - -#include <pci/pcireg.h> -#include <pci/pcivar.h> - -#include <i386/isa/ic/hd64570.h> -#include <i386/isa/if_arregs.h> - -#ifdef TRACE -#define TRC(x) x -#else -#define TRC(x) -#endif - -#define TRCL(x) x - -static int ar_pci_probe(device_t); -static int ar_pci_attach(device_t); - -static device_method_t ar_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ar_pci_probe), - DEVMETHOD(device_attach, ar_pci_attach), - DEVMETHOD(device_detach, ar_detach), - { 0, 0 } -}; - -static driver_t ar_pci_driver = { - "ar", - ar_pci_methods, - sizeof(struct ar_hardc), -}; - -DRIVER_MODULE(if_ar, pci, ar_pci_driver, ar_devclass, 0, 0); - -static int -ar_pci_probe(device_t device) -{ - u_int32_t type = pci_get_devid(device); - - switch(type) { - case 0x5012114f: - device_set_desc(device, "Digi SYNC/570i-PCI 2 port"); - return (0); - break; - case 0x5010114f: - printf("Digi SYNC/570i-PCI 2 port (mapped below 1M)\n"); - printf("Please change the jumper to select linear mode.\n"); - break; - case 0x5013114f: - device_set_desc(device, "Digi SYNC/570i-PCI 4 port"); - return (0); - break; - case 0x5011114f: - printf("Digi SYNC/570i-PCI 4 port (mapped below 1M)\n"); - printf("Please change the jumper to select linear mode.\n"); - break; - default: - break; - } - return (ENXIO); -} - -static int -ar_pci_attach(device_t device) -{ - int error; - u_int i, tmp; - u_char *inten; - struct ar_hardc *hc; - - hc = (struct ar_hardc *)device_get_softc(device); - bzero(hc, sizeof(struct ar_hardc)); - - error = ar_allocate_plx_memory(device, 0x10, 1); - if(error) - goto errexit; - - error = ar_allocate_memory(device, 0x18, 1); - if(error) - goto errexit; - - error = ar_allocate_irq(device, 0, 1); - if(error) - goto errexit; - - hc->plx_mem = rman_get_virtual(hc->res_plx_memory); - hc->mem_start = rman_get_virtual(hc->res_memory); - - hc->cunit = device_get_unit(device); - hc->sca[0] = (sca_regs *)(hc->mem_start + AR_PCI_SCA_1_OFFSET); - hc->sca[1] = (sca_regs *)(hc->mem_start + AR_PCI_SCA_2_OFFSET); - hc->iobase = 0; - hc->orbase = (u_char *)(hc->mem_start + AR_PCI_ORBASE_OFFSET); - - tmp = hc->orbase[AR_BMI * 4]; - hc->bustype = tmp & AR_BUS_MSK; - hc->memsize = (tmp & AR_MEM_MSK) >> AR_MEM_SHFT; - hc->memsize = 1 << hc->memsize; - hc->memsize <<= 16; - hc->interface[0] = (tmp & AR_IFACE_MSK); - tmp = hc->orbase[AR_REV * 4]; - hc->revision = tmp & AR_REV_MSK; - hc->winsize = (1 << ((tmp & AR_WSIZ_MSK) >> AR_WSIZ_SHFT)) * 16 * 1024; - hc->mem_end = (caddr_t)(hc->mem_start + hc->winsize); - hc->winmsk = hc->winsize - 1; - hc->numports = hc->orbase[AR_PNUM * 4]; - hc->handshake = hc->orbase[AR_HNDSH * 4]; - - for(i = 1; i < hc->numports; i++) - hc->interface[i] = hc->interface[0]; - - TRC(printf("arp%d: bus %x, rev %d, memstart %p, winsize %d, " - "winmsk %x, interface %x\n", - unit, hc->bustype, hc->revision, hc->mem_start, hc->winsize, - hc->winmsk, hc->interface[0])); - - ar_attach(device); - - /* Magic to enable the card to generate interrupts. */ - inten = (u_char *)hc->plx_mem; - inten[0x69] = 0x09; - - return (0); - -errexit: - ar_deallocate_resources(device); - return (ENXIO); -} - diff --git a/sys/pci/if_sr_p.c b/sys/pci/if_sr_p.c deleted file mode 100644 index b8ac2cc..0000000 --- a/sys/pci/if_sr_p.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1996 John Hay. - * Copyright (c) 1996 SDL Communications, Inc. - * 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. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -#ifdef COMPILING_LINT -#warning "The sr pci driver is broken and is not compiled with LINT" -#else - -#include "sr.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/malloc.h> - -#include <pci/pcivar.h> - -#ifndef COMPAT_OLDPCI -#error "The sr device requires the old pci compatibility shims" -#endif - -#ifndef BUGGY -#define BUGGY 0 -#endif - -/* - * The must match with the real functions in if_sr.c - */ -extern void *srattach_pci(int unit, - vm_offset_t plx_vaddr, - vm_offset_t sca_vaddr); -extern void srintr_hc(void *hc); - -static const char *sr_pci_probe(pcici_t tag, pcidi_t type); -static void sr_pci_attach(pcici_t config_id, int unit); - -static u_long src_count = NSR; - -static struct pci_device sr_pci_driver = -{ - "src", - sr_pci_probe, - sr_pci_attach, - &src_count, - NULL -}; - -COMPAT_PCI_DRIVER (sr_pci, sr_pci_driver); - -static const char * -sr_pci_probe(pcici_t tag, pcidi_t type) -{ - switch(type) { - case 0x556812aa: - return ("RISCom/N2pci"); - break; - case 0x55684778: - case 0x55684877: - /* - * XXX This can probably be removed sometime. - */ - return ("RISCom/N2pci (old id)"); - break; - default: - break; - } - return (0); -} - -static void -sr_pci_attach(pcici_t config_id, int unit) -{ - void *hc; -#if BUGGY > 0 - u_int *fecr; -#endif - vm_offset_t plx_vaddr, plx_paddr, sca_vaddr, sca_paddr; - -#if BUGGY > 0 - printf("srp: ID %x\n", pci_conf_read(config_id, 0)); - printf("srp: BADR0 %x\n", pci_conf_read(config_id, 0x10)); - printf("srp: BADR1 %x\n", pci_conf_read(config_id, 0x18)); -#endif - if(!pci_map_mem(config_id, 0x10, &plx_vaddr, &plx_paddr)) { - printf("srp: map failed.\n"); - return; - } -#if BUGGY > 0 - printf("srp: vaddr %x, paddr %x\n", plx_vaddr, plx_paddr); -#endif - if(!pci_map_mem(config_id, 0x18, &sca_vaddr, &sca_paddr)) { - printf("srp: map failed.\n"); - return; - } -#if BUGGY > 0 - printf("srp: vaddr %x, paddr %x\n", sca_vaddr, sca_paddr); - fecr = (u_int *)(sca_vaddr + 0x200); - printf("srp: FECR %x\n", *fecr); -#endif - - hc = srattach_pci(unit, plx_vaddr, sca_vaddr); - if(!hc) - return; - - if(!pci_map_int(config_id, srintr_hc, (void *)hc, &net_imask)) { - free(hc, M_DEVBUF); - return; - } -} -#endif |