Lines Matching +full:offset +full:- +full:x
1 // SPDX-License-Identifier: GPL-2.0+
7 * Copyright (C) 2001,2003 Greg Kroah-Hartman (greg@kroah.com)
8 * Copyright (C) 2001-2003 IBM Corp.
26 * POST builds data blocks(in this data block definition, a char-1
27 * byte, short(or word)-2 byte, long(dword)-4 byte) in the Extended
28 * BIOS Data Area which describe the configuration of the hot-plug
29 * controllers and resources used by the PCI Hot-Plug devices.
76 controller->slots = slots; in alloc_ebda_hpc()
81 controller->buses = buses; in alloc_ebda_hpc()
85 kfree(controller->slots); in alloc_ebda_hpc()
94 kfree(controller->slots); in free_ebda_hpc()
95 kfree(controller->buses); in free_ebda_hpc()
114 debug("%s - slot_min = %x\n", __func__, ptr->slot_min); in print_bus_info()
115 debug("%s - slot_max = %x\n", __func__, ptr->slot_max); in print_bus_info()
116 debug("%s - slot_count = %x\n", __func__, ptr->slot_count); in print_bus_info()
117 debug("%s - bus# = %x\n", __func__, ptr->busno); in print_bus_info()
118 debug("%s - current_speed = %x\n", __func__, ptr->current_speed); in print_bus_info()
119 debug("%s - controller_id = %x\n", __func__, ptr->controller_id); in print_bus_info()
121 debug("%s - slots_at_33_conv = %x\n", __func__, ptr->slots_at_33_conv); in print_bus_info()
122 debug("%s - slots_at_66_conv = %x\n", __func__, ptr->slots_at_66_conv); in print_bus_info()
123 debug("%s - slots_at_66_pcix = %x\n", __func__, ptr->slots_at_66_pcix); in print_bus_info()
124 debug("%s - slots_at_100_pcix = %x\n", __func__, ptr->slots_at_100_pcix); in print_bus_info()
125 debug("%s - slots_at_133_pcix = %x\n", __func__, ptr->slots_at_133_pcix); in print_bus_info()
133 debug("print_lo_info ----\n"); in print_lo_info()
135 debug("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); in print_lo_info()
136 debug("%s - rio_type = %x\n", __func__, ptr->rio_type); in print_lo_info()
137 debug("%s - owner_id = %x\n", __func__, ptr->owner_id); in print_lo_info()
138 debug("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); in print_lo_info()
139 debug("%s - wpindex = %x\n", __func__, ptr->wpindex); in print_lo_info()
140 debug("%s - chassis_num = %x\n", __func__, ptr->chassis_num); in print_lo_info()
148 debug("%s ---\n", __func__); in print_vg_info()
150 debug("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); in print_vg_info()
151 debug("%s - rio_type = %x\n", __func__, ptr->rio_type); in print_vg_info()
152 debug("%s - owner_id = %x\n", __func__, ptr->owner_id); in print_vg_info()
153 debug("%s - first_slot_num = %x\n", __func__, ptr->first_slot_num); in print_vg_info()
154 debug("%s - wpindex = %x\n", __func__, ptr->wpindex); in print_vg_info()
155 debug("%s - chassis_num = %x\n", __func__, ptr->chassis_num); in print_vg_info()
165 debug("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", in print_ebda_pci_rsrc()
166 __func__, ptr->rsrc_type, ptr->bus_num, ptr->dev_fun, ptr->start_addr, ptr->end_addr); in print_ebda_pci_rsrc()
175 debug("%s - slot_number: %x\n", __func__, ptr->number); in print_ibm_slot()
182 debug("%s ---\n", __func__); in print_opt_vg()
184 debug("%s - rio_type %x\n", __func__, ptr->rio_type); in print_opt_vg()
185 debug("%s - chassis_num: %x\n", __func__, ptr->chassis_num); in print_opt_vg()
186 debug("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); in print_opt_vg()
187 debug("%s - middle_num: %x\n", __func__, ptr->middle_num); in print_opt_vg()
197 for (index = 0; index < hpc_ptr->slot_count; index++) { in print_ebda_hpc()
198 debug("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); in print_ebda_hpc()
199 debug("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); in print_ebda_hpc()
200 debug("%s - index into ctlr addr: %x\n", __func__, hpc_ptr->slots[index].ctl_index); in print_ebda_hpc()
201 debug("%s - cap of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_cap); in print_ebda_hpc()
204 for (index = 0; index < hpc_ptr->bus_count; index++) in print_ebda_hpc()
205 …debug("%s - bus# of each bus controlled by this ctlr: %x\n", __func__, hpc_ptr->buses[index].bus_n… in print_ebda_hpc()
207 debug("%s - type of hpc: %x\n", __func__, hpc_ptr->ctlr_type); in print_ebda_hpc()
208 switch (hpc_ptr->ctlr_type) { in print_ebda_hpc()
210 debug("%s - bus: %x\n", __func__, hpc_ptr->u.pci_ctlr.bus); in print_ebda_hpc()
211 debug("%s - dev_fun: %x\n", __func__, hpc_ptr->u.pci_ctlr.dev_fun); in print_ebda_hpc()
212 debug("%s - irq: %x\n", __func__, hpc_ptr->irq); in print_ebda_hpc()
216 debug("%s - io_start: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_start); in print_ebda_hpc()
217 debug("%s - io_end: %x\n", __func__, hpc_ptr->u.isa_ctlr.io_end); in print_ebda_hpc()
218 debug("%s - irq: %x\n", __func__, hpc_ptr->irq); in print_ebda_hpc()
223 debug("%s - wpegbbar: %lx\n", __func__, hpc_ptr->u.wpeg_ctlr.wpegbbar); in print_ebda_hpc()
224 debug("%s - i2c_addr: %x\n", __func__, hpc_ptr->u.wpeg_ctlr.i2c_addr); in print_ebda_hpc()
225 debug("%s - irq: %x\n", __func__, hpc_ptr->irq); in print_ebda_hpc()
234 u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base; in ibmphp_access_ebda() local
243 return -ENOMEM; in ibmphp_access_ebda()
246 debug("returned ebda segment: %x\n", ebda_seg); in ibmphp_access_ebda()
250 return -ENOMEM; in ibmphp_access_ebda()
255 return -ENOMEM; in ibmphp_access_ebda()
259 return -ENOMEM; in ibmphp_access_ebda()
263 offset = next_offset; in ibmphp_access_ebda()
266 if (WARN(offset > (ebda_sz * 1024 - 4), in ibmphp_access_ebda()
270 next_offset = readw(io_mem + offset); /* offset of next blk */ in ibmphp_access_ebda()
272 offset += 2; in ibmphp_access_ebda()
275 blk_id = readw(io_mem + offset); /* this blk id */ in ibmphp_access_ebda()
277 offset += 2; in ibmphp_access_ebda()
283 debug("now enter hot swap block---\n"); in ibmphp_access_ebda()
284 debug("hot blk id: %x\n", blk_id); in ibmphp_access_ebda()
285 format = readb(io_mem + offset); in ibmphp_access_ebda()
287 offset += 1; in ibmphp_access_ebda()
290 debug("hot blk format: %x\n", format); in ibmphp_access_ebda()
292 base = offset; in ibmphp_access_ebda()
309 rc = -ENOMEM; in ibmphp_access_ebda()
312 hpc_list_ptr->format = format; in ibmphp_access_ebda()
313 hpc_list_ptr->num_ctlrs = num_ctlrs; in ibmphp_access_ebda()
314 hpc_list_ptr->phys_addr = sub_addr; /* offset of RSRC_CONTROLLER blk */ in ibmphp_access_ebda()
315 debug("info about hpc descriptor---\n"); in ibmphp_access_ebda()
316 debug("hot blk format: %x\n", format); in ibmphp_access_ebda()
317 debug("num of controller: %x\n", num_ctlrs); in ibmphp_access_ebda()
318 debug("offset of hpc data structure entries: %x\n ", sub_addr); in ibmphp_access_ebda()
334 sub_addr += 2; /* offset of RSRC_ENTRIES blk */ in ibmphp_access_ebda()
337 rc = -ENOMEM; in ibmphp_access_ebda()
340 rsrc_list_ptr->format = format; in ibmphp_access_ebda()
341 rsrc_list_ptr->num_entries = num_entries; in ibmphp_access_ebda()
342 rsrc_list_ptr->phys_addr = sub_addr; in ibmphp_access_ebda()
344 debug("info about rsrc descriptor---\n"); in ibmphp_access_ebda()
345 debug("format: %x\n", format); in ibmphp_access_ebda()
346 debug("num of rsrc: %x\n", num_entries); in ibmphp_access_ebda()
347 debug("offset of rsrc data structure entries: %x\n ", sub_addr); in ibmphp_access_ebda()
352 debug("now enter io table ---\n"); in ibmphp_access_ebda()
353 debug("rio blk id: %x\n", blk_id); in ibmphp_access_ebda()
357 rc = -ENOMEM; in ibmphp_access_ebda()
360 rio_table_ptr->ver_num = readb(io_mem + offset); in ibmphp_access_ebda()
361 rio_table_ptr->scal_count = readb(io_mem + offset + 1); in ibmphp_access_ebda()
362 rio_table_ptr->riodev_count = readb(io_mem + offset + 2); in ibmphp_access_ebda()
363 rio_table_ptr->offset = offset + 3 ; in ibmphp_access_ebda()
365 debug("info about rio table hdr ---\n"); in ibmphp_access_ebda()
366 debug("ver_num: %x\nscal_count: %x\nriodev_count: %x\noffset of rio table: %x\n ", in ibmphp_access_ebda()
367 rio_table_ptr->ver_num, rio_table_ptr->scal_count, in ibmphp_access_ebda()
368 rio_table_ptr->riodev_count, rio_table_ptr->offset); in ibmphp_access_ebda()
378 if (rio_complete && rio_table_ptr->ver_num == 3) { in ibmphp_access_ebda()
391 rc = -ENODEV; in ibmphp_access_ebda()
402 u16 offset; in ebda_rio_table() local
406 offset = rio_table_ptr->offset; in ebda_rio_table()
407 offset += 12 * rio_table_ptr->scal_count; in ebda_rio_table()
410 for (i = 0; i < rio_table_ptr->riodev_count; i++) { in ebda_rio_table()
413 return -ENOMEM; in ebda_rio_table()
414 rio_detail_ptr->rio_node_id = readb(io_mem + offset); in ebda_rio_table()
415 rio_detail_ptr->bbar = readl(io_mem + offset + 1); in ebda_rio_table()
416 rio_detail_ptr->rio_type = readb(io_mem + offset + 5); in ebda_rio_table()
417 rio_detail_ptr->owner_id = readb(io_mem + offset + 6); in ebda_rio_table()
418 rio_detail_ptr->port0_node_connect = readb(io_mem + offset + 7); in ebda_rio_table()
419 rio_detail_ptr->port0_port_connect = readb(io_mem + offset + 8); in ebda_rio_table()
420 rio_detail_ptr->port1_node_connect = readb(io_mem + offset + 9); in ebda_rio_table()
421 rio_detail_ptr->port1_port_connect = readb(io_mem + offset + 10); in ebda_rio_table()
422 rio_detail_ptr->first_slot_num = readb(io_mem + offset + 11); in ebda_rio_table()
423 rio_detail_ptr->status = readb(io_mem + offset + 12); in ebda_rio_table()
424 rio_detail_ptr->wpindex = readb(io_mem + offset + 13); in ebda_rio_table()
425 rio_detail_ptr->chassis_num = readb(io_mem + offset + 14); in ebda_rio_table()
426 …x\nbbar: %x\nrio_type: %x\nowner_id: %x\nport0_node: %x\nport0_port: %x\nport1_node: %x\nport1_por… in ebda_rio_table()
428 if (rio_detail_ptr->rio_type == 4 || rio_detail_ptr->rio_type == 5) in ebda_rio_table()
429 list_add(&rio_detail_ptr->rio_detail_list, &rio_vg_head); in ebda_rio_table()
431 else if (rio_detail_ptr->rio_type == 6 || rio_detail_ptr->rio_type == 7) in ebda_rio_table()
432 list_add(&rio_detail_ptr->rio_detail_list, &rio_lo_head); in ebda_rio_table()
436 offset += 15; in ebda_rio_table()
450 if (ptr->chassis_num == chassis_num) in search_opt_vg()
462 opt_rio_ptr = search_opt_vg(rio_detail_ptr->chassis_num); in combine_wpg_for_chassis()
466 return -ENOMEM; in combine_wpg_for_chassis()
467 opt_rio_ptr->rio_type = rio_detail_ptr->rio_type; in combine_wpg_for_chassis()
468 opt_rio_ptr->chassis_num = rio_detail_ptr->chassis_num; in combine_wpg_for_chassis()
469 opt_rio_ptr->first_slot_num = rio_detail_ptr->first_slot_num; in combine_wpg_for_chassis()
470 opt_rio_ptr->middle_num = rio_detail_ptr->first_slot_num; in combine_wpg_for_chassis()
471 list_add(&opt_rio_ptr->opt_rio_list, &opt_vg_head); in combine_wpg_for_chassis()
473 opt_rio_ptr->first_slot_num = min(opt_rio_ptr->first_slot_num, rio_detail_ptr->first_slot_num); in combine_wpg_for_chassis()
474 opt_rio_ptr->middle_num = max(opt_rio_ptr->middle_num, rio_detail_ptr->first_slot_num); in combine_wpg_for_chassis()
488 if (ptr->chassis_num == chassis_num) in search_opt_lo()
500 opt_rio_lo_ptr = search_opt_lo(rio_detail_ptr->chassis_num); in combine_wpg_for_expansion()
504 return -ENOMEM; in combine_wpg_for_expansion()
505 opt_rio_lo_ptr->rio_type = rio_detail_ptr->rio_type; in combine_wpg_for_expansion()
506 opt_rio_lo_ptr->chassis_num = rio_detail_ptr->chassis_num; in combine_wpg_for_expansion()
507 opt_rio_lo_ptr->first_slot_num = rio_detail_ptr->first_slot_num; in combine_wpg_for_expansion()
508 opt_rio_lo_ptr->middle_num = rio_detail_ptr->first_slot_num; in combine_wpg_for_expansion()
509 opt_rio_lo_ptr->pack_count = 1; in combine_wpg_for_expansion()
511 list_add(&opt_rio_lo_ptr->opt_rio_lo_list, &opt_lo_head); in combine_wpg_for_expansion()
513 …opt_rio_lo_ptr->first_slot_num = min(opt_rio_lo_ptr->first_slot_num, rio_detail_ptr->first_slot_nu… in combine_wpg_for_expansion()
514 opt_rio_lo_ptr->middle_num = max(opt_rio_lo_ptr->middle_num, rio_detail_ptr->first_slot_num); in combine_wpg_for_expansion()
515 opt_rio_lo_ptr->pack_count = 2; in combine_wpg_for_expansion()
535 if ((first_slot < opt_vg_ptr->first_slot_num) && (slot_num >= opt_vg_ptr->first_slot_num)) { in first_slot_num()
536 rc = -ENODEV; in first_slot_num()
542 if ((first_slot < opt_lo_ptr->first_slot_num) && (slot_num >= opt_lo_ptr->first_slot_num)) { in first_slot_num()
543 rc = -ENODEV; in first_slot_num()
557 …if ((slot_num >= opt_lo_ptr->first_slot_num) && (!first_slot_num(slot_num, opt_lo_ptr->first_slot_… in find_rxe_num()
569 …if ((slot_num >= opt_vg_ptr->first_slot_num) && (!first_slot_num(slot_num, opt_vg_ptr->first_slot_… in find_chassis_num()
584 if (slot_cur->ctrl) { in calculate_first_slot()
585 …if ((slot_cur->ctrl->ctlr_type != 4) && (slot_cur->ctrl->ending_slot_num > first_slot) && (slot_nu… in calculate_first_slot()
586 first_slot = slot_cur->ctrl->ending_slot_num; in calculate_first_slot()
611 slot_num = slot_cur->number; in create_file_name()
616 if (rio_table_ptr->ver_num == 3) { in create_file_name()
623 if ((slot_num - opt_vg_ptr->first_slot_num) > (slot_num - opt_lo_ptr->first_slot_num)) { in create_file_name()
624 number = opt_lo_ptr->chassis_num; in create_file_name()
625 first_slot = opt_lo_ptr->first_slot_num; in create_file_name()
628 first_slot = opt_vg_ptr->first_slot_num; in create_file_name()
629 number = opt_vg_ptr->chassis_num; in create_file_name()
633 first_slot = opt_vg_ptr->first_slot_num; in create_file_name()
634 number = opt_vg_ptr->chassis_num; in create_file_name()
639 number = opt_lo_ptr->chassis_num; in create_file_name()
640 first_slot = opt_lo_ptr->first_slot_num; in create_file_name()
644 if (rio_table_ptr->ver_num == 3) { in create_file_name()
650 if (slot_cur->ctrl->ctlr_type == 4) { in create_file_name()
660 number, slot_num - first_slot + 1); in create_file_name()
677 * map info (ctlr-id, slot count, slot#.. bus count, bus#, ctlr type...) of
695 addr = hpc_list_ptr->phys_addr; in ebda_rsrc_controller()
696 for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { in ebda_rsrc_controller()
703 addr_slot = addr; /* offset of slot structure */ in ebda_rsrc_controller()
709 addr_bus = addr; /* offset of bus */ in ebda_rsrc_controller()
710 addr += (bus_num * 9); /* offset of ctlr_type */ in ebda_rsrc_controller()
717 rc = -ENOMEM; in ebda_rsrc_controller()
720 hpc_ptr->ctlr_id = ctlr_id; in ebda_rsrc_controller()
721 hpc_ptr->ctlr_relative_id = ctlr; in ebda_rsrc_controller()
722 hpc_ptr->slot_count = slot_num; in ebda_rsrc_controller()
723 hpc_ptr->bus_count = bus_num; in ebda_rsrc_controller()
724 debug("now enter ctlr data structure ---\n"); in ebda_rsrc_controller()
725 debug("ctlr id: %x\n", ctlr_id); in ebda_rsrc_controller()
726 debug("ctlr_relative_id: %x\n", hpc_ptr->ctlr_relative_id); in ebda_rsrc_controller()
727 debug("count of slots controlled by this ctlr: %x\n", slot_num); in ebda_rsrc_controller()
728 debug("count of buses controlled by this ctlr: %x\n", bus_num); in ebda_rsrc_controller()
731 slot_ptr = hpc_ptr->slots; in ebda_rsrc_controller()
733 slot_ptr->slot_num = readb(io_mem + addr_slot); in ebda_rsrc_controller()
734 slot_ptr->slot_bus_num = readb(io_mem + addr_slot + slot_num); in ebda_rsrc_controller()
735 slot_ptr->ctl_index = readb(io_mem + addr_slot + 2*slot_num); in ebda_rsrc_controller()
736 slot_ptr->slot_cap = readb(io_mem + addr_slot + 3*slot_num); in ebda_rsrc_controller()
738 // create bus_info lined list --- if only one slot per bus: slot_min = slot_max in ebda_rsrc_controller()
740 bus_info_ptr2 = ibmphp_find_same_bus_num(slot_ptr->slot_bus_num); in ebda_rsrc_controller()
744 rc = -ENOMEM; in ebda_rsrc_controller()
747 bus_info_ptr1->slot_min = slot_ptr->slot_num; in ebda_rsrc_controller()
748 bus_info_ptr1->slot_max = slot_ptr->slot_num; in ebda_rsrc_controller()
749 bus_info_ptr1->slot_count += 1; in ebda_rsrc_controller()
750 bus_info_ptr1->busno = slot_ptr->slot_bus_num; in ebda_rsrc_controller()
751 bus_info_ptr1->index = bus_index++; in ebda_rsrc_controller()
752 bus_info_ptr1->current_speed = 0xff; in ebda_rsrc_controller()
753 bus_info_ptr1->current_bus_mode = 0xff; in ebda_rsrc_controller()
755 bus_info_ptr1->controller_id = hpc_ptr->ctlr_id; in ebda_rsrc_controller()
757 list_add_tail(&bus_info_ptr1->bus_info_list, &bus_info_head); in ebda_rsrc_controller()
760 bus_info_ptr2->slot_min = min(bus_info_ptr2->slot_min, slot_ptr->slot_num); in ebda_rsrc_controller()
761 bus_info_ptr2->slot_max = max(bus_info_ptr2->slot_max, slot_ptr->slot_num); in ebda_rsrc_controller()
762 bus_info_ptr2->slot_count += 1; in ebda_rsrc_controller()
773 bus_ptr = hpc_ptr->buses; in ebda_rsrc_controller()
775 bus_ptr->bus_num = readb(io_mem + addr_bus + bus); in ebda_rsrc_controller()
776 bus_ptr->slots_at_33_conv = readb(io_mem + addr_bus + bus_num + 8 * bus); in ebda_rsrc_controller()
777 bus_ptr->slots_at_66_conv = readb(io_mem + addr_bus + bus_num + 8 * bus + 1); in ebda_rsrc_controller()
779 bus_ptr->slots_at_66_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 2); in ebda_rsrc_controller()
781 bus_ptr->slots_at_100_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 3); in ebda_rsrc_controller()
783 bus_ptr->slots_at_133_pcix = readb(io_mem + addr_bus + bus_num + 8 * bus + 4); in ebda_rsrc_controller()
785 bus_info_ptr2 = ibmphp_find_same_bus_num(bus_ptr->bus_num); in ebda_rsrc_controller()
787 bus_info_ptr2->slots_at_33_conv = bus_ptr->slots_at_33_conv; in ebda_rsrc_controller()
788 bus_info_ptr2->slots_at_66_conv = bus_ptr->slots_at_66_conv; in ebda_rsrc_controller()
789 bus_info_ptr2->slots_at_66_pcix = bus_ptr->slots_at_66_pcix; in ebda_rsrc_controller()
790 bus_info_ptr2->slots_at_100_pcix = bus_ptr->slots_at_100_pcix; in ebda_rsrc_controller()
791 bus_info_ptr2->slots_at_133_pcix = bus_ptr->slots_at_133_pcix; in ebda_rsrc_controller()
796 hpc_ptr->ctlr_type = temp; in ebda_rsrc_controller()
798 switch (hpc_ptr->ctlr_type) { in ebda_rsrc_controller()
800 hpc_ptr->u.pci_ctlr.bus = readb(io_mem + addr); in ebda_rsrc_controller()
801 hpc_ptr->u.pci_ctlr.dev_fun = readb(io_mem + addr + 1); in ebda_rsrc_controller()
802 hpc_ptr->irq = readb(io_mem + addr + 2); in ebda_rsrc_controller()
804 debug("ctrl bus = %x, ctlr devfun = %x, irq = %x\n", in ebda_rsrc_controller()
805 hpc_ptr->u.pci_ctlr.bus, in ebda_rsrc_controller()
806 hpc_ptr->u.pci_ctlr.dev_fun, hpc_ptr->irq); in ebda_rsrc_controller()
810 hpc_ptr->u.isa_ctlr.io_start = readw(io_mem + addr); in ebda_rsrc_controller()
811 hpc_ptr->u.isa_ctlr.io_end = readw(io_mem + addr + 2); in ebda_rsrc_controller()
812 if (!request_region(hpc_ptr->u.isa_ctlr.io_start, in ebda_rsrc_controller()
813 (hpc_ptr->u.isa_ctlr.io_end - hpc_ptr->u.isa_ctlr.io_start + 1), in ebda_rsrc_controller()
815 rc = -ENODEV; in ebda_rsrc_controller()
818 hpc_ptr->irq = readb(io_mem + addr + 4); in ebda_rsrc_controller()
824 hpc_ptr->u.wpeg_ctlr.wpegbbar = readl(io_mem + addr); in ebda_rsrc_controller()
825 hpc_ptr->u.wpeg_ctlr.i2c_addr = readb(io_mem + addr + 4); in ebda_rsrc_controller()
826 hpc_ptr->irq = readb(io_mem + addr + 5); in ebda_rsrc_controller()
830 rc = -ENODEV; in ebda_rsrc_controller()
837 hpc_ptr->revision = 0xff; in ebda_rsrc_controller()
838 hpc_ptr->options = 0xff; in ebda_rsrc_controller()
839 hpc_ptr->starting_slot_num = hpc_ptr->slots[0].slot_num; in ebda_rsrc_controller()
840 hpc_ptr->ending_slot_num = hpc_ptr->slots[slot_num-1].slot_num; in ebda_rsrc_controller()
843 for (index = 0; index < hpc_ptr->slot_count; index++) { in ebda_rsrc_controller()
846 rc = -ENOMEM; in ebda_rsrc_controller()
850 tmp_slot->flag = 1; in ebda_rsrc_controller()
852 tmp_slot->capabilities = hpc_ptr->slots[index].slot_cap; in ebda_rsrc_controller()
853 if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_133_MAX) == EBDA_SLOT_133_MAX) in ebda_rsrc_controller()
854 tmp_slot->supported_speed = 3; in ebda_rsrc_controller()
855 else if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_100_MAX) == EBDA_SLOT_100_MAX) in ebda_rsrc_controller()
856 tmp_slot->supported_speed = 2; in ebda_rsrc_controller()
857 else if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_66_MAX) == EBDA_SLOT_66_MAX) in ebda_rsrc_controller()
858 tmp_slot->supported_speed = 1; in ebda_rsrc_controller()
860 if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_PCIX_CAP) == EBDA_SLOT_PCIX_CAP) in ebda_rsrc_controller()
861 tmp_slot->supported_bus_mode = 1; in ebda_rsrc_controller()
863 tmp_slot->supported_bus_mode = 0; in ebda_rsrc_controller()
866 tmp_slot->bus = hpc_ptr->slots[index].slot_bus_num; in ebda_rsrc_controller()
868 bus_info_ptr1 = ibmphp_find_same_bus_num(hpc_ptr->slots[index].slot_bus_num); in ebda_rsrc_controller()
870 rc = -ENODEV; in ebda_rsrc_controller()
873 tmp_slot->bus_on = bus_info_ptr1; in ebda_rsrc_controller()
875 tmp_slot->ctrl = hpc_ptr; in ebda_rsrc_controller()
877 tmp_slot->ctlr_index = hpc_ptr->slots[index].ctl_index; in ebda_rsrc_controller()
878 tmp_slot->number = hpc_ptr->slots[index].slot_num; in ebda_rsrc_controller()
880 rc = fillslotinfo(&tmp_slot->hotplug_slot); in ebda_rsrc_controller()
887 tmp_slot->hotplug_slot.ops = &ibmphp_hotplug_slot_ops; in ebda_rsrc_controller()
891 list_add(&tmp_slot->ibm_slot_list, &ibmphp_slot_head); in ebda_rsrc_controller()
895 list_add(&hpc_ptr->ebda_hpc_list, &ebda_hpc_head); in ebda_rsrc_controller()
901 pci_hp_register(&tmp_slot->hotplug_slot, in ebda_rsrc_controller()
902 pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name); in ebda_rsrc_controller()
929 addr = rsrc_list_ptr->phys_addr; in ebda_rsrc_rsrc()
931 debug("offset of rsrc: %x\n", rsrc_list_ptr->phys_addr); in ebda_rsrc_rsrc()
933 for (rsrc = 0; rsrc < rsrc_list_ptr->num_entries; rsrc++) { in ebda_rsrc_rsrc()
943 return -ENOMEM; in ebda_rsrc_rsrc()
945 rsrc_ptr->rsrc_type = type; in ebda_rsrc_rsrc()
947 rsrc_ptr->bus_num = readb(io_mem + addr); in ebda_rsrc_rsrc()
948 rsrc_ptr->dev_fun = readb(io_mem + addr + 1); in ebda_rsrc_rsrc()
949 rsrc_ptr->start_addr = readw(io_mem + addr + 2); in ebda_rsrc_rsrc()
950 rsrc_ptr->end_addr = readw(io_mem + addr + 4); in ebda_rsrc_rsrc()
953 debug("rsrc from io type ----\n"); in ebda_rsrc_rsrc()
954 debug("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", in ebda_rsrc_rsrc()
955 …rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_add… in ebda_rsrc_rsrc()
957 list_add(&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); in ebda_rsrc_rsrc()
964 return -ENOMEM; in ebda_rsrc_rsrc()
966 rsrc_ptr->rsrc_type = type; in ebda_rsrc_rsrc()
968 rsrc_ptr->bus_num = readb(io_mem + addr); in ebda_rsrc_rsrc()
969 rsrc_ptr->dev_fun = readb(io_mem + addr + 1); in ebda_rsrc_rsrc()
970 rsrc_ptr->start_addr = readl(io_mem + addr + 2); in ebda_rsrc_rsrc()
971 rsrc_ptr->end_addr = readl(io_mem + addr + 6); in ebda_rsrc_rsrc()
974 debug("rsrc from mem or pfm ---\n"); in ebda_rsrc_rsrc()
975 debug("rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", in ebda_rsrc_rsrc()
976 …rsrc_ptr->rsrc_type, rsrc_ptr->bus_num, rsrc_ptr->dev_fun, rsrc_ptr->start_addr, rsrc_ptr->end_add… in ebda_rsrc_rsrc()
978 list_add(&rsrc_ptr->ebda_pci_rsrc_list, &ibmphp_ebda_pci_rsrc_head); in ebda_rsrc_rsrc()
989 return hpc_list_ptr->num_ctlrs; in ibmphp_get_total_controllers()
997 if (slot->number == physical_num) in ibmphp_get_slot_from_physical_num()
1004 * - the smallest slot number
1005 * - the largest slot number
1006 * - the total number of the slots based on each bus
1014 if (ptr->busno == num) in ibmphp_find_same_bus_num()
1028 if (ptr->busno == num) in ibmphp_get_bus_index()
1029 return ptr->index; in ibmphp_get_bus_index()
1031 return -ENODEV; in ibmphp_get_bus_index()
1051 if (controller->ctlr_type == 0) in ibmphp_free_ebda_hpc_queue()
1052 …release_region(controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa… in ibmphp_free_ebda_hpc_queue()
1053 else if ((controller->ctlr_type == 1) && (!pci_flag)) { in ibmphp_free_ebda_hpc_queue()
1097 if (ctrl->ctlr_type == 1) { in ibmphp_register_pci()
1111 if (ctrl->ctlr_type == 1) { in ibmphp_probe()
1112 if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) { in ibmphp_probe()
1113 ctrl->ctrl_dev = dev; in ibmphp_probe()
1115 debug("dev->device = %x, dev->subsystem_device = %x\n", dev->device, dev->subsystem_device); in ibmphp_probe()
1120 return -ENODEV; in ibmphp_probe()