| .. | .. |
|---|
| 247 | 247 | break; |
|---|
| 248 | 248 | } |
|---|
| 249 | 249 | if (rc == 0) { |
|---|
| 250 | | - pslot = hotplug_slot->private; |
|---|
| 251 | | - if (pslot) |
|---|
| 252 | | - rc = ibmphp_hpc_writeslot(pslot, cmd); |
|---|
| 253 | | - else |
|---|
| 254 | | - rc = -ENODEV; |
|---|
| 250 | + pslot = to_slot(hotplug_slot); |
|---|
| 251 | + rc = ibmphp_hpc_writeslot(pslot, cmd); |
|---|
| 255 | 252 | } |
|---|
| 256 | 253 | } else |
|---|
| 257 | 254 | rc = -ENODEV; |
|---|
| .. | .. |
|---|
| 273 | 270 | |
|---|
| 274 | 271 | ibmphp_lock_operations(); |
|---|
| 275 | 272 | if (hotplug_slot) { |
|---|
| 276 | | - pslot = hotplug_slot->private; |
|---|
| 277 | | - if (pslot) { |
|---|
| 278 | | - memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 279 | | - rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 280 | | - &(myslot.status)); |
|---|
| 281 | | - if (!rc) |
|---|
| 282 | | - rc = ibmphp_hpc_readslot(pslot, |
|---|
| 283 | | - READ_EXTSLOTSTATUS, |
|---|
| 284 | | - &(myslot.ext_status)); |
|---|
| 285 | | - if (!rc) |
|---|
| 286 | | - *value = SLOT_ATTN(myslot.status, |
|---|
| 287 | | - myslot.ext_status); |
|---|
| 288 | | - } |
|---|
| 273 | + pslot = to_slot(hotplug_slot); |
|---|
| 274 | + memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 275 | + rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 276 | + &myslot.status); |
|---|
| 277 | + if (!rc) |
|---|
| 278 | + rc = ibmphp_hpc_readslot(pslot, READ_EXTSLOTSTATUS, |
|---|
| 279 | + &myslot.ext_status); |
|---|
| 280 | + if (!rc) |
|---|
| 281 | + *value = SLOT_ATTN(myslot.status, myslot.ext_status); |
|---|
| 289 | 282 | } |
|---|
| 290 | 283 | |
|---|
| 291 | 284 | ibmphp_unlock_operations(); |
|---|
| .. | .. |
|---|
| 303 | 296 | (ulong) hotplug_slot, (ulong) value); |
|---|
| 304 | 297 | ibmphp_lock_operations(); |
|---|
| 305 | 298 | if (hotplug_slot) { |
|---|
| 306 | | - pslot = hotplug_slot->private; |
|---|
| 307 | | - if (pslot) { |
|---|
| 308 | | - memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 309 | | - rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 310 | | - &(myslot.status)); |
|---|
| 311 | | - if (!rc) |
|---|
| 312 | | - *value = SLOT_LATCH(myslot.status); |
|---|
| 313 | | - } |
|---|
| 299 | + pslot = to_slot(hotplug_slot); |
|---|
| 300 | + memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 301 | + rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 302 | + &myslot.status); |
|---|
| 303 | + if (!rc) |
|---|
| 304 | + *value = SLOT_LATCH(myslot.status); |
|---|
| 314 | 305 | } |
|---|
| 315 | 306 | |
|---|
| 316 | 307 | ibmphp_unlock_operations(); |
|---|
| .. | .. |
|---|
| 330 | 321 | (ulong) hotplug_slot, (ulong) value); |
|---|
| 331 | 322 | ibmphp_lock_operations(); |
|---|
| 332 | 323 | if (hotplug_slot) { |
|---|
| 333 | | - pslot = hotplug_slot->private; |
|---|
| 334 | | - if (pslot) { |
|---|
| 335 | | - memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 336 | | - rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 337 | | - &(myslot.status)); |
|---|
| 338 | | - if (!rc) |
|---|
| 339 | | - *value = SLOT_PWRGD(myslot.status); |
|---|
| 340 | | - } |
|---|
| 324 | + pslot = to_slot(hotplug_slot); |
|---|
| 325 | + memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 326 | + rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 327 | + &myslot.status); |
|---|
| 328 | + if (!rc) |
|---|
| 329 | + *value = SLOT_PWRGD(myslot.status); |
|---|
| 341 | 330 | } |
|---|
| 342 | 331 | |
|---|
| 343 | 332 | ibmphp_unlock_operations(); |
|---|
| .. | .. |
|---|
| 357 | 346 | (ulong) hotplug_slot, (ulong) value); |
|---|
| 358 | 347 | ibmphp_lock_operations(); |
|---|
| 359 | 348 | if (hotplug_slot) { |
|---|
| 360 | | - pslot = hotplug_slot->private; |
|---|
| 361 | | - if (pslot) { |
|---|
| 362 | | - memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 363 | | - rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 364 | | - &(myslot.status)); |
|---|
| 365 | | - if (!rc) { |
|---|
| 366 | | - present = SLOT_PRESENT(myslot.status); |
|---|
| 367 | | - if (present == HPC_SLOT_EMPTY) |
|---|
| 368 | | - *value = 0; |
|---|
| 369 | | - else |
|---|
| 370 | | - *value = 1; |
|---|
| 371 | | - } |
|---|
| 349 | + pslot = to_slot(hotplug_slot); |
|---|
| 350 | + memcpy(&myslot, pslot, sizeof(struct slot)); |
|---|
| 351 | + rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, |
|---|
| 352 | + &myslot.status); |
|---|
| 353 | + if (!rc) { |
|---|
| 354 | + present = SLOT_PRESENT(myslot.status); |
|---|
| 355 | + if (present == HPC_SLOT_EMPTY) |
|---|
| 356 | + *value = 0; |
|---|
| 357 | + else |
|---|
| 358 | + *value = 1; |
|---|
| 372 | 359 | } |
|---|
| 373 | 360 | } |
|---|
| 374 | 361 | |
|---|
| .. | .. |
|---|
| 382 | 369 | int rc = 0; |
|---|
| 383 | 370 | u8 mode = 0; |
|---|
| 384 | 371 | enum pci_bus_speed speed; |
|---|
| 385 | | - struct pci_bus *bus = slot->hotplug_slot->pci_slot->bus; |
|---|
| 372 | + struct pci_bus *bus = slot->hotplug_slot.pci_slot->bus; |
|---|
| 386 | 373 | |
|---|
| 387 | 374 | debug("%s - Entry slot[%p]\n", __func__, slot); |
|---|
| 388 | 375 | |
|---|
| .. | .. |
|---|
| 582 | 569 | ****************************************************************************/ |
|---|
| 583 | 570 | int ibmphp_update_slot_info(struct slot *slot_cur) |
|---|
| 584 | 571 | { |
|---|
| 585 | | - struct hotplug_slot_info *info; |
|---|
| 586 | | - struct pci_bus *bus = slot_cur->hotplug_slot->pci_slot->bus; |
|---|
| 587 | | - int rc; |
|---|
| 572 | + struct pci_bus *bus = slot_cur->hotplug_slot.pci_slot->bus; |
|---|
| 588 | 573 | u8 bus_speed; |
|---|
| 589 | 574 | u8 mode; |
|---|
| 590 | | - |
|---|
| 591 | | - info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); |
|---|
| 592 | | - if (!info) |
|---|
| 593 | | - return -ENOMEM; |
|---|
| 594 | | - |
|---|
| 595 | | - info->power_status = SLOT_PWRGD(slot_cur->status); |
|---|
| 596 | | - info->attention_status = SLOT_ATTN(slot_cur->status, |
|---|
| 597 | | - slot_cur->ext_status); |
|---|
| 598 | | - info->latch_status = SLOT_LATCH(slot_cur->status); |
|---|
| 599 | | - if (!SLOT_PRESENT(slot_cur->status)) { |
|---|
| 600 | | - info->adapter_status = 0; |
|---|
| 601 | | -/* info->max_adapter_speed_status = MAX_ADAPTER_NONE; */ |
|---|
| 602 | | - } else { |
|---|
| 603 | | - info->adapter_status = 1; |
|---|
| 604 | | -/* get_max_adapter_speed_1(slot_cur->hotplug_slot, |
|---|
| 605 | | - &info->max_adapter_speed_status, 0); */ |
|---|
| 606 | | - } |
|---|
| 607 | 575 | |
|---|
| 608 | 576 | bus_speed = slot_cur->bus_on->current_speed; |
|---|
| 609 | 577 | mode = slot_cur->bus_on->current_bus_mode; |
|---|
| .. | .. |
|---|
| 630 | 598 | bus->cur_bus_speed = bus_speed; |
|---|
| 631 | 599 | // To do: bus_names |
|---|
| 632 | 600 | |
|---|
| 633 | | - rc = pci_hp_change_slot_info(slot_cur->hotplug_slot, info); |
|---|
| 634 | | - kfree(info); |
|---|
| 635 | | - return rc; |
|---|
| 601 | + return 0; |
|---|
| 636 | 602 | } |
|---|
| 637 | 603 | |
|---|
| 638 | 604 | |
|---|
| .. | .. |
|---|
| 673 | 639 | |
|---|
| 674 | 640 | list_for_each_entry_safe(slot_cur, next, &ibmphp_slot_head, |
|---|
| 675 | 641 | ibm_slot_list) { |
|---|
| 676 | | - pci_hp_del(slot_cur->hotplug_slot); |
|---|
| 642 | + pci_hp_del(&slot_cur->hotplug_slot); |
|---|
| 677 | 643 | slot_cur->ctrl = NULL; |
|---|
| 678 | 644 | slot_cur->bus_on = NULL; |
|---|
| 679 | 645 | |
|---|
| .. | .. |
|---|
| 683 | 649 | */ |
|---|
| 684 | 650 | ibmphp_unconfigure_card(&slot_cur, -1); |
|---|
| 685 | 651 | |
|---|
| 686 | | - pci_hp_destroy(slot_cur->hotplug_slot); |
|---|
| 687 | | - kfree(slot_cur->hotplug_slot->info); |
|---|
| 688 | | - kfree(slot_cur->hotplug_slot); |
|---|
| 652 | + pci_hp_destroy(&slot_cur->hotplug_slot); |
|---|
| 689 | 653 | kfree(slot_cur); |
|---|
| 690 | 654 | } |
|---|
| 691 | 655 | debug("%s -- exit\n", __func__); |
|---|
| .. | .. |
|---|
| 1007 | 971 | ibmphp_lock_operations(); |
|---|
| 1008 | 972 | |
|---|
| 1009 | 973 | debug("ENABLING SLOT........\n"); |
|---|
| 1010 | | - slot_cur = hs->private; |
|---|
| 974 | + slot_cur = to_slot(hs); |
|---|
| 1011 | 975 | |
|---|
| 1012 | 976 | rc = validate(slot_cur, ENABLE); |
|---|
| 1013 | 977 | if (rc) { |
|---|
| .. | .. |
|---|
| 1095 | 1059 | |
|---|
| 1096 | 1060 | slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL); |
|---|
| 1097 | 1061 | if (!slot_cur->func) { |
|---|
| 1098 | | - /* We cannot do update_slot_info here, since no memory for |
|---|
| 1099 | | - * kmalloc n.e.ways, and update_slot_info allocates some */ |
|---|
| 1062 | + /* do update_slot_info here? */ |
|---|
| 1100 | 1063 | rc = -ENOMEM; |
|---|
| 1101 | 1064 | goto error_power; |
|---|
| 1102 | 1065 | } |
|---|
| .. | .. |
|---|
| 1169 | 1132 | **************************************************************/ |
|---|
| 1170 | 1133 | static int ibmphp_disable_slot(struct hotplug_slot *hotplug_slot) |
|---|
| 1171 | 1134 | { |
|---|
| 1172 | | - struct slot *slot = hotplug_slot->private; |
|---|
| 1135 | + struct slot *slot = to_slot(hotplug_slot); |
|---|
| 1173 | 1136 | int rc; |
|---|
| 1174 | 1137 | |
|---|
| 1175 | 1138 | ibmphp_lock_operations(); |
|---|
| .. | .. |
|---|
| 1259 | 1222 | goto exit; |
|---|
| 1260 | 1223 | } |
|---|
| 1261 | 1224 | |
|---|
| 1262 | | -struct hotplug_slot_ops ibmphp_hotplug_slot_ops = { |
|---|
| 1225 | +const struct hotplug_slot_ops ibmphp_hotplug_slot_ops = { |
|---|
| 1263 | 1226 | .set_attention_status = set_attention_status, |
|---|
| 1264 | 1227 | .enable_slot = enable_slot, |
|---|
| 1265 | 1228 | .disable_slot = ibmphp_disable_slot, |
|---|
| .. | .. |
|---|
| 1313 | 1276 | memcpy(ibmphp_pci_bus, bus, sizeof(*ibmphp_pci_bus)); |
|---|
| 1314 | 1277 | |
|---|
| 1315 | 1278 | ibmphp_debug = debug; |
|---|
| 1316 | | - |
|---|
| 1317 | | - ibmphp_hpc_initvars(); |
|---|
| 1318 | 1279 | |
|---|
| 1319 | 1280 | for (i = 0; i < 16; i++) |
|---|
| 1320 | 1281 | irqs[i] = 0; |
|---|