You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sis900.c 34KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282
  1. /* -*- Mode:C; c-basic-offset:4; -*- */
  2. /*
  3. sis900.c: An SiS 900/7016 PCI Fast Ethernet driver for Etherboot
  4. Copyright (C) 2001 Entity Cyber, Inc.
  5. Revision: 1.0 March 1, 2001
  6. Author: Marty Connor (mdc@thinguin.org)
  7. Adapted from a Linux driver which was written by Donald Becker
  8. and modified by Ollie Lho and Chin-Shan Li of SiS Corporation.
  9. Rewritten for Etherboot by Marty Connor.
  10. This software may be used and distributed according to the terms
  11. of the GNU Public License (GPL), incorporated herein by reference.
  12. References:
  13. SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support,
  14. preliminary Rev. 1.0 Jan. 14, 1998
  15. SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support,
  16. preliminary Rev. 1.0 Nov. 10, 1998
  17. SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution,
  18. preliminary Rev. 1.0 Jan. 18, 1998
  19. http://www.sis.com.tw/support/databook.htm */
  20. /* Revision History */
  21. /*
  22. 07 Dec 2003 timlegge - Enabled Multicast Support
  23. 06 Dec 2003 timlegge - Fixed relocation issue in 5.2
  24. 04 Jan 2002 Chien-Yu Chen, Doug Ambrisko, Marty Connor Patch to Etherboot 5.0.5
  25. Added support for the SiS 630ET plus various bug fixes from linux kernel
  26. source 2.4.17.
  27. 01 March 2001 mdc 1.0
  28. Initial Release. Tested with PCI based sis900 card and ThinkNIC
  29. computer.
  30. 20 March 2001 P.Koegel
  31. added support for sis630e and PHY ICS1893 and RTL8201
  32. Testet with SIS730S chipset + ICS1893
  33. */
  34. /* Includes */
  35. #include "etherboot.h"
  36. #include "dev.h"
  37. #include <gpxe/pci.h>
  38. #include "nic.h"
  39. #include "timer.h"
  40. #include "sis900.h"
  41. /* Globals */
  42. static struct nic_operations sis900_operations;
  43. static int sis900_debug = 0;
  44. static unsigned short vendor, dev_id;
  45. static unsigned long ioaddr;
  46. static u8 pci_revision;
  47. static unsigned int cur_phy;
  48. static unsigned int cur_rx;
  49. struct {
  50. BufferDesc txd;
  51. BufferDesc rxd[NUM_RX_DESC];
  52. unsigned char txb[TX_BUF_SIZE];
  53. unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
  54. } sis900_bufs __shared;
  55. #define txd sis900_bufs.txd
  56. #define rxd sis900_bufs.rxd
  57. #define txb sis900_bufs.txb
  58. #define rxb sis900_bufs.rxb
  59. #if 0
  60. static struct mac_chip_info {
  61. const char *name;
  62. u16 vendor_id, device_id, flags;
  63. int io_size;
  64. } mac_chip_table[] = {
  65. { "SiS 900 PCI Fast Ethernet", PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS900,
  66. PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE},
  67. { "SiS 7016 PCI Fast Ethernet",PCI_VENDOR_ID_SIS, PCI_DEVICE_ID_SIS7016,
  68. PCI_COMMAND_IO|PCI_COMMAND_MASTER, SIS900_TOTAL_SIZE},
  69. {0,0,0,0,0} /* 0 terminated list. */
  70. };
  71. #endif
  72. static void sis900_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
  73. static void amd79c901_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
  74. static void ics1893_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
  75. static void rtl8201_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
  76. static void vt6103_read_mode(struct nic *nic, int phy_addr, int *speed, int *duplex);
  77. static struct mii_chip_info {
  78. const char * name;
  79. u16 phy_id0;
  80. u16 phy_id1;
  81. void (*read_mode) (struct nic *nic, int phy_addr, int *speed, int *duplex);
  82. } mii_chip_table[] = {
  83. {"SiS 900 Internal MII PHY", 0x001d, 0x8000, sis900_read_mode},
  84. {"SiS 7014 Physical Layer Solution", 0x0016, 0xf830,sis900_read_mode},
  85. {"AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, amd79c901_read_mode},
  86. {"AMD 79C901 HomePNA PHY", 0x0000, 0x6B90, amd79c901_read_mode},
  87. {"ICS 1893 Integrated PHYceiver" , 0x0015, 0xf440,ics1893_read_mode},
  88. // {"NS 83851 PHY",0x2000, 0x5C20, MIX },
  89. {"RTL 8201 10/100Mbps Phyceiver" , 0x0000, 0x8200,rtl8201_read_mode},
  90. {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
  91. {0,0,0,0}
  92. };
  93. static struct mii_phy {
  94. struct mii_phy * next;
  95. struct mii_chip_info * chip_info;
  96. int phy_addr;
  97. u16 status;
  98. } mii;
  99. #if 0
  100. // PCI to ISA bridge for SIS640E access
  101. static struct pci_device_id pci_isa_bridge_list[] = {
  102. { .vendor = 0x1039, .device = 0x0008,
  103. .name = "SIS 85C503/5513 PCI to ISA bridge"},
  104. };
  105. PCI_DRIVER( sis_bridge_pci_driver, pci_isa_bridge_list, PCI_NO_CLASS );
  106. static struct device_driver sis_bridge_driver = {
  107. .name = "SIS ISA bridge",
  108. .bus_driver = &pci_driver,
  109. .bus_driver_info = ( struct bus_driver_info * ) &sis_bridge_pci_driver,
  110. };
  111. #endif
  112. /* Function Prototypes */
  113. static int sis900_probe(struct nic *nic,struct pci_device *pci);
  114. static u16 sis900_read_eeprom(int location);
  115. static void sis900_mdio_reset(long mdio_addr);
  116. static void sis900_mdio_idle(long mdio_addr);
  117. static u16 sis900_mdio_read(int phy_id, int location);
  118. #if 0
  119. static void sis900_mdio_write(int phy_id, int location, int val);
  120. #endif
  121. static void sis900_init(struct nic *nic);
  122. static void sis900_reset(struct nic *nic);
  123. static void sis900_init_rxfilter(struct nic *nic);
  124. static void sis900_init_txd(struct nic *nic);
  125. static void sis900_init_rxd(struct nic *nic);
  126. static void sis900_set_rx_mode(struct nic *nic);
  127. static void sis900_check_mode(struct nic *nic);
  128. static void sis900_transmit(struct nic *nic, const char *d,
  129. unsigned int t, unsigned int s, const char *p);
  130. static int sis900_poll(struct nic *nic, int retrieve);
  131. static void sis900_disable(struct nic *nic);
  132. static void sis900_irq(struct nic *nic, irq_action_t action);
  133. /**
  134. * sis900_get_mac_addr: - Get MAC address for stand alone SiS900 model
  135. * @pci_dev: the sis900 pci device
  136. * @net_dev: the net device to get address for
  137. *
  138. * Older SiS900 and friends, use EEPROM to store MAC address.
  139. * MAC address is read from read_eeprom() into @net_dev->dev_addr.
  140. */
  141. static int sis900_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
  142. {
  143. u16 signature;
  144. int i;
  145. /* check to see if we have sane EEPROM */
  146. signature = (u16) sis900_read_eeprom( EEPROMSignature);
  147. if (signature == 0xffff || signature == 0x0000) {
  148. printf ("sis900_probe: Error EERPOM read %hX\n", signature);
  149. return 0;
  150. }
  151. /* get MAC address from EEPROM */
  152. for (i = 0; i < 3; i++)
  153. ((u16 *)(nic->node_addr))[i] = sis900_read_eeprom(i+EEPROMMACAddr);
  154. return 1;
  155. }
  156. /**
  157. * sis96x_get_mac_addr: - Get MAC address for SiS962 or SiS963 model
  158. * @pci_dev: the sis900 pci device
  159. * @net_dev: the net device to get address for
  160. *
  161. * SiS962 or SiS963 model, use EEPROM to store MAC address. And EEPROM
  162. * is shared by
  163. * LAN and 1394. When access EEPROM, send EEREQ signal to hardware first
  164. * and wait for EEGNT. If EEGNT is ON, EEPROM is permitted to be access
  165. * by LAN, otherwise is not. After MAC address is read from EEPROM, send
  166. * EEDONE signal to refuse EEPROM access by LAN.
  167. * The EEPROM map of SiS962 or SiS963 is different to SiS900.
  168. * The signature field in SiS962 or SiS963 spec is meaningless.
  169. * MAC address is read into @net_dev->dev_addr.
  170. */
  171. static int sis96x_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
  172. {
  173. /* long ioaddr = net_dev->base_addr; */
  174. long ee_addr = ioaddr + mear;
  175. u32 waittime = 0;
  176. int i;
  177. printf("Alternate function\n");
  178. outl(EEREQ, ee_addr);
  179. while(waittime < 2000) {
  180. if(inl(ee_addr) & EEGNT) {
  181. /* get MAC address from EEPROM */
  182. for (i = 0; i < 3; i++)
  183. ((u16 *)(nic->node_addr))[i] = sis900_read_eeprom(i+EEPROMMACAddr);
  184. outl(EEDONE, ee_addr);
  185. return 1;
  186. } else {
  187. udelay(1);
  188. waittime ++;
  189. }
  190. }
  191. outl(EEDONE, ee_addr);
  192. return 0;
  193. }
  194. /**
  195. * sis630e_get_mac_addr: - Get MAC address for SiS630E model
  196. * @pci_dev: the sis900 pci device
  197. * @net_dev: the net device to get address for
  198. *
  199. * SiS630E model, use APC CMOS RAM to store MAC address.
  200. * APC CMOS RAM is accessed through ISA bridge.
  201. * MAC address is read into @net_dev->dev_addr.
  202. */
  203. static int sis630e_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
  204. {
  205. u8 reg;
  206. int i;
  207. #if 0
  208. struct bus_loc bus_loc;
  209. #endif
  210. union {
  211. struct bus_dev bus_dev;
  212. struct pci_device isa_bridge;
  213. } u;
  214. #if 0
  215. /* find PCI to ISA bridge */
  216. memset(&bus_loc, 0, sizeof(bus_loc));
  217. if ( ! find_by_driver ( &bus_loc, &u.bus_dev, &sis_bridge_driver, 0 ) )
  218. return 0;
  219. #endif
  220. pci_read_config_byte(&u.isa_bridge, 0x48, &reg);
  221. pci_write_config_byte(&u.isa_bridge, 0x48, reg | 0x40);
  222. for (i = 0; i < ETH_ALEN; i++)
  223. {
  224. outb(0x09 + i, 0x70);
  225. ((u8 *)(nic->node_addr))[i] = inb(0x71);
  226. }
  227. pci_write_config_byte(&u.isa_bridge, 0x48, reg & ~0x40);
  228. return 1;
  229. }
  230. /**
  231. * sis630e_get_mac_addr: - Get MAC address for SiS630E model
  232. * @pci_dev: the sis900 pci device
  233. * @net_dev: the net device to get address for
  234. *
  235. * SiS630E model, use APC CMOS RAM to store MAC address.
  236. * APC CMOS RAM is accessed through ISA bridge.
  237. * MAC address is read into @net_dev->dev_addr.
  238. */
  239. static int sis635_get_mac_addr(struct pci_device * pci_dev __unused, struct nic *nic)
  240. {
  241. u32 rfcrSave;
  242. u32 i;
  243. rfcrSave = inl(rfcr + ioaddr);
  244. outl(rfcrSave | RELOAD, ioaddr + cr);
  245. outl(0, ioaddr + cr);
  246. /* disable packet filtering before setting filter */
  247. outl(rfcrSave & ~RFEN, rfcr + ioaddr);
  248. /* load MAC addr to filter data register */
  249. for (i = 0 ; i < 3 ; i++) {
  250. outl((i << RFADDR_shift), ioaddr + rfcr);
  251. *( ((u16 *)nic->node_addr) + i) = inw(ioaddr + rfdr);
  252. }
  253. /* enable packet filitering */
  254. outl(rfcrSave | RFEN, rfcr + ioaddr);
  255. return 1;
  256. }
  257. /*
  258. * Function: sis900_probe
  259. *
  260. * Description: initializes initializes the NIC, retrieves the
  261. * MAC address of the card, and sets up some globals required by
  262. * other routines.
  263. *
  264. * Side effects:
  265. * leaves the ioaddress of the sis900 chip in the variable ioaddr.
  266. * leaves the sis900 initialized, and ready to recieve packets.
  267. *
  268. * Returns: struct nic *: pointer to NIC data structure
  269. */
  270. static int sis900_probe ( struct nic *nic, struct pci_device *pci ) {
  271. int i;
  272. int found=0;
  273. int phy_addr;
  274. u8 revision;
  275. int ret;
  276. if (pci->ioaddr == 0)
  277. return 0;
  278. nic->irqno = 0;
  279. pci_fill_nic ( nic, pci );
  280. nic->ioaddr = pci->ioaddr;
  281. ioaddr = pci->ioaddr;
  282. vendor = pci->vendor;
  283. dev_id = pci->device;
  284. /* wakeup chip */
  285. pci_write_config_dword(pci, 0x40, 0x00000000);
  286. adjust_pci_device(pci);
  287. /* get MAC address */
  288. ret = 0;
  289. pci_read_config_byte(pci, PCI_REVISION, &revision);
  290. /* save for use later in sis900_reset() */
  291. pci_revision = revision;
  292. if (revision == SIS630E_900_REV)
  293. ret = sis630e_get_mac_addr(pci, nic);
  294. else if ((revision > 0x81) && (revision <= 0x90))
  295. ret = sis635_get_mac_addr(pci, nic);
  296. else if (revision == SIS96x_900_REV)
  297. ret = sis96x_get_mac_addr(pci, nic);
  298. else
  299. ret = sis900_get_mac_addr(pci, nic);
  300. if (ret == 0)
  301. {
  302. printf ("sis900_probe: Error MAC address not found\n");
  303. return 0;
  304. }
  305. /* 630ET : set the mii access mode as software-mode */
  306. if (revision == SIS630ET_900_REV)
  307. outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);
  308. DBG( "sis900_probe: Vendor:%#hX Device:%#hX\n", vendor, dev_id );
  309. /* probe for mii transceiver */
  310. /* search for total of 32 possible mii phy addresses */
  311. found = 0;
  312. for (phy_addr = 0; phy_addr < 32; phy_addr++) {
  313. u16 mii_status;
  314. u16 phy_id0, phy_id1;
  315. mii_status = sis900_mdio_read(phy_addr, MII_STATUS);
  316. if (mii_status == 0xffff || mii_status == 0x0000)
  317. /* the mii is not accessable, try next one */
  318. continue;
  319. phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
  320. phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
  321. /* search our mii table for the current mii */
  322. for (i = 0; mii_chip_table[i].phy_id1; i++) {
  323. if ((phy_id0 == mii_chip_table[i].phy_id0) &&
  324. ((phy_id1 & 0xFFF0) == mii_chip_table[i].phy_id1)){
  325. printf("sis900_probe: %s transceiver found at address %d.\n",
  326. mii_chip_table[i].name, phy_addr);
  327. mii.chip_info = &mii_chip_table[i];
  328. mii.phy_addr = phy_addr;
  329. mii.status = sis900_mdio_read(phy_addr, MII_STATUS);
  330. mii.next = NULL;
  331. found=1;
  332. break;
  333. }
  334. }
  335. }
  336. if (found == 0) {
  337. printf("sis900_probe: No MII transceivers found!\n");
  338. return 0;
  339. }
  340. /* Arbitrarily select the last PHY found as current PHY */
  341. cur_phy = mii.phy_addr;
  342. printf("sis900_probe: Using %s as default\n", mii.chip_info->name);
  343. /* initialize device */
  344. sis900_init(nic);
  345. nic->nic_op = &sis900_operations;
  346. return 1;
  347. }
  348. /*
  349. * EEPROM Routines: These functions read and write to EEPROM for
  350. * retrieving the MAC address and other configuration information about
  351. * the card.
  352. */
  353. /* Delay between EEPROM clock transitions. */
  354. #define eeprom_delay() inl(ee_addr)
  355. /* Function: sis900_read_eeprom
  356. *
  357. * Description: reads and returns a given location from EEPROM
  358. *
  359. * Arguments: int location: requested EEPROM location
  360. *
  361. * Returns: u16: contents of requested EEPROM location
  362. *
  363. */
  364. /* Read Serial EEPROM through EEPROM Access Register, Note that location is
  365. in word (16 bits) unit */
  366. static u16 sis900_read_eeprom(int location)
  367. {
  368. int i;
  369. u16 retval = 0;
  370. long ee_addr = ioaddr + mear;
  371. u32 read_cmd = location | EEread;
  372. outl(0, ee_addr);
  373. eeprom_delay();
  374. outl(EECS, ee_addr);
  375. eeprom_delay();
  376. /* Shift the read command (9) bits out. */
  377. for (i = 8; i >= 0; i--) {
  378. u32 dataval = (read_cmd & (1 << i)) ? EEDI | EECS : EECS;
  379. outl(dataval, ee_addr);
  380. eeprom_delay();
  381. outl(dataval | EECLK, ee_addr);
  382. eeprom_delay();
  383. }
  384. outl(EECS, ee_addr);
  385. eeprom_delay();
  386. /* read the 16-bits data in */
  387. for (i = 16; i > 0; i--) {
  388. outl(EECS, ee_addr);
  389. eeprom_delay();
  390. outl(EECS | EECLK, ee_addr);
  391. eeprom_delay();
  392. retval = (retval << 1) | ((inl(ee_addr) & EEDO) ? 1 : 0);
  393. eeprom_delay();
  394. }
  395. /* Terminate the EEPROM access. */
  396. outl(0, ee_addr);
  397. eeprom_delay();
  398. // outl(EECLK, ee_addr);
  399. return (retval);
  400. }
  401. #define sis900_mdio_delay() inl(mdio_addr)
  402. /*
  403. Read and write the MII management registers using software-generated
  404. serial MDIO protocol. Note that the command bits and data bits are
  405. send out seperately
  406. */
  407. static void sis900_mdio_idle(long mdio_addr)
  408. {
  409. outl(MDIO | MDDIR, mdio_addr);
  410. sis900_mdio_delay();
  411. outl(MDIO | MDDIR | MDC, mdio_addr);
  412. }
  413. /* Syncronize the MII management interface by shifting 32 one bits out. */
  414. static void sis900_mdio_reset(long mdio_addr)
  415. {
  416. int i;
  417. for (i = 31; i >= 0; i--) {
  418. outl(MDDIR | MDIO, mdio_addr);
  419. sis900_mdio_delay();
  420. outl(MDDIR | MDIO | MDC, mdio_addr);
  421. sis900_mdio_delay();
  422. }
  423. return;
  424. }
  425. static u16 sis900_mdio_read(int phy_id, int location)
  426. {
  427. long mdio_addr = ioaddr + mear;
  428. int mii_cmd = MIIread|(phy_id<<MIIpmdShift)|(location<<MIIregShift);
  429. u16 retval = 0;
  430. int i;
  431. sis900_mdio_reset(mdio_addr);
  432. sis900_mdio_idle(mdio_addr);
  433. for (i = 15; i >= 0; i--) {
  434. int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR;
  435. outl(dataval, mdio_addr);
  436. sis900_mdio_delay();
  437. outl(dataval | MDC, mdio_addr);
  438. sis900_mdio_delay();
  439. }
  440. /* Read the 16 data bits. */
  441. for (i = 16; i > 0; i--) {
  442. outl(0, mdio_addr);
  443. sis900_mdio_delay();
  444. retval = (retval << 1) | ((inl(mdio_addr) & MDIO) ? 1 : 0);
  445. outl(MDC, mdio_addr);
  446. sis900_mdio_delay();
  447. }
  448. outl(0x00, mdio_addr);
  449. return retval;
  450. }
  451. #if 0
  452. static void sis900_mdio_write(int phy_id, int location, int value)
  453. {
  454. long mdio_addr = ioaddr + mear;
  455. int mii_cmd = MIIwrite|(phy_id<<MIIpmdShift)|(location<<MIIregShift);
  456. int i;
  457. sis900_mdio_reset(mdio_addr);
  458. sis900_mdio_idle(mdio_addr);
  459. /* Shift the command bits out. */
  460. for (i = 15; i >= 0; i--) {
  461. int dataval = (mii_cmd & (1 << i)) ? MDDIR | MDIO : MDDIR;
  462. outb(dataval, mdio_addr);
  463. sis900_mdio_delay();
  464. outb(dataval | MDC, mdio_addr);
  465. sis900_mdio_delay();
  466. }
  467. sis900_mdio_delay();
  468. /* Shift the value bits out. */
  469. for (i = 15; i >= 0; i--) {
  470. int dataval = (value & (1 << i)) ? MDDIR | MDIO : MDDIR;
  471. outl(dataval, mdio_addr);
  472. sis900_mdio_delay();
  473. outl(dataval | MDC, mdio_addr);
  474. sis900_mdio_delay();
  475. }
  476. sis900_mdio_delay();
  477. /* Clear out extra bits. */
  478. for (i = 2; i > 0; i--) {
  479. outb(0, mdio_addr);
  480. sis900_mdio_delay();
  481. outb(MDC, mdio_addr);
  482. sis900_mdio_delay();
  483. }
  484. outl(0x00, mdio_addr);
  485. return;
  486. }
  487. #endif
  488. /* Function: sis900_init
  489. *
  490. * Description: resets the ethernet controller chip and various
  491. * data structures required for sending and receiving packets.
  492. *
  493. * Arguments: struct nic *nic: NIC data structure
  494. *
  495. * returns: void.
  496. */
  497. static void
  498. sis900_init(struct nic *nic)
  499. {
  500. /* Soft reset the chip. */
  501. sis900_reset(nic);
  502. sis900_init_rxfilter(nic);
  503. sis900_init_txd(nic);
  504. sis900_init_rxd(nic);
  505. sis900_set_rx_mode(nic);
  506. sis900_check_mode(nic);
  507. outl(RxENA| inl(ioaddr + cr), ioaddr + cr);
  508. }
  509. /*
  510. * Function: sis900_reset
  511. *
  512. * Description: disables interrupts and soft resets the controller chip
  513. *
  514. * Arguments: struct nic *nic: NIC data structure
  515. *
  516. * Returns: void.
  517. */
  518. static void
  519. sis900_reset(struct nic *nic __unused)
  520. {
  521. int i = 0;
  522. u32 status = TxRCMP | RxRCMP;
  523. outl(0, ioaddr + ier);
  524. outl(0, ioaddr + imr);
  525. outl(0, ioaddr + rfcr);
  526. outl(RxRESET | TxRESET | RESET | inl(ioaddr + cr), ioaddr + cr);
  527. /* Check that the chip has finished the reset. */
  528. while (status && (i++ < 1000)) {
  529. status ^= (inl(isr + ioaddr) & status);
  530. }
  531. if( (pci_revision >= SIS635A_900_REV) || (pci_revision == SIS900B_900_REV) )
  532. outl(PESEL | RND_CNT, ioaddr + cfg);
  533. else
  534. outl(PESEL, ioaddr + cfg);
  535. }
  536. /* Function: sis_init_rxfilter
  537. *
  538. * Description: sets receive filter address to our MAC address
  539. *
  540. * Arguments: struct nic *nic: NIC data structure
  541. *
  542. * returns: void.
  543. */
  544. static void
  545. sis900_init_rxfilter(struct nic *nic)
  546. {
  547. u32 rfcrSave;
  548. int i;
  549. rfcrSave = inl(rfcr + ioaddr);
  550. /* disable packet filtering before setting filter */
  551. outl(rfcrSave & ~RFEN, rfcr + ioaddr);
  552. /* load MAC addr to filter data register */
  553. for (i = 0 ; i < 3 ; i++) {
  554. u32 w;
  555. w = (u32) *((u16 *)(nic->node_addr)+i);
  556. outl((i << RFADDR_shift), ioaddr + rfcr);
  557. outl(w, ioaddr + rfdr);
  558. if (sis900_debug > 0)
  559. printf("sis900_init_rxfilter: Receive Filter Addrss[%d]=%lX\n",
  560. i, inl(ioaddr + rfdr));
  561. }
  562. /* enable packet filitering */
  563. outl(rfcrSave | RFEN, rfcr + ioaddr);
  564. }
  565. /*
  566. * Function: sis_init_txd
  567. *
  568. * Description: initializes the Tx descriptor
  569. *
  570. * Arguments: struct nic *nic: NIC data structure
  571. *
  572. * returns: void.
  573. */
  574. static void
  575. sis900_init_txd(struct nic *nic __unused)
  576. {
  577. txd.link = (u32) 0;
  578. txd.cmdsts = (u32) 0;
  579. txd.bufptr = virt_to_bus(&txb[0]);
  580. /* load Transmit Descriptor Register */
  581. outl(virt_to_bus(&txd), ioaddr + txdp);
  582. if (sis900_debug > 0)
  583. printf("sis900_init_txd: TX descriptor register loaded with: %lX\n",
  584. inl(ioaddr + txdp));
  585. }
  586. /* Function: sis_init_rxd
  587. *
  588. * Description: initializes the Rx descriptor ring
  589. *
  590. * Arguments: struct nic *nic: NIC data structure
  591. *
  592. * Returns: void.
  593. */
  594. static void
  595. sis900_init_rxd(struct nic *nic __unused)
  596. {
  597. int i;
  598. cur_rx = 0;
  599. /* init RX descriptor */
  600. for (i = 0; i < NUM_RX_DESC; i++) {
  601. rxd[i].link = virt_to_bus((i+1 < NUM_RX_DESC) ? &rxd[i+1] : &rxd[0]);
  602. rxd[i].cmdsts = (u32) RX_BUF_SIZE;
  603. rxd[i].bufptr = virt_to_bus(&rxb[i*RX_BUF_SIZE]);
  604. if (sis900_debug > 0)
  605. printf("sis900_init_rxd: rxd[%d]=%p link=%X cmdsts=%X bufptr=%X\n",
  606. i, &rxd[i], rxd[i].link, rxd[i].cmdsts, rxd[i].bufptr);
  607. }
  608. /* load Receive Descriptor Register */
  609. outl(virt_to_bus(&rxd[0]), ioaddr + rxdp);
  610. if (sis900_debug > 0)
  611. printf("sis900_init_rxd: RX descriptor register loaded with: %lX\n",
  612. inl(ioaddr + rxdp));
  613. }
  614. /* Function: sis_init_rxd
  615. *
  616. * Description:
  617. * sets the receive mode to accept all broadcast packets and packets
  618. * with our MAC address, and reject all multicast packets.
  619. *
  620. * Arguments: struct nic *nic: NIC data structure
  621. *
  622. * Returns: void.
  623. */
  624. static void sis900_set_rx_mode(struct nic *nic __unused)
  625. {
  626. int i, table_entries;
  627. u32 rx_mode;
  628. u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */
  629. if((pci_revision == SIS635A_900_REV) || (pci_revision == SIS900B_900_REV))
  630. table_entries = 16;
  631. else
  632. table_entries = 8;
  633. /* accept all multicast packet */
  634. rx_mode = RFAAB | RFAAM;
  635. for (i = 0; i < table_entries; i++)
  636. mc_filter[i] = 0xffff;
  637. /* update Multicast Hash Table in Receive Filter */
  638. for (i = 0; i < table_entries; i++) {
  639. /* why plus 0x04? That makes the correct value for hash table. */
  640. outl((u32)(0x00000004+i) << RFADDR_shift, ioaddr + rfcr);
  641. outl(mc_filter[i], ioaddr + rfdr);
  642. }
  643. /* Accept Broadcast and multicast packets, destination addresses that match
  644. our MAC address */
  645. outl(RFEN | rx_mode, ioaddr + rfcr);
  646. return;
  647. }
  648. /* Function: sis900_check_mode
  649. *
  650. * Description: checks the state of transmit and receive
  651. * parameters on the NIC, and updates NIC registers to match
  652. *
  653. * Arguments: struct nic *nic: NIC data structure
  654. *
  655. * Returns: void.
  656. */
  657. static void
  658. sis900_check_mode(struct nic *nic)
  659. {
  660. int speed, duplex;
  661. u32 tx_flags = 0, rx_flags = 0;
  662. mii.chip_info->read_mode(nic, cur_phy, &speed, &duplex);
  663. if( inl(ioaddr + cfg) & EDB_MASTER_EN ) {
  664. tx_flags = TxATP | (DMA_BURST_64 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift);
  665. rx_flags = DMA_BURST_64 << RxMXDMA_shift;
  666. }
  667. else {
  668. tx_flags = TxATP | (DMA_BURST_512 << TxMXDMA_shift) | (TX_FILL_THRESH << TxFILLT_shift);
  669. rx_flags = DMA_BURST_512 << RxMXDMA_shift;
  670. }
  671. if (speed == HW_SPEED_HOME || speed == HW_SPEED_10_MBPS) {
  672. rx_flags |= (RxDRNT_10 << RxDRNT_shift);
  673. tx_flags |= (TxDRNT_10 << TxDRNT_shift);
  674. }
  675. else {
  676. rx_flags |= (RxDRNT_100 << RxDRNT_shift);
  677. tx_flags |= (TxDRNT_100 << TxDRNT_shift);
  678. }
  679. if (duplex == FDX_CAPABLE_FULL_SELECTED) {
  680. tx_flags |= (TxCSI | TxHBI);
  681. rx_flags |= RxATX;
  682. }
  683. outl (tx_flags, ioaddr + txcfg);
  684. outl (rx_flags, ioaddr + rxcfg);
  685. }
  686. /* Function: sis900_read_mode
  687. *
  688. * Description: retrieves and displays speed and duplex
  689. * parameters from the NIC
  690. *
  691. * Arguments: struct nic *nic: NIC data structure
  692. *
  693. * Returns: void.
  694. */
  695. static void
  696. sis900_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
  697. {
  698. int i = 0;
  699. u32 status;
  700. u16 phy_id0, phy_id1;
  701. /* STSOUT register is Latched on Transition, read operation updates it */
  702. while (i++ < 2)
  703. status = sis900_mdio_read(phy_addr, MII_STSOUT);
  704. *speed = HW_SPEED_10_MBPS;
  705. *duplex = FDX_CAPABLE_HALF_SELECTED;
  706. if (status & (MII_NWAY_TX | MII_NWAY_TX_FDX))
  707. *speed = HW_SPEED_100_MBPS;
  708. if (status & ( MII_NWAY_TX_FDX | MII_NWAY_T_FDX))
  709. *duplex = FDX_CAPABLE_FULL_SELECTED;
  710. /* Workaround for Realtek RTL8201 PHY issue */
  711. phy_id0 = sis900_mdio_read(phy_addr, MII_PHY_ID0);
  712. phy_id1 = sis900_mdio_read(phy_addr, MII_PHY_ID1);
  713. if((phy_id0 == 0x0000) && ((phy_id1 & 0xFFF0) == 0x8200)){
  714. if(sis900_mdio_read(phy_addr, MII_CONTROL) & MII_CNTL_FDX)
  715. *duplex = FDX_CAPABLE_FULL_SELECTED;
  716. if(sis900_mdio_read(phy_addr, 0x0019) & 0x01)
  717. *speed = HW_SPEED_100_MBPS;
  718. }
  719. if (status & MII_STSOUT_LINK_FAIL)
  720. printf("sis900_read_mode: Media Link Off\n");
  721. else
  722. printf("sis900_read_mode: Media Link On %s %s-duplex \n",
  723. *speed == HW_SPEED_100_MBPS ?
  724. "100mbps" : "10mbps",
  725. *duplex == FDX_CAPABLE_FULL_SELECTED ?
  726. "full" : "half");
  727. }
  728. /* Function: amd79c901_read_mode
  729. *
  730. * Description: retrieves and displays speed and duplex
  731. * parameters from the NIC
  732. *
  733. * Arguments: struct nic *nic: NIC data structure
  734. *
  735. * Returns: void.
  736. */
  737. static void
  738. amd79c901_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
  739. {
  740. int i;
  741. u16 status;
  742. for (i = 0; i < 2; i++)
  743. status = sis900_mdio_read(phy_addr, MII_STATUS);
  744. if (status & MII_STAT_CAN_AUTO) {
  745. /* 10BASE-T PHY */
  746. for (i = 0; i < 2; i++)
  747. status = sis900_mdio_read(phy_addr, MII_STATUS_SUMMARY);
  748. if (status & MII_STSSUM_SPD)
  749. *speed = HW_SPEED_100_MBPS;
  750. else
  751. *speed = HW_SPEED_10_MBPS;
  752. if (status & MII_STSSUM_DPLX)
  753. *duplex = FDX_CAPABLE_FULL_SELECTED;
  754. else
  755. *duplex = FDX_CAPABLE_HALF_SELECTED;
  756. if (status & MII_STSSUM_LINK)
  757. printf("amd79c901_read_mode: Media Link On %s %s-duplex \n",
  758. *speed == HW_SPEED_100_MBPS ?
  759. "100mbps" : "10mbps",
  760. *duplex == FDX_CAPABLE_FULL_SELECTED ?
  761. "full" : "half");
  762. else
  763. printf("amd79c901_read_mode: Media Link Off\n");
  764. }
  765. else {
  766. /* HomePNA */
  767. *speed = HW_SPEED_HOME;
  768. *duplex = FDX_CAPABLE_HALF_SELECTED;
  769. if (status & MII_STAT_LINK)
  770. printf("amd79c901_read_mode:Media Link On 1mbps half-duplex \n");
  771. else
  772. printf("amd79c901_read_mode: Media Link Off\n");
  773. }
  774. }
  775. /**
  776. * ics1893_read_mode: - read media mode for ICS1893 PHY
  777. * @net_dev: the net device to read mode for
  778. * @phy_addr: mii phy address
  779. * @speed: the transmit speed to be determined
  780. * @duplex: the duplex mode to be determined
  781. *
  782. * ICS1893 PHY use Quick Poll Detailed Status register
  783. * to determine the speed and duplex mode for sis900
  784. */
  785. static void ics1893_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
  786. {
  787. int i = 0;
  788. u32 status;
  789. /* MII_QPDSTS is Latched, read twice in succession will reflect the current state */
  790. for (i = 0; i < 2; i++)
  791. status = sis900_mdio_read(phy_addr, MII_QPDSTS);
  792. if (status & MII_STSICS_SPD)
  793. *speed = HW_SPEED_100_MBPS;
  794. else
  795. *speed = HW_SPEED_10_MBPS;
  796. if (status & MII_STSICS_DPLX)
  797. *duplex = FDX_CAPABLE_FULL_SELECTED;
  798. else
  799. *duplex = FDX_CAPABLE_HALF_SELECTED;
  800. if (status & MII_STSICS_LINKSTS)
  801. printf("ics1893_read_mode: Media Link On %s %s-duplex \n",
  802. *speed == HW_SPEED_100_MBPS ?
  803. "100mbps" : "10mbps",
  804. *duplex == FDX_CAPABLE_FULL_SELECTED ?
  805. "full" : "half");
  806. else
  807. printf("ics1893_read_mode: Media Link Off\n");
  808. }
  809. /**
  810. * rtl8201_read_mode: - read media mode for rtl8201 phy
  811. * @nic: the net device to read mode for
  812. * @phy_addr: mii phy address
  813. * @speed: the transmit speed to be determined
  814. * @duplex: the duplex mode to be determined
  815. *
  816. * read MII_STATUS register from rtl8201 phy
  817. * to determine the speed and duplex mode for sis900
  818. */
  819. static void rtl8201_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
  820. {
  821. u32 status;
  822. status = sis900_mdio_read(phy_addr, MII_STATUS);
  823. if (status & MII_STAT_CAN_TX_FDX) {
  824. *speed = HW_SPEED_100_MBPS;
  825. *duplex = FDX_CAPABLE_FULL_SELECTED;
  826. }
  827. else if (status & MII_STAT_CAN_TX) {
  828. *speed = HW_SPEED_100_MBPS;
  829. *duplex = FDX_CAPABLE_HALF_SELECTED;
  830. }
  831. else if (status & MII_STAT_CAN_T_FDX) {
  832. *speed = HW_SPEED_10_MBPS;
  833. *duplex = FDX_CAPABLE_FULL_SELECTED;
  834. }
  835. else if (status & MII_STAT_CAN_T) {
  836. *speed = HW_SPEED_10_MBPS;
  837. *duplex = FDX_CAPABLE_HALF_SELECTED;
  838. }
  839. if (status & MII_STAT_LINK)
  840. printf("rtl8201_read_mode: Media Link On %s %s-duplex \n",
  841. *speed == HW_SPEED_100_MBPS ?
  842. "100mbps" : "10mbps",
  843. *duplex == FDX_CAPABLE_FULL_SELECTED ?
  844. "full" : "half");
  845. else
  846. printf("rtl8201_read_config_mode: Media Link Off\n");
  847. }
  848. /**
  849. * vt6103_read_mode: - read media mode for vt6103 phy
  850. * @nic: the net device to read mode for
  851. * @phy_addr: mii phy address
  852. * @speed: the transmit speed to be determined
  853. * @duplex: the duplex mode to be determined
  854. *
  855. * read MII_STATUS register from rtl8201 phy
  856. * to determine the speed and duplex mode for sis900
  857. */
  858. static void vt6103_read_mode(struct nic *nic __unused, int phy_addr, int *speed, int *duplex)
  859. {
  860. u32 status;
  861. status = sis900_mdio_read(phy_addr, MII_STATUS);
  862. if (status & MII_STAT_CAN_TX_FDX) {
  863. *speed = HW_SPEED_100_MBPS;
  864. *duplex = FDX_CAPABLE_FULL_SELECTED;
  865. }
  866. else if (status & MII_STAT_CAN_TX) {
  867. *speed = HW_SPEED_100_MBPS;
  868. *duplex = FDX_CAPABLE_HALF_SELECTED;
  869. }
  870. else if (status & MII_STAT_CAN_T_FDX) {
  871. *speed = HW_SPEED_10_MBPS;
  872. *duplex = FDX_CAPABLE_FULL_SELECTED;
  873. }
  874. else if (status & MII_STAT_CAN_T) {
  875. *speed = HW_SPEED_10_MBPS;
  876. *duplex = FDX_CAPABLE_HALF_SELECTED;
  877. }
  878. if (status & MII_STAT_LINK)
  879. printf("vt6103_read_mode: Media Link On %s %s-duplex \n",
  880. *speed == HW_SPEED_100_MBPS ?
  881. "100mbps" : "10mbps",
  882. *duplex == FDX_CAPABLE_FULL_SELECTED ?
  883. "full" : "half");
  884. else
  885. printf("vt6103_read_config_mode: Media Link Off\n");
  886. }
  887. /* Function: sis900_transmit
  888. *
  889. * Description: transmits a packet and waits for completion or timeout.
  890. *
  891. * Arguments: char d[6]: destination ethernet address.
  892. * unsigned short t: ethernet protocol type.
  893. * unsigned short s: size of the data-part of the packet.
  894. * char *p: the data for the packet.
  895. *
  896. * Returns: void.
  897. */
  898. static void
  899. sis900_transmit(struct nic *nic,
  900. const char *d, /* Destination */
  901. unsigned int t, /* Type */
  902. unsigned int s, /* size */
  903. const char *p) /* Packet */
  904. {
  905. u32 to, nstype;
  906. volatile u32 tx_status;
  907. /* Stop the transmitter */
  908. outl(TxDIS | inl(ioaddr + cr), ioaddr + cr);
  909. /* load Transmit Descriptor Register */
  910. outl(virt_to_bus(&txd), ioaddr + txdp);
  911. if (sis900_debug > 1)
  912. printf("sis900_transmit: TX descriptor register loaded with: %lX\n",
  913. inl(ioaddr + txdp));
  914. memcpy(txb, d, ETH_ALEN);
  915. memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN);
  916. nstype = htons(t);
  917. memcpy(txb + 2 * ETH_ALEN, (char*)&nstype, 2);
  918. memcpy(txb + ETH_HLEN, p, s);
  919. s += ETH_HLEN;
  920. s &= DSIZE;
  921. if (sis900_debug > 1)
  922. printf("sis900_transmit: sending %d bytes ethtype %hX\n", (int) s, t);
  923. /* pad to minimum packet size */
  924. while (s < ETH_ZLEN)
  925. txb[s++] = '\0';
  926. /* set the transmit buffer descriptor and enable Transmit State Machine */
  927. txd.bufptr = virt_to_bus(&txb[0]);
  928. txd.cmdsts = (u32) OWN | s;
  929. /* restart the transmitter */
  930. outl(TxENA | inl(ioaddr + cr), ioaddr + cr);
  931. if (sis900_debug > 1)
  932. printf("sis900_transmit: Queued Tx packet size %d.\n", (int) s);
  933. to = currticks() + TX_TIMEOUT;
  934. while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
  935. /* wait */ ;
  936. if (currticks() >= to) {
  937. printf("sis900_transmit: TX Timeout! Tx status %X.\n", tx_status);
  938. }
  939. if (tx_status & (ABORT | UNDERRUN | OWCOLL)) {
  940. /* packet unsuccessfully transmited */
  941. printf("sis900_transmit: Transmit error, Tx status %X.\n", tx_status);
  942. }
  943. /* Disable interrupts by clearing the interrupt mask. */
  944. outl(0, ioaddr + imr);
  945. }
  946. /* Function: sis900_poll
  947. *
  948. * Description: checks for a received packet and returns it if found.
  949. *
  950. * Arguments: struct nic *nic: NIC data structure
  951. *
  952. * Returns: 1 if a packet was recieved.
  953. * 0 if no pacet was recieved.
  954. *
  955. * Side effects:
  956. * Returns (copies) the packet to the array nic->packet.
  957. * Returns the length of the packet in nic->packetlen.
  958. */
  959. static int
  960. sis900_poll(struct nic *nic, int retrieve)
  961. {
  962. u32 rx_status = rxd[cur_rx].cmdsts;
  963. int retstat = 0;
  964. if (sis900_debug > 2)
  965. printf("sis900_poll: cur_rx:%d, status:%X\n", cur_rx, rx_status);
  966. if (!(rx_status & OWN))
  967. return retstat;
  968. if (sis900_debug > 1)
  969. printf("sis900_poll: got a packet: cur_rx:%d, status:%X\n",
  970. cur_rx, rx_status);
  971. if ( ! retrieve ) return 1;
  972. nic->packetlen = (rx_status & DSIZE) - CRC_SIZE;
  973. if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) {
  974. /* corrupted packet received */
  975. printf("sis900_poll: Corrupted packet received, buffer status = %X\n",
  976. rx_status);
  977. retstat = 0;
  978. } else {
  979. /* give packet to higher level routine */
  980. memcpy(nic->packet, (rxb + cur_rx*RX_BUF_SIZE), nic->packetlen);
  981. retstat = 1;
  982. }
  983. /* return the descriptor and buffer to receive ring */
  984. rxd[cur_rx].cmdsts = RX_BUF_SIZE;
  985. rxd[cur_rx].bufptr = virt_to_bus(&rxb[cur_rx*RX_BUF_SIZE]);
  986. if (++cur_rx == NUM_RX_DESC)
  987. cur_rx = 0;
  988. /* re-enable the potentially idle receive state machine */
  989. outl(RxENA | inl(ioaddr + cr), ioaddr + cr);
  990. return retstat;
  991. }
  992. /* Function: sis900_disable
  993. *
  994. * Description: Turns off interrupts and stops Tx and Rx engines
  995. *
  996. * Arguments: struct nic *nic: NIC data structure
  997. *
  998. * Returns: void.
  999. */
  1000. static void
  1001. sis900_disable ( struct nic *nic ) {
  1002. sis900_init(nic);
  1003. /* Disable interrupts by clearing the interrupt mask. */
  1004. outl(0, ioaddr + imr);
  1005. outl(0, ioaddr + ier);
  1006. /* Stop the chip's Tx and Rx Status Machine */
  1007. outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr);
  1008. }
  1009. /* Function: sis900_irq
  1010. *
  1011. * Description: Enable, Disable, or Force, interrupts
  1012. *
  1013. * Arguments: struct nic *nic: NIC data structure
  1014. * irq_action_t action: Requested action
  1015. *
  1016. * Returns: void.
  1017. */
  1018. static void
  1019. sis900_irq(struct nic *nic __unused, irq_action_t action __unused)
  1020. {
  1021. switch ( action ) {
  1022. case DISABLE :
  1023. break;
  1024. case ENABLE :
  1025. break;
  1026. case FORCE :
  1027. break;
  1028. }
  1029. }
  1030. static struct nic_operations sis900_operations = {
  1031. .connect = dummy_connect,
  1032. .poll = sis900_poll,
  1033. .transmit = sis900_transmit,
  1034. .irq = sis900_irq,
  1035. };
  1036. static struct pci_device_id sis900_nics[] = {
  1037. PCI_ROM(0x1039, 0x0900, "sis900", "SIS900"),
  1038. PCI_ROM(0x1039, 0x7016, "sis7016", "SIS7016"),
  1039. };
  1040. PCI_DRIVER ( sis900_driver, sis900_nics, PCI_NO_CLASS );
  1041. DRIVER ( "SIS900", nic_driver, pci_driver, sis900_driver,
  1042. sis900_probe, sis900_disable );