// SPDX-License-Identifier: GPL-2.0-only /* * pci_slot.c - ACPI PCI Slot Driver * * The code here is heavily leveraged from the acpiphp module. * Thanks to Matthew Wilcox <matthew@wil.cx> for much guidance. * Thanks to Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> for code * review and fixes. * * Copyright (C) 2007-2008 Hewlett-Packard Development Company, L.P. * Alex Chiang <achiang@hp.com> * * Copyright (C) 2013 Huawei Tech. Co., Ltd. * Jiang Liu <jiang.liu@huawei.com>
*/
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
pr_debug("Checking slot on path: %s\n", (char *)buffer.pointer);
if (check_sta_before_sun) { /* If SxFy doesn't have _STA, we just assume it's there */
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_SUCCESS(status) && !(sta & ACPI_STA_DEVICE_PRESENT)) goto out;
}
status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); if (ACPI_FAILURE(status)) {
pr_debug("_ADR returned %d on %s\n",
status, (char *)buffer.pointer); goto out;
}
/* No _SUN == not a slot == bail */
status = acpi_evaluate_integer(handle, "_SUN", NULL, sun); if (ACPI_FAILURE(status)) {
pr_debug("_SUN returned %d on %s\n",
status, (char *)buffer.pointer); goto out;
}
/* * Check whether handle has an associated slot and create PCI slot if it has.
*/ static acpi_status
register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
{ int device; unsignedlonglong sun; char name[SLOT_NAME_SIZE]; struct acpi_pci_slot *slot; struct pci_slot *pci_slot; struct pci_bus *pci_bus = context;
device = check_slot(handle, &sun); if (device < 0) return AE_OK;
/* * There may be multiple PCI functions associated with the same slot. * Check whether PCI slot has already been created for this PCI device.
*/
list_for_each_entry(slot, &slot_list, list) {
pci_slot = slot->pci_slot; if (pci_slot->bus == pci_bus && pci_slot->number == device) return AE_OK;
}
slot = kmalloc(sizeof(*slot), GFP_KERNEL); if (!slot) return AE_OK;
staticint do_sta_before_sun(conststruct dmi_system_id *d)
{
pr_info("%s detected: will evaluate _STA before calling _SUN\n",
d->ident);
check_sta_before_sun = 1; return 0;
}
staticconststruct dmi_system_id acpi_pci_slot_dmi_table[] __initconst = { /* * Fujitsu Primequest machines will return 1023 to indicate an * error if the _SUN method is evaluated on SxFy objects that * are not present (as indicated by _STA), so for those machines, * we want to check _STA before evaluating _SUN.
*/
{
.callback = do_sta_before_sun,
.ident = "Fujitsu PRIMEQUEST",
.matches = {
DMI_MATCH(DMI_BIOS_VENDOR, "FUJITSU LIMITED"),
DMI_MATCH(DMI_BIOS_VERSION, "PRIMEQUEST"),
},
},
{}
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.