linux/drivers/pci/pci-label.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Export the firmware instance and label associated with a PCI device to
 * sysfs
 *
 * Copyright (C) 2010 Dell Inc.
 * by Narendra K <[email protected]>,
 * Jordan Hargrave <[email protected]>
 *
 * PCI Firmware Specification Revision 3.1 section 4.6.7 (DSM for Naming a
 * PCI or PCI Express Device Under Operating Systems) defines an instance
 * number and string name. This code retrieves them and exports them to sysfs.
 * If the system firmware does not provide the ACPI _DSM (Device Specific
 * Method), then the SMBIOS type 41 instance number and string is exported to
 * sysfs.
 *
 * SMBIOS defines type 41 for onboard pci devices. This code retrieves
 * the instance number and string from the type 41 record and exports
 * it to sysfs.
 *
 * Please see https://linux.dell.com/files/biosdevname/ for more
 * information.
 */

#include <linux/dmi.h>
#include <linux/sysfs.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/nls.h>
#include <linux/acpi.h>
#include <linux/pci-acpi.h>
#include "pci.h"

static bool device_has_acpi_name(struct device *dev)
{}

#ifdef CONFIG_DMI
enum smbios_attr_enum {};

static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
					  enum smbios_attr_enum attribute)
{}

static ssize_t smbios_label_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}
static struct device_attribute dev_attr_smbios_label =;

static ssize_t index_show(struct device *dev, struct device_attribute *attr,
			  char *buf)
{}
static DEVICE_ATTR_RO(index);

static struct attribute *smbios_attrs[] =;

static umode_t smbios_attr_is_visible(struct kobject *kobj, struct attribute *a,
				      int n)
{}

const struct attribute_group pci_dev_smbios_attr_group =;
#endif

#ifdef CONFIG_ACPI
enum acpi_attr_enum {};

static int dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
{}

static int dsm_get_label(struct device *dev, char *buf,
			 enum acpi_attr_enum attr)
{}

static ssize_t label_show(struct device *dev, struct device_attribute *attr,
			  char *buf)
{}
static DEVICE_ATTR_RO(label);

static ssize_t acpi_index_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(acpi_index);

static struct attribute *acpi_attrs[] =;

static umode_t acpi_attr_is_visible(struct kobject *kobj, struct attribute *a,
				    int n)
{}

const struct attribute_group pci_dev_acpi_attr_group =;
#endif