diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-12-07 00:08:33 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-12-10 21:46:07 -0500 |
commit | cd9afb34ed7e7fd3d1eb892b606019e032b0888b (patch) | |
tree | 4785273e4b625b38119f228930cd5dbb5a097901 /arch/powerpc/platforms | |
parent | b3b9595f50f73f0d53ebd71c463c5f09a6e64a21 (diff) |
[POWERPC] iSeries: DeCamelCase vpdinfo.c
This is a purely mechanical transformation.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/iseries/pci.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/pci.h | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/vpdinfo.c | 188 |
3 files changed, 95 insertions, 97 deletions
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index 3071a30356ce..5466975bc906 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c | |||
@@ -227,7 +227,7 @@ void __init iSeries_pci_final_fixup(void) | |||
227 | pdev->sysdata = node; | 227 | pdev->sysdata = node; |
228 | PCI_DN(node)->pcidev = pdev; | 228 | PCI_DN(node)->pcidev = pdev; |
229 | allocate_device_bars(pdev); | 229 | allocate_device_bars(pdev); |
230 | iSeries_Device_Information(pdev, num_dev, bus, *sub_bus); | 230 | iseries_device_information(pdev, num_dev, bus, *sub_bus); |
231 | iommu_devnode_init_iSeries(pdev, node); | 231 | iommu_devnode_init_iSeries(pdev, node); |
232 | } | 232 | } |
233 | iSeries_activate_IRQs(); | 233 | iSeries_activate_IRQs(); |
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h index b14287342129..5f517cf23082 100644 --- a/arch/powerpc/platforms/iseries/pci.h +++ b/arch/powerpc/platforms/iseries/pci.h | |||
@@ -47,7 +47,7 @@ struct pci_dev; /* For Forward Reference */ | |||
47 | #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) | 47 | #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) |
48 | #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) | 48 | #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) |
49 | 49 | ||
50 | extern void iSeries_Device_Information(struct pci_dev *PciDev, int count, | 50 | extern void iseries_device_information(struct pci_dev *pdev, int count, |
51 | u16 bus, HvSubBusNumber subbus); | 51 | u16 bus, HvSubBusNumber subbus); |
52 | #ifdef CONFIG_PCI | 52 | #ifdef CONFIG_PCI |
53 | extern void iSeries_pcibios_init(void); | 53 | extern void iSeries_pcibios_init(void); |
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c index 25dc0bb6185b..f9415bf01518 100644 --- a/arch/powerpc/platforms/iseries/vpdinfo.c +++ b/arch/powerpc/platforms/iseries/vpdinfo.c | |||
@@ -44,113 +44,111 @@ | |||
44 | /* | 44 | /* |
45 | * Bus Vpd Tags | 45 | * Bus Vpd Tags |
46 | */ | 46 | */ |
47 | #define VpdEndOfAreaTag 0x79 | 47 | #define VPD_END_OF_AREA 0x79 |
48 | #define VpdIdStringTag 0x82 | 48 | #define VPD_ID_STRING 0x82 |
49 | #define VpdVendorAreaTag 0x84 | 49 | #define VPD_VENDOR_AREA 0x84 |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Mfg Area Tags | 52 | * Mfg Area Tags |
53 | */ | 53 | */ |
54 | #define VpdFruFrameId 0x4649 // "FI" | 54 | #define VPD_FRU_FRAME_ID 0x4649 /* "FI" */ |
55 | #define VpdSlotMapFormat 0x4D46 // "MF" | 55 | #define VPD_SLOT_MAP_FORMAT 0x4D46 /* "MF" */ |
56 | #define VpdSlotMap 0x534D // "SM" | 56 | #define VPD_SLOT_MAP 0x534D /* "SM" */ |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Structures of the areas | 59 | * Structures of the areas |
60 | */ | 60 | */ |
61 | struct MfgVpdAreaStruct { | 61 | struct mfg_vpd_area { |
62 | u16 Tag; | 62 | u16 tag; |
63 | u8 TagLength; | 63 | u8 length; |
64 | u8 AreaData1; | 64 | u8 data1; |
65 | u8 AreaData2; | 65 | u8 data2; |
66 | }; | 66 | }; |
67 | typedef struct MfgVpdAreaStruct MfgArea; | ||
68 | #define MFG_ENTRY_SIZE 3 | 67 | #define MFG_ENTRY_SIZE 3 |
69 | 68 | ||
70 | struct SlotMapStruct { | 69 | struct slot_map { |
71 | u8 AgentId; | 70 | u8 agent; |
72 | u8 SecondaryAgentId; | 71 | u8 secondary_agent; |
73 | u8 PhbId; | 72 | u8 phb; |
74 | char CardLocation[3]; | 73 | char card_location[3]; |
75 | char Parms[8]; | 74 | char parms[8]; |
76 | char Reserved[2]; | 75 | char reserved[2]; |
77 | }; | 76 | }; |
78 | typedef struct SlotMapStruct SlotMap; | ||
79 | #define SLOT_ENTRY_SIZE 16 | 77 | #define SLOT_ENTRY_SIZE 16 |
80 | 78 | ||
81 | /* | 79 | /* |
82 | * Parse the Slot Area | 80 | * Parse the Slot Area |
83 | */ | 81 | */ |
84 | static void __init iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen, | 82 | static void __init iseries_parse_slot_area(struct slot_map *map, int len, |
85 | HvAgentId agent, u8 *PhbId, char card[4]) | 83 | HvAgentId agent, u8 *phb, char card[4]) |
86 | { | 84 | { |
87 | int SlotMapLen = MapLen; | 85 | int slot_map_len = len; |
88 | SlotMap *SlotMapPtr = MapPtr; | 86 | struct slot_map *slot_map = map; |
89 | 87 | ||
90 | /* | 88 | /* |
91 | * Parse Slot label until we find the one requested | 89 | * Parse Slot label until we find the one requested |
92 | */ | 90 | */ |
93 | while (SlotMapLen > 0) { | 91 | while (slot_map_len > 0) { |
94 | if (SlotMapPtr->AgentId == agent) { | 92 | if (slot_map->agent == agent) { |
95 | /* | 93 | /* |
96 | * If Phb wasn't found, grab the entry first one found. | 94 | * If Phb wasn't found, grab the entry first one found. |
97 | */ | 95 | */ |
98 | if (*PhbId == 0xff) | 96 | if (*phb == 0xff) |
99 | *PhbId = SlotMapPtr->PhbId; | 97 | *phb = slot_map->phb; |
100 | /* Found it, extract the data. */ | 98 | /* Found it, extract the data. */ |
101 | if (SlotMapPtr->PhbId == *PhbId) { | 99 | if (slot_map->phb == *phb) { |
102 | memcpy(card, &SlotMapPtr->CardLocation, 3); | 100 | memcpy(card, &slot_map->card_location, 3); |
103 | card[3] = 0; | 101 | card[3] = 0; |
104 | break; | 102 | break; |
105 | } | 103 | } |
106 | } | 104 | } |
107 | /* Point to the next Slot */ | 105 | /* Point to the next Slot */ |
108 | SlotMapPtr = (SlotMap *)((char *)SlotMapPtr + SLOT_ENTRY_SIZE); | 106 | slot_map = (struct slot_map *)((char *)slot_map + SLOT_ENTRY_SIZE); |
109 | SlotMapLen -= SLOT_ENTRY_SIZE; | 107 | slot_map_len -= SLOT_ENTRY_SIZE; |
110 | } | 108 | } |
111 | } | 109 | } |
112 | 110 | ||
113 | /* | 111 | /* |
114 | * Parse the Mfg Area | 112 | * Parse the Mfg Area |
115 | */ | 113 | */ |
116 | static void __init iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen, | 114 | static void __init iseries_parse_mfg_area(u8 *area, int len, |
117 | HvAgentId agent, u8 *PhbId, | 115 | HvAgentId agent, u8 *phb, |
118 | u8 *frame, char card[4]) | 116 | u8 *frame, char card[4]) |
119 | { | 117 | { |
120 | MfgArea *MfgAreaPtr = (MfgArea *)AreaData; | 118 | struct mfg_vpd_area *mfg_area = (struct mfg_vpd_area *)area; |
121 | int MfgAreaLen = AreaLen; | 119 | int mfg_area_len = len; |
122 | u16 SlotMapFmt = 0; | 120 | u16 slot_map_fmt = 0; |
123 | 121 | ||
124 | /* Parse Mfg Data */ | 122 | /* Parse Mfg Data */ |
125 | while (MfgAreaLen > 0) { | 123 | while (mfg_area_len > 0) { |
126 | int MfgTagLen = MfgAreaPtr->TagLength; | 124 | int mfg_tag_len = mfg_area->length; |
127 | /* Frame ID (FI 4649020310 ) */ | 125 | /* Frame ID (FI 4649020310 ) */ |
128 | if (MfgAreaPtr->Tag == VpdFruFrameId) /* FI */ | 126 | if (mfg_area->tag == VPD_FRU_FRAME_ID) |
129 | *frame = MfgAreaPtr->AreaData1; | 127 | *frame = mfg_area->data1; |
130 | /* Slot Map Format (MF 4D46020004 ) */ | 128 | /* Slot Map Format (MF 4D46020004 ) */ |
131 | else if (MfgAreaPtr->Tag == VpdSlotMapFormat) /* MF */ | 129 | else if (mfg_area->tag == VPD_SLOT_MAP_FORMAT) |
132 | SlotMapFmt = (MfgAreaPtr->AreaData1 * 256) | 130 | slot_map_fmt = (mfg_area->data1 * 256) |
133 | + MfgAreaPtr->AreaData2; | 131 | + mfg_area->data2; |
134 | /* Slot Map (SM 534D90 */ | 132 | /* Slot Map (SM 534D90 */ |
135 | else if (MfgAreaPtr->Tag == VpdSlotMap) { /* SM */ | 133 | else if (mfg_area->tag == VPD_SLOT_MAP) { |
136 | SlotMap *SlotMapPtr; | 134 | struct slot_map *slot_map; |
137 | 135 | ||
138 | if (SlotMapFmt == 0x1004) | 136 | if (slot_map_fmt == 0x1004) |
139 | SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr | 137 | slot_map = (struct slot_map *)((char *)mfg_area |
140 | + MFG_ENTRY_SIZE + 1); | 138 | + MFG_ENTRY_SIZE + 1); |
141 | else | 139 | else |
142 | SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr | 140 | slot_map = (struct slot_map *)((char *)mfg_area |
143 | + MFG_ENTRY_SIZE); | 141 | + MFG_ENTRY_SIZE); |
144 | iSeries_Parse_SlotArea(SlotMapPtr, MfgTagLen, | 142 | iseries_parse_slot_area(slot_map, mfg_tag_len, |
145 | agent, PhbId, card); | 143 | agent, phb, card); |
146 | } | 144 | } |
147 | /* | 145 | /* |
148 | * Point to the next Mfg Area | 146 | * Point to the next Mfg Area |
149 | * Use defined size, sizeof give wrong answer | 147 | * Use defined size, sizeof give wrong answer |
150 | */ | 148 | */ |
151 | MfgAreaPtr = (MfgArea *)((char *)MfgAreaPtr + MfgTagLen | 149 | mfg_area = (struct mfg_vpd_area *)((char *)mfg_area + mfg_tag_len |
152 | + MFG_ENTRY_SIZE); | 150 | + MFG_ENTRY_SIZE); |
153 | MfgAreaLen -= (MfgTagLen + MFG_ENTRY_SIZE); | 151 | mfg_area_len -= (mfg_tag_len + MFG_ENTRY_SIZE); |
154 | } | 152 | } |
155 | } | 153 | } |
156 | 154 | ||
@@ -158,79 +156,79 @@ static void __init iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen, | |||
158 | * Look for "BUS".. Data is not Null terminated. | 156 | * Look for "BUS".. Data is not Null terminated. |
159 | * PHBID of 0xFF indicates PHB was not found in VPD Data. | 157 | * PHBID of 0xFF indicates PHB was not found in VPD Data. |
160 | */ | 158 | */ |
161 | static int __init iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength) | 159 | static int __init iseries_parse_phbid(u8 *area, int len) |
162 | { | 160 | { |
163 | u8 *PhbPtr = AreaPtr; | 161 | u8 *phb_ptr = area; |
164 | int DataLen = AreaLength; | 162 | int data_len = len; |
165 | char PhbId = 0xFF; | 163 | char phb = 0xFF; |
166 | 164 | ||
167 | while (DataLen > 0) { | 165 | while (data_len > 0) { |
168 | if ((*PhbPtr == 'B') && (*(PhbPtr + 1) == 'U') | 166 | if ((*phb_ptr == 'B') && (*(phb_ptr + 1) == 'U') |
169 | && (*(PhbPtr + 2) == 'S')) { | 167 | && (*(phb_ptr + 2) == 'S')) { |
170 | PhbPtr += 3; | 168 | phb_ptr += 3; |
171 | while (*PhbPtr == ' ') | 169 | while (*phb_ptr == ' ') |
172 | ++PhbPtr; | 170 | ++phb_ptr; |
173 | PhbId = (*PhbPtr & 0x0F); | 171 | phb = (*phb_ptr & 0x0F); |
174 | break; | 172 | break; |
175 | } | 173 | } |
176 | ++PhbPtr; | 174 | ++phb_ptr; |
177 | --DataLen; | 175 | --data_len; |
178 | } | 176 | } |
179 | return PhbId; | 177 | return phb; |
180 | } | 178 | } |
181 | 179 | ||
182 | /* | 180 | /* |
183 | * Parse out the VPD Areas | 181 | * Parse out the VPD Areas |
184 | */ | 182 | */ |
185 | static void __init iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen, | 183 | static void __init iseries_parse_vpd(u8 *data, int vpd_data_len, |
186 | HvAgentId agent, u8 *frame, char card[4]) | 184 | HvAgentId agent, u8 *frame, char card[4]) |
187 | { | 185 | { |
188 | u8 *TagPtr = VpdData; | 186 | u8 *tag_ptr = data; |
189 | int DataLen = VpdDataLen - 3; | 187 | int data_len = vpd_data_len - 3; |
190 | u8 PhbId = 0xff; | 188 | u8 phb = 0xff; |
191 | 189 | ||
192 | while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) { | 190 | while ((*tag_ptr != VPD_END_OF_AREA) && (data_len > 0)) { |
193 | int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256); | 191 | int len = *(tag_ptr + 1) + (*(tag_ptr + 2) * 256); |
194 | u8 *AreaData = TagPtr + 3; | 192 | u8 *area = tag_ptr + 3; |
195 | 193 | ||
196 | if (*TagPtr == VpdIdStringTag) | 194 | if (*tag_ptr == VPD_ID_STRING) |
197 | PhbId = iSeries_Parse_PhbId(AreaData, AreaLen); | 195 | phb = iseries_parse_phbid(area, len); |
198 | else if (*TagPtr == VpdVendorAreaTag) | 196 | else if (*tag_ptr == VPD_VENDOR_AREA) |
199 | iSeries_Parse_MfgArea(AreaData, AreaLen, | 197 | iseries_parse_mfg_area(area, len, |
200 | agent, &PhbId, frame, card); | 198 | agent, &phb, frame, card); |
201 | /* Point to next Area. */ | 199 | /* Point to next Area. */ |
202 | TagPtr = AreaData + AreaLen; | 200 | tag_ptr = area + len; |
203 | DataLen -= AreaLen; | 201 | data_len -= len; |
204 | } | 202 | } |
205 | } | 203 | } |
206 | 204 | ||
207 | static int __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, | 205 | static int __init iseries_get_location_code(u16 bus, HvAgentId agent, |
208 | u8 *frame, char card[4]) | 206 | u8 *frame, char card[4]) |
209 | { | 207 | { |
210 | int status = 0; | 208 | int status = 0; |
211 | int BusVpdLen = 0; | 209 | int bus_vpd_len = 0; |
212 | u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL); | 210 | u8 *bus_vpd = kmalloc(BUS_VPDSIZE, GFP_KERNEL); |
213 | 211 | ||
214 | if (BusVpdPtr == NULL) { | 212 | if (bus_vpd == NULL) { |
215 | printk("PCI: Bus VPD Buffer allocation failure.\n"); | 213 | printk("PCI: Bus VPD Buffer allocation failure.\n"); |
216 | return 0; | 214 | return 0; |
217 | } | 215 | } |
218 | BusVpdLen = HvCallPci_getBusVpd(bus, iseries_hv_addr(BusVpdPtr), | 216 | bus_vpd_len = HvCallPci_getBusVpd(bus, iseries_hv_addr(bus_vpd), |
219 | BUS_VPDSIZE); | 217 | BUS_VPDSIZE); |
220 | if (BusVpdLen == 0) { | 218 | if (bus_vpd_len == 0) { |
221 | printk("PCI: Bus VPD Buffer zero length.\n"); | 219 | printk("PCI: Bus VPD Buffer zero length.\n"); |
222 | goto out_free; | 220 | goto out_free; |
223 | } | 221 | } |
224 | /* printk("PCI: BusVpdPtr: %p, %d\n",BusVpdPtr, BusVpdLen); */ | 222 | /* printk("PCI: bus_vpd: %p, %d\n",bus_vpd, bus_vpd_len); */ |
225 | /* Make sure this is what I think it is */ | 223 | /* Make sure this is what I think it is */ |
226 | if (*BusVpdPtr != VpdIdStringTag) { /* 0x82 */ | 224 | if (*bus_vpd != VPD_ID_STRING) { |
227 | printk("PCI: Bus VPD Buffer missing starting tag.\n"); | 225 | printk("PCI: Bus VPD Buffer missing starting tag.\n"); |
228 | goto out_free; | 226 | goto out_free; |
229 | } | 227 | } |
230 | iSeries_Parse_Vpd(BusVpdPtr, BusVpdLen, agent, frame, card); | 228 | iseries_parse_vpd(bus_vpd, bus_vpd_len, agent, frame, card); |
231 | status = 1; | 229 | status = 1; |
232 | out_free: | 230 | out_free: |
233 | kfree(BusVpdPtr); | 231 | kfree(bus_vpd); |
234 | return status; | 232 | return status; |
235 | } | 233 | } |
236 | 234 | ||
@@ -243,7 +241,7 @@ out_free: | |||
243 | * PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet | 241 | * PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet |
244 | * controller | 242 | * controller |
245 | */ | 243 | */ |
246 | void __init iSeries_Device_Information(struct pci_dev *PciDev, int count, | 244 | void __init iseries_device_information(struct pci_dev *pdev, int count, |
247 | u16 bus, HvSubBusNumber subbus) | 245 | u16 bus, HvSubBusNumber subbus) |
248 | { | 246 | { |
249 | u8 frame = 0; | 247 | u8 frame = 0; |
@@ -253,10 +251,10 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count, | |||
253 | agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), | 251 | agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), |
254 | ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); | 252 | ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); |
255 | 253 | ||
256 | if (iSeries_Get_Location_Code(bus, agent, &frame, card)) { | 254 | if (iseries_get_location_code(bus, agent, &frame, card)) { |
257 | printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, " | 255 | printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, " |
258 | "Card %4s 0x%04X\n", count, bus, | 256 | "Card %4s 0x%04X\n", count, bus, |
259 | PCI_SLOT(PciDev->devfn), PciDev->vendor, frame, | 257 | PCI_SLOT(pdev->devfn), pdev->vendor, frame, |
260 | card, (int)(PciDev->class >> 8)); | 258 | card, (int)(pdev->class >> 8)); |
261 | } | 259 | } |
262 | } | 260 | } |