Lines Matching full:root
3 * pci_root.c - ACPI PCI Root Bridge Driver ($Revision: 40 $)
28 #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge"
62 * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge
146 static void decode_osc_bits(struct acpi_pci_root *root, char *msg, u32 word, in decode_osc_bits() argument
159 dev_info(&root->device->dev, "_OSC: %s [%s]\n", msg, buf); in decode_osc_bits()
162 static void decode_osc_support(struct acpi_pci_root *root, char *msg, u32 word) in decode_osc_support() argument
164 decode_osc_bits(root, msg, word, pci_osc_support_bit, in decode_osc_support()
168 static void decode_osc_control(struct acpi_pci_root *root, char *msg, u32 word) in decode_osc_control() argument
170 decode_osc_bits(root, msg, word, pci_osc_control_bit, in decode_osc_control()
195 static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, in acpi_pci_query_osc() argument
203 support |= root->osc_support_set; in acpi_pci_query_osc()
209 capbuf[OSC_CONTROL_DWORD] = *control | root->osc_control_set; in acpi_pci_query_osc()
212 capbuf[OSC_CONTROL_DWORD] = root->osc_control_set; in acpi_pci_query_osc()
215 status = acpi_pci_run_osc(root->device->handle, capbuf, &result); in acpi_pci_query_osc()
217 root->osc_support_set = support; in acpi_pci_query_osc()
224 static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags) in acpi_pci_osc_support() argument
229 status = acpi_pci_query_osc(root, flags, NULL); in acpi_pci_osc_support()
236 struct acpi_pci_root *root; in acpi_pci_find_root() local
243 root = acpi_driver_data(device); in acpi_pci_find_root()
245 return root; in acpi_pci_find_root()
275 struct acpi_pci_root *root; in acpi_get_pci_dev() local
279 * Walk up the ACPI CA namespace until we reach a PCI root bridge. in acpi_get_pci_dev()
296 root = acpi_pci_find_root(phandle); in acpi_get_pci_dev()
297 if (!root) in acpi_get_pci_dev()
300 pbus = root->bus; in acpi_get_pci_dev()
304 * original handle. Assumes that everything between the PCI root in acpi_get_pci_dev()
342 * acpi_pci_osc_control_set - Request control of PCI root _OSC features.
343 * @handle: ACPI handle of a PCI root bridge (or PCIe Root Complex).
358 struct acpi_pci_root *root; in acpi_pci_osc_control_set() local
369 root = acpi_pci_find_root(handle); in acpi_pci_osc_control_set()
370 if (!root) in acpi_pci_osc_control_set()
375 *mask = ctrl | root->osc_control_set; in acpi_pci_osc_control_set()
377 if ((root->osc_control_set & ctrl) == ctrl) in acpi_pci_osc_control_set()
382 status = acpi_pci_query_osc(root, root->osc_support_set, mask); in acpi_pci_osc_control_set()
387 decode_osc_control(root, "platform does not support", in acpi_pci_osc_control_set()
393 decode_osc_control(root, "not requesting control; platform does not support", in acpi_pci_osc_control_set()
400 capbuf[OSC_SUPPORT_DWORD] = root->osc_support_set; in acpi_pci_osc_control_set()
404 root->osc_control_set = *mask; in acpi_pci_osc_control_set()
411 static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, in negotiate_os_control() argument
416 struct acpi_device *device = root->device; in negotiate_os_control()
425 root->osc_control_set = ~OSC_PCI_EXPRESS_PME_CONTROL; in negotiate_os_control()
426 decode_osc_control(root, "OS assumes control of", in negotiate_os_control()
427 root->osc_control_set); in negotiate_os_control()
446 decode_osc_support(root, "OS supports", support); in negotiate_os_control()
447 status = acpi_pci_osc_support(root, support); in negotiate_os_control()
467 decode_osc_support(root, "not requesting OS control; OS requires", in negotiate_os_control()
500 decode_osc_control(root, "OS now controls", control); in negotiate_os_control()
511 decode_osc_control(root, "OS requested", requested); in negotiate_os_control()
512 decode_osc_control(root, "platform willing to grant", control); in negotiate_os_control()
521 * root scan. in negotiate_os_control()
533 struct acpi_pci_root *root; in acpi_pci_root_add() local
539 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); in acpi_pci_root_add()
540 if (!root) in acpi_pci_root_add()
553 root->secondary.flags = IORESOURCE_BUS; in acpi_pci_root_add()
554 status = try_get_root_bridge_busnr(handle, &root->secondary); in acpi_pci_root_add()
562 root->secondary.end = 0xFF; in acpi_pci_root_add()
568 root->secondary.start = bus; in acpi_pci_root_add()
570 root->secondary.start = 0; in acpi_pci_root_add()
578 root->device = device; in acpi_pci_root_add()
579 root->segment = segment & 0xFFFF; in acpi_pci_root_add()
582 device->driver_data = root; in acpi_pci_root_add()
591 root->segment, &root->secondary); in acpi_pci_root_add()
593 root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle); in acpi_pci_root_add()
596 negotiate_os_control(root, &no_aspm, is_pcie); in acpi_pci_root_add()
603 * Scan the Root Bridge in acpi_pci_root_add()
605 * Must do this prior to any attempt to bind the root device, as the in acpi_pci_root_add()
607 * thus the root bridge's pci_dev does not exist). in acpi_pci_root_add()
609 root->bus = pci_acpi_scan_root(root); in acpi_pci_root_add()
610 if (!root->bus) { in acpi_pci_root_add()
613 root->segment, (unsigned int)root->secondary.start); in acpi_pci_root_add()
623 device_set_wakeup_capable(root->bus->bridge, device->wakeup.flags.valid); in acpi_pci_root_add()
626 pcibios_resource_survey_bus(root->bus); in acpi_pci_root_add()
627 pci_assign_unassigned_root_bus_resources(root->bus); in acpi_pci_root_add()
638 acpi_ioapic_add(root->device->handle); in acpi_pci_root_add()
642 pci_bus_add_devices(root->bus); in acpi_pci_root_add()
650 kfree(root); in acpi_pci_root_add()
656 struct acpi_pci_root *root = acpi_driver_data(device); in acpi_pci_root_remove() local
660 pci_stop_root_bus(root->bus); in acpi_pci_root_remove()
662 pci_ioapic_remove(root); in acpi_pci_root_remove()
663 device_set_wakeup_capable(root->bus->bridge, false); in acpi_pci_root_remove()
666 pci_remove_root_bus(root->bus); in acpi_pci_root_remove()
667 WARN_ON(acpi_ioapic_remove(root)); in acpi_pci_root_remove()
673 kfree(root); in acpi_pci_root_remove()
686 struct resource *res1, *res2, *root = NULL; in acpi_pci_root_validate_resources() local
690 root = (type & IORESOURCE_MEM) ? &iomem_resource : &ioport_resource; in acpi_pci_root_validate_resources()
702 end = min(res1->end, root->end); in acpi_pci_root_validate_resources()
816 struct resource *res, *conflict, *root = NULL; in pci_acpi_root_add_resources() local
821 root = &iomem_resource; in pci_acpi_root_add_resources()
823 root = &ioport_resource; in pci_acpi_root_add_resources()
831 if (res == root) in pci_acpi_root_add_resources()
834 conflict = insert_resource_conflict(root, res); in pci_acpi_root_add_resources()
879 struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, in acpi_pci_root_create() argument
884 int ret, busnum = root->secondary.start; in acpi_pci_root_create()
885 struct acpi_device *device = root->device; in acpi_pci_root_create()
891 info->root = root; in acpi_pci_root_create()
896 root->segment, busnum); in acpi_pci_root_create()
908 pci_add_resource(&info->resources, &root->secondary); in acpi_pci_root_create()
915 if (!(root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) in acpi_pci_root_create()
917 if (!(root->osc_control_set & OSC_PCI_SHPC_NATIVE_HP_CONTROL)) in acpi_pci_root_create()
919 if (!(root->osc_control_set & OSC_PCI_EXPRESS_AER_CONTROL)) in acpi_pci_root_create()
921 if (!(root->osc_control_set & OSC_PCI_EXPRESS_PME_CONTROL)) in acpi_pci_root_create()
923 if (!(root->osc_control_set & OSC_PCI_EXPRESS_LTR_CONTROL)) in acpi_pci_root_create()
925 if (!(root->osc_control_set & OSC_PCI_EXPRESS_DPC_CONTROL)) in acpi_pci_root_create()