xgbe-pci.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. /*
  2. * AMD 10Gb Ethernet driver
  3. *
  4. * This file is available to you under your choice of the following two
  5. * licenses:
  6. *
  7. * License 1: GPLv2
  8. *
  9. * Copyright (c) 2016 Advanced Micro Devices, Inc.
  10. *
  11. * This file is free software; you may copy, redistribute and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 2 of the License, or (at
  14. * your option) any later version.
  15. *
  16. * This file is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. * This file incorporates work covered by the following copyright and
  25. * permission notice:
  26. * The Synopsys DWC ETHER XGMAC Software Driver and documentation
  27. * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
  28. * Inc. unless otherwise expressly agreed to in writing between Synopsys
  29. * and you.
  30. *
  31. * The Software IS NOT an item of Licensed Software or Licensed Product
  32. * under any End User Software License Agreement or Agreement for Licensed
  33. * Product with Synopsys or any supplement thereto. Permission is hereby
  34. * granted, free of charge, to any person obtaining a copy of this software
  35. * annotated with this license and the Software, to deal in the Software
  36. * without restriction, including without limitation the rights to use,
  37. * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  38. * of the Software, and to permit persons to whom the Software is furnished
  39. * to do so, subject to the following conditions:
  40. *
  41. * The above copyright notice and this permission notice shall be included
  42. * in all copies or substantial portions of the Software.
  43. *
  44. * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
  45. * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  46. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  47. * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
  48. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  49. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  50. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  51. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  52. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  53. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  54. * THE POSSIBILITY OF SUCH DAMAGE.
  55. *
  56. *
  57. * License 2: Modified BSD
  58. *
  59. * Copyright (c) 2016 Advanced Micro Devices, Inc.
  60. * All rights reserved.
  61. *
  62. * Redistribution and use in source and binary forms, with or without
  63. * modification, are permitted provided that the following conditions are met:
  64. * * Redistributions of source code must retain the above copyright
  65. * notice, this list of conditions and the following disclaimer.
  66. * * Redistributions in binary form must reproduce the above copyright
  67. * notice, this list of conditions and the following disclaimer in the
  68. * documentation and/or other materials provided with the distribution.
  69. * * Neither the name of Advanced Micro Devices, Inc. nor the
  70. * names of its contributors may be used to endorse or promote products
  71. * derived from this software without specific prior written permission.
  72. *
  73. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  74. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  75. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  76. * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  77. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  78. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  79. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  80. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  81. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  82. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  83. *
  84. * This file incorporates work covered by the following copyright and
  85. * permission notice:
  86. * The Synopsys DWC ETHER XGMAC Software Driver and documentation
  87. * (hereinafter "Software") is an unsupported proprietary work of Synopsys,
  88. * Inc. unless otherwise expressly agreed to in writing between Synopsys
  89. * and you.
  90. *
  91. * The Software IS NOT an item of Licensed Software or Licensed Product
  92. * under any End User Software License Agreement or Agreement for Licensed
  93. * Product with Synopsys or any supplement thereto. Permission is hereby
  94. * granted, free of charge, to any person obtaining a copy of this software
  95. * annotated with this license and the Software, to deal in the Software
  96. * without restriction, including without limitation the rights to use,
  97. * copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  98. * of the Software, and to permit persons to whom the Software is furnished
  99. * to do so, subject to the following conditions:
  100. *
  101. * The above copyright notice and this permission notice shall be included
  102. * in all copies or substantial portions of the Software.
  103. *
  104. * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS"
  105. * BASIS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  106. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  107. * PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS
  108. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  109. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  110. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  111. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  112. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  113. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  114. * THE POSSIBILITY OF SUCH DAMAGE.
  115. */
  116. #include <linux/module.h>
  117. #include <linux/device.h>
  118. #include <linux/pci.h>
  119. #include <linux/log2.h>
  120. #include "xgbe.h"
  121. #include "xgbe-common.h"
  122. static int xgbe_config_multi_msi(struct xgbe_prv_data *pdata)
  123. {
  124. unsigned int vector_count;
  125. unsigned int i, j;
  126. int ret;
  127. vector_count = XGBE_MSI_BASE_COUNT;
  128. vector_count += max(pdata->rx_ring_count,
  129. pdata->tx_ring_count);
  130. ret = pci_alloc_irq_vectors(pdata->pcidev, XGBE_MSI_MIN_COUNT,
  131. vector_count, PCI_IRQ_MSI | PCI_IRQ_MSIX);
  132. if (ret < 0) {
  133. dev_info(pdata->dev, "multi MSI/MSI-X enablement failed\n");
  134. return ret;
  135. }
  136. pdata->irq_count = ret;
  137. pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0);
  138. pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 1);
  139. pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 2);
  140. pdata->an_irq = pci_irq_vector(pdata->pcidev, 3);
  141. for (i = XGBE_MSI_BASE_COUNT, j = 0; i < ret; i++, j++)
  142. pdata->channel_irq[j] = pci_irq_vector(pdata->pcidev, i);
  143. pdata->channel_irq_count = j;
  144. pdata->per_channel_irq = 1;
  145. pdata->channel_irq_mode = XGBE_IRQ_MODE_LEVEL;
  146. if (netif_msg_probe(pdata))
  147. dev_dbg(pdata->dev, "multi %s interrupts enabled\n",
  148. pdata->pcidev->msix_enabled ? "MSI-X" : "MSI");
  149. return 0;
  150. }
  151. static int xgbe_config_irqs(struct xgbe_prv_data *pdata)
  152. {
  153. int ret;
  154. ret = xgbe_config_multi_msi(pdata);
  155. if (!ret)
  156. goto out;
  157. ret = pci_alloc_irq_vectors(pdata->pcidev, 1, 1,
  158. PCI_IRQ_LEGACY | PCI_IRQ_MSI);
  159. if (ret < 0) {
  160. dev_info(pdata->dev, "single IRQ enablement failed\n");
  161. return ret;
  162. }
  163. pdata->irq_count = 1;
  164. pdata->channel_irq_count = 1;
  165. pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0);
  166. pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 0);
  167. pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 0);
  168. pdata->an_irq = pci_irq_vector(pdata->pcidev, 0);
  169. if (netif_msg_probe(pdata))
  170. dev_dbg(pdata->dev, "single %s interrupt enabled\n",
  171. pdata->pcidev->msi_enabled ? "MSI" : "legacy");
  172. out:
  173. if (netif_msg_probe(pdata)) {
  174. unsigned int i;
  175. dev_dbg(pdata->dev, " dev irq=%d\n", pdata->dev_irq);
  176. dev_dbg(pdata->dev, " ecc irq=%d\n", pdata->ecc_irq);
  177. dev_dbg(pdata->dev, " i2c irq=%d\n", pdata->i2c_irq);
  178. dev_dbg(pdata->dev, " an irq=%d\n", pdata->an_irq);
  179. for (i = 0; i < pdata->channel_irq_count; i++)
  180. dev_dbg(pdata->dev, " dma%u irq=%d\n",
  181. i, pdata->channel_irq[i]);
  182. }
  183. return 0;
  184. }
  185. static int xgbe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
  186. {
  187. struct xgbe_prv_data *pdata;
  188. struct device *dev = &pdev->dev;
  189. void __iomem * const *iomap_table;
  190. struct pci_dev *rdev;
  191. unsigned int ma_lo, ma_hi;
  192. unsigned int reg;
  193. int bar_mask;
  194. int ret;
  195. pdata = xgbe_alloc_pdata(dev);
  196. if (IS_ERR(pdata)) {
  197. ret = PTR_ERR(pdata);
  198. goto err_alloc;
  199. }
  200. pdata->pcidev = pdev;
  201. pci_set_drvdata(pdev, pdata);
  202. /* Get the version data */
  203. pdata->vdata = (struct xgbe_version_data *)id->driver_data;
  204. ret = pcim_enable_device(pdev);
  205. if (ret) {
  206. dev_err(dev, "pcim_enable_device failed\n");
  207. goto err_pci_enable;
  208. }
  209. /* Obtain the mmio areas for the device */
  210. bar_mask = pci_select_bars(pdev, IORESOURCE_MEM);
  211. ret = pcim_iomap_regions(pdev, bar_mask, XGBE_DRV_NAME);
  212. if (ret) {
  213. dev_err(dev, "pcim_iomap_regions failed\n");
  214. goto err_pci_enable;
  215. }
  216. iomap_table = pcim_iomap_table(pdev);
  217. if (!iomap_table) {
  218. dev_err(dev, "pcim_iomap_table failed\n");
  219. ret = -ENOMEM;
  220. goto err_pci_enable;
  221. }
  222. pdata->xgmac_regs = iomap_table[XGBE_XGMAC_BAR];
  223. if (!pdata->xgmac_regs) {
  224. dev_err(dev, "xgmac ioremap failed\n");
  225. ret = -ENOMEM;
  226. goto err_pci_enable;
  227. }
  228. pdata->xprop_regs = pdata->xgmac_regs + XGBE_MAC_PROP_OFFSET;
  229. pdata->xi2c_regs = pdata->xgmac_regs + XGBE_I2C_CTRL_OFFSET;
  230. if (netif_msg_probe(pdata)) {
  231. dev_dbg(dev, "xgmac_regs = %p\n", pdata->xgmac_regs);
  232. dev_dbg(dev, "xprop_regs = %p\n", pdata->xprop_regs);
  233. dev_dbg(dev, "xi2c_regs = %p\n", pdata->xi2c_regs);
  234. }
  235. pdata->xpcs_regs = iomap_table[XGBE_XPCS_BAR];
  236. if (!pdata->xpcs_regs) {
  237. dev_err(dev, "xpcs ioremap failed\n");
  238. ret = -ENOMEM;
  239. goto err_pci_enable;
  240. }
  241. if (netif_msg_probe(pdata))
  242. dev_dbg(dev, "xpcs_regs = %p\n", pdata->xpcs_regs);
  243. /* Set the PCS indirect addressing definition registers */
  244. rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
  245. if (rdev &&
  246. (rdev->vendor == PCI_VENDOR_ID_AMD) && (rdev->device == 0x15d0)) {
  247. pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF;
  248. pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT;
  249. } else {
  250. pdata->xpcs_window_def_reg = PCS_V2_WINDOW_DEF;
  251. pdata->xpcs_window_sel_reg = PCS_V2_WINDOW_SELECT;
  252. }
  253. pci_dev_put(rdev);
  254. /* Configure the PCS indirect addressing support */
  255. reg = XPCS32_IOREAD(pdata, pdata->xpcs_window_def_reg);
  256. pdata->xpcs_window = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, OFFSET);
  257. pdata->xpcs_window <<= 6;
  258. pdata->xpcs_window_size = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, SIZE);
  259. pdata->xpcs_window_size = 1 << (pdata->xpcs_window_size + 7);
  260. pdata->xpcs_window_mask = pdata->xpcs_window_size - 1;
  261. if (netif_msg_probe(pdata)) {
  262. dev_dbg(dev, "xpcs window = %#010x\n",
  263. pdata->xpcs_window);
  264. dev_dbg(dev, "xpcs window size = %#010x\n",
  265. pdata->xpcs_window_size);
  266. dev_dbg(dev, "xpcs window mask = %#010x\n",
  267. pdata->xpcs_window_mask);
  268. }
  269. pci_set_master(pdev);
  270. /* Enable all interrupts in the hardware */
  271. XP_IOWRITE(pdata, XP_INT_EN, 0x1fffff);
  272. /* Retrieve the MAC address */
  273. ma_lo = XP_IOREAD(pdata, XP_MAC_ADDR_LO);
  274. ma_hi = XP_IOREAD(pdata, XP_MAC_ADDR_HI);
  275. pdata->mac_addr[0] = ma_lo & 0xff;
  276. pdata->mac_addr[1] = (ma_lo >> 8) & 0xff;
  277. pdata->mac_addr[2] = (ma_lo >> 16) & 0xff;
  278. pdata->mac_addr[3] = (ma_lo >> 24) & 0xff;
  279. pdata->mac_addr[4] = ma_hi & 0xff;
  280. pdata->mac_addr[5] = (ma_hi >> 8) & 0xff;
  281. if (!XP_GET_BITS(ma_hi, XP_MAC_ADDR_HI, VALID) ||
  282. !is_valid_ether_addr(pdata->mac_addr)) {
  283. dev_err(dev, "invalid mac address\n");
  284. ret = -EINVAL;
  285. goto err_pci_enable;
  286. }
  287. /* Clock settings */
  288. pdata->sysclk_rate = XGBE_V2_DMA_CLOCK_FREQ;
  289. pdata->ptpclk_rate = XGBE_V2_PTP_CLOCK_FREQ;
  290. /* Set the DMA coherency values */
  291. pdata->coherent = 1;
  292. pdata->axdomain = XGBE_DMA_OS_AXDOMAIN;
  293. pdata->arcache = XGBE_DMA_OS_ARCACHE;
  294. pdata->awcache = XGBE_DMA_OS_AWCACHE;
  295. /* Set the maximum channels and queues */
  296. reg = XP_IOREAD(pdata, XP_PROP_1);
  297. pdata->tx_max_channel_count = XP_GET_BITS(reg, XP_PROP_1, MAX_TX_DMA);
  298. pdata->rx_max_channel_count = XP_GET_BITS(reg, XP_PROP_1, MAX_RX_DMA);
  299. pdata->tx_max_q_count = XP_GET_BITS(reg, XP_PROP_1, MAX_TX_QUEUES);
  300. pdata->rx_max_q_count = XP_GET_BITS(reg, XP_PROP_1, MAX_RX_QUEUES);
  301. if (netif_msg_probe(pdata)) {
  302. dev_dbg(dev, "max tx/rx channel count = %u/%u\n",
  303. pdata->tx_max_channel_count,
  304. pdata->tx_max_channel_count);
  305. dev_dbg(dev, "max tx/rx hw queue count = %u/%u\n",
  306. pdata->tx_max_q_count, pdata->rx_max_q_count);
  307. }
  308. /* Set the hardware channel and queue counts */
  309. xgbe_set_counts(pdata);
  310. /* Set the maximum fifo amounts */
  311. reg = XP_IOREAD(pdata, XP_PROP_2);
  312. pdata->tx_max_fifo_size = XP_GET_BITS(reg, XP_PROP_2, TX_FIFO_SIZE);
  313. pdata->tx_max_fifo_size *= 16384;
  314. pdata->tx_max_fifo_size = min(pdata->tx_max_fifo_size,
  315. pdata->vdata->tx_max_fifo_size);
  316. pdata->rx_max_fifo_size = XP_GET_BITS(reg, XP_PROP_2, RX_FIFO_SIZE);
  317. pdata->rx_max_fifo_size *= 16384;
  318. pdata->rx_max_fifo_size = min(pdata->rx_max_fifo_size,
  319. pdata->vdata->rx_max_fifo_size);
  320. if (netif_msg_probe(pdata))
  321. dev_dbg(dev, "max tx/rx max fifo size = %u/%u\n",
  322. pdata->tx_max_fifo_size, pdata->rx_max_fifo_size);
  323. /* Configure interrupt support */
  324. ret = xgbe_config_irqs(pdata);
  325. if (ret)
  326. goto err_pci_enable;
  327. /* Configure the netdev resource */
  328. ret = xgbe_config_netdev(pdata);
  329. if (ret)
  330. goto err_irq_vectors;
  331. netdev_notice(pdata->netdev, "net device enabled\n");
  332. return 0;
  333. err_irq_vectors:
  334. pci_free_irq_vectors(pdata->pcidev);
  335. err_pci_enable:
  336. xgbe_free_pdata(pdata);
  337. err_alloc:
  338. dev_notice(dev, "net device not enabled\n");
  339. return ret;
  340. }
  341. static void xgbe_pci_remove(struct pci_dev *pdev)
  342. {
  343. struct xgbe_prv_data *pdata = pci_get_drvdata(pdev);
  344. xgbe_deconfig_netdev(pdata);
  345. pci_free_irq_vectors(pdata->pcidev);
  346. xgbe_free_pdata(pdata);
  347. }
  348. #ifdef CONFIG_PM
  349. static int xgbe_pci_suspend(struct pci_dev *pdev, pm_message_t state)
  350. {
  351. struct xgbe_prv_data *pdata = pci_get_drvdata(pdev);
  352. struct net_device *netdev = pdata->netdev;
  353. int ret = 0;
  354. if (netif_running(netdev))
  355. ret = xgbe_powerdown(netdev, XGMAC_DRIVER_CONTEXT);
  356. pdata->lpm_ctrl = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_CTRL1);
  357. pdata->lpm_ctrl |= MDIO_CTRL1_LPOWER;
  358. XMDIO_WRITE(pdata, MDIO_MMD_PCS, MDIO_CTRL1, pdata->lpm_ctrl);
  359. return ret;
  360. }
  361. static int xgbe_pci_resume(struct pci_dev *pdev)
  362. {
  363. struct xgbe_prv_data *pdata = pci_get_drvdata(pdev);
  364. struct net_device *netdev = pdata->netdev;
  365. int ret = 0;
  366. pdata->lpm_ctrl &= ~MDIO_CTRL1_LPOWER;
  367. XMDIO_WRITE(pdata, MDIO_MMD_PCS, MDIO_CTRL1, pdata->lpm_ctrl);
  368. if (netif_running(netdev)) {
  369. ret = xgbe_powerup(netdev, XGMAC_DRIVER_CONTEXT);
  370. /* Schedule a restart in case the link or phy state changed
  371. * while we were powered down.
  372. */
  373. schedule_work(&pdata->restart_work);
  374. }
  375. return ret;
  376. }
  377. #endif /* CONFIG_PM */
  378. static const struct xgbe_version_data xgbe_v2a = {
  379. .init_function_ptrs_phy_impl = xgbe_init_function_ptrs_phy_v2,
  380. .xpcs_access = XGBE_XPCS_ACCESS_V2,
  381. .mmc_64bit = 1,
  382. .tx_max_fifo_size = 229376,
  383. .rx_max_fifo_size = 229376,
  384. .tx_tstamp_workaround = 1,
  385. .ecc_support = 1,
  386. .i2c_support = 1,
  387. };
  388. static const struct xgbe_version_data xgbe_v2b = {
  389. .init_function_ptrs_phy_impl = xgbe_init_function_ptrs_phy_v2,
  390. .xpcs_access = XGBE_XPCS_ACCESS_V2,
  391. .mmc_64bit = 1,
  392. .tx_max_fifo_size = 65536,
  393. .rx_max_fifo_size = 65536,
  394. .tx_tstamp_workaround = 1,
  395. .ecc_support = 1,
  396. .i2c_support = 1,
  397. };
  398. static const struct pci_device_id xgbe_pci_table[] = {
  399. { PCI_VDEVICE(AMD, 0x1458),
  400. .driver_data = (kernel_ulong_t)&xgbe_v2a },
  401. { PCI_VDEVICE(AMD, 0x1459),
  402. .driver_data = (kernel_ulong_t)&xgbe_v2b },
  403. /* Last entry must be zero */
  404. { 0, }
  405. };
  406. MODULE_DEVICE_TABLE(pci, xgbe_pci_table);
  407. static struct pci_driver xgbe_driver = {
  408. .name = XGBE_DRV_NAME,
  409. .id_table = xgbe_pci_table,
  410. .probe = xgbe_pci_probe,
  411. .remove = xgbe_pci_remove,
  412. #ifdef CONFIG_PM
  413. .suspend = xgbe_pci_suspend,
  414. .resume = xgbe_pci_resume,
  415. #endif
  416. };
  417. int xgbe_pci_init(void)
  418. {
  419. return pci_register_driver(&xgbe_driver);
  420. }
  421. void xgbe_pci_exit(void)
  422. {
  423. pci_unregister_driver(&xgbe_driver);
  424. }