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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208
  1. /*
  2. * gPXE driver for Intel eepro1000 ethernet cards
  3. *
  4. * Written by Marty Connor
  5. *
  6. * Copyright Entity Cyber, Inc. 2007
  7. *
  8. * This software may be used and distributed according to the terms of
  9. * the GNU General Public License (GPL), incorporated herein by
  10. * reference. Drivers based on or derived from this code fall under
  11. * the GPL and must retain the authorship, copyright and license
  12. * notice.
  13. *
  14. */
  15. /*******************************************************************************
  16. Intel PRO/1000 Linux driver
  17. Copyright(c) 1999 - 2006 Intel Corporation.
  18. This program is free software; you can redistribute it and/or modify it
  19. under the terms and conditions of the GNU General Public License,
  20. version 2, as published by the Free Software Foundation.
  21. This program is distributed in the hope it will be useful, but WITHOUT
  22. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  23. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  24. more details.
  25. You should have received a copy of the GNU General Public License along with
  26. this program; if not, write to the Free Software Foundation, Inc.,
  27. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  28. The full GNU General Public License is included in this distribution in
  29. the file called "COPYING".
  30. Contact Information:
  31. Linux NICS <linux.nics@intel.com>
  32. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  33. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  34. *******************************************************************************/
  35. FILE_LICENCE ( GPL2_ONLY );
  36. #include "e1000.h"
  37. /**
  38. * e1000_get_hw_control - get control of the h/w from f/w
  39. *
  40. * @v adapter e1000 private structure
  41. *
  42. * e1000_get_hw_control sets {CTRL_EXT|FWSM}:DRV_LOAD bit.
  43. * For ASF and Pass Through versions of f/w this means that
  44. * the driver is loaded. For AMT version (only with 82573)
  45. * of the f/w this means that the network i/f is open.
  46. *
  47. **/
  48. static void
  49. e1000_get_hw_control ( struct e1000_adapter *adapter )
  50. {
  51. uint32_t ctrl_ext;
  52. uint32_t swsm;
  53. DBG ( "e1000_get_hw_control\n" );
  54. /* Let firmware know the driver has taken over */
  55. switch (adapter->hw.mac_type) {
  56. case e1000_82573:
  57. swsm = E1000_READ_REG(&adapter->hw, SWSM);
  58. E1000_WRITE_REG(&adapter->hw, SWSM,
  59. swsm | E1000_SWSM_DRV_LOAD);
  60. break;
  61. case e1000_82571:
  62. case e1000_82572:
  63. case e1000_82576:
  64. case e1000_80003es2lan:
  65. case e1000_ich8lan:
  66. ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
  67. E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
  68. ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
  69. break;
  70. default:
  71. break;
  72. }
  73. }
  74. /**
  75. * e1000_irq_enable - Enable default interrupt generation settings
  76. *
  77. * @v adapter e1000 private structure
  78. **/
  79. static void
  80. e1000_irq_enable ( struct e1000_adapter *adapter )
  81. {
  82. E1000_WRITE_REG ( &adapter->hw, IMS, IMS_ENABLE_MASK );
  83. E1000_WRITE_FLUSH ( &adapter->hw );
  84. }
  85. /**
  86. * e1000_irq_disable - Mask off interrupt generation on the NIC
  87. *
  88. * @v adapter e1000 private structure
  89. **/
  90. static void
  91. e1000_irq_disable ( struct e1000_adapter *adapter )
  92. {
  93. E1000_WRITE_REG ( &adapter->hw, IMC, ~0 );
  94. E1000_WRITE_FLUSH ( &adapter->hw );
  95. }
  96. /**
  97. * e1000_irq_force - trigger interrupt
  98. *
  99. * @v adapter e1000 private structure
  100. **/
  101. static void
  102. e1000_irq_force ( struct e1000_adapter *adapter )
  103. {
  104. E1000_WRITE_REG ( &adapter->hw, ICS, E1000_ICS_RXDMT0 );
  105. E1000_WRITE_FLUSH ( &adapter->hw );
  106. }
  107. /**
  108. * e1000_sw_init - Initialize general software structures (struct e1000_adapter)
  109. *
  110. * @v adapter e1000 private structure
  111. *
  112. * e1000_sw_init initializes the Adapter private data structure.
  113. * Fields are initialized based on PCI device information and
  114. * OS network device settings (MTU size).
  115. **/
  116. static int
  117. e1000_sw_init ( struct e1000_adapter *adapter )
  118. {
  119. struct e1000_hw *hw = &adapter->hw;
  120. struct pci_device *pdev = adapter->pdev;
  121. /* PCI config space info */
  122. hw->vendor_id = pdev->vendor;
  123. hw->device_id = pdev->device;
  124. pci_read_config_word ( pdev, PCI_COMMAND, &hw->pci_cmd_word );
  125. /* Disable Flow Control */
  126. hw->fc = E1000_FC_NONE;
  127. adapter->eeprom_wol = 0;
  128. adapter->wol = adapter->eeprom_wol;
  129. adapter->en_mng_pt = 0;
  130. adapter->rx_int_delay = 0;
  131. adapter->rx_abs_int_delay = 0;
  132. adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
  133. adapter->rx_ps_bsize0 = E1000_RXBUFFER_128;
  134. hw->max_frame_size = MAXIMUM_ETHERNET_VLAN_SIZE +
  135. ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
  136. hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
  137. /* identify the MAC */
  138. if ( e1000_set_mac_type ( hw ) ) {
  139. DBG ( "Unknown MAC Type\n" );
  140. return -EIO;
  141. }
  142. switch ( hw->mac_type ) {
  143. default:
  144. break;
  145. case e1000_82541:
  146. case e1000_82547:
  147. case e1000_82541_rev_2:
  148. case e1000_82547_rev_2:
  149. hw->phy_init_script = 1;
  150. break;
  151. }
  152. e1000_set_media_type ( hw );
  153. hw->autoneg = TRUE;
  154. hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT;
  155. hw->wait_autoneg_complete = TRUE;
  156. hw->tbi_compatibility_en = TRUE;
  157. hw->adaptive_ifs = TRUE;
  158. /* Copper options */
  159. if ( hw->media_type == e1000_media_type_copper ) {
  160. hw->mdix = AUTO_ALL_MODES;
  161. hw->disable_polarity_correction = FALSE;
  162. hw->master_slave = E1000_MASTER_SLAVE;
  163. }
  164. e1000_irq_disable ( adapter );
  165. return 0;
  166. }
  167. /**
  168. * e1000_setup_tx_resources - allocate Tx resources (Descriptors)
  169. *
  170. * @v adapter e1000 private structure
  171. *
  172. * @ret rc Returns 0 on success, negative on failure
  173. **/
  174. static int
  175. e1000_setup_tx_resources ( struct e1000_adapter *adapter )
  176. {
  177. DBG ( "e1000_setup_tx_resources\n" );
  178. /* Allocate transmit descriptor ring memory.
  179. It must not cross a 64K boundary because of hardware errata #23
  180. so we use malloc_dma() requesting a 128 byte block that is
  181. 128 byte aligned. This should guarantee that the memory
  182. allocated will not cross a 64K boundary, because 128 is an
  183. even multiple of 65536 ( 65536 / 128 == 512 ), so all possible
  184. allocations of 128 bytes on a 128 byte boundary will not
  185. cross 64K bytes.
  186. */
  187. adapter->tx_base =
  188. malloc_dma ( adapter->tx_ring_size, adapter->tx_ring_size );
  189. if ( ! adapter->tx_base ) {
  190. return -ENOMEM;
  191. }
  192. memset ( adapter->tx_base, 0, adapter->tx_ring_size );
  193. DBG ( "adapter->tx_base = %#08lx\n", virt_to_bus ( adapter->tx_base ) );
  194. return 0;
  195. }
  196. static void
  197. e1000_free_tx_resources ( struct e1000_adapter *adapter )
  198. {
  199. DBG ( "e1000_free_tx_resources\n" );
  200. free_dma ( adapter->tx_base, adapter->tx_ring_size );
  201. }
  202. /**
  203. * e1000_configure_tx - Configure 8254x Transmit Unit after Reset
  204. * @adapter: board private structure
  205. *
  206. * Configure the Tx unit of the MAC after a reset.
  207. **/
  208. static void
  209. e1000_configure_tx ( struct e1000_adapter *adapter )
  210. {
  211. struct e1000_hw *hw = &adapter->hw;
  212. uint32_t tctl;
  213. uint32_t txdctl;
  214. DBG ( "e1000_configure_tx\n" );
  215. E1000_WRITE_REG ( hw, TDBAH, 0 );
  216. E1000_WRITE_REG ( hw, TDBAL, virt_to_bus ( adapter->tx_base ) );
  217. E1000_WRITE_REG ( hw, TDLEN, adapter->tx_ring_size );
  218. DBG ( "TDBAL: %#08x\n", E1000_READ_REG ( hw, TDBAL ) );
  219. DBG ( "TDLEN: %d\n", E1000_READ_REG ( hw, TDLEN ) );
  220. /* Setup the HW Tx Head and Tail descriptor pointers */
  221. E1000_WRITE_REG ( hw, TDH, 0 );
  222. E1000_WRITE_REG ( hw, TDT, 0 );
  223. adapter->tx_head = 0;
  224. adapter->tx_tail = 0;
  225. adapter->tx_fill_ctr = 0;
  226. if (hw->mac_type == e1000_82576) {
  227. txdctl = E1000_READ_REG ( hw, TXDCTL );
  228. txdctl |= E1000_TXDCTL_QUEUE_ENABLE;
  229. E1000_WRITE_REG ( hw, TXDCTL, txdctl );
  230. }
  231. /* Setup Transmit Descriptor Settings for eop descriptor */
  232. tctl = E1000_TCTL_PSP | E1000_TCTL_EN |
  233. (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT) |
  234. (E1000_HDX_COLLISION_DISTANCE << E1000_COLD_SHIFT);
  235. e1000_config_collision_dist ( hw );
  236. E1000_WRITE_REG ( hw, TCTL, tctl );
  237. E1000_WRITE_FLUSH ( hw );
  238. }
  239. static void
  240. e1000_free_rx_resources ( struct e1000_adapter *adapter )
  241. {
  242. int i;
  243. DBG ( "e1000_free_rx_resources\n" );
  244. free_dma ( adapter->rx_base, adapter->rx_ring_size );
  245. for ( i = 0; i < NUM_RX_DESC; i++ ) {
  246. free_iob ( adapter->rx_iobuf[i] );
  247. }
  248. }
  249. /**
  250. * e1000_refill_rx_ring - allocate Rx io_buffers
  251. *
  252. * @v adapter e1000 private structure
  253. *
  254. * @ret rc Returns 0 on success, negative on failure
  255. **/
  256. int e1000_refill_rx_ring ( struct e1000_adapter *adapter )
  257. {
  258. int i, rx_curr;
  259. int rc = 0;
  260. struct e1000_rx_desc *rx_curr_desc;
  261. struct e1000_hw *hw = &adapter->hw;
  262. struct io_buffer *iob;
  263. DBG ("e1000_refill_rx_ring\n");
  264. for ( i = 0; i < NUM_RX_DESC; i++ ) {
  265. rx_curr = ( ( adapter->rx_curr + i ) % NUM_RX_DESC );
  266. rx_curr_desc = adapter->rx_base + rx_curr;
  267. if ( rx_curr_desc->status & E1000_RXD_STAT_DD )
  268. continue;
  269. if ( adapter->rx_iobuf[rx_curr] != NULL )
  270. continue;
  271. DBG2 ( "Refilling rx desc %d\n", rx_curr );
  272. iob = alloc_iob ( MAXIMUM_ETHERNET_VLAN_SIZE );
  273. adapter->rx_iobuf[rx_curr] = iob;
  274. if ( ! iob ) {
  275. DBG ( "alloc_iob failed\n" );
  276. rc = -ENOMEM;
  277. break;
  278. } else {
  279. rx_curr_desc->buffer_addr = virt_to_bus ( iob->data );
  280. E1000_WRITE_REG ( hw, RDT, rx_curr );
  281. }
  282. }
  283. return rc;
  284. }
  285. /**
  286. * e1000_setup_rx_resources - allocate Rx resources (Descriptors)
  287. *
  288. * @v adapter e1000 private structure
  289. *
  290. * @ret rc Returns 0 on success, negative on failure
  291. **/
  292. static int
  293. e1000_setup_rx_resources ( struct e1000_adapter *adapter )
  294. {
  295. int i, rc = 0;
  296. DBG ( "e1000_setup_rx_resources\n" );
  297. /* Allocate receive descriptor ring memory.
  298. It must not cross a 64K boundary because of hardware errata
  299. */
  300. adapter->rx_base =
  301. malloc_dma ( adapter->rx_ring_size, adapter->rx_ring_size );
  302. if ( ! adapter->rx_base ) {
  303. return -ENOMEM;
  304. }
  305. memset ( adapter->rx_base, 0, adapter->rx_ring_size );
  306. for ( i = 0; i < NUM_RX_DESC; i++ ) {
  307. /* let e1000_refill_rx_ring() io_buffer allocations */
  308. adapter->rx_iobuf[i] = NULL;
  309. }
  310. /* allocate io_buffers */
  311. rc = e1000_refill_rx_ring ( adapter );
  312. if ( rc < 0 )
  313. e1000_free_rx_resources ( adapter );
  314. return rc;
  315. }
  316. /**
  317. * e1000_configure_rx - Configure 8254x Receive Unit after Reset
  318. * @adapter: board private structure
  319. *
  320. * Configure the Rx unit of the MAC after a reset.
  321. **/
  322. static void
  323. e1000_configure_rx ( struct e1000_adapter *adapter )
  324. {
  325. struct e1000_hw *hw = &adapter->hw;
  326. uint32_t rctl, rxdctl, mrqc, rxcsum;
  327. DBG ( "e1000_configure_rx\n" );
  328. /* disable receives while setting up the descriptors */
  329. rctl = E1000_READ_REG ( hw, RCTL );
  330. E1000_WRITE_REG ( hw, RCTL, rctl & ~E1000_RCTL_EN );
  331. E1000_WRITE_FLUSH ( hw );
  332. mdelay(10);
  333. adapter->rx_curr = 0;
  334. /* Setup the HW Rx Head and Tail Descriptor Pointers and
  335. * the Base and Length of the Rx Descriptor Ring */
  336. E1000_WRITE_REG ( hw, RDBAL, virt_to_bus ( adapter->rx_base ) );
  337. E1000_WRITE_REG ( hw, RDBAH, 0 );
  338. E1000_WRITE_REG ( hw, RDLEN, adapter->rx_ring_size );
  339. E1000_WRITE_REG ( hw, RDH, 0 );
  340. if (hw->mac_type == e1000_82576)
  341. E1000_WRITE_REG ( hw, RDT, 0 );
  342. else
  343. E1000_WRITE_REG ( hw, RDT, NUM_RX_DESC - 1 );
  344. /* This doesn't seem to be necessary for correct operation,
  345. * but it seems as well to be implicit
  346. */
  347. if (hw->mac_type == e1000_82576) {
  348. rxdctl = E1000_READ_REG ( hw, RXDCTL );
  349. rxdctl |= E1000_RXDCTL_QUEUE_ENABLE;
  350. rxdctl &= 0xFFF00000;
  351. rxdctl |= IGB_RX_PTHRESH;
  352. rxdctl |= IGB_RX_HTHRESH << 8;
  353. rxdctl |= IGB_RX_WTHRESH << 16;
  354. E1000_WRITE_REG ( hw, RXDCTL, rxdctl );
  355. E1000_WRITE_FLUSH ( hw );
  356. rxcsum = E1000_READ_REG(hw, RXCSUM);
  357. rxcsum &= ~( E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPPCSE );
  358. E1000_WRITE_REG ( hw, RXCSUM, 0 );
  359. /* The initial value for MRQC disables multiple receive
  360. * queues, however this setting is not recommended.
  361. * - Intel® 82576 Gigabit Ethernet Controller Datasheet r2.41
  362. * Section 8.10.9 Multiple Queues Command Register - MRQC
  363. */
  364. mrqc = E1000_MRQC_ENABLE_VMDQ;
  365. E1000_WRITE_REG ( hw, MRQC, mrqc );
  366. }
  367. /* Enable Receives */
  368. rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 |
  369. E1000_RCTL_MPE;
  370. E1000_WRITE_REG ( hw, RCTL, rctl );
  371. E1000_WRITE_FLUSH ( hw );
  372. /* On the 82576, RDT([0]) must not be "bumped" before
  373. * the enable bit of RXDCTL([0]) is set.
  374. * - Intel® 82576 Gigabit Ethernet Controller Datasheet r2.41
  375. * Section 4.5.9 receive Initialization
  376. *
  377. * By observation I have found to occur when the enable bit of
  378. * RCTL is set. The datasheet recommends polling for this bit,
  379. * however as I see no evidence of this in the Linux igb driver
  380. * I have omitted that step.
  381. * - Simon Horman, May 2009
  382. */
  383. if (hw->mac_type == e1000_82576)
  384. E1000_WRITE_REG ( hw, RDT, NUM_RX_DESC - 1 );
  385. DBG ( "RDBAL: %#08x\n", E1000_READ_REG ( hw, RDBAL ) );
  386. DBG ( "RDLEN: %d\n", E1000_READ_REG ( hw, RDLEN ) );
  387. DBG ( "RCTL: %#08x\n", E1000_READ_REG ( hw, RCTL ) );
  388. }
  389. /**
  390. * e1000_reset - Put e1000 NIC in known initial state
  391. *
  392. * @v adapter e1000 private structure
  393. **/
  394. static void
  395. e1000_reset ( struct e1000_adapter *adapter )
  396. {
  397. uint32_t pba = 0;
  398. uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF;
  399. DBG ( "e1000_reset\n" );
  400. switch (adapter->hw.mac_type) {
  401. case e1000_82542_rev2_0:
  402. case e1000_82542_rev2_1:
  403. case e1000_82543:
  404. case e1000_82544:
  405. case e1000_82540:
  406. case e1000_82541:
  407. case e1000_82541_rev_2:
  408. pba = E1000_PBA_48K;
  409. break;
  410. case e1000_82545:
  411. case e1000_82545_rev_3:
  412. case e1000_82546:
  413. case e1000_82546_rev_3:
  414. pba = E1000_PBA_48K;
  415. break;
  416. case e1000_82547:
  417. case e1000_82547_rev_2:
  418. pba = E1000_PBA_30K;
  419. break;
  420. case e1000_82571:
  421. case e1000_82572:
  422. case e1000_80003es2lan:
  423. pba = E1000_PBA_38K;
  424. break;
  425. case e1000_82573:
  426. pba = E1000_PBA_20K;
  427. break;
  428. case e1000_82576:
  429. pba = E1000_PBA_64K;
  430. break;
  431. case e1000_ich8lan:
  432. pba = E1000_PBA_8K;
  433. case e1000_undefined:
  434. case e1000_num_macs:
  435. break;
  436. }
  437. E1000_WRITE_REG ( &adapter->hw, PBA, pba );
  438. /* flow control settings */
  439. /* Set the FC high water mark to 90% of the FIFO size.
  440. * Required to clear last 3 LSB */
  441. fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8;
  442. /* We can't use 90% on small FIFOs because the remainder
  443. * would be less than 1 full frame. In this case, we size
  444. * it to allow at least a full frame above the high water
  445. * mark. */
  446. if (pba < E1000_PBA_16K)
  447. fc_high_water_mark = (pba * 1024) - 1600;
  448. /* This actually applies to < e1000_82575, one revision less than
  449. * e1000_82576, but e1000_82575 isn't currently defined in the code */
  450. if (adapter->hw.mac_type < e1000_82576) {
  451. /* 8-byte granularity */
  452. adapter->hw.fc_high_water = fc_high_water_mark & 0xFFF8;
  453. adapter->hw.fc_low_water = adapter->hw.fc_high_water - 8;
  454. } else {
  455. /* 16-byte granularity */
  456. adapter->hw.fc_high_water = fc_high_water_mark & 0xFFF0;
  457. adapter->hw.fc_low_water = adapter->hw.fc_high_water - 16;
  458. }
  459. if (adapter->hw.mac_type == e1000_80003es2lan ||
  460. adapter->hw.mac_type == e1000_82576)
  461. adapter->hw.fc_pause_time = 0xFFFF;
  462. else
  463. adapter->hw.fc_pause_time = E1000_FC_PAUSE_TIME;
  464. adapter->hw.fc_send_xon = 1;
  465. adapter->hw.fc = adapter->hw.original_fc;
  466. /* Allow time for pending master requests to run */
  467. e1000_reset_hw ( &adapter->hw );
  468. if ( adapter->hw.mac_type >= e1000_82544 )
  469. E1000_WRITE_REG ( &adapter->hw, WUC, 0 );
  470. if ( e1000_init_hw ( &adapter->hw ) )
  471. DBG ( "Hardware Error\n" );
  472. /* if (adapter->hwflags & HWFLAGS_PHY_PWR_BIT) { */
  473. if (adapter->hw.mac_type >= e1000_82544 &&
  474. adapter->hw.mac_type <= e1000_82547_rev_2 &&
  475. adapter->hw.autoneg == 1 &&
  476. adapter->hw.autoneg_advertised == ADVERTISE_1000_FULL) {
  477. uint32_t ctrl = E1000_READ_REG(&adapter->hw, CTRL);
  478. /* clear phy power management bit if we are in gig only mode,
  479. * which if enabled will attempt negotiation to 100Mb, which
  480. * can cause a loss of link at power off or driver unload */
  481. ctrl &= ~E1000_CTRL_SWDPIN3;
  482. E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
  483. }
  484. e1000_phy_get_info ( &adapter->hw, &adapter->phy_info );
  485. if (!adapter->smart_power_down &&
  486. (adapter->hw.mac_type == e1000_82571 ||
  487. adapter->hw.mac_type == e1000_82572)) {
  488. uint16_t phy_data = 0;
  489. /* speed up time to link by disabling smart power down, ignore
  490. * the return value of this function because there is nothing
  491. * different we would do if it failed */
  492. e1000_read_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
  493. &phy_data);
  494. phy_data &= ~IGP02E1000_PM_SPD;
  495. e1000_write_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
  496. phy_data);
  497. }
  498. }
  499. /** Functions that implement the gPXE driver API **/
  500. /**
  501. * e1000_close - Disables a network interface
  502. *
  503. * @v netdev network interface device structure
  504. *
  505. **/
  506. static void
  507. e1000_close ( struct net_device *netdev )
  508. {
  509. struct e1000_adapter *adapter = netdev_priv ( netdev );
  510. struct e1000_hw *hw = &adapter->hw;
  511. uint32_t rctl;
  512. uint32_t icr;
  513. DBG ( "e1000_close\n" );
  514. /* Acknowledge interrupts */
  515. icr = E1000_READ_REG ( hw, ICR );
  516. e1000_irq_disable ( adapter );
  517. /* disable receives */
  518. rctl = E1000_READ_REG ( hw, RCTL );
  519. E1000_WRITE_REG ( hw, RCTL, rctl & ~E1000_RCTL_EN );
  520. E1000_WRITE_FLUSH ( hw );
  521. e1000_reset_hw ( hw );
  522. e1000_free_tx_resources ( adapter );
  523. e1000_free_rx_resources ( adapter );
  524. }
  525. /**
  526. * e1000_transmit - Transmit a packet
  527. *
  528. * @v netdev Network device
  529. * @v iobuf I/O buffer
  530. *
  531. * @ret rc Returns 0 on success, negative on failure
  532. */
  533. static int
  534. e1000_transmit ( struct net_device *netdev, struct io_buffer *iobuf )
  535. {
  536. struct e1000_adapter *adapter = netdev_priv( netdev );
  537. struct e1000_hw *hw = &adapter->hw;
  538. uint32_t tx_curr = adapter->tx_tail;
  539. struct e1000_tx_desc *tx_curr_desc;
  540. DBG ("e1000_transmit\n");
  541. if ( adapter->tx_fill_ctr == NUM_TX_DESC ) {
  542. DBG ("TX overflow\n");
  543. return -ENOBUFS;
  544. }
  545. /* Save pointer to iobuf we have been given to transmit,
  546. netdev_tx_complete() will need it later
  547. */
  548. adapter->tx_iobuf[tx_curr] = iobuf;
  549. tx_curr_desc = ( void * ) ( adapter->tx_base ) +
  550. ( tx_curr * sizeof ( *adapter->tx_base ) );
  551. DBG ( "tx_curr_desc = %#08lx\n", virt_to_bus ( tx_curr_desc ) );
  552. DBG ( "tx_curr_desc + 16 = %#08lx\n", virt_to_bus ( tx_curr_desc ) + 16 );
  553. DBG ( "iobuf->data = %#08lx\n", virt_to_bus ( iobuf->data ) );
  554. /* Add the packet to TX ring
  555. */
  556. tx_curr_desc->buffer_addr =
  557. virt_to_bus ( iobuf->data );
  558. tx_curr_desc->lower.data =
  559. E1000_TXD_CMD_RPS | E1000_TXD_CMD_EOP |
  560. E1000_TXD_CMD_IFCS | iob_len ( iobuf );
  561. tx_curr_desc->upper.data = 0;
  562. DBG ( "TX fill: %d tx_curr: %d addr: %#08lx len: %zd\n", adapter->tx_fill_ctr,
  563. tx_curr, virt_to_bus ( iobuf->data ), iob_len ( iobuf ) );
  564. /* Point to next free descriptor */
  565. adapter->tx_tail = ( adapter->tx_tail + 1 ) % NUM_TX_DESC;
  566. adapter->tx_fill_ctr++;
  567. /* Write new tail to NIC, making packet available for transmit
  568. */
  569. wmb();
  570. E1000_WRITE_REG ( hw, TDT, adapter->tx_tail );
  571. return 0;
  572. }
  573. /**
  574. * e1000_poll - Poll for received packets
  575. *
  576. * @v netdev Network device
  577. */
  578. static void
  579. e1000_poll ( struct net_device *netdev )
  580. {
  581. struct e1000_adapter *adapter = netdev_priv( netdev );
  582. struct e1000_hw *hw = &adapter->hw;
  583. uint32_t icr;
  584. uint32_t tx_status;
  585. uint32_t rx_status;
  586. uint32_t rx_len;
  587. uint32_t rx_err;
  588. struct e1000_tx_desc *tx_curr_desc;
  589. struct e1000_rx_desc *rx_curr_desc;
  590. uint32_t i;
  591. DBGP ( "e1000_poll\n" );
  592. /* Acknowledge interrupts */
  593. icr = E1000_READ_REG ( hw, ICR );
  594. if ( ! icr )
  595. return;
  596. DBG ( "e1000_poll: intr_status = %#08x\n", icr );
  597. /* Check status of transmitted packets
  598. */
  599. while ( ( i = adapter->tx_head ) != adapter->tx_tail ) {
  600. tx_curr_desc = ( void * ) ( adapter->tx_base ) +
  601. ( i * sizeof ( *adapter->tx_base ) );
  602. tx_status = tx_curr_desc->upper.data;
  603. /* if the packet at tx_head is not owned by hardware it is for us */
  604. if ( ! ( tx_status & E1000_TXD_STAT_DD ) )
  605. break;
  606. DBG ( "Sent packet. tx_head: %d tx_tail: %d tx_status: %#08x\n",
  607. adapter->tx_head, adapter->tx_tail, tx_status );
  608. if ( tx_status & ( E1000_TXD_STAT_EC | E1000_TXD_STAT_LC |
  609. E1000_TXD_STAT_TU ) ) {
  610. netdev_tx_complete_err ( netdev, adapter->tx_iobuf[i], -EINVAL );
  611. DBG ( "Error transmitting packet, tx_status: %#08x\n",
  612. tx_status );
  613. } else {
  614. netdev_tx_complete ( netdev, adapter->tx_iobuf[i] );
  615. DBG ( "Success transmitting packet, tx_status: %#08x\n",
  616. tx_status );
  617. }
  618. /* Decrement count of used descriptors, clear this descriptor
  619. */
  620. adapter->tx_fill_ctr--;
  621. memset ( tx_curr_desc, 0, sizeof ( *tx_curr_desc ) );
  622. adapter->tx_head = ( adapter->tx_head + 1 ) % NUM_TX_DESC;
  623. }
  624. /* Process received packets
  625. */
  626. while ( 1 ) {
  627. i = adapter->rx_curr;
  628. rx_curr_desc = ( void * ) ( adapter->rx_base ) +
  629. ( i * sizeof ( *adapter->rx_base ) );
  630. rx_status = rx_curr_desc->status;
  631. DBG2 ( "Before DD Check RX_status: %#08x\n", rx_status );
  632. if ( ! ( rx_status & E1000_RXD_STAT_DD ) )
  633. break;
  634. if ( adapter->rx_iobuf[i] == NULL )
  635. break;
  636. DBG ( "RCTL = %#08x\n", E1000_READ_REG ( &adapter->hw, RCTL ) );
  637. rx_len = rx_curr_desc->length;
  638. DBG ( "Received packet, rx_curr: %d rx_status: %#08x rx_len: %d\n",
  639. i, rx_status, rx_len );
  640. rx_err = rx_curr_desc->errors;
  641. iob_put ( adapter->rx_iobuf[i], rx_len );
  642. if ( rx_err & E1000_RXD_ERR_FRAME_ERR_MASK ) {
  643. netdev_rx_err ( netdev, adapter->rx_iobuf[i], -EINVAL );
  644. DBG ( "e1000_poll: Corrupted packet received!"
  645. " rx_err: %#08x\n", rx_err );
  646. } else {
  647. /* Add this packet to the receive queue. */
  648. netdev_rx ( netdev, adapter->rx_iobuf[i] );
  649. }
  650. adapter->rx_iobuf[i] = NULL;
  651. memset ( rx_curr_desc, 0, sizeof ( *rx_curr_desc ) );
  652. adapter->rx_curr = ( adapter->rx_curr + 1 ) % NUM_RX_DESC;
  653. }
  654. e1000_refill_rx_ring(adapter);
  655. }
  656. /**
  657. * e1000_irq - enable or Disable interrupts
  658. *
  659. * @v adapter e1000 adapter
  660. * @v action requested interrupt action
  661. **/
  662. static void
  663. e1000_irq ( struct net_device *netdev, int enable )
  664. {
  665. struct e1000_adapter *adapter = netdev_priv(netdev);
  666. DBG ( "e1000_irq\n" );
  667. switch ( enable ) {
  668. case 0 :
  669. e1000_irq_disable ( adapter );
  670. break;
  671. case 1 :
  672. e1000_irq_enable ( adapter );
  673. break;
  674. case 2 :
  675. e1000_irq_force ( adapter );
  676. break;
  677. }
  678. }
  679. static struct net_device_operations e1000_operations;
  680. /**
  681. * e1000_probe - Initial configuration of e1000 NIC
  682. *
  683. * @v pci PCI device
  684. * @v id PCI IDs
  685. *
  686. * @ret rc Return status code
  687. **/
  688. static int
  689. e1000_probe ( struct pci_device *pdev,
  690. const struct pci_device_id *id __unused )
  691. {
  692. int i, err;
  693. struct net_device *netdev;
  694. struct e1000_adapter *adapter;
  695. unsigned long mmio_start, mmio_len;
  696. unsigned long flash_start, flash_len;
  697. DBG ( "e1000_probe\n" );
  698. err = -ENOMEM;
  699. /* Allocate net device ( also allocates memory for netdev->priv
  700. and makes netdev-priv point to it ) */
  701. netdev = alloc_etherdev ( sizeof ( struct e1000_adapter ) );
  702. if ( ! netdev )
  703. goto err_alloc_etherdev;
  704. /* Associate e1000-specific network operations operations with
  705. * generic network device layer */
  706. netdev_init ( netdev, &e1000_operations );
  707. /* Associate this network device with given PCI device */
  708. pci_set_drvdata ( pdev, netdev );
  709. netdev->dev = &pdev->dev;
  710. /* Initialize driver private storage */
  711. adapter = netdev_priv ( netdev );
  712. memset ( adapter, 0, ( sizeof ( *adapter ) ) );
  713. adapter->hw.io_base = pdev->ioaddr;
  714. adapter->ioaddr = pdev->ioaddr;
  715. adapter->irqno = pdev->irq;
  716. adapter->netdev = netdev;
  717. adapter->pdev = pdev;
  718. adapter->hw.back = adapter;
  719. adapter->tx_ring_size = sizeof ( *adapter->tx_base ) * NUM_TX_DESC;
  720. adapter->rx_ring_size = sizeof ( *adapter->rx_base ) * NUM_RX_DESC;
  721. mmio_start = pci_bar_start ( pdev, PCI_BASE_ADDRESS_0 );
  722. mmio_len = pci_bar_size ( pdev, PCI_BASE_ADDRESS_0 );
  723. DBG ( "mmio_start: %#08lx\n", mmio_start );
  724. DBG ( "mmio_len: %#08lx\n", mmio_len );
  725. /* Fix up PCI device */
  726. adjust_pci_device ( pdev );
  727. err = -EIO;
  728. adapter->hw.hw_addr = ioremap ( mmio_start, mmio_len );
  729. DBG ( "adapter->hw.hw_addr: %p\n", adapter->hw.hw_addr );
  730. if ( ! adapter->hw.hw_addr )
  731. goto err_ioremap;
  732. /* setup the private structure */
  733. if ( ( err = e1000_sw_init ( adapter ) ) )
  734. goto err_sw_init;
  735. DBG ( "adapter->hw.mac_type: %#08x\n", adapter->hw.mac_type );
  736. /* Flash BAR mapping must happen after e1000_sw_init
  737. * because it depends on mac_type
  738. */
  739. if ( ( adapter->hw.mac_type == e1000_ich8lan ) && ( pdev->ioaddr ) ) {
  740. flash_start = pci_bar_start ( pdev, PCI_BASE_ADDRESS_1 );
  741. flash_len = pci_bar_size ( pdev, PCI_BASE_ADDRESS_1 );
  742. adapter->hw.flash_address = ioremap ( flash_start, flash_len );
  743. if ( ! adapter->hw.flash_address )
  744. goto err_flashmap;
  745. }
  746. /* initialize eeprom parameters */
  747. if ( e1000_init_eeprom_params ( &adapter->hw ) ) {
  748. DBG ( "EEPROM initialization failed\n" );
  749. goto err_eeprom;
  750. }
  751. /* before reading the EEPROM, reset the controller to
  752. * put the device in a known good starting state
  753. */
  754. err = e1000_reset_hw ( &adapter->hw );
  755. if ( err < 0 ) {
  756. DBG ( "Hardware Initialization Failed\n" );
  757. goto err_reset;
  758. }
  759. /* make sure the EEPROM is good */
  760. if ( e1000_validate_eeprom_checksum( &adapter->hw ) < 0 ) {
  761. DBG ( "The EEPROM Checksum Is Not Valid\n" );
  762. goto err_eeprom;
  763. }
  764. /* copy the MAC address out of the EEPROM */
  765. if ( e1000_read_mac_addr ( &adapter->hw ) )
  766. DBG ( "EEPROM Read Error\n" );
  767. memcpy ( netdev->hw_addr, adapter->hw.mac_addr, ETH_ALEN );
  768. /* print bus type/speed/width info */
  769. {
  770. struct e1000_hw *hw = &adapter->hw;
  771. DBG ( "(PCI%s:%s:%s) ",
  772. ((hw->bus_type == e1000_bus_type_pcix) ? "-X" :
  773. (hw->bus_type == e1000_bus_type_pci_express ? " Express":"")),
  774. ((hw->bus_speed == e1000_bus_speed_2500) ? "2.5Gb/s" :
  775. (hw->bus_speed == e1000_bus_speed_133) ? "133MHz" :
  776. (hw->bus_speed == e1000_bus_speed_120) ? "120MHz" :
  777. (hw->bus_speed == e1000_bus_speed_100) ? "100MHz" :
  778. (hw->bus_speed == e1000_bus_speed_66) ? "66MHz" : "33MHz"),
  779. ((hw->bus_width == e1000_bus_width_64) ? "64-bit" :
  780. (hw->bus_width == e1000_bus_width_pciex_4) ? "Width x4" :
  781. (hw->bus_width == e1000_bus_width_pciex_1) ? "Width x1" :
  782. "32-bit"));
  783. }
  784. for (i = 0; i < 6; i++)
  785. DBG ("%02x%s", netdev->ll_addr[i], i == 5 ? "\n" : ":");
  786. /* reset the hardware with the new settings */
  787. e1000_reset ( adapter );
  788. e1000_get_hw_control ( adapter );
  789. /* Mark as link up; we don't yet handle link state */
  790. netdev_link_up ( netdev );
  791. if ( ( err = register_netdev ( netdev ) ) != 0)
  792. goto err_register;
  793. DBG ( "e1000_probe succeeded!\n" );
  794. /* No errors, return success */
  795. return 0;
  796. /* Error return paths */
  797. err_reset:
  798. err_register:
  799. err_eeprom:
  800. if ( ! e1000_check_phy_reset_block ( &adapter->hw ) )
  801. e1000_phy_hw_reset ( &adapter->hw );
  802. if ( adapter->hw.flash_address )
  803. iounmap ( adapter->hw.flash_address );
  804. err_flashmap:
  805. err_sw_init:
  806. iounmap ( adapter->hw.hw_addr );
  807. err_ioremap:
  808. netdev_put ( netdev );
  809. err_alloc_etherdev:
  810. return err;
  811. }
  812. /**
  813. * e1000_remove - Device Removal Routine
  814. *
  815. * @v pdev PCI device information struct
  816. *
  817. **/
  818. static void
  819. e1000_remove ( struct pci_device *pdev )
  820. {
  821. struct net_device *netdev = pci_get_drvdata ( pdev );
  822. struct e1000_adapter *adapter = netdev_priv ( netdev );
  823. DBG ( "e1000_remove\n" );
  824. if ( adapter->hw.flash_address )
  825. iounmap ( adapter->hw.flash_address );
  826. if ( adapter->hw.hw_addr )
  827. iounmap ( adapter->hw.hw_addr );
  828. unregister_netdev ( netdev );
  829. e1000_reset_hw ( &adapter->hw );
  830. netdev_nullify ( netdev );
  831. netdev_put ( netdev );
  832. }
  833. /**
  834. * e1000_open - Called when a network interface is made active
  835. *
  836. * @v netdev network interface device structure
  837. * @ret rc Return status code, 0 on success, negative value on failure
  838. *
  839. **/
  840. static int
  841. e1000_open ( struct net_device *netdev )
  842. {
  843. struct e1000_adapter *adapter = netdev_priv(netdev);
  844. int err;
  845. DBG ( "e1000_open\n" );
  846. /* allocate transmit descriptors */
  847. err = e1000_setup_tx_resources ( adapter );
  848. if ( err ) {
  849. DBG ( "Error setting up TX resources!\n" );
  850. goto err_setup_tx;
  851. }
  852. /* allocate receive descriptors */
  853. err = e1000_setup_rx_resources ( adapter );
  854. if ( err ) {
  855. DBG ( "Error setting up RX resources!\n" );
  856. goto err_setup_rx;
  857. }
  858. e1000_configure_tx ( adapter );
  859. e1000_configure_rx ( adapter );
  860. DBG ( "RXDCTL: %#08x\n", E1000_READ_REG ( &adapter->hw, RXDCTL ) );
  861. return 0;
  862. err_setup_rx:
  863. e1000_free_tx_resources ( adapter );
  864. err_setup_tx:
  865. e1000_reset ( adapter );
  866. return err;
  867. }
  868. /** e1000 net device operations */
  869. static struct net_device_operations e1000_operations = {
  870. .open = e1000_open,
  871. .close = e1000_close,
  872. .transmit = e1000_transmit,
  873. .poll = e1000_poll,
  874. .irq = e1000_irq,
  875. };
  876. int32_t
  877. e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value)
  878. {
  879. struct e1000_adapter *adapter = hw->back;
  880. uint16_t cap_offset;
  881. #define PCI_CAP_ID_EXP 0x10 /* PCI Express */
  882. cap_offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP);
  883. if (!cap_offset)
  884. return -E1000_ERR_CONFIG;
  885. pci_read_config_word(adapter->pdev, cap_offset + reg, value);
  886. return 0;
  887. }
  888. void
  889. e1000_pci_clear_mwi ( struct e1000_hw *hw )
  890. {
  891. struct e1000_adapter *adapter = hw->back;
  892. pci_write_config_word ( adapter->pdev, PCI_COMMAND,
  893. hw->pci_cmd_word & ~PCI_COMMAND_INVALIDATE );
  894. }
  895. void
  896. e1000_pci_set_mwi ( struct e1000_hw *hw )
  897. {
  898. struct e1000_adapter *adapter = hw->back;
  899. pci_write_config_word ( adapter->pdev, PCI_COMMAND, hw->pci_cmd_word );
  900. }
  901. void
  902. e1000_read_pci_cfg ( struct e1000_hw *hw, uint32_t reg, uint16_t *value )
  903. {
  904. struct e1000_adapter *adapter = hw->back;
  905. pci_read_config_word ( adapter->pdev, reg, value );
  906. }
  907. void
  908. e1000_write_pci_cfg ( struct e1000_hw *hw, uint32_t reg, uint16_t *value )
  909. {
  910. struct e1000_adapter *adapter = hw->back;
  911. pci_write_config_word ( adapter->pdev, reg, *value );
  912. }
  913. void
  914. e1000_io_write ( struct e1000_hw *hw __unused, unsigned long port, uint32_t value )
  915. {
  916. outl ( value, port );
  917. }
  918. static struct pci_device_id e1000_nics[] = {
  919. PCI_ROM(0x8086, 0x1000, "e1000-0x1000", "e1000-0x1000", 0),
  920. PCI_ROM(0x8086, 0x1001, "e1000-0x1001", "e1000-0x1001", 0),
  921. PCI_ROM(0x8086, 0x1004, "e1000-0x1004", "e1000-0x1004", 0),
  922. PCI_ROM(0x8086, 0x1008, "e1000-0x1008", "e1000-0x1008", 0),
  923. PCI_ROM(0x8086, 0x1009, "e1000-0x1009", "e1000-0x1009", 0),
  924. PCI_ROM(0x8086, 0x100c, "e1000-0x100c", "e1000-0x100c", 0),
  925. PCI_ROM(0x8086, 0x100d, "e1000-0x100d", "e1000-0x100d", 0),
  926. PCI_ROM(0x8086, 0x100e, "e1000-0x100e", "e1000-0x100e", 0),
  927. PCI_ROM(0x8086, 0x100f, "e1000-0x100f", "e1000-0x100f", 0),
  928. PCI_ROM(0x8086, 0x1010, "e1000-0x1010", "e1000-0x1010", 0),
  929. PCI_ROM(0x8086, 0x1011, "e1000-0x1011", "e1000-0x1011", 0),
  930. PCI_ROM(0x8086, 0x1012, "e1000-0x1012", "e1000-0x1012", 0),
  931. PCI_ROM(0x8086, 0x1013, "e1000-0x1013", "e1000-0x1013", 0),
  932. PCI_ROM(0x8086, 0x1014, "e1000-0x1014", "e1000-0x1014", 0),
  933. PCI_ROM(0x8086, 0x1015, "e1000-0x1015", "e1000-0x1015", 0),
  934. PCI_ROM(0x8086, 0x1016, "e1000-0x1016", "e1000-0x1016", 0),
  935. PCI_ROM(0x8086, 0x1017, "e1000-0x1017", "e1000-0x1017", 0),
  936. PCI_ROM(0x8086, 0x1018, "e1000-0x1018", "e1000-0x1018", 0),
  937. PCI_ROM(0x8086, 0x1019, "e1000-0x1019", "e1000-0x1019", 0),
  938. PCI_ROM(0x8086, 0x101a, "e1000-0x101a", "e1000-0x101a", 0),
  939. PCI_ROM(0x8086, 0x101d, "e1000-0x101d", "e1000-0x101d", 0),
  940. PCI_ROM(0x8086, 0x101e, "e1000-0x101e", "e1000-0x101e", 0),
  941. PCI_ROM(0x8086, 0x1026, "e1000-0x1026", "e1000-0x1026", 0),
  942. PCI_ROM(0x8086, 0x1027, "e1000-0x1027", "e1000-0x1027", 0),
  943. PCI_ROM(0x8086, 0x1028, "e1000-0x1028", "e1000-0x1028", 0),
  944. PCI_ROM(0x8086, 0x1049, "e1000-0x1049", "e1000-0x1049", 0),
  945. PCI_ROM(0x8086, 0x104a, "e1000-0x104a", "e1000-0x104a", 0),
  946. PCI_ROM(0x8086, 0x104b, "e1000-0x104b", "e1000-0x104b", 0),
  947. PCI_ROM(0x8086, 0x104c, "e1000-0x104c", "e1000-0x104c", 0),
  948. PCI_ROM(0x8086, 0x104d, "e1000-0x104d", "e1000-0x104d", 0),
  949. PCI_ROM(0x8086, 0x105e, "e1000-0x105e", "e1000-0x105e", 0),
  950. PCI_ROM(0x8086, 0x105f, "e1000-0x105f", "e1000-0x105f", 0),
  951. PCI_ROM(0x8086, 0x1060, "e1000-0x1060", "e1000-0x1060", 0),
  952. PCI_ROM(0x8086, 0x1075, "e1000-0x1075", "e1000-0x1075", 0),
  953. PCI_ROM(0x8086, 0x1076, "e1000-0x1076", "e1000-0x1076", 0),
  954. PCI_ROM(0x8086, 0x1077, "e1000-0x1077", "e1000-0x1077", 0),
  955. PCI_ROM(0x8086, 0x1078, "e1000-0x1078", "e1000-0x1078", 0),
  956. PCI_ROM(0x8086, 0x1079, "e1000-0x1079", "e1000-0x1079", 0),
  957. PCI_ROM(0x8086, 0x107a, "e1000-0x107a", "e1000-0x107a", 0),
  958. PCI_ROM(0x8086, 0x107b, "e1000-0x107b", "e1000-0x107b", 0),
  959. PCI_ROM(0x8086, 0x107c, "e1000-0x107c", "e1000-0x107c", 0),
  960. PCI_ROM(0x8086, 0x107d, "e1000-0x107d", "e1000-0x107d", 0),
  961. PCI_ROM(0x8086, 0x107e, "e1000-0x107e", "e1000-0x107e", 0),
  962. PCI_ROM(0x8086, 0x107f, "e1000-0x107f", "e1000-0x107f", 0),
  963. PCI_ROM(0x8086, 0x108a, "e1000-0x108a", "e1000-0x108a", 0),
  964. PCI_ROM(0x8086, 0x108b, "e1000-0x108b", "e1000-0x108b", 0),
  965. PCI_ROM(0x8086, 0x108c, "e1000-0x108c", "e1000-0x108c", 0),
  966. PCI_ROM(0x8086, 0x1096, "e1000-0x1096", "e1000-0x1096", 0),
  967. PCI_ROM(0x8086, 0x1098, "e1000-0x1098", "e1000-0x1098", 0),
  968. PCI_ROM(0x8086, 0x1099, "e1000-0x1099", "e1000-0x1099", 0),
  969. PCI_ROM(0x8086, 0x109a, "e1000-0x109a", "e1000-0x109a", 0),
  970. PCI_ROM(0x8086, 0x10a4, "e1000-0x10a4", "e1000-0x10a4", 0),
  971. PCI_ROM(0x8086, 0x10a5, "e1000-0x10a5", "e1000-0x10a5", 0),
  972. PCI_ROM(0x8086, 0x10b5, "e1000-0x10b5", "e1000-0x10b5", 0),
  973. PCI_ROM(0x8086, 0x10b9, "e1000-0x10b9", "e1000-0x10b9", 0),
  974. PCI_ROM(0x8086, 0x10ba, "e1000-0x10ba", "e1000-0x10ba", 0),
  975. PCI_ROM(0x8086, 0x10bb, "e1000-0x10bb", "e1000-0x10bb", 0),
  976. PCI_ROM(0x8086, 0x10bc, "e1000-0x10bc", "e1000-0x10bc", 0),
  977. PCI_ROM(0x8086, 0x10c4, "e1000-0x10c4", "e1000-0x10c4", 0),
  978. PCI_ROM(0x8086, 0x10c5, "e1000-0x10c5", "e1000-0x10c5", 0),
  979. PCI_ROM(0x8086, 0x10c9, "e1000-0x10c9", "e1000-0x10c9", 0),
  980. PCI_ROM(0x8086, 0x10d9, "e1000-0x10d9", "e1000-0x10d9", 0),
  981. PCI_ROM(0x8086, 0x10da, "e1000-0x10da", "e1000-0x10da", 0),
  982. };
  983. struct pci_driver e1000_driver __pci_driver = {
  984. .ids = e1000_nics,
  985. .id_count = (sizeof (e1000_nics) / sizeof (e1000_nics[0])),
  986. .probe = e1000_probe,
  987. .remove = e1000_remove,
  988. };
  989. /*
  990. * Local variables:
  991. * c-basic-offset: 8
  992. * c-indent-level: 8
  993. * tab-width: 8
  994. * End:
  995. */