xref: /openbmc/linux/drivers/pci/pci-label.c (revision 6058989b)
1911e1c9bSNarendra K /*
2911e1c9bSNarendra K  * Purpose: Export the firmware instance and label associated with
3911e1c9bSNarendra K  * a pci device to sysfs
4911e1c9bSNarendra K  * Copyright (C) 2010 Dell Inc.
5911e1c9bSNarendra K  * by Narendra K <Narendra_K@dell.com>,
6911e1c9bSNarendra K  * Jordan Hargrave <Jordan_Hargrave@dell.com>
7911e1c9bSNarendra K  *
86058989bSNarendra_K@Dell.com  * PCI Firmware Specification Revision 3.1 section 4.6.7 (DSM for Naming a
96058989bSNarendra_K@Dell.com  * PCI or PCI Express Device Under Operating Systems) defines an instance
106058989bSNarendra_K@Dell.com  * number and string name. This code retrieves them and exports them to sysfs.
116058989bSNarendra_K@Dell.com  * If the system firmware does not provide the ACPI _DSM (Device Specific
126058989bSNarendra_K@Dell.com  * Method), then the SMBIOS type 41 instance number and string is exported to
136058989bSNarendra_K@Dell.com  * sysfs.
146058989bSNarendra_K@Dell.com  *
15911e1c9bSNarendra K  * SMBIOS defines type 41 for onboard pci devices. This code retrieves
16911e1c9bSNarendra K  * the instance number and string from the type 41 record and exports
17911e1c9bSNarendra K  * it to sysfs.
18911e1c9bSNarendra K  *
19911e1c9bSNarendra K  * Please see http://linux.dell.com/wiki/index.php/Oss/libnetdevname for more
20911e1c9bSNarendra K  * information.
21911e1c9bSNarendra K  */
22911e1c9bSNarendra K 
23911e1c9bSNarendra K #include <linux/dmi.h>
24911e1c9bSNarendra K #include <linux/sysfs.h>
25911e1c9bSNarendra K #include <linux/pci.h>
26911e1c9bSNarendra K #include <linux/pci_ids.h>
27911e1c9bSNarendra K #include <linux/module.h>
28911e1c9bSNarendra K #include <linux/device.h>
296058989bSNarendra_K@Dell.com #include <linux/nls.h>
306058989bSNarendra_K@Dell.com #include <linux/acpi.h>
316058989bSNarendra_K@Dell.com #include <linux/pci-acpi.h>
326058989bSNarendra_K@Dell.com #include <acpi/acpi_drivers.h>
336058989bSNarendra_K@Dell.com #include <acpi/acpi_bus.h>
34911e1c9bSNarendra K #include "pci.h"
35911e1c9bSNarendra K 
366058989bSNarendra_K@Dell.com #define	DEVICE_LABEL_DSM	0x07
376058989bSNarendra_K@Dell.com 
386058989bSNarendra_K@Dell.com #ifndef CONFIG_DMI
396058989bSNarendra_K@Dell.com 
406058989bSNarendra_K@Dell.com static inline int
416058989bSNarendra_K@Dell.com pci_create_smbiosname_file(struct pci_dev *pdev)
426058989bSNarendra_K@Dell.com {
436058989bSNarendra_K@Dell.com 	return -1;
446058989bSNarendra_K@Dell.com }
456058989bSNarendra_K@Dell.com 
466058989bSNarendra_K@Dell.com static inline void
476058989bSNarendra_K@Dell.com pci_remove_smbiosname_file(struct pci_dev *pdev)
486058989bSNarendra_K@Dell.com {
496058989bSNarendra_K@Dell.com }
506058989bSNarendra_K@Dell.com 
516058989bSNarendra_K@Dell.com #else
526058989bSNarendra_K@Dell.com 
53911e1c9bSNarendra K enum smbios_attr_enum {
54911e1c9bSNarendra K 	SMBIOS_ATTR_NONE = 0,
55911e1c9bSNarendra K 	SMBIOS_ATTR_LABEL_SHOW,
56911e1c9bSNarendra K 	SMBIOS_ATTR_INSTANCE_SHOW,
57911e1c9bSNarendra K };
58911e1c9bSNarendra K 
59911e1c9bSNarendra K static mode_t
60911e1c9bSNarendra K find_smbios_instance_string(struct pci_dev *pdev, char *buf,
61911e1c9bSNarendra K 			    enum smbios_attr_enum attribute)
62911e1c9bSNarendra K {
63911e1c9bSNarendra K 	const struct dmi_device *dmi;
64911e1c9bSNarendra K 	struct dmi_dev_onboard *donboard;
65911e1c9bSNarendra K 	int bus;
66911e1c9bSNarendra K 	int devfn;
67911e1c9bSNarendra K 
68911e1c9bSNarendra K 	bus = pdev->bus->number;
69911e1c9bSNarendra K 	devfn = pdev->devfn;
70911e1c9bSNarendra K 
71911e1c9bSNarendra K 	dmi = NULL;
72911e1c9bSNarendra K 	while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
73911e1c9bSNarendra K 				      NULL, dmi)) != NULL) {
74911e1c9bSNarendra K 		donboard = dmi->device_data;
75911e1c9bSNarendra K 		if (donboard && donboard->bus == bus &&
76911e1c9bSNarendra K 					donboard->devfn == devfn) {
77911e1c9bSNarendra K 			if (buf) {
78911e1c9bSNarendra K 				if (attribute == SMBIOS_ATTR_INSTANCE_SHOW)
79911e1c9bSNarendra K 					return scnprintf(buf, PAGE_SIZE,
80911e1c9bSNarendra K 							 "%d\n",
81911e1c9bSNarendra K 							 donboard->instance);
82911e1c9bSNarendra K 				else if (attribute == SMBIOS_ATTR_LABEL_SHOW)
83911e1c9bSNarendra K 					return scnprintf(buf, PAGE_SIZE,
84911e1c9bSNarendra K 							 "%s\n",
85911e1c9bSNarendra K 							 dmi->name);
86911e1c9bSNarendra K 			}
87911e1c9bSNarendra K 			return strlen(dmi->name);
88911e1c9bSNarendra K 		}
89911e1c9bSNarendra K 	}
90911e1c9bSNarendra K 	return 0;
91911e1c9bSNarendra K }
92911e1c9bSNarendra K 
93911e1c9bSNarendra K static mode_t
94911e1c9bSNarendra K smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
95911e1c9bSNarendra K 			     int n)
96911e1c9bSNarendra K {
97911e1c9bSNarendra K 	struct device *dev;
98911e1c9bSNarendra K 	struct pci_dev *pdev;
99911e1c9bSNarendra K 
100911e1c9bSNarendra K 	dev = container_of(kobj, struct device, kobj);
101911e1c9bSNarendra K 	pdev = to_pci_dev(dev);
102911e1c9bSNarendra K 
103911e1c9bSNarendra K 	return find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE) ?
104911e1c9bSNarendra K 					   S_IRUGO : 0;
105911e1c9bSNarendra K }
106911e1c9bSNarendra K 
107911e1c9bSNarendra K static ssize_t
108911e1c9bSNarendra K smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
109911e1c9bSNarendra K {
110911e1c9bSNarendra K 	struct pci_dev *pdev;
111911e1c9bSNarendra K 	pdev = to_pci_dev(dev);
112911e1c9bSNarendra K 
113911e1c9bSNarendra K 	return find_smbios_instance_string(pdev, buf,
114911e1c9bSNarendra K 					   SMBIOS_ATTR_LABEL_SHOW);
115911e1c9bSNarendra K }
116911e1c9bSNarendra K 
117911e1c9bSNarendra K static ssize_t
118911e1c9bSNarendra K smbiosinstance_show(struct device *dev,
119911e1c9bSNarendra K 		    struct device_attribute *attr, char *buf)
120911e1c9bSNarendra K {
121911e1c9bSNarendra K 	struct pci_dev *pdev;
122911e1c9bSNarendra K 	pdev = to_pci_dev(dev);
123911e1c9bSNarendra K 
124911e1c9bSNarendra K 	return find_smbios_instance_string(pdev, buf,
125911e1c9bSNarendra K 					   SMBIOS_ATTR_INSTANCE_SHOW);
126911e1c9bSNarendra K }
127911e1c9bSNarendra K 
128911e1c9bSNarendra K static struct device_attribute smbios_attr_label = {
129763e9db9SStephen Rothwell 	.attr = {.name = "label", .mode = 0444},
130911e1c9bSNarendra K 	.show = smbioslabel_show,
131911e1c9bSNarendra K };
132911e1c9bSNarendra K 
133911e1c9bSNarendra K static struct device_attribute smbios_attr_instance = {
134763e9db9SStephen Rothwell 	.attr = {.name = "index", .mode = 0444},
135911e1c9bSNarendra K 	.show = smbiosinstance_show,
136911e1c9bSNarendra K };
137911e1c9bSNarendra K 
138911e1c9bSNarendra K static struct attribute *smbios_attributes[] = {
139911e1c9bSNarendra K 	&smbios_attr_label.attr,
140911e1c9bSNarendra K 	&smbios_attr_instance.attr,
141911e1c9bSNarendra K 	NULL,
142911e1c9bSNarendra K };
143911e1c9bSNarendra K 
144911e1c9bSNarendra K static struct attribute_group smbios_attr_group = {
145911e1c9bSNarendra K 	.attrs = smbios_attributes,
146911e1c9bSNarendra K 	.is_visible = smbios_instance_string_exist,
147911e1c9bSNarendra K };
148911e1c9bSNarendra K 
149911e1c9bSNarendra K static int
150911e1c9bSNarendra K pci_create_smbiosname_file(struct pci_dev *pdev)
151911e1c9bSNarendra K {
1526058989bSNarendra_K@Dell.com 	return sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group);
153911e1c9bSNarendra K }
154911e1c9bSNarendra K 
155911e1c9bSNarendra K static void
156911e1c9bSNarendra K pci_remove_smbiosname_file(struct pci_dev *pdev)
157911e1c9bSNarendra K {
158911e1c9bSNarendra K 	sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
159911e1c9bSNarendra K }
160911e1c9bSNarendra K 
1616058989bSNarendra_K@Dell.com #endif
1626058989bSNarendra_K@Dell.com 
1636058989bSNarendra_K@Dell.com #ifndef CONFIG_ACPI
1646058989bSNarendra_K@Dell.com 
1656058989bSNarendra_K@Dell.com static inline int
1666058989bSNarendra_K@Dell.com pci_create_acpi_index_label_files(struct pci_dev *pdev)
1676058989bSNarendra_K@Dell.com {
1686058989bSNarendra_K@Dell.com 	return -1;
1696058989bSNarendra_K@Dell.com }
1706058989bSNarendra_K@Dell.com 
1716058989bSNarendra_K@Dell.com static inline int
1726058989bSNarendra_K@Dell.com pci_remove_acpi_index_label_files(struct pci_dev *pdev)
1736058989bSNarendra_K@Dell.com {
1746058989bSNarendra_K@Dell.com 	return -1;
1756058989bSNarendra_K@Dell.com }
1766058989bSNarendra_K@Dell.com 
1776058989bSNarendra_K@Dell.com #else
1786058989bSNarendra_K@Dell.com 
1796058989bSNarendra_K@Dell.com static const char device_label_dsm_uuid[] = {
1806058989bSNarendra_K@Dell.com 	0xD0, 0x37, 0xC9, 0xE5, 0x53, 0x35, 0x7A, 0x4D,
1816058989bSNarendra_K@Dell.com 	0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D
1826058989bSNarendra_K@Dell.com };
1836058989bSNarendra_K@Dell.com 
1846058989bSNarendra_K@Dell.com enum acpi_attr_enum {
1856058989bSNarendra_K@Dell.com 	ACPI_ATTR_NONE = 0,
1866058989bSNarendra_K@Dell.com 	ACPI_ATTR_LABEL_SHOW,
1876058989bSNarendra_K@Dell.com 	ACPI_ATTR_INDEX_SHOW,
1886058989bSNarendra_K@Dell.com };
1896058989bSNarendra_K@Dell.com 
1906058989bSNarendra_K@Dell.com static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
1916058989bSNarendra_K@Dell.com {
1926058989bSNarendra_K@Dell.com 	int len;
1936058989bSNarendra_K@Dell.com 	len = utf16s_to_utf8s((const wchar_t *)obj->
1946058989bSNarendra_K@Dell.com 			      package.elements[1].string.pointer,
1956058989bSNarendra_K@Dell.com 			      obj->package.elements[1].string.length,
1966058989bSNarendra_K@Dell.com 			      UTF16_LITTLE_ENDIAN,
1976058989bSNarendra_K@Dell.com 			      buf, PAGE_SIZE);
1986058989bSNarendra_K@Dell.com 	buf[len] = '\n';
1996058989bSNarendra_K@Dell.com }
2006058989bSNarendra_K@Dell.com 
2016058989bSNarendra_K@Dell.com static int
2026058989bSNarendra_K@Dell.com dsm_get_label(acpi_handle handle, int func,
2036058989bSNarendra_K@Dell.com 	      struct acpi_buffer *output,
2046058989bSNarendra_K@Dell.com 	      char *buf, enum acpi_attr_enum attribute)
2056058989bSNarendra_K@Dell.com {
2066058989bSNarendra_K@Dell.com 	struct acpi_object_list input;
2076058989bSNarendra_K@Dell.com 	union acpi_object params[4];
2086058989bSNarendra_K@Dell.com 	union acpi_object *obj;
2096058989bSNarendra_K@Dell.com 	int len = 0;
2106058989bSNarendra_K@Dell.com 
2116058989bSNarendra_K@Dell.com 	int err;
2126058989bSNarendra_K@Dell.com 
2136058989bSNarendra_K@Dell.com 	input.count = 4;
2146058989bSNarendra_K@Dell.com 	input.pointer = params;
2156058989bSNarendra_K@Dell.com 	params[0].type = ACPI_TYPE_BUFFER;
2166058989bSNarendra_K@Dell.com 	params[0].buffer.length = sizeof(device_label_dsm_uuid);
2176058989bSNarendra_K@Dell.com 	params[0].buffer.pointer = (char *)device_label_dsm_uuid;
2186058989bSNarendra_K@Dell.com 	params[1].type = ACPI_TYPE_INTEGER;
2196058989bSNarendra_K@Dell.com 	params[1].integer.value = 0x02;
2206058989bSNarendra_K@Dell.com 	params[2].type = ACPI_TYPE_INTEGER;
2216058989bSNarendra_K@Dell.com 	params[2].integer.value = func;
2226058989bSNarendra_K@Dell.com 	params[3].type = ACPI_TYPE_PACKAGE;
2236058989bSNarendra_K@Dell.com 	params[3].package.count = 0;
2246058989bSNarendra_K@Dell.com 	params[3].package.elements = NULL;
2256058989bSNarendra_K@Dell.com 
2266058989bSNarendra_K@Dell.com 	err = acpi_evaluate_object(handle, "_DSM", &input, output);
2276058989bSNarendra_K@Dell.com 	if (err)
2286058989bSNarendra_K@Dell.com 		return -1;
2296058989bSNarendra_K@Dell.com 
2306058989bSNarendra_K@Dell.com 	obj = (union acpi_object *)output->pointer;
2316058989bSNarendra_K@Dell.com 
2326058989bSNarendra_K@Dell.com 	switch (obj->type) {
2336058989bSNarendra_K@Dell.com 	case ACPI_TYPE_PACKAGE:
2346058989bSNarendra_K@Dell.com 		if (obj->package.count != 2)
2356058989bSNarendra_K@Dell.com 			break;
2366058989bSNarendra_K@Dell.com 		len = obj->package.elements[0].integer.value;
2376058989bSNarendra_K@Dell.com 		if (buf) {
2386058989bSNarendra_K@Dell.com 			if (attribute == ACPI_ATTR_INDEX_SHOW)
2396058989bSNarendra_K@Dell.com 				scnprintf(buf, PAGE_SIZE, "%llu\n",
2406058989bSNarendra_K@Dell.com 				obj->package.elements[0].integer.value);
2416058989bSNarendra_K@Dell.com 			else if (attribute == ACPI_ATTR_LABEL_SHOW)
2426058989bSNarendra_K@Dell.com 				dsm_label_utf16s_to_utf8s(obj, buf);
2436058989bSNarendra_K@Dell.com 			kfree(output->pointer);
2446058989bSNarendra_K@Dell.com 			return strlen(buf);
2456058989bSNarendra_K@Dell.com 		}
2466058989bSNarendra_K@Dell.com 		kfree(output->pointer);
2476058989bSNarendra_K@Dell.com 		return len;
2486058989bSNarendra_K@Dell.com 	break;
2496058989bSNarendra_K@Dell.com 	default:
2506058989bSNarendra_K@Dell.com 		kfree(output->pointer);
2516058989bSNarendra_K@Dell.com 	}
2526058989bSNarendra_K@Dell.com 	return -1;
2536058989bSNarendra_K@Dell.com }
2546058989bSNarendra_K@Dell.com 
2556058989bSNarendra_K@Dell.com static bool
2566058989bSNarendra_K@Dell.com device_has_dsm(struct device *dev)
2576058989bSNarendra_K@Dell.com {
2586058989bSNarendra_K@Dell.com 	acpi_handle handle;
2596058989bSNarendra_K@Dell.com 	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
2606058989bSNarendra_K@Dell.com 
2616058989bSNarendra_K@Dell.com 	handle = DEVICE_ACPI_HANDLE(dev);
2626058989bSNarendra_K@Dell.com 
2636058989bSNarendra_K@Dell.com 	if (!handle)
2646058989bSNarendra_K@Dell.com 		return FALSE;
2656058989bSNarendra_K@Dell.com 
2666058989bSNarendra_K@Dell.com 	if (dsm_get_label(handle, DEVICE_LABEL_DSM, &output, NULL,
2676058989bSNarendra_K@Dell.com 			  ACPI_ATTR_NONE) > 0)
2686058989bSNarendra_K@Dell.com 		return TRUE;
2696058989bSNarendra_K@Dell.com 
2706058989bSNarendra_K@Dell.com 	return FALSE;
2716058989bSNarendra_K@Dell.com }
2726058989bSNarendra_K@Dell.com 
2736058989bSNarendra_K@Dell.com static mode_t
2746058989bSNarendra_K@Dell.com acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
2756058989bSNarendra_K@Dell.com {
2766058989bSNarendra_K@Dell.com 	struct device *dev;
2776058989bSNarendra_K@Dell.com 
2786058989bSNarendra_K@Dell.com 	dev = container_of(kobj, struct device, kobj);
2796058989bSNarendra_K@Dell.com 
2806058989bSNarendra_K@Dell.com 	if (device_has_dsm(dev))
2816058989bSNarendra_K@Dell.com 		return S_IRUGO;
2826058989bSNarendra_K@Dell.com 
2836058989bSNarendra_K@Dell.com 	return 0;
2846058989bSNarendra_K@Dell.com }
2856058989bSNarendra_K@Dell.com 
2866058989bSNarendra_K@Dell.com static ssize_t
2876058989bSNarendra_K@Dell.com acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
2886058989bSNarendra_K@Dell.com {
2896058989bSNarendra_K@Dell.com 	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
2906058989bSNarendra_K@Dell.com 	acpi_handle handle;
2916058989bSNarendra_K@Dell.com 	int length;
2926058989bSNarendra_K@Dell.com 
2936058989bSNarendra_K@Dell.com 	handle = DEVICE_ACPI_HANDLE(dev);
2946058989bSNarendra_K@Dell.com 
2956058989bSNarendra_K@Dell.com 	if (!handle)
2966058989bSNarendra_K@Dell.com 		return -1;
2976058989bSNarendra_K@Dell.com 
2986058989bSNarendra_K@Dell.com 	length = dsm_get_label(handle, DEVICE_LABEL_DSM,
2996058989bSNarendra_K@Dell.com 			       &output, buf, ACPI_ATTR_LABEL_SHOW);
3006058989bSNarendra_K@Dell.com 
3016058989bSNarendra_K@Dell.com 	if (length < 1)
3026058989bSNarendra_K@Dell.com 		return -1;
3036058989bSNarendra_K@Dell.com 
3046058989bSNarendra_K@Dell.com 	return length;
3056058989bSNarendra_K@Dell.com }
3066058989bSNarendra_K@Dell.com 
3076058989bSNarendra_K@Dell.com static ssize_t
3086058989bSNarendra_K@Dell.com acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
3096058989bSNarendra_K@Dell.com {
3106058989bSNarendra_K@Dell.com 	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
3116058989bSNarendra_K@Dell.com 	acpi_handle handle;
3126058989bSNarendra_K@Dell.com 	int length;
3136058989bSNarendra_K@Dell.com 
3146058989bSNarendra_K@Dell.com 	handle = DEVICE_ACPI_HANDLE(dev);
3156058989bSNarendra_K@Dell.com 
3166058989bSNarendra_K@Dell.com 	if (!handle)
3176058989bSNarendra_K@Dell.com 		return -1;
3186058989bSNarendra_K@Dell.com 
3196058989bSNarendra_K@Dell.com 	length = dsm_get_label(handle, DEVICE_LABEL_DSM,
3206058989bSNarendra_K@Dell.com 			       &output, buf, ACPI_ATTR_INDEX_SHOW);
3216058989bSNarendra_K@Dell.com 
3226058989bSNarendra_K@Dell.com 	if (length < 0)
3236058989bSNarendra_K@Dell.com 		return -1;
3246058989bSNarendra_K@Dell.com 
3256058989bSNarendra_K@Dell.com 	return length;
3266058989bSNarendra_K@Dell.com 
3276058989bSNarendra_K@Dell.com }
3286058989bSNarendra_K@Dell.com 
3296058989bSNarendra_K@Dell.com static struct device_attribute acpi_attr_label = {
3306058989bSNarendra_K@Dell.com 	.attr = {.name = "label", .mode = 0444},
3316058989bSNarendra_K@Dell.com 	.show = acpilabel_show,
3326058989bSNarendra_K@Dell.com };
3336058989bSNarendra_K@Dell.com 
3346058989bSNarendra_K@Dell.com static struct device_attribute acpi_attr_index = {
3356058989bSNarendra_K@Dell.com 	.attr = {.name = "acpi_index", .mode = 0444},
3366058989bSNarendra_K@Dell.com 	.show = acpiindex_show,
3376058989bSNarendra_K@Dell.com };
3386058989bSNarendra_K@Dell.com 
3396058989bSNarendra_K@Dell.com static struct attribute *acpi_attributes[] = {
3406058989bSNarendra_K@Dell.com 	&acpi_attr_label.attr,
3416058989bSNarendra_K@Dell.com 	&acpi_attr_index.attr,
3426058989bSNarendra_K@Dell.com 	NULL,
3436058989bSNarendra_K@Dell.com };
3446058989bSNarendra_K@Dell.com 
3456058989bSNarendra_K@Dell.com static struct attribute_group acpi_attr_group = {
3466058989bSNarendra_K@Dell.com 	.attrs = acpi_attributes,
3476058989bSNarendra_K@Dell.com 	.is_visible = acpi_index_string_exist,
3486058989bSNarendra_K@Dell.com };
3496058989bSNarendra_K@Dell.com 
3506058989bSNarendra_K@Dell.com static int
3516058989bSNarendra_K@Dell.com pci_create_acpi_index_label_files(struct pci_dev *pdev)
3526058989bSNarendra_K@Dell.com {
3536058989bSNarendra_K@Dell.com 	return sysfs_create_group(&pdev->dev.kobj, &acpi_attr_group);
3546058989bSNarendra_K@Dell.com }
3556058989bSNarendra_K@Dell.com 
3566058989bSNarendra_K@Dell.com static int
3576058989bSNarendra_K@Dell.com pci_remove_acpi_index_label_files(struct pci_dev *pdev)
3586058989bSNarendra_K@Dell.com {
3596058989bSNarendra_K@Dell.com 	sysfs_remove_group(&pdev->dev.kobj, &acpi_attr_group);
3606058989bSNarendra_K@Dell.com 	return 0;
3616058989bSNarendra_K@Dell.com }
3626058989bSNarendra_K@Dell.com #endif
3636058989bSNarendra_K@Dell.com 
364911e1c9bSNarendra K void pci_create_firmware_label_files(struct pci_dev *pdev)
365911e1c9bSNarendra K {
3666058989bSNarendra_K@Dell.com 	if (device_has_dsm(&pdev->dev))
3676058989bSNarendra_K@Dell.com 		pci_create_acpi_index_label_files(pdev);
3686058989bSNarendra_K@Dell.com 	else
3696058989bSNarendra_K@Dell.com 		pci_create_smbiosname_file(pdev);
370911e1c9bSNarendra K }
371911e1c9bSNarendra K 
372911e1c9bSNarendra K void pci_remove_firmware_label_files(struct pci_dev *pdev)
373911e1c9bSNarendra K {
3746058989bSNarendra_K@Dell.com 	if (device_has_dsm(&pdev->dev))
3756058989bSNarendra_K@Dell.com 		pci_remove_acpi_index_label_files(pdev);
3766058989bSNarendra_K@Dell.com 	else
377911e1c9bSNarendra K 		pci_remove_smbiosname_file(pdev);
378911e1c9bSNarendra K }
379