aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2014-04-16 10:12:05 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-05-20 02:58:50 -0400
commitac4995b9d5705f10a69ea74d440e3943db41f2ca (patch)
tree2d346083802c68ab66ab6a0a81c86a1d68d8e781
parent93065d045a99391c60fa9ab8aca6b503f51b2e95 (diff)
s390/pci: add some new arch specific pci attributes
Add a bunch of s390 specific pci attributes to help identifying pci functions. Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/pci.h6
-rw-r--r--arch/s390/include/asm/pci_clp.h10
-rw-r--r--arch/s390/pci/pci_clp.c10
-rw-r--r--arch/s390/pci/pci_sysfs.c42
4 files changed, 65 insertions, 3 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 79b5f0783a30..c030900320e0 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -78,10 +78,16 @@ struct zpci_dev {
78 enum zpci_state state; 78 enum zpci_state state;
79 u32 fid; /* function ID, used by sclp */ 79 u32 fid; /* function ID, used by sclp */
80 u32 fh; /* function handle, used by insn's */ 80 u32 fh; /* function handle, used by insn's */
81 u16 vfn; /* virtual function number */
81 u16 pchid; /* physical channel ID */ 82 u16 pchid; /* physical channel ID */
82 u8 pfgid; /* function group ID */ 83 u8 pfgid; /* function group ID */
84 u8 pft; /* pci function type */
83 u16 domain; 85 u16 domain;
84 86
87 u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */
88 u32 uid; /* user defined id */
89 u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */
90
85 /* IRQ stuff */ 91 /* IRQ stuff */
86 u64 msi_addr; /* MSI address */ 92 u64 msi_addr; /* MSI address */
87 struct airq_iv *aibv; /* adapter interrupt bit vector */ 93 struct airq_iv *aibv; /* adapter interrupt bit vector */
diff --git a/arch/s390/include/asm/pci_clp.h b/arch/s390/include/asm/pci_clp.h
index d31d739f8689..dd78f92f1cce 100644
--- a/arch/s390/include/asm/pci_clp.h
+++ b/arch/s390/include/asm/pci_clp.h
@@ -44,6 +44,7 @@ struct clp_fh_list_entry {
44#define CLP_SET_DISABLE_PCI_FN 1 /* Yes, 1 disables it */ 44#define CLP_SET_DISABLE_PCI_FN 1 /* Yes, 1 disables it */
45 45
46#define CLP_UTIL_STR_LEN 64 46#define CLP_UTIL_STR_LEN 64
47#define CLP_PFIP_NR_SEGMENTS 4
47 48
48/* List PCI functions request */ 49/* List PCI functions request */
49struct clp_req_list_pci { 50struct clp_req_list_pci {
@@ -85,7 +86,7 @@ struct clp_rsp_query_pci {
85 struct clp_rsp_hdr hdr; 86 struct clp_rsp_hdr hdr;
86 u32 fmt : 4; /* cmd request block format */ 87 u32 fmt : 4; /* cmd request block format */
87 u32 : 28; 88 u32 : 28;
88 u64 reserved1; 89 u64 : 64;
89 u16 vfn; /* virtual fn number */ 90 u16 vfn; /* virtual fn number */
90 u16 : 7; 91 u16 : 7;
91 u16 util_str_avail : 1; /* utility string available? */ 92 u16 util_str_avail : 1; /* utility string available? */
@@ -94,10 +95,13 @@ struct clp_rsp_query_pci {
94 u8 bar_size[PCI_BAR_COUNT]; 95 u8 bar_size[PCI_BAR_COUNT];
95 u16 pchid; 96 u16 pchid;
96 u32 bar[PCI_BAR_COUNT]; 97 u32 bar[PCI_BAR_COUNT];
97 u64 reserved2; 98 u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */
99 u32 : 24;
100 u8 pft; /* pci function type */
98 u64 sdma; /* start dma as */ 101 u64 sdma; /* start dma as */
99 u64 edma; /* end dma as */ 102 u64 edma; /* end dma as */
100 u64 reserved3[6]; 103 u32 reserved[11];
104 u32 uid; /* user defined id */
101 u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */ 105 u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */
102} __packed; 106} __packed;
103 107
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index c747394029ee..96545d7659fd 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -114,6 +114,16 @@ static int clp_store_query_pci_fn(struct zpci_dev *zdev,
114 zdev->end_dma = response->edma; 114 zdev->end_dma = response->edma;
115 zdev->pchid = response->pchid; 115 zdev->pchid = response->pchid;
116 zdev->pfgid = response->pfgid; 116 zdev->pfgid = response->pfgid;
117 zdev->pft = response->pft;
118 zdev->vfn = response->vfn;
119 zdev->uid = response->uid;
120
121 memcpy(zdev->pfip, response->pfip, sizeof(zdev->pfip));
122 if (response->util_str_avail) {
123 memcpy(zdev->util_str, response->util_str,
124 sizeof(zdev->util_str));
125 }
126
117 return 0; 127 return 0;
118} 128}
119 129
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index f23da1c0a489..9190214b8702 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -26,6 +26,13 @@ zpci_attr(function_id, "0x%08x\n", fid);
26zpci_attr(function_handle, "0x%08x\n", fh); 26zpci_attr(function_handle, "0x%08x\n", fh);
27zpci_attr(pchid, "0x%04x\n", pchid); 27zpci_attr(pchid, "0x%04x\n", pchid);
28zpci_attr(pfgid, "0x%02x\n", pfgid); 28zpci_attr(pfgid, "0x%02x\n", pfgid);
29zpci_attr(vfn, "0x%04x\n", vfn);
30zpci_attr(pft, "0x%02x\n", pft);
31zpci_attr(uid, "0x%x\n", uid);
32zpci_attr(segment0, "0x%02x\n", pfip[0]);
33zpci_attr(segment1, "0x%02x\n", pfip[1]);
34zpci_attr(segment2, "0x%02x\n", pfip[2]);
35zpci_attr(segment3, "0x%02x\n", pfip[3]);
29 36
30static ssize_t recover_store(struct device *dev, struct device_attribute *attr, 37static ssize_t recover_store(struct device *dev, struct device_attribute *attr,
31 const char *buf, size_t count) 38 const char *buf, size_t count)
@@ -51,18 +58,53 @@ static ssize_t recover_store(struct device *dev, struct device_attribute *attr,
51} 58}
52static DEVICE_ATTR_WO(recover); 59static DEVICE_ATTR_WO(recover);
53 60
61static ssize_t util_string_read(struct file *filp, struct kobject *kobj,
62 struct bin_attribute *attr, char *buf,
63 loff_t off, size_t count)
64{
65 struct device *dev = kobj_to_dev(kobj);
66 struct pci_dev *pdev = to_pci_dev(dev);
67 struct zpci_dev *zdev = get_zdev(pdev);
68
69 return memory_read_from_buffer(buf, count, &off, zdev->util_str,
70 sizeof(zdev->util_str));
71}
72static BIN_ATTR_RO(util_string, CLP_UTIL_STR_LEN);
73static struct bin_attribute *zpci_bin_attrs[] = {
74 &bin_attr_util_string,
75 NULL,
76};
77
54static struct attribute *zpci_dev_attrs[] = { 78static struct attribute *zpci_dev_attrs[] = {
55 &dev_attr_function_id.attr, 79 &dev_attr_function_id.attr,
56 &dev_attr_function_handle.attr, 80 &dev_attr_function_handle.attr,
57 &dev_attr_pchid.attr, 81 &dev_attr_pchid.attr,
58 &dev_attr_pfgid.attr, 82 &dev_attr_pfgid.attr,
83 &dev_attr_pft.attr,
84 &dev_attr_vfn.attr,
85 &dev_attr_uid.attr,
59 &dev_attr_recover.attr, 86 &dev_attr_recover.attr,
60 NULL, 87 NULL,
61}; 88};
62static struct attribute_group zpci_attr_group = { 89static struct attribute_group zpci_attr_group = {
63 .attrs = zpci_dev_attrs, 90 .attrs = zpci_dev_attrs,
91 .bin_attrs = zpci_bin_attrs,
92};
93
94static struct attribute *pfip_attrs[] = {
95 &dev_attr_segment0.attr,
96 &dev_attr_segment1.attr,
97 &dev_attr_segment2.attr,
98 &dev_attr_segment3.attr,
99 NULL,
100};
101static struct attribute_group pfip_attr_group = {
102 .name = "pfip",
103 .attrs = pfip_attrs,
64}; 104};
105
65const struct attribute_group *zpci_attr_groups[] = { 106const struct attribute_group *zpci_attr_groups[] = {
66 &zpci_attr_group, 107 &zpci_attr_group,
108 &pfip_attr_group,
67 NULL, 109 NULL,
68}; 110};