Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
ac4995b9 93065d04

+65 -3
+6
arch/s390/include/asm/pci.h
··· 78 78 enum zpci_state state; 79 79 u32 fid; /* function ID, used by sclp */ 80 80 u32 fh; /* function handle, used by insn's */ 81 + u16 vfn; /* virtual function number */ 81 82 u16 pchid; /* physical channel ID */ 82 83 u8 pfgid; /* function group ID */ 84 + u8 pft; /* pci function type */ 83 85 u16 domain; 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 */ 84 90 85 91 /* IRQ stuff */ 86 92 u64 msi_addr; /* MSI address */
+7 -3
arch/s390/include/asm/pci_clp.h
··· 44 44 #define CLP_SET_DISABLE_PCI_FN 1 /* Yes, 1 disables it */ 45 45 46 46 #define CLP_UTIL_STR_LEN 64 47 + #define CLP_PFIP_NR_SEGMENTS 4 47 48 48 49 /* List PCI functions request */ 49 50 struct clp_req_list_pci { ··· 86 85 struct clp_rsp_hdr hdr; 87 86 u32 fmt : 4; /* cmd request block format */ 88 87 u32 : 28; 89 - u64 reserved1; 88 + u64 : 64; 90 89 u16 vfn; /* virtual fn number */ 91 90 u16 : 7; 92 91 u16 util_str_avail : 1; /* utility string available? */ ··· 95 94 u8 bar_size[PCI_BAR_COUNT]; 96 95 u16 pchid; 97 96 u32 bar[PCI_BAR_COUNT]; 98 - u64 reserved2; 97 + u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */ 98 + u32 : 24; 99 + u8 pft; /* pci function type */ 99 100 u64 sdma; /* start dma as */ 100 101 u64 edma; /* end dma as */ 101 - u64 reserved3[6]; 102 + u32 reserved[11]; 103 + u32 uid; /* user defined id */ 102 104 u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */ 103 105 } __packed; 104 106
+10
arch/s390/pci/pci_clp.c
··· 114 114 zdev->end_dma = response->edma; 115 115 zdev->pchid = response->pchid; 116 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 127 return 0; 118 128 } 119 129
+42
arch/s390/pci/pci_sysfs.c
··· 26 26 zpci_attr(function_handle, "0x%08x\n", fh); 27 27 zpci_attr(pchid, "0x%04x\n", pchid); 28 28 zpci_attr(pfgid, "0x%02x\n", pfgid); 29 + zpci_attr(vfn, "0x%04x\n", vfn); 30 + zpci_attr(pft, "0x%02x\n", pft); 31 + zpci_attr(uid, "0x%x\n", uid); 32 + zpci_attr(segment0, "0x%02x\n", pfip[0]); 33 + zpci_attr(segment1, "0x%02x\n", pfip[1]); 34 + zpci_attr(segment2, "0x%02x\n", pfip[2]); 35 + zpci_attr(segment3, "0x%02x\n", pfip[3]); 29 36 30 37 static ssize_t recover_store(struct device *dev, struct device_attribute *attr, 31 38 const char *buf, size_t count) ··· 58 51 } 59 52 static DEVICE_ATTR_WO(recover); 60 53 54 + static ssize_t util_string_read(struct file *filp, struct kobject *kobj, 55 + struct bin_attribute *attr, char *buf, 56 + loff_t off, size_t count) 57 + { 58 + struct device *dev = kobj_to_dev(kobj); 59 + struct pci_dev *pdev = to_pci_dev(dev); 60 + struct zpci_dev *zdev = get_zdev(pdev); 61 + 62 + return memory_read_from_buffer(buf, count, &off, zdev->util_str, 63 + sizeof(zdev->util_str)); 64 + } 65 + static BIN_ATTR_RO(util_string, CLP_UTIL_STR_LEN); 66 + static struct bin_attribute *zpci_bin_attrs[] = { 67 + &bin_attr_util_string, 68 + NULL, 69 + }; 70 + 61 71 static struct attribute *zpci_dev_attrs[] = { 62 72 &dev_attr_function_id.attr, 63 73 &dev_attr_function_handle.attr, 64 74 &dev_attr_pchid.attr, 65 75 &dev_attr_pfgid.attr, 76 + &dev_attr_pft.attr, 77 + &dev_attr_vfn.attr, 78 + &dev_attr_uid.attr, 66 79 &dev_attr_recover.attr, 67 80 NULL, 68 81 }; 69 82 static struct attribute_group zpci_attr_group = { 70 83 .attrs = zpci_dev_attrs, 84 + .bin_attrs = zpci_bin_attrs, 71 85 }; 86 + 87 + static struct attribute *pfip_attrs[] = { 88 + &dev_attr_segment0.attr, 89 + &dev_attr_segment1.attr, 90 + &dev_attr_segment2.attr, 91 + &dev_attr_segment3.attr, 92 + NULL, 93 + }; 94 + static struct attribute_group pfip_attr_group = { 95 + .name = "pfip", 96 + .attrs = pfip_attrs, 97 + }; 98 + 72 99 const struct attribute_group *zpci_attr_groups[] = { 73 100 &zpci_attr_group, 101 + &pfip_attr_group, 74 102 NULL, 75 103 };