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.

e1000.c 33KB

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