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

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