Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 2 | /* |
Bjorn Helgaas | df62ab5 | 2018-03-09 16:36:33 -0600 | [diff] [blame] | 3 | * Export the firmware instance and label associated with a PCI device to |
| 4 | * sysfs |
| 5 | * |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 6 | * Copyright (C) 2010 Dell Inc. |
| 7 | * by Narendra K <Narendra_K@dell.com>, |
| 8 | * Jordan Hargrave <Jordan_Hargrave@dell.com> |
| 9 | * |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 10 | * PCI Firmware Specification Revision 3.1 section 4.6.7 (DSM for Naming a |
| 11 | * PCI or PCI Express Device Under Operating Systems) defines an instance |
| 12 | * number and string name. This code retrieves them and exports them to sysfs. |
| 13 | * If the system firmware does not provide the ACPI _DSM (Device Specific |
| 14 | * Method), then the SMBIOS type 41 instance number and string is exported to |
| 15 | * sysfs. |
| 16 | * |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 17 | * SMBIOS defines type 41 for onboard pci devices. This code retrieves |
| 18 | * the instance number and string from the type 41 record and exports |
| 19 | * it to sysfs. |
| 20 | * |
Alexander A. Klimov | 7ecd4a8 | 2020-06-27 12:30:50 +0200 | [diff] [blame] | 21 | * Please see https://linux.dell.com/files/biosdevname/ for more |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 22 | * information. |
| 23 | */ |
| 24 | |
| 25 | #include <linux/dmi.h> |
| 26 | #include <linux/sysfs.h> |
| 27 | #include <linux/pci.h> |
| 28 | #include <linux/pci_ids.h> |
| 29 | #include <linux/module.h> |
| 30 | #include <linux/device.h> |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 31 | #include <linux/nls.h> |
| 32 | #include <linux/acpi.h> |
| 33 | #include <linux/pci-acpi.h> |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 34 | #include "pci.h" |
| 35 | |
Krzysztof Wilczyński | 1017275 | 2021-04-27 10:39:16 -0500 | [diff] [blame] | 36 | static bool device_has_acpi_name(struct device *dev) |
| 37 | { |
| 38 | #ifdef CONFIG_ACPI |
| 39 | acpi_handle handle; |
| 40 | |
| 41 | handle = ACPI_HANDLE(dev); |
| 42 | if (!handle) |
| 43 | return false; |
| 44 | |
| 45 | return acpi_check_dsm(handle, &pci_acpi_dsm_guid, 0x2, |
| 46 | 1 << DSM_PCI_DEVICE_NAME); |
| 47 | #else |
| 48 | return false; |
| 49 | #endif |
| 50 | } |
| 51 | |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 52 | #ifdef CONFIG_DMI |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 53 | enum smbios_attr_enum { |
| 54 | SMBIOS_ATTR_NONE = 0, |
| 55 | SMBIOS_ATTR_LABEL_SHOW, |
| 56 | SMBIOS_ATTR_INSTANCE_SHOW, |
| 57 | }; |
| 58 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 59 | static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, |
| 60 | enum smbios_attr_enum attribute) |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 61 | { |
| 62 | const struct dmi_device *dmi; |
| 63 | struct dmi_dev_onboard *donboard; |
Sujith Pandel | 6c51c82 | 2017-05-02 06:55:40 -0400 | [diff] [blame] | 64 | int domain_nr; |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 65 | int bus; |
| 66 | int devfn; |
| 67 | |
Sujith Pandel | 6c51c82 | 2017-05-02 06:55:40 -0400 | [diff] [blame] | 68 | domain_nr = pci_domain_nr(pdev->bus); |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 69 | bus = pdev->bus->number; |
| 70 | devfn = pdev->devfn; |
| 71 | |
| 72 | dmi = NULL; |
| 73 | while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD, |
| 74 | NULL, dmi)) != NULL) { |
| 75 | donboard = dmi->device_data; |
Sujith Pandel | 6c51c82 | 2017-05-02 06:55:40 -0400 | [diff] [blame] | 76 | if (donboard && donboard->segment == domain_nr && |
| 77 | donboard->bus == bus && |
| 78 | donboard->devfn == devfn) { |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 79 | if (buf) { |
| 80 | if (attribute == SMBIOS_ATTR_INSTANCE_SHOW) |
| 81 | return scnprintf(buf, PAGE_SIZE, |
| 82 | "%d\n", |
| 83 | donboard->instance); |
| 84 | else if (attribute == SMBIOS_ATTR_LABEL_SHOW) |
| 85 | return scnprintf(buf, PAGE_SIZE, |
| 86 | "%s\n", |
| 87 | dmi->name); |
| 88 | } |
| 89 | return strlen(dmi->name); |
| 90 | } |
| 91 | } |
| 92 | return 0; |
| 93 | } |
| 94 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 95 | static umode_t smbios_instance_string_exist(struct kobject *kobj, |
| 96 | struct attribute *attr, int n) |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 97 | { |
| 98 | struct device *dev; |
| 99 | struct pci_dev *pdev; |
| 100 | |
Geliang Tang | 554a603 | 2015-12-23 20:28:13 +0800 | [diff] [blame] | 101 | dev = kobj_to_dev(kobj); |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 102 | pdev = to_pci_dev(dev); |
| 103 | |
| 104 | return find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE) ? |
| 105 | S_IRUGO : 0; |
| 106 | } |
| 107 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 108 | static ssize_t smbioslabel_show(struct device *dev, |
| 109 | struct device_attribute *attr, char *buf) |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 110 | { |
| 111 | struct pci_dev *pdev; |
| 112 | pdev = to_pci_dev(dev); |
| 113 | |
| 114 | return find_smbios_instance_string(pdev, buf, |
| 115 | SMBIOS_ATTR_LABEL_SHOW); |
| 116 | } |
| 117 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 118 | static ssize_t smbiosinstance_show(struct device *dev, |
| 119 | struct device_attribute *attr, char *buf) |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 120 | { |
| 121 | struct pci_dev *pdev; |
| 122 | pdev = to_pci_dev(dev); |
| 123 | |
| 124 | return find_smbios_instance_string(pdev, buf, |
| 125 | SMBIOS_ATTR_INSTANCE_SHOW); |
| 126 | } |
| 127 | |
| 128 | static struct device_attribute smbios_attr_label = { |
Stephen Rothwell | 763e9db | 2010-08-04 14:25:31 +1000 | [diff] [blame] | 129 | .attr = {.name = "label", .mode = 0444}, |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 130 | .show = smbioslabel_show, |
| 131 | }; |
| 132 | |
| 133 | static struct device_attribute smbios_attr_instance = { |
Stephen Rothwell | 763e9db | 2010-08-04 14:25:31 +1000 | [diff] [blame] | 134 | .attr = {.name = "index", .mode = 0444}, |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 135 | .show = smbiosinstance_show, |
| 136 | }; |
| 137 | |
| 138 | static struct attribute *smbios_attributes[] = { |
| 139 | &smbios_attr_label.attr, |
| 140 | &smbios_attr_instance.attr, |
| 141 | NULL, |
| 142 | }; |
| 143 | |
Arvind Yadav | f484128 | 2017-07-11 14:57:08 +0530 | [diff] [blame] | 144 | static const struct attribute_group smbios_attr_group = { |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 145 | .attrs = smbios_attributes, |
| 146 | .is_visible = smbios_instance_string_exist, |
| 147 | }; |
| 148 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 149 | static int pci_create_smbiosname_file(struct pci_dev *pdev) |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 150 | { |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 151 | return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group); |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 152 | } |
| 153 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 154 | static void pci_remove_smbiosname_file(struct pci_dev *pdev) |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 155 | { |
| 156 | sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group); |
| 157 | } |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 158 | #else |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 159 | static inline int pci_create_smbiosname_file(struct pci_dev *pdev) |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 160 | { |
| 161 | return -1; |
| 162 | } |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 163 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 164 | static inline void pci_remove_smbiosname_file(struct pci_dev *pdev) |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 165 | { |
| 166 | } |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 167 | #endif |
| 168 | |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 169 | #ifdef CONFIG_ACPI |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 170 | enum acpi_attr_enum { |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 171 | ACPI_ATTR_LABEL_SHOW, |
| 172 | ACPI_ATTR_INDEX_SHOW, |
| 173 | }; |
| 174 | |
| 175 | static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) |
| 176 | { |
| 177 | int len; |
Simone Gotti | dcfa9be | 2014-06-18 16:55:30 +0200 | [diff] [blame] | 178 | len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer, |
| 179 | obj->buffer.length, |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 180 | UTF16_LITTLE_ENDIAN, |
| 181 | buf, PAGE_SIZE); |
| 182 | buf[len] = '\n'; |
| 183 | } |
| 184 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 185 | static int dsm_get_label(struct device *dev, char *buf, |
| 186 | enum acpi_attr_enum attr) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 187 | { |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 188 | acpi_handle handle; |
| 189 | union acpi_object *obj, *tmp; |
| 190 | int len = -1; |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 191 | |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 192 | handle = ACPI_HANDLE(dev); |
| 193 | if (!handle) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 194 | return -1; |
| 195 | |
Andy Shevchenko | 94116f8 | 2017-06-05 19:40:46 +0300 | [diff] [blame] | 196 | obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 0x2, |
Krzysztof Wilczyński | 3910eba | 2020-05-26 21:39:05 +0000 | [diff] [blame] | 197 | DSM_PCI_DEVICE_NAME, NULL); |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 198 | if (!obj) |
| 199 | return -1; |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 200 | |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 201 | tmp = obj->package.elements; |
| 202 | if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 && |
| 203 | tmp[0].type == ACPI_TYPE_INTEGER && |
Simone Gotti | dcfa9be | 2014-06-18 16:55:30 +0200 | [diff] [blame] | 204 | (tmp[1].type == ACPI_TYPE_STRING || |
| 205 | tmp[1].type == ACPI_TYPE_BUFFER)) { |
Jiang Liu | 2fc59fe | 2013-12-19 20:38:14 +0800 | [diff] [blame] | 206 | /* |
| 207 | * The second string element is optional even when |
| 208 | * this _DSM is implemented; when not implemented, |
| 209 | * this entry must return a null string. |
| 210 | */ |
Simone Gotti | dcfa9be | 2014-06-18 16:55:30 +0200 | [diff] [blame] | 211 | if (attr == ACPI_ATTR_INDEX_SHOW) { |
Jiang Liu | 2fc59fe | 2013-12-19 20:38:14 +0800 | [diff] [blame] | 212 | scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value); |
Simone Gotti | dcfa9be | 2014-06-18 16:55:30 +0200 | [diff] [blame] | 213 | } else if (attr == ACPI_ATTR_LABEL_SHOW) { |
| 214 | if (tmp[1].type == ACPI_TYPE_STRING) |
| 215 | scnprintf(buf, PAGE_SIZE, "%s\n", |
| 216 | tmp[1].string.pointer); |
| 217 | else if (tmp[1].type == ACPI_TYPE_BUFFER) |
| 218 | dsm_label_utf16s_to_utf8s(tmp + 1, buf); |
| 219 | } |
Jiang Liu | 2fc59fe | 2013-12-19 20:38:14 +0800 | [diff] [blame] | 220 | len = strlen(buf) > 0 ? strlen(buf) : -1; |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 221 | } |
Jiang Liu | 54e5bb4 | 2013-12-19 20:38:12 +0800 | [diff] [blame] | 222 | |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 223 | ACPI_FREE(obj); |
Jiang Liu | 54e5bb4 | 2013-12-19 20:38:12 +0800 | [diff] [blame] | 224 | |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 225 | return len; |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 226 | } |
| 227 | |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 228 | static umode_t acpi_attr_is_visible(struct kobject *kobj, struct attribute *a, |
| 229 | int n) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 230 | { |
| 231 | struct device *dev; |
| 232 | |
Geliang Tang | 554a603 | 2015-12-23 20:28:13 +0800 | [diff] [blame] | 233 | dev = kobj_to_dev(kobj); |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 234 | |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 235 | if (!device_has_acpi_name(dev)) |
| 236 | return 0; |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 237 | |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 238 | return a->mode; |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 239 | } |
| 240 | |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 241 | static ssize_t label_show(struct device *dev, struct device_attribute *attr, |
| 242 | char *buf) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 243 | { |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 244 | return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW); |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 245 | } |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 246 | static DEVICE_ATTR_RO(label); |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 247 | |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 248 | static ssize_t acpi_index_show(struct device *dev, |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 249 | struct device_attribute *attr, char *buf) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 250 | { |
Jiang Liu | 1d0fcef | 2013-12-19 20:38:13 +0800 | [diff] [blame] | 251 | return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW); |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 252 | } |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 253 | static DEVICE_ATTR_RO(acpi_index); |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 254 | |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 255 | static struct attribute *acpi_attrs[] = { |
| 256 | &dev_attr_label.attr, |
| 257 | &dev_attr_acpi_index.attr, |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 258 | NULL, |
| 259 | }; |
| 260 | |
Arvind Yadav | f484128 | 2017-07-11 14:57:08 +0530 | [diff] [blame] | 261 | static const struct attribute_group acpi_attr_group = { |
Krzysztof Wilczyński | 2ed6494 | 2021-04-27 13:48:51 -0500 | [diff] [blame^] | 262 | .attrs = acpi_attrs, |
| 263 | .is_visible = acpi_attr_is_visible, |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 264 | }; |
| 265 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 266 | static int pci_create_acpi_index_label_files(struct pci_dev *pdev) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 267 | { |
| 268 | return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group); |
| 269 | } |
| 270 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 271 | static int pci_remove_acpi_index_label_files(struct pci_dev *pdev) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 272 | { |
| 273 | sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group); |
| 274 | return 0; |
| 275 | } |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 276 | #else |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 277 | static inline int pci_create_acpi_index_label_files(struct pci_dev *pdev) |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 278 | { |
| 279 | return -1; |
| 280 | } |
| 281 | |
Ryan Desfosses | 3c78bc6 | 2014-04-18 20:13:49 -0400 | [diff] [blame] | 282 | static inline int pci_remove_acpi_index_label_files(struct pci_dev *pdev) |
Bjorn Helgaas | 4c85980 | 2014-01-13 17:01:11 -0700 | [diff] [blame] | 283 | { |
| 284 | return -1; |
| 285 | } |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 286 | #endif |
| 287 | |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 288 | void pci_create_firmware_label_files(struct pci_dev *pdev) |
| 289 | { |
Krzysztof Wilczyński | 1017275 | 2021-04-27 10:39:16 -0500 | [diff] [blame] | 290 | if (device_has_acpi_name(&pdev->dev)) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 291 | pci_create_acpi_index_label_files(pdev); |
| 292 | else |
| 293 | pci_create_smbiosname_file(pdev); |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | void pci_remove_firmware_label_files(struct pci_dev *pdev) |
| 297 | { |
Krzysztof Wilczyński | 1017275 | 2021-04-27 10:39:16 -0500 | [diff] [blame] | 298 | if (device_has_acpi_name(&pdev->dev)) |
Narendra_K@Dell.com | 6058989 | 2011-03-02 22:34:17 +0530 | [diff] [blame] | 299 | pci_remove_acpi_index_label_files(pdev); |
| 300 | else |
| 301 | pci_remove_smbiosname_file(pdev); |
Narendra K | 911e1c9 | 2010-07-26 05:56:50 -0500 | [diff] [blame] | 302 | } |