aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-06-21 20:15:45 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 21:46:29 -0400
commit57ca86d4f0e44f81be10bc77a5d0e26760e4844f (patch)
tree86f6283baadc33fa6ce2e1b6ea4c899f13971e9b /arch
parente7eb22d201936fb3450fa5d1d30cbf2de2fb918b (diff)
[PATCH] ppc64 iSeries: iSeries_VpdInfo.c cleanups
Clean up iSeries_VpdInfo.c: - white space and comment fixes - make a function static - the functions here are only called from iSeries_pci.c, so CONFIG_PCI will be set (so remove check) - only build when CONFIG_PCI is set - remove unneeded includes and cast Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc64/kernel/Makefile5
-rw-r--r--arch/ppc64/kernel/iSeries_VpdInfo.c84
2 files changed, 43 insertions, 46 deletions
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index 9132d927171f..ada9be84ddee 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -16,13 +16,12 @@ obj-y += vdso32/ vdso64/
16 16
17obj-$(CONFIG_PPC_OF) += of_device.o 17obj-$(CONFIG_PPC_OF) += of_device.o
18 18
19pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o 19pci-obj-$(CONFIG_PPC_ISERIES) += iSeries_pci.o iSeries_VpdInfo.o
20pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o 20pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o
21 21
22obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y) 22obj-$(CONFIG_PCI) += pci.o pci_iommu.o iomap.o $(pci-obj-y)
23 23
24obj-$(CONFIG_PPC_ISERIES) += iSeries_irq.o \ 24obj-$(CONFIG_PPC_ISERIES) += iSeries_irq.o XmPciLpEvent.o \
25 iSeries_VpdInfo.o XmPciLpEvent.o \
26 HvCall.o HvLpConfig.o LparData.o \ 25 HvCall.o HvLpConfig.o LparData.o \
27 iSeries_setup.o ItLpQueue.o hvCall.o \ 26 iSeries_setup.o ItLpQueue.o hvCall.o \
28 mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \ 27 mf.o HvLpEvent.o iSeries_proc.o iSeries_htab.o \
diff --git a/arch/ppc64/kernel/iSeries_VpdInfo.c b/arch/ppc64/kernel/iSeries_VpdInfo.c
index a82caf98d2e3..9c89ce9a3d0b 100644
--- a/arch/ppc64/kernel/iSeries_VpdInfo.c
+++ b/arch/ppc64/kernel/iSeries_VpdInfo.c
@@ -1,31 +1,31 @@
1/************************************************************************/ 1/*
2/* File iSeries_vpdInfo.c created by Allan Trautman on Fri Feb 2 2001. */ 2 * File iSeries_vpdInfo.c created by Allan Trautman on Fri Feb 2 2001.
3/************************************************************************/ 3 *
4/* This code gets the card location of the hardware */ 4 * This code gets the card location of the hardware
5/* Copyright (C) 20yy <Allan H Trautman> <IBM Corp> */ 5 * Copyright (C) 2001 <Allan H Trautman> <IBM Corp>
6/* */ 6 * Copyright (C) 2005 Stephen Rothwel, IBM Corp
7/* This program is free software; you can redistribute it and/or modify */ 7 *
8/* it under the terms of the GNU General Public License as published by */ 8 * This program is free software; you can redistribute it and/or modify
9/* the Free Software Foundation; either version 2 of the License, or */ 9 * it under the terms of the GNU General Public License as published by
10/* (at your option) any later version. */ 10 * the Free Software Foundation; either version 2 of the License, or
11/* */ 11 * (at your option) any later version.
12/* This program is distributed in the hope that it will be useful, */ 12 *
13/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 13 * This program is distributed in the hope that it will be useful,
14/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15/* GNU General Public License for more details. */ 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16/* */ 16 * GNU General Public License for more details.
17/* You should have received a copy of the GNU General Public License */ 17 *
18/* along with this program; if not, write to the: */ 18 * You should have received a copy of the GNU General Public License
19/* Free Software Foundation, Inc., */ 19 * along with this program; if not, write to the:
20/* 59 Temple Place, Suite 330, */ 20 * Free Software Foundation, Inc.,
21/* Boston, MA 02111-1307 USA */ 21 * 59 Temple Place, Suite 330,
22/************************************************************************/ 22 * Boston, MA 02111-1307 USA
23/* Change Activity: */ 23 *
24/* Created, Feb 2, 2001 */ 24 * Change Activity:
25/* Ported to ppc64, August 20, 2001 */ 25 * Created, Feb 2, 2001
26/* End Change Activity */ 26 * Ported to ppc64, August 20, 2001
27/************************************************************************/ 27 * End Change Activity
28#include <linux/config.h> 28 */
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
@@ -34,14 +34,13 @@
34 34
35#include <asm/iSeries/HvCallPci.h> 35#include <asm/iSeries/HvCallPci.h>
36#include <asm/iSeries/HvTypes.h> 36#include <asm/iSeries/HvTypes.h>
37#include <asm/iSeries/mf.h>
38#include <asm/iSeries/iSeries_pci.h> 37#include <asm/iSeries/iSeries_pci.h>
39#include "pci.h"
40 38
41/* 39/*
42 * Size of Bus VPD data 40 * Size of Bus VPD data
43 */ 41 */
44#define BUS_VPDSIZE 1024 42#define BUS_VPDSIZE 1024
43
45/* 44/*
46 * Bus Vpd Tags 45 * Bus Vpd Tags
47 */ 46 */
@@ -49,6 +48,7 @@
49#define VpdEndOfAreaTag 0x79 48#define VpdEndOfAreaTag 0x79
50#define VpdIdStringTag 0x82 49#define VpdIdStringTag 0x82
51#define VpdVendorAreaTag 0x84 50#define VpdVendorAreaTag 0x84
51
52/* 52/*
53 * Mfg Area Tags 53 * Mfg Area Tags
54 */ 54 */
@@ -78,7 +78,7 @@ struct SlotMapStruct {
78 char CardLocation[3]; 78 char CardLocation[3];
79 char Parms[8]; 79 char Parms[8];
80 char Reserved[2]; 80 char Reserved[2];
81}; 81};
82typedef struct SlotMapStruct SlotMap; 82typedef struct SlotMapStruct SlotMap;
83#define SLOT_ENTRY_SIZE 16 83#define SLOT_ENTRY_SIZE 16
84 84
@@ -111,28 +111,26 @@ int iSeries_Device_Information(struct pci_dev *PciDev, char *buffer,
111 PciDev->vendor); 111 PciDev->vendor);
112 len += sprintf(buffer + len, "Frame%3d, Card %4s ", 112 len += sprintf(buffer + len, "Frame%3d, Card %4s ",
113 DevNode->FrameId, DevNode->CardLocation); 113 DevNode->FrameId, DevNode->CardLocation);
114#ifdef CONFIG_PCI
115 if (pci_class_name(PciDev->class >> 8) == 0) 114 if (pci_class_name(PciDev->class >> 8) == 0)
116 len += sprintf(buffer + len, "0x%04X ", 115 len += sprintf(buffer + len, "0x%04X ",
117 (int)(PciDev->class >> 8)); 116 (int)(PciDev->class >> 8));
118 else 117 else
119 len += sprintf(buffer + len, "%s", 118 len += sprintf(buffer + len, "%s",
120 pci_class_name(PciDev->class >> 8)); 119 pci_class_name(PciDev->class >> 8));
121#endif
122 return len; 120 return len;
123} 121}
124 122
125/* 123/*
126 * Parse the Slot Area 124 * Parse the Slot Area
127 */ 125 */
128void iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen, 126static void iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen,
129 struct iSeries_Device_Node *DevNode) 127 struct iSeries_Device_Node *DevNode)
130{ 128{
131 int SlotMapLen = MapLen; 129 int SlotMapLen = MapLen;
132 SlotMap *SlotMapPtr = MapPtr; 130 SlotMap *SlotMapPtr = MapPtr;
133 131
134 /* 132 /*
135 * Parse Slot label until we find the one requrested 133 * Parse Slot label until we find the one requested
136 */ 134 */
137 while (SlotMapLen > 0) { 135 while (SlotMapLen > 0) {
138 if (SlotMapPtr->AgentId == DevNode->AgentId ) { 136 if (SlotMapPtr->AgentId == DevNode->AgentId ) {
@@ -182,7 +180,7 @@ static void iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
182 if (SlotMapFmt == 0x1004) 180 if (SlotMapFmt == 0x1004)
183 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr 181 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr
184 + MFG_ENTRY_SIZE + 1); 182 + MFG_ENTRY_SIZE + 1);
185 else 183 else
186 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr 184 SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr
187 + MFG_ENTRY_SIZE); 185 + MFG_ENTRY_SIZE);
188 iSeries_Parse_SlotArea(SlotMapPtr, MfgTagLen, DevNode); 186 iSeries_Parse_SlotArea(SlotMapPtr, MfgTagLen, DevNode);
@@ -193,8 +191,8 @@ static void iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
193 */ 191 */
194 MfgAreaPtr = (MfgArea *)((char *)MfgAreaPtr + MfgTagLen 192 MfgAreaPtr = (MfgArea *)((char *)MfgAreaPtr + MfgTagLen
195 + MFG_ENTRY_SIZE); 193 + MFG_ENTRY_SIZE);
196 MfgAreaLen -= (MfgTagLen + MFG_ENTRY_SIZE); 194 MfgAreaLen -= (MfgTagLen + MFG_ENTRY_SIZE);
197 } 195 }
198} 196}
199 197
200/* 198/*
@@ -205,7 +203,7 @@ static int iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength)
205{ 203{
206 u8 *PhbPtr = AreaPtr; 204 u8 *PhbPtr = AreaPtr;
207 int DataLen = AreaLength; 205 int DataLen = AreaLength;
208 char PhbId = 0xFF; 206 char PhbId = 0xFF;
209 207
210 while (DataLen > 0) { 208 while (DataLen > 0) {
211 if ((*PhbPtr == 'B') && (*(PhbPtr + 1) == 'U') 209 if ((*PhbPtr == 'B') && (*(PhbPtr + 1) == 'U')
@@ -215,7 +213,7 @@ static int iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength)
215 ++PhbPtr; 213 ++PhbPtr;
216 PhbId = (*PhbPtr & 0x0F); 214 PhbId = (*PhbPtr & 0x0F);
217 break; 215 break;
218 } 216 }
219 ++PhbPtr; 217 ++PhbPtr;
220 --DataLen; 218 --DataLen;
221 } 219 }
@@ -232,7 +230,7 @@ static void iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen,
232 int DataLen = VpdDataLen - 3; 230 int DataLen = VpdDataLen - 3;
233 231
234 while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) { 232 while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) {
235 int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256); 233 int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256);
236 u8 *AreaData = TagPtr + 3; 234 u8 *AreaData = TagPtr + 3;
237 235
238 if (*TagPtr == VpdIdStringTag) 236 if (*TagPtr == VpdIdStringTag)
@@ -243,12 +241,12 @@ static void iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen,
243 TagPtr = AreaData + AreaLen; 241 TagPtr = AreaData + AreaLen;
244 DataLen -= AreaLen; 242 DataLen -= AreaLen;
245 } 243 }
246} 244}
247 245
248void iSeries_Get_Location_Code(struct iSeries_Device_Node *DevNode) 246void iSeries_Get_Location_Code(struct iSeries_Device_Node *DevNode)
249{ 247{
250 int BusVpdLen = 0; 248 int BusVpdLen = 0;
251 u8 *BusVpdPtr = (u8 *)kmalloc(BUS_VPDSIZE, GFP_KERNEL); 249 u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
252 250
253 if (BusVpdPtr == NULL) { 251 if (BusVpdPtr == NULL) {
254 printk("PCI: Bus VPD Buffer allocation failure.\n"); 252 printk("PCI: Bus VPD Buffer allocation failure.\n");