aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/pci/pci.c
diff options
context:
space:
mode:
authorJan Glauber <jang@linux.vnet.ibm.com>2012-11-29 06:55:21 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-11-30 09:40:47 -0500
commita755a45dd928e05a4fb980d31d4a0dbc49adc562 (patch)
treead7e88579a6a52c06cada11ce59529e3c8888d06 /arch/s390/pci/pci.c
parentcd24834130ac655d15accee6757e0eaeab4ad4ef (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.c28
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
440int 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;
449out:
450 return rc;
451}
452EXPORT_SYMBOL_GPL(zpci_enable_device);
453
439int zpci_create_device(struct zpci_dev *zdev) 454int 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
478out_start:
479 mutex_lock(&zpci_list_lock);
480 list_del(&zdev->entry);
481 mutex_unlock(&zpci_list_lock);
460out_bus: 482out_bus:
461 zpci_free_domain(zdev); 483 zpci_free_domain(zdev);
462out: 484out:
@@ -489,6 +511,7 @@ int zpci_scan_device(struct zpci_dev *zdev)
489 return 0; 511 return 0;
490 512
491out: 513out:
514 clp_disable_fh(zdev);
492 return -EIO; 515 return -EIO;
493} 516}
494EXPORT_SYMBOL_GPL(zpci_scan_device); 517EXPORT_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
580out_find:
553 zpci_mem_exit(); 581 zpci_mem_exit();
554out_mem: 582out_mem:
555 return rc; 583 return rc;