blob: b4ef40e4269ab1ca8f87d2ddd8a0d75a5e11494f [file] [log] [blame]
Angel Pons8a3453f2020-04-02 23:48:19 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Damien Zammite983f0c2016-05-21 02:24:19 +10002
3/*
Damien Zammitf5dd23f2016-12-01 23:29:34 +11004 * This driver resets the 10ec:8168 NIC then tries to read
5 * "macaddress" string XX:XX:XX:XX:XX:XX from CBFS.
6 * If no MAC is found, it programs a default MAC address in the device
Damien Zammite983f0c2016-05-21 02:24:19 +10007 * so that if the EEPROM/efuse is unconfigured it still has a default MAC.
8 */
9
Damien Zammitf5dd23f2016-12-01 23:29:34 +110010#include <cbfs.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -070011#include <acpi/acpi_device.h>
12#include <acpi/acpigen.h>
Damien Zammitf5dd23f2016-12-01 23:29:34 +110013#include <string.h>
Damien Zammite983f0c2016-05-21 02:24:19 +100014#include <arch/io.h>
Shelley Chen0528b612017-06-12 18:29:24 -070015#include <console/console.h>
Damien Zammite983f0c2016-05-21 02:24:19 +100016#include <device/device.h>
17#include <device/pci.h>
18#include <device/pci_ops.h>
19#include <device/pci_def.h>
Alan Huang769994c2021-11-10 10:59:13 +080020#include <device/pci_ids.h>
Damien Zammite983f0c2016-05-21 02:24:19 +100021#include <delay.h>
Shelley Chen0528b612017-06-12 18:29:24 -070022#include <fmap.h>
Elyes HAOUASbd1683d2019-05-15 21:05:37 +020023#include <types.h>
24
Gaggery Tsai65623ef2017-09-29 11:15:23 +080025#include "chip.h"
Damien Zammite983f0c2016-05-21 02:24:19 +100026
27#define NIC_TIMEOUT 1000
28
29#define CMD_REG 0x37
30#define CMD_REG_RESET 0x10
Gaggery Tsai65623ef2017-09-29 11:15:23 +080031#define CMD_LED0_LED1 0x18
Rory Liu2b1e7372021-11-22 10:42:25 +080032#define CMD_LED_FEATURE 0x94
33#define CMD_LEDSEL0 0x18
34#define CMD_LEDSEL2 0x84
Damien Zammite983f0c2016-05-21 02:24:19 +100035
36#define CFG_9346 0x50
37#define CFG_9346_LOCK 0x00
38#define CFG_9346_UNLOCK 0xc0
Alan Huangad90edc2022-01-18 11:39:05 +080039#define CMD_REG_ASPM 0xb0
40#define ASPM_L1_2_MASK 0xe059000f
Damien Zammite983f0c2016-05-21 02:24:19 +100041
Gaggery Tsai1f847042017-12-26 17:13:52 +080042#define DEVICE_INDEX_BYTE 12
43#define MAX_DEVICE_SUPPORT 10
Shelley Chen0528b612017-06-12 18:29:24 -070044/**
45 * search: Find first instance of string in a given region
46 * @param p string to find
47 * @param a start address of region to search
48 * @param lengthp length of string to search for
49 * @param lengtha length of region to search in
50 * @return offset offset from start address a where string was found.
51 * If string not found, return lengtha.
52 */
53static size_t search(const char *p, const u8 *a, size_t lengthp,
54 size_t lengtha)
55{
56 size_t i, j;
57
58 if (lengtha < lengthp)
59 return lengtha;
60 /* Searching */
61 for (j = 0; j <= lengtha - lengthp; j++) {
62 for (i = 0; i < lengthp && p[i] == a[i + j]; i++)
63 ;
David Wu9a0d9e02018-05-04 15:37:37 +080064 if (i >= lengthp && a[j - 1] == lengthp)
Shelley Chen0528b612017-06-12 18:29:24 -070065 return j;
66 }
67 return lengtha;
68}
69
Damien Zammitf5dd23f2016-12-01 23:29:34 +110070static u8 get_hex_digit(const u8 c)
Damien Zammite983f0c2016-05-21 02:24:19 +100071{
Damien Zammitf5dd23f2016-12-01 23:29:34 +110072 u8 ret = 0;
Damien Zammite983f0c2016-05-21 02:24:19 +100073
Damien Zammitf5dd23f2016-12-01 23:29:34 +110074 ret = c - '0';
75 if (ret > 0x09) {
76 ret = c - 'A' + 0x0a;
77 if (ret > 0x0f)
78 ret = c - 'a' + 0x0a;
79 }
80 if (ret > 0x0f) {
Julius Wernere9665952022-01-21 17:06:20 -080081 printk(BIOS_ERR, "Invalid hex digit found: "
Shelley Chen0528b612017-06-12 18:29:24 -070082 "%c - 0x%02x\n", (char)c, c);
Damien Zammitf5dd23f2016-12-01 23:29:34 +110083 ret = 0;
84 }
85 return ret;
86}
Damien Zammite983f0c2016-05-21 02:24:19 +100087
Shelley Chen0528b612017-06-12 18:29:24 -070088#define MACLEN 17
89
Edward O'Callaghan2a82f742020-03-25 12:52:50 +110090/* Returns MAC address based on the key that is passed in. */
91static enum cb_err fetch_mac_vpd_key(u8 *macstrbuf, const char *vpd_key)
Shelley Chen0528b612017-06-12 18:29:24 -070092{
93 struct region_device rdev;
94 void *search_address;
95 size_t search_length;
96 size_t offset;
Edward O'Callaghan2a82f742020-03-25 12:52:50 +110097
98 if (fmap_locate_area_as_rdev("RO_VPD", &rdev)) {
Julius Wernere9665952022-01-21 17:06:20 -080099 printk(BIOS_ERR, "Couldn't find RO_VPD region.");
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100100 return CB_ERR;
101 }
102 search_address = rdev_mmap_full(&rdev);
103 if (search_address == NULL) {
104 printk(BIOS_ERR, "LAN: VPD not found.\n");
105 return CB_ERR;
106 }
107
108 search_length = region_device_sz(&rdev);
109 offset = search(vpd_key, search_address, strlen(vpd_key),
110 search_length);
111
112 if (offset == search_length) {
Julius Wernere9665952022-01-21 17:06:20 -0800113 printk(BIOS_ERR, "Could not locate '%s' in VPD\n", vpd_key);
Edward O'Callaghand08bc5a2020-03-26 14:37:37 +1100114 rdev_munmap(&rdev, search_address);
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100115 return CB_ERR;
116 }
117 printk(BIOS_DEBUG, "Located '%s' in VPD\n", vpd_key);
118
119 offset += strlen(vpd_key) + 1; /* move to next character */
120
121 if (offset + MACLEN > search_length) {
Edward O'Callaghand08bc5a2020-03-26 14:37:37 +1100122 rdev_munmap(&rdev, search_address);
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100123 printk(BIOS_ERR, "Search result too small!\n");
124 return CB_ERR;
125 }
126 memcpy(macstrbuf, search_address + offset, MACLEN);
Edward O'Callaghand08bc5a2020-03-26 14:37:37 +1100127 rdev_munmap(&rdev, search_address);
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100128
129 return CB_SUCCESS;
130}
131
132/* Prepares vpd_key by concatenating ethernet_mac with device_index */
133static enum cb_err fetch_mac_vpd_dev_idx(u8 *macstrbuf, u8 device_index)
134{
Gaggery Tsai1f847042017-12-26 17:13:52 +0800135 char key[] = "ethernet_mac "; /* Leave a space at tail to stuff an index */
136
137 /*
Edward O'Callaghan0e138062020-03-23 13:06:42 +1100138 * Map each NIC on the DUT to "ethernet_macN", where N is [0-9].
139 * Translate index number from integer to ascii by adding '0' char.
Gaggery Tsai1f847042017-12-26 17:13:52 +0800140 */
Edward O'Callaghan0e138062020-03-23 13:06:42 +1100141 key[DEVICE_INDEX_BYTE] = device_index + '0';
Shelley Chen0528b612017-06-12 18:29:24 -0700142
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100143 return fetch_mac_vpd_key(macstrbuf, key);
144}
145
146static void fetch_mac_string_vpd(struct drivers_net_config *config, u8 *macstrbuf)
147{
148 if (!config)
149 return;
150
151 /* Current implementation is up to 10 NIC cards */
152 if (config->device_index > MAX_DEVICE_SUPPORT) {
153 printk(BIOS_ERR, "r8168: the maximum device_index should be less then %d\n."
154 " Using default 00:e0:4c:00:c0:b0\n", MAX_DEVICE_SUPPORT);
155 return;
Shelley Chen0528b612017-06-12 18:29:24 -0700156 }
157
Edward O'Callaghan0e138062020-03-23 13:06:42 +1100158 if (fetch_mac_vpd_dev_idx(macstrbuf, config->device_index) == CB_SUCCESS)
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100159 return;
Gaggery Tsai1f847042017-12-26 17:13:52 +0800160
Edward O'Callaghan0e138062020-03-23 13:06:42 +1100161 if (!CONFIG(RT8168_SUPPORT_LEGACY_VPD_MAC)) {
162 printk(BIOS_ERR, "r8168: mac address not found in VPD,"
163 " using default 00:e0:4c:00:c0:b0\n");
164 return;
165 }
166
Edward O'Callaghan2a0a02f2020-03-26 16:47:55 +1100167 if (fetch_mac_vpd_key(macstrbuf, "ethernet_mac") != CB_SUCCESS)
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100168 printk(BIOS_ERR, "r8168: mac address not found in VPD,"
169 " using default 00:e0:4c:00:c0:b0\n");
Shelley Chen0528b612017-06-12 18:29:24 -0700170}
171
172static enum cb_err fetch_mac_string_cbfs(u8 *macstrbuf)
173{
Julius Werner77639e42021-02-05 16:51:25 -0800174 if (!cbfs_load("rt8168-macaddress", macstrbuf, MACLEN)) {
175 printk(BIOS_ERR, "r8168: Error reading MAC from CBFS\n");
176 return CB_ERR;
Shelley Chen0528b612017-06-12 18:29:24 -0700177 }
Julius Werner77639e42021-02-05 16:51:25 -0800178 return CB_SUCCESS;
Shelley Chen0528b612017-06-12 18:29:24 -0700179}
180
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100181static void get_mac_address(u8 *macaddr, const u8 *strbuf)
182{
183 size_t offset = 0;
184 int i;
185
Shelley Chen0528b612017-06-12 18:29:24 -0700186 if ((strbuf[2] != ':') || (strbuf[5] != ':') ||
187 (strbuf[8] != ':') || (strbuf[11] != ':') ||
188 (strbuf[14] != ':')) {
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100189 printk(BIOS_ERR, "r8168: ignore invalid MAC address in cbfs\n");
190 return;
191 }
192
193 for (i = 0; i < 6; i++) {
194 macaddr[i] = 0;
195 macaddr[i] |= get_hex_digit(strbuf[offset]) << 4;
196 macaddr[i] |= get_hex_digit(strbuf[offset + 1]);
197 offset += 3;
198 }
199}
200
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100201static void program_mac_address(struct device *dev, u16 io_base)
202{
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100203 u8 macstrbuf[MACLEN] = { 0 };
204 int i = 0;
Shelley Chen0528b612017-06-12 18:29:24 -0700205 /* Default MAC Address of 00:E0:4C:00:C0:B0 */
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100206 u8 mac[6] = { 0x00, 0xe0, 0x4c, 0x00, 0xc0, 0xb0 };
Gaggery Tsai1f847042017-12-26 17:13:52 +0800207 struct drivers_net_config *config = dev->chip_info;
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100208
Shelley Chen0528b612017-06-12 18:29:24 -0700209 /* check the VPD for the mac address */
Julius Wernercd49cce2019-03-05 16:53:33 -0800210 if (CONFIG(RT8168_GET_MAC_FROM_VPD)) {
Edward O'Callaghan2a82f742020-03-25 12:52:50 +1100211 fetch_mac_string_vpd(config, macstrbuf);
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100212 } else {
Shelley Chen0528b612017-06-12 18:29:24 -0700213 if (fetch_mac_string_cbfs(macstrbuf) != CB_SUCCESS)
214 printk(BIOS_ERR, "r8168: Error reading MAC from CBFS,"
Gaggery Tsai1f847042017-12-26 17:13:52 +0800215 " using default 00:e0:4c:00:c0:b0\n");
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100216 }
Shelley Chen0528b612017-06-12 18:29:24 -0700217 get_mac_address(mac, macstrbuf);
Damien Zammite983f0c2016-05-21 02:24:19 +1000218
219 /* Reset NIC */
220 printk(BIOS_DEBUG, "r8168: Resetting NIC...");
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100221 outb(CMD_REG_RESET, io_base + CMD_REG);
Damien Zammite983f0c2016-05-21 02:24:19 +1000222
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100223 /* Poll for reset, with 1sec timeout */
224 while (i < NIC_TIMEOUT && (inb(io_base + CMD_REG) & CMD_REG_RESET)) {
Damien Zammite983f0c2016-05-21 02:24:19 +1000225 udelay(1000);
226 if (++i >= NIC_TIMEOUT)
Shelley Chen0528b612017-06-12 18:29:24 -0700227 printk(BIOS_ERR, "timeout waiting for nic to reset\n");
Damien Zammite983f0c2016-05-21 02:24:19 +1000228 }
229 if (i < NIC_TIMEOUT)
230 printk(BIOS_DEBUG, "done\n");
231
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100232 printk(BIOS_DEBUG, "r8168: Programming MAC Address...");
Damien Zammite983f0c2016-05-21 02:24:19 +1000233
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100234 /* Disable register protection */
235 outb(CFG_9346_UNLOCK, io_base + CFG_9346);
Damien Zammite983f0c2016-05-21 02:24:19 +1000236
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100237 /* Set MAC address: only 4-byte write accesses allowed */
238 outl(mac[4] | mac[5] << 8, io_base + 4);
239 inl(io_base + 4);
240 outl(mac[0] | mac[1] << 8 | mac[2] << 16 | mac[3] << 24,
241 io_base);
242 inl(io_base);
Damien Zammite983f0c2016-05-21 02:24:19 +1000243 /* Lock config regs */
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100244 outb(CFG_9346_LOCK, io_base + CFG_9346);
245
246 printk(BIOS_DEBUG, "done\n");
247}
248
Alan Huangad90edc2022-01-18 11:39:05 +0800249static void enable_aspm_l1_2(u16 io_base)
250{
251 printk(BIOS_INFO, "rtl: Enable ASPM L1.2\n");
252
253 /* Disable register protection */
254 outb(CFG_9346_UNLOCK, io_base + CFG_9346);
255
256 /* Enable ASPM_L1.2 */
257 outl(ASPM_L1_2_MASK, io_base + CMD_REG_ASPM);
258
259 /* Lock config regs */
260 outb(CFG_9346_LOCK, io_base + CFG_9346);
261}
262
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800263static void r8168_set_customized_led(struct device *dev, u16 io_base)
264{
265 struct drivers_net_config *config = dev->chip_info;
266
267 if (!config)
268 return;
269
Felix Singer43b7f412022-03-07 04:34:52 +0100270 if (dev->device == PCI_DID_REALTEK_8125) {
Rory Liu2b1e7372021-11-22 10:42:25 +0800271 /* Set LED global Feature register */
272 outb(config->led_feature, io_base + CMD_LED_FEATURE);
273 printk(BIOS_DEBUG, "r8125: read back LED global feature setting as 0x%x\n",
274 inb(io_base + CMD_LED_FEATURE));
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800275
Rory Liu2b1e7372021-11-22 10:42:25 +0800276 /*
277 * Refer to RTL8125 datasheet 5.Customizable LED Configuration
278 * Register Name IO Address
279 * LEDSEL0 0x18
280 * LEDSEL2 0x84
281 * LEDFEATURE 0x94
282 *
283 * LEDSEL Bit[] Description
284 * Bit0 Link10M
285 * Bit1 Link100M
286 * Bit3 Link1000M
287 * Bit5 Link2.5G
288 * Bit9 ACT
289 * Bit10 preboot enable
290 * Bit11 lp enable
291 * Bit12 active low/high
292 *
293 * LEDFEATURE Description
294 * Bit0 LED Table V1/V2
295 * Bit1~3 Reserved
296 * Bit4~5 LED Blinking Duty Cycle 12.5%/ 25%/ 50%/ 75%
297 * Bit6~7 LED Blinking Freq. 240ms/160ms/80ms/Link-Speed-Dependent
298 */
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800299
Rory Liu2b1e7372021-11-22 10:42:25 +0800300 /* Set customized LED0 register */
301 outw(config->customized_led0, io_base + CMD_LEDSEL0);
302 printk(BIOS_DEBUG, "r8125: read back LED0 setting as 0x%x\n",
303 inw(io_base + CMD_LEDSEL0));
304
305 /* Set customized LED2 register */
306 outw(config->customized_led2, io_base + CMD_LEDSEL2);
307 printk(BIOS_DEBUG, "r8125: read back LED2 setting as 0x%x\n",
308 inw(io_base + CMD_LEDSEL2));
309 } else {
310 /* Read the customized LED setting from devicetree */
311 printk(BIOS_DEBUG, "r8168: Customized LED 0x%x\n", config->customized_leds);
312
313 /*
314 * Refer to RTL8111H datasheet 7.2 Customizable LED Configuration
315 * Starting from offset 0x18
316 * Bit[15:12] LED Feature Control(FC)
317 * Bit[11:08] LED Select for PINLED2
318 * Bit[07:04] LED Select for PINLED1
319 * Bit[03:00] LED Select for PINLED0
320 *
321 * Speed Link10M Link100M Link1000M ACT/Full
322 * LED0 Bit0 Bit1 Bit2 Bit3
323 * LED1 Bit4 Bit5 Bit6 Bit7
324 * LED2 Bit8 Bit9 Bit10 Bit11
325 * FC Bit12 Bit13 Bit14 Bit15
326 */
327
328 /* Set customized LED registers */
329 outw(config->customized_leds, io_base + CMD_LED0_LED1);
330 printk(BIOS_DEBUG, "r8168: read back LED setting as 0x%x\n",
331 inw(io_base + CMD_LED0_LED1));
332 }
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800333}
334
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100335static void r8168_init(struct device *dev)
336{
337 /* Get the resource of the NIC mmio */
338 struct resource *nic_res = find_resource(dev, PCI_BASE_ADDRESS_0);
339 u16 io_base = (u16)nic_res->base;
340
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800341 /* Check if the base is invalid */
342 if (!io_base) {
Martin Roth0949e732021-10-01 14:28:22 -0600343 printk(BIOS_ERR, "r8168: Error can't find IO resource\n");
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800344 return;
345 }
Damien Zammitf5dd23f2016-12-01 23:29:34 +1100346 /* Enable but do not set bus master */
347 pci_write_config16(dev, PCI_COMMAND,
348 PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
349
350 /* Program MAC address based on CBFS "macaddress" containing
351 * a string AA:BB:CC:DD:EE:FF */
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800352 program_mac_address(dev, io_base);
353
354 /* Program customized LED mode */
Julius Wernercd49cce2019-03-05 16:53:33 -0800355 if (CONFIG(RT8168_SET_LED_MODE))
Gaggery Tsai65623ef2017-09-29 11:15:23 +0800356 r8168_set_customized_led(dev, io_base);
Alan Huangad90edc2022-01-18 11:39:05 +0800357
358 struct drivers_net_config *config = dev->chip_info;
359 if (CONFIG(PCIEXP_ASPM) && config->enable_aspm_l1_2)
360 enable_aspm_l1_2(io_base);
Damien Zammite983f0c2016-05-21 02:24:19 +1000361}
362
Julius Wernercd49cce2019-03-05 16:53:33 -0800363#if CONFIG(HAVE_ACPI_TABLES)
Gaggery Tsai6919a932017-11-16 17:21:23 +0800364#define R8168_ACPI_HID "R8168"
Furquan Shaikh7536a392020-04-24 21:59:21 -0700365static void r8168_net_fill_ssdt(const struct device *dev)
Gaggery Tsai6919a932017-11-16 17:21:23 +0800366{
367 struct drivers_net_config *config = dev->chip_info;
368 const char *path = acpi_device_path(dev->bus->dev);
369 u32 address;
370
371 if (!path || !config)
372 return;
373
374 /* Device */
375 acpigen_write_scope(path);
376 acpigen_write_device(acpi_device_name(dev));
377 acpigen_write_name_string("_HID", R8168_ACPI_HID);
Patrick Rudolphc83bab62019-12-13 12:16:06 +0100378 acpi_device_write_uid(dev);
379
Gaggery Tsai6919a932017-11-16 17:21:23 +0800380 if (dev->chip_ops)
381 acpigen_write_name_string("_DDN", dev->chip_ops->name);
382
Edward O'Callaghanb765fa62020-01-21 21:01:32 +1100383 /* Power Resource */
Arthur Heymans59a348b2021-10-27 18:27:58 +0200384 if (CONFIG(RT8168_GEN_ACPI_POWER_RESOURCE) && config->has_power_resource) {
Edward O'Callaghanb765fa62020-01-21 21:01:32 +1100385 const struct acpi_power_res_params power_res_params = {
386 .stop_gpio = &config->stop_gpio,
387 .stop_delay_ms = config->stop_delay_ms,
388 .stop_off_delay_ms = config->stop_off_delay_ms
389 };
390 acpi_device_add_power_res(&power_res_params);
391 }
392
Gaggery Tsai6919a932017-11-16 17:21:23 +0800393 /* Address */
394 address = PCI_SLOT(dev->path.pci.devfn) & 0xffff;
395 address <<= 16;
396 address |= PCI_FUNC(dev->path.pci.devfn) & 0xffff;
397 acpigen_write_name_dword("_ADR", address);
398
399 /* Wake capabilities */
400 if (config->wake)
401 acpigen_write_PRW(config->wake, 3);
402
403 acpigen_pop_len(); /* Device */
404 acpigen_pop_len(); /* Scope */
405
406 printk(BIOS_INFO, "%s.%s: %s %s\n", path, acpi_device_name(dev),
407 dev->chip_ops ? dev->chip_ops->name : "", dev_path(dev));
408}
409
410static const char *r8168_net_acpi_name(const struct device *dev)
411{
412 return "RLTK";
413}
414#endif
415
Damien Zammite983f0c2016-05-21 02:24:19 +1000416static struct device_operations r8168_ops = {
Martin Rothb9810a42017-07-23 20:00:04 -0600417 .read_resources = pci_dev_read_resources,
418 .set_resources = pci_dev_set_resources,
419 .enable_resources = pci_dev_enable_resources,
420 .init = r8168_init,
Julius Wernercd49cce2019-03-05 16:53:33 -0800421#if CONFIG(HAVE_ACPI_TABLES)
Nico Huber68680dd2020-03-31 17:34:52 +0200422 .acpi_name = r8168_net_acpi_name,
423 .acpi_fill_ssdt = r8168_net_fill_ssdt,
Gaggery Tsai6919a932017-11-16 17:21:23 +0800424#endif
Damien Zammite983f0c2016-05-21 02:24:19 +1000425};
426
Alan Huang769994c2021-11-10 10:59:13 +0800427static const unsigned short pci_device_ids[] = {
Felix Singer43b7f412022-03-07 04:34:52 +0100428 PCI_DID_REALTEK_8168,
429 PCI_DID_REALTEK_8125,
Alan Huang769994c2021-11-10 10:59:13 +0800430 0
431};
432
Damien Zammite983f0c2016-05-21 02:24:19 +1000433static const struct pci_driver r8168_driver __pci_driver = {
Martin Rothb9810a42017-07-23 20:00:04 -0600434 .ops = &r8168_ops,
Felix Singer43b7f412022-03-07 04:34:52 +0100435 .vendor = PCI_VID_REALTEK,
Alan Huang769994c2021-11-10 10:59:13 +0800436 .devices = pci_device_ids,
Damien Zammite983f0c2016-05-21 02:24:19 +1000437};
Gaggery Tsai6919a932017-11-16 17:21:23 +0800438
439struct chip_operations drivers_net_ops = {
440 CHIP_NAME("Realtek r8168")
441};