diff options
author | Jan Glauber <jang@linux.vnet.ibm.com> | 2012-11-29 06:55:21 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-11-30 09:40:47 -0500 |
commit | a755a45dd928e05a4fb980d31d4a0dbc49adc562 (patch) | |
tree | ad7e88579a6a52c06cada11ce59529e3c8888d06 /arch/s390/pci/pci.c | |
parent | cd24834130ac655d15accee6757e0eaeab4ad4ef (diff) |
s390/pci: CLP interface
CLP instructions are used to query the firmware about detected PCI
functions, the attributes of those functions and to enable or disable
a PCI function. The CLP interface is the equivalent to a PCI bus scan.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/pci/pci.c')
-rw-r--r-- | arch/s390/pci/pci.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 0b80ac7e158f..70f6c56c8d0f 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <asm/facility.h> | 30 | #include <asm/facility.h> |
31 | #include <asm/pci_insn.h> | 31 | #include <asm/pci_insn.h> |
32 | #include <asm/pci_clp.h> | ||
32 | 33 | ||
33 | #define DEBUG /* enable pr_debug */ | 34 | #define DEBUG /* enable pr_debug */ |
34 | 35 | ||
@@ -436,6 +437,20 @@ static void zpci_free_domain(struct zpci_dev *zdev) | |||
436 | spin_unlock(&zpci_domain_lock); | 437 | spin_unlock(&zpci_domain_lock); |
437 | } | 438 | } |
438 | 439 | ||
440 | int zpci_enable_device(struct zpci_dev *zdev) | ||
441 | { | ||
442 | int rc; | ||
443 | |||
444 | rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES); | ||
445 | if (rc) | ||
446 | goto out; | ||
447 | pr_info("Enabled fh: 0x%x fid: 0x%x\n", zdev->fh, zdev->fid); | ||
448 | return 0; | ||
449 | out: | ||
450 | return rc; | ||
451 | } | ||
452 | EXPORT_SYMBOL_GPL(zpci_enable_device); | ||
453 | |||
439 | int zpci_create_device(struct zpci_dev *zdev) | 454 | int zpci_create_device(struct zpci_dev *zdev) |
440 | { | 455 | { |
441 | int rc; | 456 | int rc; |
@@ -455,8 +470,15 @@ int zpci_create_device(struct zpci_dev *zdev) | |||
455 | if (zdev->state == ZPCI_FN_STATE_STANDBY) | 470 | if (zdev->state == ZPCI_FN_STATE_STANDBY) |
456 | return 0; | 471 | return 0; |
457 | 472 | ||
473 | rc = zpci_enable_device(zdev); | ||
474 | if (rc) | ||
475 | goto out_start; | ||
458 | return 0; | 476 | return 0; |
459 | 477 | ||
478 | out_start: | ||
479 | mutex_lock(&zpci_list_lock); | ||
480 | list_del(&zdev->entry); | ||
481 | mutex_unlock(&zpci_list_lock); | ||
460 | out_bus: | 482 | out_bus: |
461 | zpci_free_domain(zdev); | 483 | zpci_free_domain(zdev); |
462 | out: | 484 | out: |
@@ -489,6 +511,7 @@ int zpci_scan_device(struct zpci_dev *zdev) | |||
489 | return 0; | 511 | return 0; |
490 | 512 | ||
491 | out: | 513 | out: |
514 | clp_disable_fh(zdev); | ||
492 | return -EIO; | 515 | return -EIO; |
493 | } | 516 | } |
494 | EXPORT_SYMBOL_GPL(zpci_scan_device); | 517 | EXPORT_SYMBOL_GPL(zpci_scan_device); |
@@ -547,9 +570,14 @@ static int __init pci_base_init(void) | |||
547 | if (rc) | 570 | if (rc) |
548 | goto out_mem; | 571 | goto out_mem; |
549 | 572 | ||
573 | rc = clp_find_pci_devices(); | ||
574 | if (rc) | ||
575 | goto out_find; | ||
576 | |||
550 | zpci_scan_devices(); | 577 | zpci_scan_devices(); |
551 | return 0; | 578 | return 0; |
552 | 579 | ||
580 | out_find: | ||
553 | zpci_mem_exit(); | 581 | zpci_mem_exit(); |
554 | out_mem: | 582 | out_mem: |
555 | return rc; | 583 | return rc; |