if_ed_pci.c revision 51442
150397Sobrien/* 2104752Skan * 350397Sobrien * Copyright (c) 1996 Stefan Esser <se@freebsd.org> 450397Sobrien * All rights reserved. 550397Sobrien * 650397Sobrien * Redistribution and use in source and binary forms, with or without 750397Sobrien * modification, are permitted provided that the following conditions 850397Sobrien * are met: 950397Sobrien * 1. Redistributions of source code must retain the above copyright 1050397Sobrien * notice immediately at the beginning of the file, without modification, 1150397Sobrien * this list of conditions, and the following disclaimer. 1250397Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1350397Sobrien * notice, this list of conditions and the following disclaimer in the 1450397Sobrien * documentation and/or other materials provided with the distribution. 1550397Sobrien * 3. Absolutely no warranty of function or purpose is made by the author 1650397Sobrien * Stefan Esser. 1750397Sobrien * 4. Modifications may be freely made to this file if the above conditions 1850397Sobrien * are met. 1950397Sobrien * 2050397Sobrien * $FreeBSD: head/sys/dev/ed/if_ed_pci.c 51442 1999-09-20 05:48:16Z peter $ 2150397Sobrien */ 2250397Sobrien 2350397Sobrien#include "card.h" 2490075Sobrien#if NCARD == 0 2550397Sobrien 2650397Sobrien#include <sys/param.h> 2750397Sobrien#include <sys/systm.h> 2850397Sobrien#include <sys/socket.h> 2950397Sobrien#include <sys/kernel.h> 3052284Sobrien#include <sys/module.h> 3152284Sobrien#include <sys/bus.h> 3252284Sobrien#include <machine/bus.h> 3352284Sobrien 3452284Sobrien#include <pci/pcireg.h> 3552284Sobrien#include <pci/pcivar.h> 3652284Sobrien 3796263Sobrien#include <net/if.h> 3852284Sobrien#include <net/if_arp.h> 3952284Sobrien#include <net/if_mib.h> 4050397Sobrien 4150397Sobrien#include <dev/ed/if_edvar.h> 4250397Sobrien 4390075Sobrienstatic struct _pcsid 4490075Sobrien{ 4590075Sobrien u_int32_t type; 4690075Sobrien const char *desc; 4790075Sobrien} pci_ids[] = 4890075Sobrien{ 4990075Sobrien { 0x802910ec, "NE2000 PCI Ethernet (RealTek 8029)" }, 5090075Sobrien { 0x50004a14, "NE2000 PCI Ethernet (NetVin 5000)" }, 5150397Sobrien { 0x09401050, "NE2000 PCI Ethernet (ProLAN)" }, 5250397Sobrien { 0x140111f6, "NE2000 PCI Ethernet (Compex)" }, 5350397Sobrien { 0x30008e2e, "NE2000 PCI Ethernet (KTI)" }, 5490075Sobrien { 0x19808c4a, "NE2000 PCI Ethernet (Winbond W89C940)" }, 5550397Sobrien { 0x0e3410bd, "NE2000 PCI Ethernet (Surecom NE-34)" }, 5650397Sobrien { 0x09261106, "NE2000 PCI Ethernet (VIA VT86C926)" }, 5752284Sobrien { 0x00000000, NULL } 58104752Skan}; 59117395Skan 60104752Skanextern int ed_attach_NE2000_pci __P((device_t dev, int)); 6190075Sobrien 6250397Sobrienstatic int ed_pci_probe __P((device_t)); 6350397Sobrienstatic int ed_pci_attach __P((device_t)); 6450397Sobrien 6550397Sobrienstatic int 6650397Sobriened_pci_probe (device_t dev) 6750397Sobrien{ 6850397Sobrien u_int32_t type = pci_get_devid(dev); 6950397Sobrien struct _pcsid *ep =pci_ids; 7052284Sobrien 71104752Skan while (ep->type && ep->type != type) 72104752Skan ++ep; 73104752Skan if (ep->desc) { 7450397Sobrien device_set_desc(dev, ep->desc); 7590075Sobrien return 0; 7690075Sobrien } else { 7790075Sobrien return ENXIO; 7890075Sobrien } 7950397Sobrien} 8050397Sobrien 8150397Sobrienstatic int 8250397Sobriened_pci_attach(device_t dev) 8350397Sobrien{ 8452284Sobrien return ed_attach_NE2000_pci(dev, PCIR_MAPS); 8550397Sobrien} 8690075Sobrien 8790075Sobrienstatic device_method_t ed_pci_methods[] = { 8890075Sobrien /* Device interface */ 8990075Sobrien DEVMETHOD(device_probe, ed_pci_probe), 9090075Sobrien DEVMETHOD(device_attach, ed_pci_attach), 9150397Sobrien 9290075Sobrien { 0, 0 } 9390075Sobrien}; 9450397Sobrien 9590075Sobrienstatic driver_t ed_pci_driver = { 9650397Sobrien "ed", 97117395Skan ed_pci_methods, 98117395Skan sizeof(struct ed_softc), 9950397Sobrien}; 10090075Sobrien 10152284Sobrienstatic devclass_t ed_devclass; 10290075Sobrien 10390075SobrienDRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, 0, 0); 10490075Sobrien#endif 10590075Sobrien