if_ed_pci.c revision 20723
115813Sse/* 215813Sse * 315813Sse * Copyright (c) 1996 Stefan Esser <se@freebsd.org> 415813Sse * All rights reserved. 515813Sse * 615813Sse * Redistribution and use in source and binary forms, with or without 715813Sse * modification, are permitted provided that the following conditions 815813Sse * are met: 915813Sse * 1. Redistributions of source code must retain the above copyright 1015813Sse * notice immediately at the beginning of the file, without modification, 1115813Sse * this list of conditions, and the following disclaimer. 1215813Sse * 2. Redistributions in binary form must reproduce the above copyright 1315813Sse * notice, this list of conditions and the following disclaimer in the 1415813Sse * documentation and/or other materials provided with the distribution. 1515813Sse * 3. Absolutely no warranty of function or purpose is made by the author 1615813Sse * Stefan Esser. 1715813Sse * 4. Modifications may be freely made to this file if the above conditions 1815813Sse * are met. 1915813Sse * 2020723Sse * $Id: if_ed_p.c,v 1.5 1996/10/15 19:22:40 bde Exp $ 2115813Sse */ 2215813Sse 2317877Sbde#include "pci.h" 2415813Sse#if NPCI > 0 2515813Sse 2615813Sse#include <sys/param.h> 2715813Sse#include <sys/systm.h> 2815813Sse#include <sys/malloc.h> 2915813Sse#include <sys/kernel.h> 3015813Sse#include <pci/pcireg.h> 3115813Sse#include <pci/pcivar.h> 3215813Sse 3318946Sbde#include "ed.h" 3415813Sse 3520723Sse#define PCI_DEVICE_ID_RealTek_8029 0x802910ec 3620723Sse#define PCI_DEVICE_ID_ProLAN_NE2000 0x09401050 3720723Sse#define PCI_DEVICE_ID_Compex_NE2000 0x140111f6 3815813Sse 3916289Salexextern void *ed_attach_NE2000_pci __P((int, int)); 4016289Salex 4115813Ssestatic char* ed_pci_probe __P((pcici_t tag, pcidi_t type)); 4215813Ssestatic void ed_pci_attach __P((pcici_t config_id, int unit)); 4315813Sse 4415813Ssestatic u_long ed_pci_count = NED; 4515813Sse 4615813Ssestatic struct pci_device ed_pci_driver = { 4715813Sse "ed", 4815813Sse ed_pci_probe, 4915813Sse ed_pci_attach, 5015813Sse &ed_pci_count, 5116289Salex NULL 5215813Sse}; 5315813Sse 5415813SseDATA_SET (pcidevice_set, ed_pci_driver); 5515813Sse 5615813Ssestatic char* 5715813Sseed_pci_probe (pcici_t tag, pcidi_t type) 5815813Sse{ 5915813Sse switch(type) { 6020723Sse case PCI_DEVICE_ID_RealTek_8029: 6120723Sse return ("NE2000 PCI Ethernet (RealTek 8029)"); 6220723Sse case PCI_DEVICE_ID_ProLAN_NE2000: 6320723Sse return ("NE2000 PCI Ethernet (ProLAN)"); 6420723Sse case PCI_DEVICE_ID_Compex_NE2000: 6520723Sse return ("NE2000 PCI Ethernet (Compex)"); 6615813Sse } 6715813Sse return (0); 6815813Sse} 6915813Sse 7015813Ssevoid edintr_sc (void*); 7115813Sse 7215813Ssestatic void 7315813Sseed_pci_attach(config_id, unit) 7415813Sse pcici_t config_id; 7515813Sse int unit; 7615813Sse{ 7720723Sse int io_port; 7815813Sse void *ed; /* device specific data ... */ 7915813Sse 8015813Sse io_port = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO; 8115813Sse 8215813Sse ed = ed_attach_NE2000_pci(unit, io_port); 8315813Sse if (!ed) 8415813Sse return; 8515813Sse 8615813Sse if(!(pci_map_int(config_id, edintr_sc, (void *)ed, &net_imask))) { 8715813Sse free (ed, M_DEVBUF); 8815813Sse return; 8915813Sse } 9015813Sse 9115813Sse return; 9215813Sse} 9315813Sse 9415813Sse#endif /* NPCI > 0 */ 9515813Sse 96