Lines Matching +full:non +full:- +full:prefetchable

1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
49 endp = (end - sizeof(struct hrt) + 1); in detect_HRT_floating_pointer()
80 if (func->pci_dev == NULL) in cpqhp_configure_device()
81 func->pci_dev = pci_get_domain_bus_and_slot(0, func->bus, in cpqhp_configure_device()
82 PCI_DEVFN(func->device, in cpqhp_configure_device()
83 func->function)); in cpqhp_configure_device()
86 if (func->pci_dev == NULL) { in cpqhp_configure_device()
89 num = pci_scan_slot(ctrl->pci_dev->bus, PCI_DEVFN(func->device, func->function)); in cpqhp_configure_device()
91 pci_bus_add_devices(ctrl->pci_dev->bus); in cpqhp_configure_device()
93 func->pci_dev = pci_get_domain_bus_and_slot(0, func->bus, in cpqhp_configure_device()
94 PCI_DEVFN(func->device, in cpqhp_configure_device()
95 func->function)); in cpqhp_configure_device()
96 if (func->pci_dev == NULL) { in cpqhp_configure_device()
102 if (func->pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { in cpqhp_configure_device()
103 pci_hp_add_bridge(func->pci_dev); in cpqhp_configure_device()
104 child = func->pci_dev->subordinate; in cpqhp_configure_device()
109 pci_dev_put(func->pci_dev); in cpqhp_configure_device()
121 dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function); in cpqhp_unconfigure_device()
126 func->bus, in cpqhp_unconfigure_device()
127 PCI_DEVFN(func->device, in cpqhp_unconfigure_device()
159 return -ENOMEM; in cpqhp_set_irq()
162 fakedev->devfn = dev_num << 3; in cpqhp_set_irq()
163 fakedev->bus = fakebus; in cpqhp_set_irq()
164 fakebus->number = bus_num; in cpqhp_set_irq()
167 rc = pcibios_set_irq_routing(fakedev, int_pin - 1, irq_num); in cpqhp_set_irq()
196 int ret = -1; in PCI_ScanBusForNonBridge()
198 ctrl->pci_bus->number = bus_num; in PCI_ScanBusForNonBridge()
202 if (!pci_bus_read_dev_vendor_id(ctrl->pci_bus, tdevice, &work, 0)) in PCI_ScanBusForNonBridge()
204 ret = pci_bus_read_config_dword(ctrl->pci_bus, tdevice, PCI_CLASS_REVISION, &work); in PCI_ScanBusForNonBridge()
238 tbus = cpqhp_routing_table->slots[loop].bus; in PCI_GetBusDevHelper()
239 tdevice = cpqhp_routing_table->slots[loop].devfn; in PCI_GetBusDevHelper()
240 tslot = cpqhp_routing_table->slots[loop].slot; in PCI_GetBusDevHelper()
245 ctrl->pci_bus->number = tbus; in PCI_GetBusDevHelper()
246 pci_bus_read_config_dword(ctrl->pci_bus, *dev_num, PCI_VENDOR_ID, &work); in PCI_GetBusDevHelper()
251 pci_bus_read_config_dword(ctrl->pci_bus, *dev_num, PCI_CLASS_REVISION, &work); in PCI_GetBusDevHelper()
255 pci_bus_read_config_byte(ctrl->pci_bus, *dev_num, PCI_SECONDARY_BUS, &tbus); in PCI_GetBusDevHelper()
256 dbg("Scan bus for Non Bridge: bus %d\n", tbus); in PCI_GetBusDevHelper()
265 return -1; in PCI_GetBusDevHelper()
286 * Note: For non-hot plug buses, the slot # saved is the device #
317 LastSupported = FirstSupported + (is_hot_plug & 0x0F) - 1; in cpqhp_save_config()
324 ctrl->pci_bus->number = busnumber; in cpqhp_save_config()
327 rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID); in cpqhp_save_config()
338 new_slot->bus = (u8) busnumber; in cpqhp_save_config()
339 new_slot->device = (u8) device; in cpqhp_save_config()
340 new_slot->function = 0; in cpqhp_save_config()
341 new_slot->is_a_board = 0; in cpqhp_save_config()
342 new_slot->presence_save = 0; in cpqhp_save_config()
343 new_slot->switch_save = 0; in cpqhp_save_config()
348 rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(device, 0), 0x0B, &class_code); in cpqhp_save_config()
352 rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(device, 0), PCI_HEADER_TYPE, &header_type); in cpqhp_save_config()
356 /* If multi-function device, set max_functions to 8 */ in cpqhp_save_config()
370 …rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(device, function), PCI_SECONDARY_BUS, &seco… in cpqhp_save_config()
382 ctrl->pci_bus->number = busnumber; in cpqhp_save_config()
389 (new_slot->function != (u8) function)) in cpqhp_save_config()
399 new_slot->bus = (u8) busnumber; in cpqhp_save_config()
400 new_slot->device = (u8) device; in cpqhp_save_config()
401 new_slot->function = (u8) function; in cpqhp_save_config()
402 new_slot->is_a_board = 1; in cpqhp_save_config()
403 new_slot->switch_save = 0x10; in cpqhp_save_config()
405 new_slot->status = DevError; in cpqhp_save_config()
406 devfn = (new_slot->device << 3) | new_slot->function; in cpqhp_save_config()
407 new_slot->pci_dev = pci_get_domain_bus_and_slot(0, in cpqhp_save_config()
408 new_slot->bus, devfn); in cpqhp_save_config()
411 …rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) &(n… in cpqhp_save_config()
416 pci_dev_put(new_slot->pci_dev); in cpqhp_save_config()
426 rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), PCI_VENDOR_ID, &ID); in cpqhp_save_config()
431 rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(device, function), 0x0B, &class_code); in cpqhp_save_config()
435 …rc = pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(device, function), PCI_HEADER_TYPE, &header… in cpqhp_save_config()
472 ctrl->pci_bus->number = new_slot->bus; in cpqhp_save_slot_config()
473 pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID); in cpqhp_save_slot_config()
478 pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), 0x0B, &class_code); in cpqhp_save_slot_config()
479 …pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_HEADER_TYPE, &header_t… in cpqhp_save_slot_config()
489 …pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_SECONDARY_BUS, … in cpqhp_save_slot_config()
499 ctrl->pci_bus->number = new_slot->bus; in cpqhp_save_slot_config()
503 new_slot->status = 0; in cpqhp_save_slot_config()
506 …pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), cloop << 2, (u32 *… in cpqhp_save_slot_config()
516 …pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_VENDOR_ID, &ID… in cpqhp_save_slot_config()
521 … pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), 0x0B, &class_code); in cpqhp_save_slot_config()
522 …pci_bus_read_config_byte(ctrl->pci_bus, PCI_DEVFN(new_slot->device, function), PCI_HEADER_TYPE, &h… in cpqhp_save_slot_config()
553 struct pci_bus *pci_bus = ctrl->pci_bus; in cpqhp_save_base_addr_length()
556 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_save_base_addr_length()
559 pci_bus->number = func->bus; in cpqhp_save_base_addr_length()
560 devfn = PCI_DEVFN(func->device, func->function); in cpqhp_save_base_addr_length()
577 next = next->next; in cpqhp_save_base_addr_length()
579 pci_bus->number = func->bus; in cpqhp_save_base_addr_length()
581 /* FIXME: this loop is duplicated in the non-bridge in cpqhp_save_base_addr_length()
613 func->base_length[(cloop - 0x10) >> 2] = in cpqhp_save_base_addr_length()
615 func->base_type[(cloop - 0x10) >> 2] = type; in cpqhp_save_base_addr_length()
653 func->base_length[(cloop - 0x10) >> 2] = base; in cpqhp_save_base_addr_length()
654 func->base_type[(cloop - 0x10) >> 2] = type; in cpqhp_save_base_addr_length()
662 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_save_base_addr_length()
698 struct pci_bus *pci_bus = ctrl->pci_bus; in cpqhp_save_used_resources()
701 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_save_used_resources()
703 while ((func != NULL) && func->is_a_board) { in cpqhp_save_used_resources()
704 pci_bus->number = func->bus; in cpqhp_save_used_resources()
705 devfn = PCI_DEVFN(func->device, func->function); in cpqhp_save_used_resources()
726 return -ENOMEM; in cpqhp_save_used_resources()
728 bus_node->base = secondary_bus; in cpqhp_save_used_resources()
729 bus_node->length = temp_byte - secondary_bus + 1; in cpqhp_save_used_resources()
731 bus_node->next = func->bus_head; in cpqhp_save_used_resources()
732 func->bus_head = bus_node; in cpqhp_save_used_resources()
741 return -ENOMEM; in cpqhp_save_used_resources()
743 io_node->base = (b_base & 0xF0) << 8; in cpqhp_save_used_resources()
744 io_node->length = (b_length - b_base + 0x10) << 8; in cpqhp_save_used_resources()
746 io_node->next = func->io_head; in cpqhp_save_used_resources()
747 func->io_head = io_node; in cpqhp_save_used_resources()
757 return -ENOMEM; in cpqhp_save_used_resources()
759 mem_node->base = w_base << 16; in cpqhp_save_used_resources()
760 mem_node->length = (w_length - w_base + 0x10) << 16; in cpqhp_save_used_resources()
762 mem_node->next = func->mem_head; in cpqhp_save_used_resources()
763 func->mem_head = mem_node; in cpqhp_save_used_resources()
766 /* Save prefetchable memory base and Limit registers */ in cpqhp_save_used_resources()
773 return -ENOMEM; in cpqhp_save_used_resources()
775 p_mem_node->base = w_base << 16; in cpqhp_save_used_resources()
776 p_mem_node->length = (w_length - w_base + 0x10) << 16; in cpqhp_save_used_resources()
778 p_mem_node->next = func->p_mem_head; in cpqhp_save_used_resources()
779 func->p_mem_head = p_mem_node; in cpqhp_save_used_resources()
805 return -ENOMEM; in cpqhp_save_used_resources()
807 io_node->base = in cpqhp_save_used_resources()
809 io_node->length = temp_register; in cpqhp_save_used_resources()
811 io_node->next = func->io_head; in cpqhp_save_used_resources()
812 func->io_head = io_node; in cpqhp_save_used_resources()
816 /* prefetchable memory base */ in cpqhp_save_used_resources()
823 return -ENOMEM; in cpqhp_save_used_resources()
825 p_mem_node->base = save_base & (~0x0FL); in cpqhp_save_used_resources()
826 p_mem_node->length = temp_register; in cpqhp_save_used_resources()
828 p_mem_node->next = func->p_mem_head; in cpqhp_save_used_resources()
829 func->p_mem_head = p_mem_node; in cpqhp_save_used_resources()
833 /* prefetchable memory base */ in cpqhp_save_used_resources()
840 return -ENOMEM; in cpqhp_save_used_resources()
842 mem_node->base = save_base & (~0x0FL); in cpqhp_save_used_resources()
843 mem_node->length = temp_register; in cpqhp_save_used_resources()
845 mem_node->next = func->mem_head; in cpqhp_save_used_resources()
846 func->mem_head = mem_node; in cpqhp_save_used_resources()
877 return -ENOMEM; in cpqhp_save_used_resources()
879 io_node->base = save_base & (~0x01L); in cpqhp_save_used_resources()
880 io_node->length = temp_register; in cpqhp_save_used_resources()
882 io_node->next = func->io_head; in cpqhp_save_used_resources()
883 func->io_head = io_node; in cpqhp_save_used_resources()
887 /* prefetchable memory base */ in cpqhp_save_used_resources()
894 return -ENOMEM; in cpqhp_save_used_resources()
896 p_mem_node->base = save_base & (~0x0FL); in cpqhp_save_used_resources()
897 p_mem_node->length = temp_register; in cpqhp_save_used_resources()
899 p_mem_node->next = func->p_mem_head; in cpqhp_save_used_resources()
900 func->p_mem_head = p_mem_node; in cpqhp_save_used_resources()
904 /* prefetchable memory base */ in cpqhp_save_used_resources()
911 return -ENOMEM; in cpqhp_save_used_resources()
913 mem_node->base = save_base & (~0x0FL); in cpqhp_save_used_resources()
914 mem_node->length = temp_register; in cpqhp_save_used_resources()
916 mem_node->next = func->mem_head; in cpqhp_save_used_resources()
917 func->mem_head = mem_node; in cpqhp_save_used_resources()
925 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_save_used_resources()
951 struct pci_bus *pci_bus = ctrl->pci_bus; in cpqhp_configure_board()
954 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_configure_board()
957 pci_bus->number = func->bus; in cpqhp_configure_board()
958 devfn = PCI_DEVFN(func->device, func->function); in cpqhp_configure_board()
963 for (cloop = 0x3C; cloop > 0; cloop -= 4) in cpqhp_configure_board()
964 pci_bus_write_config_dword(pci_bus, devfn, cloop, func->config_space[cloop >> 2]); in cpqhp_configure_board()
981 next = next->next; in cpqhp_configure_board()
992 if (temp != func->config_space[cloop >> 2]) { in cpqhp_configure_board()
994 dbg("bus = %x, device = %x, function = %x\n", func->bus, func->device, func->function); in cpqhp_configure_board()
995 dbg("temp = %x, config space = %x\n\n", temp, func->config_space[cloop >> 2]); in cpqhp_configure_board()
1001 func->configured = 1; in cpqhp_configure_board()
1003 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_configure_board()
1030 struct pci_bus *pci_bus = ctrl->pci_bus; in cpqhp_valid_replace()
1033 if (!func->is_a_board) in cpqhp_valid_replace()
1036 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_valid_replace()
1039 pci_bus->number = func->bus; in cpqhp_valid_replace()
1040 devfn = PCI_DEVFN(func->device, func->function); in cpqhp_valid_replace()
1048 if (temp_register != func->config_space[0]) in cpqhp_valid_replace()
1055 if (temp_register != func->config_space[0x08 >> 2]) in cpqhp_valid_replace()
1067 temp_register = func->config_space[0x18 >> 2]; in cpqhp_valid_replace()
1079 next = next->next; in cpqhp_valid_replace()
1088 if (temp_register != func->config_space[0x2C >> 2]) { in cpqhp_valid_replace()
1089 /* If it's a SMART-2 and the register isn't in cpqhp_valid_replace()
1093 if (!((func->config_space[0] == 0xAE100E11) in cpqhp_valid_replace()
1127 if (func->base_length[(cloop - 0x10) >> 2] != base) in cpqhp_valid_replace()
1130 if (func->base_type[(cloop - 0x10) >> 2] != type) in cpqhp_valid_replace()
1144 func = cpqhp_slot_find(func->bus, func->device, index++); in cpqhp_valid_replace()
1180 return -ENODEV; in cpqhp_find_available_resources()
1215 cpqhp_nic_irq = ctrl->cfgspc_irq; in cpqhp_find_available_resources()
1218 cpqhp_disk_irq = ctrl->cfgspc_irq; in cpqhp_find_available_resources()
1253 if (primary_bus != ctrl->bus) { in cpqhp_find_available_resources()
1254 i--; in cpqhp_find_available_resources()
1259 ctrl->pci_bus->number = primary_bus; in cpqhp_find_available_resources()
1260 pci_bus_read_config_dword(ctrl->pci_bus, dev_func, PCI_VENDOR_ID, &temp_dword); in cpqhp_find_available_resources()
1267 while (func && (func->function != (dev_func & 0x07))) { in cpqhp_find_available_resources()
1274 i--; in cpqhp_find_available_resources()
1298 return -ENOMEM; in cpqhp_find_available_resources()
1300 io_node->base = io_base; in cpqhp_find_available_resources()
1301 io_node->length = io_length; in cpqhp_find_available_resources()
1304 io_node->base, io_node->length); in cpqhp_find_available_resources()
1307 io_node->next = ctrl->io_head; in cpqhp_find_available_resources()
1308 ctrl->io_head = io_node; in cpqhp_find_available_resources()
1310 io_node->next = func->io_head; in cpqhp_find_available_resources()
1311 func->io_head = io_node; in cpqhp_find_available_resources()
1320 return -ENOMEM; in cpqhp_find_available_resources()
1322 mem_node->base = mem_base << 16; in cpqhp_find_available_resources()
1324 mem_node->length = mem_length << 16; in cpqhp_find_available_resources()
1327 mem_node->base, mem_node->length); in cpqhp_find_available_resources()
1330 mem_node->next = ctrl->mem_head; in cpqhp_find_available_resources()
1331 ctrl->mem_head = mem_node; in cpqhp_find_available_resources()
1333 mem_node->next = func->mem_head; in cpqhp_find_available_resources()
1334 func->mem_head = mem_node; in cpqhp_find_available_resources()
1338 /* If we've got a valid prefetchable memory base, and in cpqhp_find_available_resources()
1345 return -ENOMEM; in cpqhp_find_available_resources()
1347 p_mem_node->base = pre_mem_base << 16; in cpqhp_find_available_resources()
1349 p_mem_node->length = pre_mem_length << 16; in cpqhp_find_available_resources()
1351 p_mem_node->base, p_mem_node->length); in cpqhp_find_available_resources()
1355 p_mem_node->next = ctrl->p_mem_head; in cpqhp_find_available_resources()
1356 ctrl->p_mem_head = p_mem_node; in cpqhp_find_available_resources()
1358 p_mem_node->next = func->p_mem_head; in cpqhp_find_available_resources()
1359 func->p_mem_head = p_mem_node; in cpqhp_find_available_resources()
1365 * populated slots that don't have PCI-PCI bridges in cpqhp_find_available_resources()
1370 return -ENOMEM; in cpqhp_find_available_resources()
1372 bus_node->base = secondary_bus; in cpqhp_find_available_resources()
1373 bus_node->length = max_bus - secondary_bus + 1; in cpqhp_find_available_resources()
1375 bus_node->base, bus_node->length); in cpqhp_find_available_resources()
1378 bus_node->next = ctrl->bus_head; in cpqhp_find_available_resources()
1379 ctrl->bus_head = bus_node; in cpqhp_find_available_resources()
1381 bus_node->next = func->bus_head; in cpqhp_find_available_resources()
1382 func->bus_head = bus_node; in cpqhp_find_available_resources()
1386 i--; in cpqhp_find_available_resources()
1394 rc &= cpqhp_resource_sort_and_combine(&(ctrl->mem_head)); in cpqhp_find_available_resources()
1395 rc &= cpqhp_resource_sort_and_combine(&(ctrl->p_mem_head)); in cpqhp_find_available_resources()
1396 rc &= cpqhp_resource_sort_and_combine(&(ctrl->io_head)); in cpqhp_find_available_resources()
1397 rc &= cpqhp_resource_sort_and_combine(&(ctrl->bus_head)); in cpqhp_find_available_resources()
1421 node = func->io_head; in cpqhp_return_board_resources()
1422 func->io_head = NULL; in cpqhp_return_board_resources()
1424 t_node = node->next; in cpqhp_return_board_resources()
1425 return_resource(&(resources->io_head), node); in cpqhp_return_board_resources()
1429 node = func->mem_head; in cpqhp_return_board_resources()
1430 func->mem_head = NULL; in cpqhp_return_board_resources()
1432 t_node = node->next; in cpqhp_return_board_resources()
1433 return_resource(&(resources->mem_head), node); in cpqhp_return_board_resources()
1437 node = func->p_mem_head; in cpqhp_return_board_resources()
1438 func->p_mem_head = NULL; in cpqhp_return_board_resources()
1440 t_node = node->next; in cpqhp_return_board_resources()
1441 return_resource(&(resources->p_mem_head), node); in cpqhp_return_board_resources()
1445 node = func->bus_head; in cpqhp_return_board_resources()
1446 func->bus_head = NULL; in cpqhp_return_board_resources()
1448 t_node = node->next; in cpqhp_return_board_resources()
1449 return_resource(&(resources->bus_head), node); in cpqhp_return_board_resources()
1453 rc |= cpqhp_resource_sort_and_combine(&(resources->mem_head)); in cpqhp_return_board_resources()
1454 rc |= cpqhp_resource_sort_and_combine(&(resources->p_mem_head)); in cpqhp_return_board_resources()
1455 rc |= cpqhp_resource_sort_and_combine(&(resources->io_head)); in cpqhp_return_board_resources()
1456 rc |= cpqhp_resource_sort_and_combine(&(resources->bus_head)); in cpqhp_return_board_resources()
1471 res = resources->io_head; in cpqhp_destroy_resource_list()
1472 resources->io_head = NULL; in cpqhp_destroy_resource_list()
1476 res = res->next; in cpqhp_destroy_resource_list()
1480 res = resources->mem_head; in cpqhp_destroy_resource_list()
1481 resources->mem_head = NULL; in cpqhp_destroy_resource_list()
1485 res = res->next; in cpqhp_destroy_resource_list()
1489 res = resources->p_mem_head; in cpqhp_destroy_resource_list()
1490 resources->p_mem_head = NULL; in cpqhp_destroy_resource_list()
1494 res = res->next; in cpqhp_destroy_resource_list()
1498 res = resources->bus_head; in cpqhp_destroy_resource_list()
1499 resources->bus_head = NULL; in cpqhp_destroy_resource_list()
1503 res = res->next; in cpqhp_destroy_resource_list()
1518 res = func->io_head; in cpqhp_destroy_board_resources()
1519 func->io_head = NULL; in cpqhp_destroy_board_resources()
1523 res = res->next; in cpqhp_destroy_board_resources()
1527 res = func->mem_head; in cpqhp_destroy_board_resources()
1528 func->mem_head = NULL; in cpqhp_destroy_board_resources()
1532 res = res->next; in cpqhp_destroy_board_resources()
1536 res = func->p_mem_head; in cpqhp_destroy_board_resources()
1537 func->p_mem_head = NULL; in cpqhp_destroy_board_resources()
1541 res = res->next; in cpqhp_destroy_board_resources()
1545 res = func->bus_head; in cpqhp_destroy_board_resources()
1546 func->bus_head = NULL; in cpqhp_destroy_board_resources()
1550 res = res->next; in cpqhp_destroy_board_resources()