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

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