if_ed_pci.c revision 17877
1290968Sngie/* 2290968Sngie * 3298107Sgjb * Copyright (c) 1996 Stefan Esser <se@freebsd.org> 4299094Sngie * All rights reserved. 5293821Sngie * 6293821Sngie * Redistribution and use in source and binary forms, with or without 7290968Sngie * modification, are permitted provided that the following conditions 8290968Sngie * are met: 9290968Sngie * 1. Redistributions of source code must retain the above copyright 10290968Sngie * notice immediately at the beginning of the file, without modification, 11290968Sngie * this list of conditions, and the following disclaimer. 12290968Sngie * 2. Redistributions in binary form must reproduce the above copyright 13290968Sngie * notice, this list of conditions and the following disclaimer in the 14290968Sngie * documentation and/or other materials provided with the distribution. 15299094Sngie * 3. Absolutely no warranty of function or purpose is made by the author 16290968Sngie * Stefan Esser. 17293821Sngie * 4. Modifications may be freely made to this file if the above conditions 18293821Sngie * are met. 19293821Sngie * 20293821Sngie * $Id: if_ed_p.c,v 1.3 1996/06/14 11:02:07 asami Exp $ 21290968Sngie */ 22 23#include "pci.h" 24#if NPCI > 0 25 26#include <sys/param.h> 27#include <sys/systm.h> 28#include <sys/malloc.h> 29#include <sys/kernel.h> 30#include <pci/pcireg.h> 31#include <pci/pcivar.h> 32 33#include <ed.h> 34 35#define PCI_DEVICE_ID_NE2000 0x802910ec 36 37extern void *ed_attach_NE2000_pci __P((int, int)); 38 39static char* ed_pci_probe __P((pcici_t tag, pcidi_t type)); 40static void ed_pci_attach __P((pcici_t config_id, int unit)); 41 42static u_long ed_pci_count = NED; 43 44static struct pci_device ed_pci_driver = { 45 "ed", 46 ed_pci_probe, 47 ed_pci_attach, 48 &ed_pci_count, 49 NULL 50}; 51 52DATA_SET (pcidevice_set, ed_pci_driver); 53 54static char* 55ed_pci_probe (pcici_t tag, pcidi_t type) 56{ 57 switch(type) { 58 case PCI_DEVICE_ID_NE2000: 59 return ("NE2000 compatible PCI Ethernet adapter"); 60 break; 61 default: 62 break; 63 } 64 return (0); 65} 66 67void edintr_sc (void*); 68 69static void 70ed_pci_attach(config_id, unit) 71 pcici_t config_id; 72 int unit; 73{ 74 u_long io_port; 75 void *ed; /* device specific data ... */ 76 77 io_port = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO; 78 79 ed = ed_attach_NE2000_pci(unit, io_port); 80 if (!ed) 81 return; 82 83 if(!(pci_map_int(config_id, edintr_sc, (void *)ed, &net_imask))) { 84 free (ed, M_DEVBUF); 85 return; 86 } 87 88 return; 89} 90 91#endif /* NPCI > 0 */ 92 93