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.

intel.c 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. /*
  2. * Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. *
  19. * You can also choose to distribute this program under the terms of
  20. * the Unmodified Binary Distribution Licence (as given in the file
  21. * COPYING.UBDL), provided that you have satisfied its requirements.
  22. */
  23. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  24. #include <stdint.h>
  25. #include <string.h>
  26. #include <unistd.h>
  27. #include <errno.h>
  28. #include <byteswap.h>
  29. #include <ipxe/netdevice.h>
  30. #include <ipxe/ethernet.h>
  31. #include <ipxe/if_ether.h>
  32. #include <ipxe/iobuf.h>
  33. #include <ipxe/malloc.h>
  34. #include <ipxe/pci.h>
  35. #include <ipxe/profile.h>
  36. #include "intel.h"
  37. /** @file
  38. *
  39. * Intel 10/100/1000 network card driver
  40. *
  41. */
  42. /** VM transmit profiler */
  43. static struct profiler intel_vm_tx_profiler __profiler =
  44. { .name = "intel.vm_tx" };
  45. /** VM receive refill profiler */
  46. static struct profiler intel_vm_refill_profiler __profiler =
  47. { .name = "intel.vm_refill" };
  48. /** VM poll profiler */
  49. static struct profiler intel_vm_poll_profiler __profiler =
  50. { .name = "intel.vm_poll" };
  51. /******************************************************************************
  52. *
  53. * EEPROM interface
  54. *
  55. ******************************************************************************
  56. */
  57. /**
  58. * Read data from EEPROM
  59. *
  60. * @v nvs NVS device
  61. * @v address Address from which to read
  62. * @v data Data buffer
  63. * @v len Length of data buffer
  64. * @ret rc Return status code
  65. */
  66. static int intel_read_eeprom ( struct nvs_device *nvs, unsigned int address,
  67. void *data, size_t len ) {
  68. struct intel_nic *intel =
  69. container_of ( nvs, struct intel_nic, eeprom );
  70. unsigned int i;
  71. uint32_t value;
  72. uint16_t *data_word = data;
  73. /* Sanity check. We advertise a blocksize of one word, so
  74. * should only ever receive single-word requests.
  75. */
  76. assert ( len == sizeof ( *data_word ) );
  77. /* Initiate read */
  78. writel ( ( INTEL_EERD_START | ( address << intel->eerd_addr_shift ) ),
  79. intel->regs + INTEL_EERD );
  80. /* Wait for read to complete */
  81. for ( i = 0 ; i < INTEL_EEPROM_MAX_WAIT_MS ; i++ ) {
  82. /* If read is not complete, delay 1ms and retry */
  83. value = readl ( intel->regs + INTEL_EERD );
  84. if ( ! ( value & intel->eerd_done ) ) {
  85. mdelay ( 1 );
  86. continue;
  87. }
  88. /* Extract data */
  89. *data_word = cpu_to_le16 ( INTEL_EERD_DATA ( value ) );
  90. return 0;
  91. }
  92. DBGC ( intel, "INTEL %p timed out waiting for EEPROM read\n", intel );
  93. return -ETIMEDOUT;
  94. }
  95. /**
  96. * Write data to EEPROM
  97. *
  98. * @v nvs NVS device
  99. * @v address Address to which to write
  100. * @v data Data buffer
  101. * @v len Length of data buffer
  102. * @ret rc Return status code
  103. */
  104. static int intel_write_eeprom ( struct nvs_device *nvs,
  105. unsigned int address __unused,
  106. const void *data __unused,
  107. size_t len __unused ) {
  108. struct intel_nic *intel =
  109. container_of ( nvs, struct intel_nic, eeprom );
  110. DBGC ( intel, "INTEL %p EEPROM write not supported\n", intel );
  111. return -ENOTSUP;
  112. }
  113. /**
  114. * Initialise EEPROM
  115. *
  116. * @v intel Intel device
  117. * @ret rc Return status code
  118. */
  119. static int intel_init_eeprom ( struct intel_nic *intel ) {
  120. unsigned int i;
  121. uint32_t value;
  122. /* The NIC automatically detects the type of attached EEPROM.
  123. * The EERD register provides access to only a single word at
  124. * a time, so we pretend to have a single-word block size.
  125. *
  126. * The EEPROM size may be larger than the minimum size, but
  127. * this doesn't matter to us since we access only the first
  128. * few words.
  129. */
  130. intel->eeprom.word_len_log2 = INTEL_EEPROM_WORD_LEN_LOG2;
  131. intel->eeprom.size = INTEL_EEPROM_MIN_SIZE_WORDS;
  132. intel->eeprom.block_size = 1;
  133. intel->eeprom.read = intel_read_eeprom;
  134. intel->eeprom.write = intel_write_eeprom;
  135. /* The layout of the EERD register was changed at some point
  136. * to accommodate larger EEPROMs. Read from address zero (for
  137. * which the request layouts are compatible) to determine
  138. * which type of register we have.
  139. */
  140. writel ( INTEL_EERD_START, intel->regs + INTEL_EERD );
  141. for ( i = 0 ; i < INTEL_EEPROM_MAX_WAIT_MS ; i++ ) {
  142. value = readl ( intel->regs + INTEL_EERD );
  143. if ( value & INTEL_EERD_DONE_LARGE ) {
  144. DBGC ( intel, "INTEL %p has large-format EERD\n",
  145. intel );
  146. intel->eerd_done = INTEL_EERD_DONE_LARGE;
  147. intel->eerd_addr_shift = INTEL_EERD_ADDR_SHIFT_LARGE;
  148. return 0;
  149. }
  150. if ( value & INTEL_EERD_DONE_SMALL ) {
  151. DBGC ( intel, "INTEL %p has small-format EERD\n",
  152. intel );
  153. intel->eerd_done = INTEL_EERD_DONE_SMALL;
  154. intel->eerd_addr_shift = INTEL_EERD_ADDR_SHIFT_SMALL;
  155. return 0;
  156. }
  157. mdelay ( 1 );
  158. }
  159. DBGC ( intel, "INTEL %p timed out waiting for initial EEPROM read "
  160. "(value %08x)\n", intel, value );
  161. return -ETIMEDOUT;
  162. }
  163. /******************************************************************************
  164. *
  165. * MAC address
  166. *
  167. ******************************************************************************
  168. */
  169. /**
  170. * Fetch initial MAC address from EEPROM
  171. *
  172. * @v intel Intel device
  173. * @v hw_addr Hardware address to fill in
  174. * @ret rc Return status code
  175. */
  176. static int intel_fetch_mac_eeprom ( struct intel_nic *intel,
  177. uint8_t *hw_addr ) {
  178. int rc;
  179. /* Initialise EEPROM */
  180. if ( ( rc = intel_init_eeprom ( intel ) ) != 0 )
  181. return rc;
  182. /* Read base MAC address from EEPROM */
  183. if ( ( rc = nvs_read ( &intel->eeprom, INTEL_EEPROM_MAC,
  184. hw_addr, ETH_ALEN ) ) != 0 ) {
  185. DBGC ( intel, "INTEL %p could not read EEPROM base MAC "
  186. "address: %s\n", intel, strerror ( rc ) );
  187. return rc;
  188. }
  189. /* Adjust MAC address for multi-port devices */
  190. hw_addr[ETH_ALEN-1] ^= intel->port;
  191. DBGC ( intel, "INTEL %p has EEPROM MAC address %s (port %d)\n",
  192. intel, eth_ntoa ( hw_addr ), intel->port );
  193. return 0;
  194. }
  195. /**
  196. * Fetch initial MAC address
  197. *
  198. * @v intel Intel device
  199. * @v hw_addr Hardware address to fill in
  200. * @ret rc Return status code
  201. */
  202. static int intel_fetch_mac ( struct intel_nic *intel, uint8_t *hw_addr ) {
  203. union intel_receive_address mac;
  204. int rc;
  205. /* Read current address from RAL0/RAH0 */
  206. mac.reg.low = cpu_to_le32 ( readl ( intel->regs + INTEL_RAL0 ) );
  207. mac.reg.high = cpu_to_le32 ( readl ( intel->regs + INTEL_RAH0 ) );
  208. DBGC ( intel, "INTEL %p has autoloaded MAC address %s\n",
  209. intel, eth_ntoa ( mac.raw ) );
  210. /* Use current address if valid */
  211. if ( is_valid_ether_addr ( mac.raw ) ) {
  212. memcpy ( hw_addr, mac.raw, ETH_ALEN );
  213. return 0;
  214. }
  215. /* Otherwise, try to read address from EEPROM */
  216. if ( ( rc = intel_fetch_mac_eeprom ( intel, hw_addr ) ) == 0 )
  217. return 0;
  218. DBGC ( intel, "INTEL %p has no MAC address to use\n", intel );
  219. return -ENOENT;
  220. }
  221. /******************************************************************************
  222. *
  223. * Device reset
  224. *
  225. ******************************************************************************
  226. */
  227. /**
  228. * Reset hardware
  229. *
  230. * @v intel Intel device
  231. * @ret rc Return status code
  232. */
  233. static int intel_reset ( struct intel_nic *intel ) {
  234. uint32_t pbs;
  235. uint32_t pba;
  236. uint32_t ctrl;
  237. uint32_t status;
  238. /* Force RX and TX packet buffer allocation, to work around an
  239. * errata in ICH devices.
  240. */
  241. if ( intel->flags & INTEL_PBS_ERRATA ) {
  242. DBGC ( intel, "INTEL %p WARNING: applying ICH PBS/PBA errata\n",
  243. intel );
  244. pbs = readl ( intel->regs + INTEL_PBS );
  245. pba = readl ( intel->regs + INTEL_PBA );
  246. writel ( 0x08, intel->regs + INTEL_PBA );
  247. writel ( 0x10, intel->regs + INTEL_PBS );
  248. DBGC ( intel, "INTEL %p PBS %#08x->%#08x PBA %#08x->%#08x\n",
  249. intel, pbs, readl ( intel->regs + INTEL_PBS ),
  250. pba, readl ( intel->regs + INTEL_PBA ) );
  251. }
  252. /* Always reset MAC. Required to reset the TX and RX rings. */
  253. ctrl = readl ( intel->regs + INTEL_CTRL );
  254. writel ( ( ctrl | INTEL_CTRL_RST ), intel->regs + INTEL_CTRL );
  255. mdelay ( INTEL_RESET_DELAY_MS );
  256. /* Set a sensible default configuration */
  257. ctrl |= ( INTEL_CTRL_SLU | INTEL_CTRL_ASDE );
  258. ctrl &= ~( INTEL_CTRL_LRST | INTEL_CTRL_FRCSPD | INTEL_CTRL_FRCDPLX );
  259. writel ( ctrl, intel->regs + INTEL_CTRL );
  260. mdelay ( INTEL_RESET_DELAY_MS );
  261. /* If link is already up, do not attempt to reset the PHY. On
  262. * some models (notably ICH), performing a PHY reset seems to
  263. * drop the link speed to 10Mbps.
  264. */
  265. status = readl ( intel->regs + INTEL_STATUS );
  266. if ( status & INTEL_STATUS_LU ) {
  267. DBGC ( intel, "INTEL %p MAC reset (ctrl %08x)\n",
  268. intel, ctrl );
  269. return 0;
  270. }
  271. /* Reset PHY and MAC simultaneously */
  272. writel ( ( ctrl | INTEL_CTRL_RST | INTEL_CTRL_PHY_RST ),
  273. intel->regs + INTEL_CTRL );
  274. mdelay ( INTEL_RESET_DELAY_MS );
  275. /* PHY reset is not self-clearing on all models */
  276. writel ( ctrl, intel->regs + INTEL_CTRL );
  277. mdelay ( INTEL_RESET_DELAY_MS );
  278. DBGC ( intel, "INTEL %p MAC+PHY reset (ctrl %08x)\n", intel, ctrl );
  279. return 0;
  280. }
  281. /******************************************************************************
  282. *
  283. * Link state
  284. *
  285. ******************************************************************************
  286. */
  287. /**
  288. * Check link state
  289. *
  290. * @v netdev Network device
  291. */
  292. static void intel_check_link ( struct net_device *netdev ) {
  293. struct intel_nic *intel = netdev->priv;
  294. uint32_t status;
  295. /* Read link status */
  296. status = readl ( intel->regs + INTEL_STATUS );
  297. DBGC ( intel, "INTEL %p link status is %08x\n", intel, status );
  298. /* Update network device */
  299. if ( status & INTEL_STATUS_LU ) {
  300. netdev_link_up ( netdev );
  301. } else {
  302. netdev_link_down ( netdev );
  303. }
  304. }
  305. /******************************************************************************
  306. *
  307. * Descriptors
  308. *
  309. ******************************************************************************
  310. */
  311. /**
  312. * Populate transmit descriptor
  313. *
  314. * @v tx Transmit descriptor
  315. * @v addr Data buffer address
  316. * @v len Length of data
  317. */
  318. void intel_describe_tx ( struct intel_descriptor *tx, physaddr_t addr,
  319. size_t len ) {
  320. /* Populate transmit descriptor */
  321. tx->address = cpu_to_le64 ( addr );
  322. tx->length = cpu_to_le16 ( len );
  323. tx->flags = 0;
  324. tx->command = ( INTEL_DESC_CMD_RS | INTEL_DESC_CMD_IFCS |
  325. INTEL_DESC_CMD_EOP );
  326. tx->status = 0;
  327. }
  328. /**
  329. * Populate advanced transmit descriptor
  330. *
  331. * @v tx Transmit descriptor
  332. * @v addr Data buffer address
  333. * @v len Length of data
  334. */
  335. void intel_describe_tx_adv ( struct intel_descriptor *tx, physaddr_t addr,
  336. size_t len ) {
  337. /* Populate advanced transmit descriptor */
  338. tx->address = cpu_to_le64 ( addr );
  339. tx->length = cpu_to_le16 ( len );
  340. tx->flags = INTEL_DESC_FL_DTYP_DATA;
  341. tx->command = ( INTEL_DESC_CMD_DEXT | INTEL_DESC_CMD_RS |
  342. INTEL_DESC_CMD_IFCS | INTEL_DESC_CMD_EOP );
  343. tx->status = cpu_to_le32 ( INTEL_DESC_STATUS_PAYLEN ( len ) );
  344. }
  345. /**
  346. * Populate receive descriptor
  347. *
  348. * @v rx Receive descriptor
  349. * @v addr Data buffer address
  350. * @v len Length of data
  351. */
  352. void intel_describe_rx ( struct intel_descriptor *rx, physaddr_t addr,
  353. size_t len __unused ) {
  354. /* Populate transmit descriptor */
  355. rx->address = cpu_to_le64 ( addr );
  356. rx->length = 0;
  357. rx->status = 0;
  358. }
  359. /******************************************************************************
  360. *
  361. * Network device interface
  362. *
  363. ******************************************************************************
  364. */
  365. /**
  366. * Create descriptor ring
  367. *
  368. * @v intel Intel device
  369. * @v ring Descriptor ring
  370. * @ret rc Return status code
  371. */
  372. int intel_create_ring ( struct intel_nic *intel, struct intel_ring *ring ) {
  373. physaddr_t address;
  374. uint32_t dctl;
  375. /* Allocate descriptor ring. Align ring on its own size to
  376. * prevent any possible page-crossing errors due to hardware
  377. * errata.
  378. */
  379. ring->desc = malloc_dma ( ring->len, ring->len );
  380. if ( ! ring->desc )
  381. return -ENOMEM;
  382. /* Initialise descriptor ring */
  383. memset ( ring->desc, 0, ring->len );
  384. /* Program ring address */
  385. address = virt_to_bus ( ring->desc );
  386. writel ( ( address & 0xffffffffUL ),
  387. ( intel->regs + ring->reg + INTEL_xDBAL ) );
  388. if ( sizeof ( physaddr_t ) > sizeof ( uint32_t ) ) {
  389. writel ( ( ( ( uint64_t ) address ) >> 32 ),
  390. ( intel->regs + ring->reg + INTEL_xDBAH ) );
  391. } else {
  392. writel ( 0, intel->regs + ring->reg + INTEL_xDBAH );
  393. }
  394. /* Program ring length */
  395. writel ( ring->len, ( intel->regs + ring->reg + INTEL_xDLEN ) );
  396. /* Reset head and tail pointers */
  397. writel ( 0, ( intel->regs + ring->reg + INTEL_xDH ) );
  398. writel ( 0, ( intel->regs + ring->reg + INTEL_xDT ) );
  399. /* Enable ring */
  400. dctl = readl ( intel->regs + ring->reg + INTEL_xDCTL );
  401. dctl |= INTEL_xDCTL_ENABLE;
  402. writel ( dctl, intel->regs + ring->reg + INTEL_xDCTL );
  403. DBGC ( intel, "INTEL %p ring %05x is at [%08llx,%08llx)\n",
  404. intel, ring->reg, ( ( unsigned long long ) address ),
  405. ( ( unsigned long long ) address + ring->len ) );
  406. return 0;
  407. }
  408. /**
  409. * Destroy descriptor ring
  410. *
  411. * @v intel Intel device
  412. * @v ring Descriptor ring
  413. */
  414. void intel_destroy_ring ( struct intel_nic *intel, struct intel_ring *ring ) {
  415. /* Clear ring length */
  416. writel ( 0, ( intel->regs + ring->reg + INTEL_xDLEN ) );
  417. /* Clear ring address */
  418. writel ( 0, ( intel->regs + ring->reg + INTEL_xDBAL ) );
  419. writel ( 0, ( intel->regs + ring->reg + INTEL_xDBAH ) );
  420. /* Free descriptor ring */
  421. free_dma ( ring->desc, ring->len );
  422. ring->desc = NULL;
  423. ring->prod = 0;
  424. ring->cons = 0;
  425. }
  426. /**
  427. * Refill receive descriptor ring
  428. *
  429. * @v intel Intel device
  430. */
  431. void intel_refill_rx ( struct intel_nic *intel ) {
  432. struct intel_descriptor *rx;
  433. struct io_buffer *iobuf;
  434. unsigned int rx_idx;
  435. unsigned int rx_tail;
  436. physaddr_t address;
  437. unsigned int refilled = 0;
  438. /* Refill ring */
  439. while ( ( intel->rx.prod - intel->rx.cons ) < INTEL_RX_FILL ) {
  440. /* Allocate I/O buffer */
  441. iobuf = alloc_iob ( INTEL_RX_MAX_LEN );
  442. if ( ! iobuf ) {
  443. /* Wait for next refill */
  444. break;
  445. }
  446. /* Get next receive descriptor */
  447. rx_idx = ( intel->rx.prod++ % INTEL_NUM_RX_DESC );
  448. rx = &intel->rx.desc[rx_idx];
  449. /* Populate receive descriptor */
  450. address = virt_to_bus ( iobuf->data );
  451. intel->rx.describe ( rx, address, 0 );
  452. /* Record I/O buffer */
  453. assert ( intel->rx_iobuf[rx_idx] == NULL );
  454. intel->rx_iobuf[rx_idx] = iobuf;
  455. DBGC2 ( intel, "INTEL %p RX %d is [%llx,%llx)\n", intel, rx_idx,
  456. ( ( unsigned long long ) address ),
  457. ( ( unsigned long long ) address + INTEL_RX_MAX_LEN ) );
  458. refilled++;
  459. }
  460. /* Push descriptors to card, if applicable */
  461. if ( refilled ) {
  462. wmb();
  463. rx_tail = ( intel->rx.prod % INTEL_NUM_RX_DESC );
  464. profile_start ( &intel_vm_refill_profiler );
  465. writel ( rx_tail, intel->regs + intel->rx.reg + INTEL_xDT );
  466. profile_stop ( &intel_vm_refill_profiler );
  467. profile_exclude ( &intel_vm_refill_profiler );
  468. }
  469. }
  470. /**
  471. * Discard unused receive I/O buffers
  472. *
  473. * @v intel Intel device
  474. */
  475. void intel_empty_rx ( struct intel_nic *intel ) {
  476. unsigned int i;
  477. for ( i = 0 ; i < INTEL_NUM_RX_DESC ; i++ ) {
  478. if ( intel->rx_iobuf[i] )
  479. free_iob ( intel->rx_iobuf[i] );
  480. intel->rx_iobuf[i] = NULL;
  481. }
  482. }
  483. /**
  484. * Open network device
  485. *
  486. * @v netdev Network device
  487. * @ret rc Return status code
  488. */
  489. static int intel_open ( struct net_device *netdev ) {
  490. struct intel_nic *intel = netdev->priv;
  491. union intel_receive_address mac;
  492. uint32_t tctl;
  493. uint32_t rctl;
  494. int rc;
  495. /* Create transmit descriptor ring */
  496. if ( ( rc = intel_create_ring ( intel, &intel->tx ) ) != 0 )
  497. goto err_create_tx;
  498. /* Create receive descriptor ring */
  499. if ( ( rc = intel_create_ring ( intel, &intel->rx ) ) != 0 )
  500. goto err_create_rx;
  501. /* Program MAC address */
  502. memset ( &mac, 0, sizeof ( mac ) );
  503. memcpy ( mac.raw, netdev->ll_addr, sizeof ( mac.raw ) );
  504. writel ( le32_to_cpu ( mac.reg.low ), intel->regs + INTEL_RAL0 );
  505. writel ( ( le32_to_cpu ( mac.reg.high ) | INTEL_RAH0_AV ),
  506. intel->regs + INTEL_RAH0 );
  507. /* Enable transmitter */
  508. tctl = readl ( intel->regs + INTEL_TCTL );
  509. tctl &= ~( INTEL_TCTL_CT_MASK | INTEL_TCTL_COLD_MASK );
  510. tctl |= ( INTEL_TCTL_EN | INTEL_TCTL_PSP | INTEL_TCTL_CT_DEFAULT |
  511. INTEL_TCTL_COLD_DEFAULT );
  512. writel ( tctl, intel->regs + INTEL_TCTL );
  513. /* Enable receiver */
  514. rctl = readl ( intel->regs + INTEL_RCTL );
  515. rctl &= ~( INTEL_RCTL_BSIZE_BSEX_MASK );
  516. rctl |= ( INTEL_RCTL_EN | INTEL_RCTL_UPE | INTEL_RCTL_MPE |
  517. INTEL_RCTL_BAM | INTEL_RCTL_BSIZE_2048 | INTEL_RCTL_SECRC );
  518. writel ( rctl, intel->regs + INTEL_RCTL );
  519. /* Fill receive ring */
  520. intel_refill_rx ( intel );
  521. /* Update link state */
  522. intel_check_link ( netdev );
  523. /* Apply required errata */
  524. if ( intel->flags & INTEL_VMWARE ) {
  525. DBGC ( intel, "INTEL %p applying VMware errata workaround\n",
  526. intel );
  527. intel->force_icr = INTEL_IRQ_RXT0;
  528. }
  529. return 0;
  530. intel_destroy_ring ( intel, &intel->rx );
  531. err_create_rx:
  532. intel_destroy_ring ( intel, &intel->tx );
  533. err_create_tx:
  534. return rc;
  535. }
  536. /**
  537. * Close network device
  538. *
  539. * @v netdev Network device
  540. */
  541. static void intel_close ( struct net_device *netdev ) {
  542. struct intel_nic *intel = netdev->priv;
  543. /* Disable receiver */
  544. writel ( 0, intel->regs + INTEL_RCTL );
  545. /* Disable transmitter */
  546. writel ( 0, intel->regs + INTEL_TCTL );
  547. /* Destroy receive descriptor ring */
  548. intel_destroy_ring ( intel, &intel->rx );
  549. /* Discard any unused receive buffers */
  550. intel_empty_rx ( intel );
  551. /* Destroy transmit descriptor ring */
  552. intel_destroy_ring ( intel, &intel->tx );
  553. /* Reset the NIC, to flush the transmit and receive FIFOs */
  554. intel_reset ( intel );
  555. }
  556. /**
  557. * Transmit packet
  558. *
  559. * @v netdev Network device
  560. * @v iobuf I/O buffer
  561. * @ret rc Return status code
  562. */
  563. int intel_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) {
  564. struct intel_nic *intel = netdev->priv;
  565. struct intel_descriptor *tx;
  566. unsigned int tx_idx;
  567. unsigned int tx_tail;
  568. physaddr_t address;
  569. size_t len;
  570. /* Get next transmit descriptor */
  571. if ( ( intel->tx.prod - intel->tx.cons ) >= INTEL_TX_FILL ) {
  572. DBGC ( intel, "INTEL %p out of transmit descriptors\n", intel );
  573. return -ENOBUFS;
  574. }
  575. tx_idx = ( intel->tx.prod++ % INTEL_NUM_TX_DESC );
  576. tx_tail = ( intel->tx.prod % INTEL_NUM_TX_DESC );
  577. tx = &intel->tx.desc[tx_idx];
  578. /* Populate transmit descriptor */
  579. address = virt_to_bus ( iobuf->data );
  580. len = iob_len ( iobuf );
  581. intel->tx.describe ( tx, address, len );
  582. wmb();
  583. /* Notify card that there are packets ready to transmit */
  584. profile_start ( &intel_vm_tx_profiler );
  585. writel ( tx_tail, intel->regs + intel->tx.reg + INTEL_xDT );
  586. profile_stop ( &intel_vm_tx_profiler );
  587. profile_exclude ( &intel_vm_tx_profiler );
  588. DBGC2 ( intel, "INTEL %p TX %d is [%llx,%llx)\n", intel, tx_idx,
  589. ( ( unsigned long long ) address ),
  590. ( ( unsigned long long ) address + len ) );
  591. return 0;
  592. }
  593. /**
  594. * Poll for completed packets
  595. *
  596. * @v netdev Network device
  597. */
  598. void intel_poll_tx ( struct net_device *netdev ) {
  599. struct intel_nic *intel = netdev->priv;
  600. struct intel_descriptor *tx;
  601. unsigned int tx_idx;
  602. /* Check for completed packets */
  603. while ( intel->tx.cons != intel->tx.prod ) {
  604. /* Get next transmit descriptor */
  605. tx_idx = ( intel->tx.cons % INTEL_NUM_TX_DESC );
  606. tx = &intel->tx.desc[tx_idx];
  607. /* Stop if descriptor is still in use */
  608. if ( ! ( tx->status & cpu_to_le32 ( INTEL_DESC_STATUS_DD ) ) )
  609. return;
  610. DBGC2 ( intel, "INTEL %p TX %d complete\n", intel, tx_idx );
  611. /* Complete TX descriptor */
  612. netdev_tx_complete_next ( netdev );
  613. intel->tx.cons++;
  614. }
  615. }
  616. /**
  617. * Poll for received packets
  618. *
  619. * @v netdev Network device
  620. */
  621. void intel_poll_rx ( struct net_device *netdev ) {
  622. struct intel_nic *intel = netdev->priv;
  623. struct intel_descriptor *rx;
  624. struct io_buffer *iobuf;
  625. unsigned int rx_idx;
  626. size_t len;
  627. /* Check for received packets */
  628. while ( intel->rx.cons != intel->rx.prod ) {
  629. /* Get next receive descriptor */
  630. rx_idx = ( intel->rx.cons % INTEL_NUM_RX_DESC );
  631. rx = &intel->rx.desc[rx_idx];
  632. /* Stop if descriptor is still in use */
  633. if ( ! ( rx->status & cpu_to_le32 ( INTEL_DESC_STATUS_DD ) ) )
  634. return;
  635. /* Populate I/O buffer */
  636. iobuf = intel->rx_iobuf[rx_idx];
  637. intel->rx_iobuf[rx_idx] = NULL;
  638. len = le16_to_cpu ( rx->length );
  639. iob_put ( iobuf, len );
  640. /* Hand off to network stack */
  641. if ( rx->status & cpu_to_le32 ( INTEL_DESC_STATUS_RXE ) ) {
  642. DBGC ( intel, "INTEL %p RX %d error (length %zd, "
  643. "status %08x)\n", intel, rx_idx, len,
  644. le32_to_cpu ( rx->status ) );
  645. netdev_rx_err ( netdev, iobuf, -EIO );
  646. } else {
  647. DBGC2 ( intel, "INTEL %p RX %d complete (length %zd)\n",
  648. intel, rx_idx, len );
  649. netdev_rx ( netdev, iobuf );
  650. }
  651. intel->rx.cons++;
  652. }
  653. }
  654. /**
  655. * Poll for completed and received packets
  656. *
  657. * @v netdev Network device
  658. */
  659. static void intel_poll ( struct net_device *netdev ) {
  660. struct intel_nic *intel = netdev->priv;
  661. uint32_t icr;
  662. /* Check for and acknowledge interrupts */
  663. profile_start ( &intel_vm_poll_profiler );
  664. icr = readl ( intel->regs + INTEL_ICR );
  665. profile_stop ( &intel_vm_poll_profiler );
  666. profile_exclude ( &intel_vm_poll_profiler );
  667. icr |= intel->force_icr;
  668. if ( ! icr )
  669. return;
  670. /* Poll for TX completions, if applicable */
  671. if ( icr & INTEL_IRQ_TXDW )
  672. intel_poll_tx ( netdev );
  673. /* Poll for RX completions, if applicable */
  674. if ( icr & ( INTEL_IRQ_RXT0 | INTEL_IRQ_RXO ) )
  675. intel_poll_rx ( netdev );
  676. /* Report receive overruns */
  677. if ( icr & INTEL_IRQ_RXO )
  678. netdev_rx_err ( netdev, NULL, -ENOBUFS );
  679. /* Check link state, if applicable */
  680. if ( icr & INTEL_IRQ_LSC )
  681. intel_check_link ( netdev );
  682. /* Check for unexpected interrupts */
  683. if ( icr & ~( INTEL_IRQ_TXDW | INTEL_IRQ_TXQE | INTEL_IRQ_LSC |
  684. INTEL_IRQ_RXDMT0 | INTEL_IRQ_RXT0 | INTEL_IRQ_RXO ) ) {
  685. DBGC ( intel, "INTEL %p unexpected ICR %08x\n", intel, icr );
  686. /* Report as a TX error */
  687. netdev_tx_err ( netdev, NULL, -ENOTSUP );
  688. }
  689. /* Refill RX ring */
  690. intel_refill_rx ( intel );
  691. }
  692. /**
  693. * Enable or disable interrupts
  694. *
  695. * @v netdev Network device
  696. * @v enable Interrupts should be enabled
  697. */
  698. static void intel_irq ( struct net_device *netdev, int enable ) {
  699. struct intel_nic *intel = netdev->priv;
  700. uint32_t mask;
  701. mask = ( INTEL_IRQ_TXDW | INTEL_IRQ_LSC | INTEL_IRQ_RXT0 );
  702. if ( enable ) {
  703. writel ( mask, intel->regs + INTEL_IMS );
  704. } else {
  705. writel ( mask, intel->regs + INTEL_IMC );
  706. }
  707. }
  708. /** Intel network device operations */
  709. static struct net_device_operations intel_operations = {
  710. .open = intel_open,
  711. .close = intel_close,
  712. .transmit = intel_transmit,
  713. .poll = intel_poll,
  714. .irq = intel_irq,
  715. };
  716. /******************************************************************************
  717. *
  718. * PCI interface
  719. *
  720. ******************************************************************************
  721. */
  722. /**
  723. * Probe PCI device
  724. *
  725. * @v pci PCI device
  726. * @ret rc Return status code
  727. */
  728. static int intel_probe ( struct pci_device *pci ) {
  729. struct net_device *netdev;
  730. struct intel_nic *intel;
  731. int rc;
  732. /* Allocate and initialise net device */
  733. netdev = alloc_etherdev ( sizeof ( *intel ) );
  734. if ( ! netdev ) {
  735. rc = -ENOMEM;
  736. goto err_alloc;
  737. }
  738. netdev_init ( netdev, &intel_operations );
  739. intel = netdev->priv;
  740. pci_set_drvdata ( pci, netdev );
  741. netdev->dev = &pci->dev;
  742. memset ( intel, 0, sizeof ( *intel ) );
  743. intel->port = PCI_FUNC ( pci->busdevfn );
  744. intel->flags = pci->id->driver_data;
  745. intel_init_ring ( &intel->tx, INTEL_NUM_TX_DESC, INTEL_TD,
  746. intel_describe_tx );
  747. intel_init_ring ( &intel->rx, INTEL_NUM_RX_DESC, INTEL_RD,
  748. intel_describe_rx );
  749. /* Fix up PCI device */
  750. adjust_pci_device ( pci );
  751. /* Map registers */
  752. intel->regs = ioremap ( pci->membase, INTEL_BAR_SIZE );
  753. if ( ! intel->regs ) {
  754. rc = -ENODEV;
  755. goto err_ioremap;
  756. }
  757. /* Reset the NIC */
  758. if ( ( rc = intel_reset ( intel ) ) != 0 )
  759. goto err_reset;
  760. /* Fetch MAC address */
  761. if ( ( rc = intel_fetch_mac ( intel, netdev->hw_addr ) ) != 0 )
  762. goto err_fetch_mac;
  763. /* Register network device */
  764. if ( ( rc = register_netdev ( netdev ) ) != 0 )
  765. goto err_register_netdev;
  766. /* Set initial link state */
  767. intel_check_link ( netdev );
  768. return 0;
  769. unregister_netdev ( netdev );
  770. err_register_netdev:
  771. err_fetch_mac:
  772. intel_reset ( intel );
  773. err_reset:
  774. iounmap ( intel->regs );
  775. err_ioremap:
  776. netdev_nullify ( netdev );
  777. netdev_put ( netdev );
  778. err_alloc:
  779. return rc;
  780. }
  781. /**
  782. * Remove PCI device
  783. *
  784. * @v pci PCI device
  785. */
  786. static void intel_remove ( struct pci_device *pci ) {
  787. struct net_device *netdev = pci_get_drvdata ( pci );
  788. struct intel_nic *intel = netdev->priv;
  789. /* Unregister network device */
  790. unregister_netdev ( netdev );
  791. /* Reset the NIC */
  792. intel_reset ( intel );
  793. /* Free network device */
  794. iounmap ( intel->regs );
  795. netdev_nullify ( netdev );
  796. netdev_put ( netdev );
  797. }
  798. /** Intel PCI device IDs */
  799. static struct pci_device_id intel_nics[] = {
  800. PCI_ROM ( 0x8086, 0x0438, "dh8900cc", "DH8900CC", 0 ),
  801. PCI_ROM ( 0x8086, 0x043a, "dh8900cc-f", "DH8900CC Fiber", 0 ),
  802. PCI_ROM ( 0x8086, 0x043c, "dh8900cc-b", "DH8900CC Backplane", 0 ),
  803. PCI_ROM ( 0x8086, 0x0440, "dh8900cc-s", "DH8900CC SFP", 0 ),
  804. PCI_ROM ( 0x8086, 0x1000, "82542-f", "82542 (Fiber)", 0 ),
  805. PCI_ROM ( 0x8086, 0x1001, "82543gc-f", "82543GC (Fiber)", 0 ),
  806. PCI_ROM ( 0x8086, 0x1004, "82543gc", "82543GC (Copper)", 0 ),
  807. PCI_ROM ( 0x8086, 0x1008, "82544ei", "82544EI (Copper)", 0 ),
  808. PCI_ROM ( 0x8086, 0x1009, "82544ei-f", "82544EI (Fiber)", 0 ),
  809. PCI_ROM ( 0x8086, 0x100c, "82544gc", "82544GC (Copper)", 0 ),
  810. PCI_ROM ( 0x8086, 0x100d, "82544gc-l", "82544GC (LOM)", 0 ),
  811. PCI_ROM ( 0x8086, 0x100e, "82540em", "82540EM", 0 ),
  812. PCI_ROM ( 0x8086, 0x100f, "82545em", "82545EM (Copper)", INTEL_VMWARE ),
  813. PCI_ROM ( 0x8086, 0x1010, "82546eb", "82546EB (Copper)", 0 ),
  814. PCI_ROM ( 0x8086, 0x1011, "82545em-f", "82545EM (Fiber)", 0 ),
  815. PCI_ROM ( 0x8086, 0x1012, "82546eb-f", "82546EB (Fiber)", 0 ),
  816. PCI_ROM ( 0x8086, 0x1013, "82541ei", "82541EI", 0 ),
  817. PCI_ROM ( 0x8086, 0x1014, "82541er", "82541ER", 0 ),
  818. PCI_ROM ( 0x8086, 0x1015, "82540em-l", "82540EM (LOM)", 0 ),
  819. PCI_ROM ( 0x8086, 0x1016, "82540ep-m", "82540EP (Mobile)", 0 ),
  820. PCI_ROM ( 0x8086, 0x1017, "82540ep", "82540EP", 0 ),
  821. PCI_ROM ( 0x8086, 0x1018, "82541ei", "82541EI", 0 ),
  822. PCI_ROM ( 0x8086, 0x1019, "82547ei", "82547EI", 0 ),
  823. PCI_ROM ( 0x8086, 0x101a, "82547ei-m", "82547EI (Mobile)", 0 ),
  824. PCI_ROM ( 0x8086, 0x101d, "82546eb", "82546EB", 0 ),
  825. PCI_ROM ( 0x8086, 0x101e, "82540ep-m", "82540EP (Mobile)", 0 ),
  826. PCI_ROM ( 0x8086, 0x1026, "82545gm", "82545GM", 0 ),
  827. PCI_ROM ( 0x8086, 0x1027, "82545gm-1", "82545GM", 0 ),
  828. PCI_ROM ( 0x8086, 0x1028, "82545gm-2", "82545GM", 0 ),
  829. PCI_ROM ( 0x8086, 0x1049, "82566mm", "82566MM", INTEL_PBS_ERRATA ),
  830. PCI_ROM ( 0x8086, 0x104a, "82566dm", "82566DM", INTEL_PBS_ERRATA ),
  831. PCI_ROM ( 0x8086, 0x104b, "82566dc", "82566DC", INTEL_PBS_ERRATA ),
  832. PCI_ROM ( 0x8086, 0x104c, "82562v", "82562V", INTEL_PBS_ERRATA ),
  833. PCI_ROM ( 0x8086, 0x104d, "82566mc", "82566MC", INTEL_PBS_ERRATA ),
  834. PCI_ROM ( 0x8086, 0x105e, "82571eb", "82571EB", 0 ),
  835. PCI_ROM ( 0x8086, 0x105f, "82571eb-1", "82571EB", 0 ),
  836. PCI_ROM ( 0x8086, 0x1060, "82571eb-2", "82571EB", 0 ),
  837. PCI_ROM ( 0x8086, 0x1075, "82547gi", "82547GI", 0 ),
  838. PCI_ROM ( 0x8086, 0x1076, "82541gi", "82541GI", 0 ),
  839. PCI_ROM ( 0x8086, 0x1077, "82541gi-1", "82541GI", 0 ),
  840. PCI_ROM ( 0x8086, 0x1078, "82541er", "82541ER", 0 ),
  841. PCI_ROM ( 0x8086, 0x1079, "82546gb", "82546GB", 0 ),
  842. PCI_ROM ( 0x8086, 0x107a, "82546gb-1", "82546GB", 0 ),
  843. PCI_ROM ( 0x8086, 0x107b, "82546gb-2", "82546GB", 0 ),
  844. PCI_ROM ( 0x8086, 0x107c, "82541pi", "82541PI", 0 ),
  845. PCI_ROM ( 0x8086, 0x107d, "82572ei", "82572EI (Copper)", 0 ),
  846. PCI_ROM ( 0x8086, 0x107e, "82572ei-f", "82572EI (Fiber)", 0 ),
  847. PCI_ROM ( 0x8086, 0x107f, "82572ei", "82572EI", 0 ),
  848. PCI_ROM ( 0x8086, 0x108a, "82546gb-3", "82546GB", 0 ),
  849. PCI_ROM ( 0x8086, 0x108b, "82573v", "82573V (Copper)", 0 ),
  850. PCI_ROM ( 0x8086, 0x108c, "82573e", "82573E (Copper)", 0 ),
  851. PCI_ROM ( 0x8086, 0x1096, "80003es2lan", "80003ES2LAN (Copper)", 0 ),
  852. PCI_ROM ( 0x8086, 0x1098, "80003es2lan-s", "80003ES2LAN (Serdes)", 0 ),
  853. PCI_ROM ( 0x8086, 0x1099, "82546gb-4", "82546GB (Copper)", 0 ),
  854. PCI_ROM ( 0x8086, 0x109a, "82573l", "82573L", 0 ),
  855. PCI_ROM ( 0x8086, 0x10a4, "82571eb", "82571EB", 0 ),
  856. PCI_ROM ( 0x8086, 0x10a5, "82571eb", "82571EB (Fiber)", 0 ),
  857. PCI_ROM ( 0x8086, 0x10a7, "82575eb", "82575EB", 0 ),
  858. PCI_ROM ( 0x8086, 0x10a9, "82575eb", "82575EB Backplane", 0 ),
  859. PCI_ROM ( 0x8086, 0x10b5, "82546gb", "82546GB (Copper)", 0 ),
  860. PCI_ROM ( 0x8086, 0x10b9, "82572ei", "82572EI (Copper)", 0 ),
  861. PCI_ROM ( 0x8086, 0x10ba, "80003es2lan", "80003ES2LAN (Copper)", 0 ),
  862. PCI_ROM ( 0x8086, 0x10bb, "80003es2lan", "80003ES2LAN (Serdes)", 0 ),
  863. PCI_ROM ( 0x8086, 0x10bc, "82571eb", "82571EB (Copper)", 0 ),
  864. PCI_ROM ( 0x8086, 0x10bd, "82566dm-2", "82566DM-2", 0 ),
  865. PCI_ROM ( 0x8086, 0x10bf, "82567lf", "82567LF", 0 ),
  866. PCI_ROM ( 0x8086, 0x10c0, "82562v-2", "82562V-2", 0 ),
  867. PCI_ROM ( 0x8086, 0x10c2, "82562g-2", "82562G-2", 0 ),
  868. PCI_ROM ( 0x8086, 0x10c3, "82562gt-2", "82562GT-2", 0 ),
  869. PCI_ROM ( 0x8086, 0x10c4, "82562gt", "82562GT", INTEL_PBS_ERRATA ),
  870. PCI_ROM ( 0x8086, 0x10c5, "82562g", "82562G", INTEL_PBS_ERRATA ),
  871. PCI_ROM ( 0x8086, 0x10c9, "82576", "82576", 0 ),
  872. PCI_ROM ( 0x8086, 0x10cb, "82567v", "82567V", 0 ),
  873. PCI_ROM ( 0x8086, 0x10cc, "82567lm-2", "82567LM-2", 0 ),
  874. PCI_ROM ( 0x8086, 0x10cd, "82567lf-2", "82567LF-2", 0 ),
  875. PCI_ROM ( 0x8086, 0x10ce, "82567v-2", "82567V-2", 0 ),
  876. PCI_ROM ( 0x8086, 0x10d3, "82574l", "82574L", 0 ),
  877. PCI_ROM ( 0x8086, 0x10d5, "82571pt", "82571PT PT Quad", 0 ),
  878. PCI_ROM ( 0x8086, 0x10d6, "82575gb", "82575GB", 0 ),
  879. PCI_ROM ( 0x8086, 0x10d9, "82571eb-d", "82571EB Dual Mezzanine", 0 ),
  880. PCI_ROM ( 0x8086, 0x10da, "82571eb-q", "82571EB Quad Mezzanine", 0 ),
  881. PCI_ROM ( 0x8086, 0x10de, "82567lm-3", "82567LM-3", 0 ),
  882. PCI_ROM ( 0x8086, 0x10df, "82567lf-3", "82567LF-3", 0 ),
  883. PCI_ROM ( 0x8086, 0x10e5, "82567lm-4", "82567LM-4", 0 ),
  884. PCI_ROM ( 0x8086, 0x10e6, "82576", "82576", 0 ),
  885. PCI_ROM ( 0x8086, 0x10e7, "82576-2", "82576", 0 ),
  886. PCI_ROM ( 0x8086, 0x10e8, "82576-3", "82576", 0 ),
  887. PCI_ROM ( 0x8086, 0x10ea, "82577lm", "82577LM", 0 ),
  888. PCI_ROM ( 0x8086, 0x10eb, "82577lc", "82577LC", 0 ),
  889. PCI_ROM ( 0x8086, 0x10ef, "82578dm", "82578DM", 0 ),
  890. PCI_ROM ( 0x8086, 0x10f0, "82578dc", "82578DC", 0 ),
  891. PCI_ROM ( 0x8086, 0x10f5, "82567lm", "82567LM", 0 ),
  892. PCI_ROM ( 0x8086, 0x10f6, "82574l", "82574L", 0 ),
  893. PCI_ROM ( 0x8086, 0x1501, "82567v-3", "82567V-3", INTEL_PBS_ERRATA ),
  894. PCI_ROM ( 0x8086, 0x1502, "82579lm", "82579LM", 0 ),
  895. PCI_ROM ( 0x8086, 0x1503, "82579v", "82579V", 0 ),
  896. PCI_ROM ( 0x8086, 0x150a, "82576ns", "82576NS", 0 ),
  897. PCI_ROM ( 0x8086, 0x150c, "82583v", "82583V", 0 ),
  898. PCI_ROM ( 0x8086, 0x150d, "82576-4", "82576 Backplane", 0 ),
  899. PCI_ROM ( 0x8086, 0x150e, "82580", "82580", 0 ),
  900. PCI_ROM ( 0x8086, 0x150f, "82580-f", "82580 Fiber", 0 ),
  901. PCI_ROM ( 0x8086, 0x1510, "82580-b", "82580 Backplane", 0 ),
  902. PCI_ROM ( 0x8086, 0x1511, "82580-s", "82580 SFP", 0 ),
  903. PCI_ROM ( 0x8086, 0x1516, "82580-2", "82580", 0 ),
  904. PCI_ROM ( 0x8086, 0x1518, "82576ns", "82576NS SerDes", 0 ),
  905. PCI_ROM ( 0x8086, 0x1521, "i350", "I350", 0 ),
  906. PCI_ROM ( 0x8086, 0x1522, "i350-f", "I350 Fiber", 0 ),
  907. PCI_ROM ( 0x8086, 0x1523, "i350-b", "I350 Backplane", 0 ),
  908. PCI_ROM ( 0x8086, 0x1524, "i350-2", "I350", 0 ),
  909. PCI_ROM ( 0x8086, 0x1525, "82567v-4", "82567V-4", 0 ),
  910. PCI_ROM ( 0x8086, 0x1526, "82576-5", "82576", 0 ),
  911. PCI_ROM ( 0x8086, 0x1527, "82580-f2", "82580 Fiber", 0 ),
  912. PCI_ROM ( 0x8086, 0x1533, "i210", "I210", 0 ),
  913. PCI_ROM ( 0x8086, 0x1539, "i211", "I211", 0 ),
  914. PCI_ROM ( 0x8086, 0x153a, "i217lm", "I217-LM", 0 ),
  915. PCI_ROM ( 0x8086, 0x153b, "i217v", "I217-V", 0 ),
  916. PCI_ROM ( 0x8086, 0x1559, "i218v", "I218-V", 0),
  917. PCI_ROM ( 0x8086, 0x155a, "i218lm", "I218-LM", 0),
  918. PCI_ROM ( 0x8086, 0x157b, "i210-2", "I210", 0 ),
  919. PCI_ROM ( 0x8086, 0x15a0, "i218lm-2", "I218-LM", 0 ),
  920. PCI_ROM ( 0x8086, 0x15a1, "i218v-2", "I218-V", 0 ),
  921. PCI_ROM ( 0x8086, 0x15a2, "i218lm-3", "I218-LM", 0 ),
  922. PCI_ROM ( 0x8086, 0x15a3, "i218v-3", "I218-V", 0 ),
  923. PCI_ROM ( 0x8086, 0x294c, "82566dc-2", "82566DC-2", 0 ),
  924. PCI_ROM ( 0x8086, 0x2e6e, "cemedia", "CE Media Processor", 0 ),
  925. };
  926. /** Intel PCI driver */
  927. struct pci_driver intel_driver __pci_driver = {
  928. .ids = intel_nics,
  929. .id_count = ( sizeof ( intel_nics ) / sizeof ( intel_nics[0] ) ),
  930. .probe = intel_probe,
  931. .remove = intel_remove,
  932. };