diff options
Diffstat (limited to 'include/asm-ppc64/iSeries/iSeries_pci.h')
-rw-r--r-- | include/asm-ppc64/iSeries/iSeries_pci.h | 142 |
1 files changed, 59 insertions, 83 deletions
diff --git a/include/asm-ppc64/iSeries/iSeries_pci.h b/include/asm-ppc64/iSeries/iSeries_pci.h index 5769cff4c00c..575f611f8b33 100644 --- a/include/asm-ppc64/iSeries/iSeries_pci.h +++ b/include/asm-ppc64/iSeries/iSeries_pci.h | |||
@@ -1,112 +1,88 @@ | |||
1 | #ifndef _ISERIES_64_PCI_H | 1 | #ifndef _ISERIES_64_PCI_H |
2 | #define _ISERIES_64_PCI_H | 2 | #define _ISERIES_64_PCI_H |
3 | 3 | ||
4 | /************************************************************************/ | 4 | /* |
5 | /* File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001. */ | 5 | * File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001. |
6 | /************************************************************************/ | 6 | * |
7 | /* Define some useful macros for the iSeries pci routines. */ | 7 | * Define some useful macros for the iSeries pci routines. |
8 | /* Copyright (C) 2001 Allan H Trautman, IBM Corporation */ | 8 | * Copyright (C) 2001 Allan H Trautman, IBM Corporation |
9 | /* */ | 9 | * |
10 | /* This program is free software; you can redistribute it and/or modify */ | 10 | * This program is free software; you can redistribute it and/or modify |
11 | /* it under the terms of the GNU General Public License as published by */ | 11 | * it under the terms of the GNU General Public License as published by |
12 | /* the Free Software Foundation; either version 2 of the License, or */ | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | /* (at your option) any later version. */ | 13 | * (at your option) any later version. |
14 | /* */ | 14 | * |
15 | /* This program is distributed in the hope that it will be useful, */ | 15 | * This program is distributed in the hope that it will be useful, |
16 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | /* GNU General Public License for more details. */ | 18 | * GNU General Public License for more details. |
19 | /* */ | 19 | * |
20 | /* You should have received a copy of the GNU General Public License */ | 20 | * You should have received a copy of the GNU General Public License |
21 | /* along with this program; if not, write to the: */ | 21 | * along with this program; if not, write to the: |
22 | /* Free Software Foundation, Inc., */ | 22 | * Free Software Foundation, Inc., |
23 | /* 59 Temple Place, Suite 330, */ | 23 | * 59 Temple Place, Suite 330, |
24 | /* Boston, MA 02111-1307 USA */ | 24 | * Boston, MA 02111-1307 USA |
25 | /************************************************************************/ | 25 | * |
26 | /* Change Activity: */ | 26 | * Change Activity: |
27 | /* Created Feb 20, 2001 */ | 27 | * Created Feb 20, 2001 |
28 | /* Added device reset, March 22, 2001 */ | 28 | * Added device reset, March 22, 2001 |
29 | /* Ported to ppc64, May 25, 2001 */ | 29 | * Ported to ppc64, May 25, 2001 |
30 | /* End Change Activity */ | 30 | * End Change Activity |
31 | /************************************************************************/ | 31 | */ |
32 | 32 | ||
33 | #include <asm/iSeries/HvCallPci.h> | 33 | #include <asm/iSeries/HvCallPci.h> |
34 | #include <asm/abs_addr.h> | 34 | #include <asm/abs_addr.h> |
35 | 35 | ||
36 | struct pci_dev; /* For Forward Reference */ | 36 | struct pci_dev; /* For Forward Reference */ |
37 | struct iSeries_Device_Node; | 37 | struct iSeries_Device_Node; |
38 | 38 | ||
39 | /************************************************************************/ | 39 | /* |
40 | /* Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure */ | 40 | * Gets iSeries Bus, SubBus, DevFn using iSeries_Device_Node structure |
41 | /************************************************************************/ | 41 | */ |
42 | 42 | ||
43 | #define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber | 43 | #define ISERIES_BUS(DevPtr) DevPtr->DsaAddr.Dsa.busNumber |
44 | #define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber | 44 | #define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.Dsa.subBusNumber |
45 | #define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId | 45 | #define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.Dsa.deviceId |
46 | #define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr | 46 | #define ISERIES_DSA(DevPtr) DevPtr->DsaAddr.DsaAddr |
47 | #define ISERIES_DEVFUN(DevPtr) DevPtr->DevFn | 47 | #define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node *)PciDev->sysdata) |
48 | #define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node*)PciDev->sysdata) | ||
49 | 48 | ||
50 | #define EADsMaxAgents 7 | 49 | #define EADsMaxAgents 7 |
51 | 50 | ||
52 | /************************************************************************/ | ||
53 | /* Decodes Linux DevFn to iSeries DevFn, bridge device, or function. */ | ||
54 | /* For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h */ | ||
55 | /************************************************************************/ | ||
56 | |||
57 | #define ISERIES_PCI_AGENTID(idsel,func) ((idsel & 0x0F) << 4) | (func & 0x07) | ||
58 | #define ISERIES_ENCODE_DEVICE(agentid) ((0x10) | ((agentid&0x20)>>2) | (agentid&07)) | ||
59 | |||
60 | #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) | ||
61 | #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) | ||
62 | |||
63 | /* | 51 | /* |
64 | * N.B. the ISERIES_DECODE_* macros are not used anywhere, and I think | 52 | * Decodes Linux DevFn to iSeries DevFn, bridge device, or function. |
65 | * the 0x71 (at least) must be wrong - 0x78 maybe? -- paulus. | 53 | * For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h |
66 | */ | 54 | */ |
67 | #define ISERIES_DECODE_DEVFN(linuxdevfn) (((linuxdevfn & 0x71) << 1) | (linuxdevfn & 0x07)) | ||
68 | #define ISERIES_DECODE_DEVICE(linuxdevfn) (((linuxdevfn & 0x38) >> 3) |(((linuxdevfn & 0x40) >> 2) + 0x10)) | ||
69 | #define ISERIES_DECODE_FUNCTION(linuxdevfn) (linuxdevfn & 0x07) | ||
70 | 55 | ||
71 | /************************************************************************/ | 56 | #define ISERIES_PCI_AGENTID(idsel, func) \ |
72 | /* Converts Virtual Address to Real Address for Hypervisor calls */ | 57 | (((idsel & 0x0F) << 4) | (func & 0x07)) |
73 | /************************************************************************/ | 58 | #define ISERIES_ENCODE_DEVICE(agentid) \ |
59 | ((0x10) | ((agentid & 0x20) >> 2) | (agentid & 0x07)) | ||
74 | 60 | ||
75 | #define ISERIES_HV_ADDR(virtaddr) (0x8000000000000000 | virt_to_abs(virtaddr)) | 61 | #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7) |
62 | #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7) | ||
76 | 63 | ||
77 | /************************************************************************/ | 64 | /* |
78 | /* iSeries Device Information */ | 65 | * Converts Virtual Address to Real Address for Hypervisor calls |
79 | /************************************************************************/ | 66 | */ |
67 | #define ISERIES_HV_ADDR(virtaddr) \ | ||
68 | (0x8000000000000000 | virt_to_abs(virtaddr)) | ||
80 | 69 | ||
70 | /* | ||
71 | * iSeries Device Information | ||
72 | */ | ||
81 | struct iSeries_Device_Node { | 73 | struct iSeries_Device_Node { |
82 | struct list_head Device_List; | 74 | struct list_head Device_List; |
83 | struct pci_dev* PciDev; /* Pointer to pci_dev structure*/ | 75 | struct pci_dev *PciDev; |
84 | union HvDsaMap DsaAddr; /* Direct Select Address */ | 76 | union HvDsaMap DsaAddr; /* Direct Select Address */ |
85 | /* busNumber,subBusNumber, */ | 77 | /* busNumber, subBusNumber, */ |
86 | /* deviceId, barNumber */ | 78 | /* deviceId, barNumber */ |
87 | HvAgentId AgentId; /* Hypervisor DevFn */ | 79 | int DevFn; /* Linux devfn */ |
88 | int DevFn; /* Linux devfn */ | 80 | int Irq; /* Assigned IRQ */ |
89 | int BarOffset; | 81 | int Flags; /* Possible flags(disable/bist)*/ |
90 | int Irq; /* Assigned IRQ */ | 82 | u8 LogicalSlot; /* Hv Slot Index for Tces */ |
91 | int ReturnCode; /* Return Code Holder */ | 83 | struct iommu_table *iommu_table;/* Device TCE Table */ |
92 | int IoRetry; /* Current Retry Count */ | ||
93 | int Flags; /* Possible flags(disable/bist)*/ | ||
94 | u16 Vendor; /* Vendor ID */ | ||
95 | u8 LogicalSlot; /* Hv Slot Index for Tces */ | ||
96 | struct iommu_table* iommu_table;/* Device TCE Table */ | ||
97 | u8 PhbId; /* Phb Card is on. */ | ||
98 | u16 Board; /* Board Number */ | ||
99 | u8 FrameId; /* iSeries spcn Frame Id */ | ||
100 | char CardLocation[4];/* Char format of planar vpd */ | ||
101 | char Location[20]; /* Frame 1, Card C10 */ | ||
102 | }; | 84 | }; |
103 | 85 | ||
104 | /************************************************************************/ | 86 | extern void iSeries_Device_Information(struct pci_dev*, int); |
105 | /* Functions */ | ||
106 | /************************************************************************/ | ||
107 | |||
108 | extern int iSeries_Device_Information(struct pci_dev*,char*, int); | ||
109 | extern void iSeries_Get_Location_Code(struct iSeries_Device_Node*); | ||
110 | extern int iSeries_Device_ToggleReset(struct pci_dev* PciDev, int AssertTime, int DelayTime); | ||
111 | 87 | ||
112 | #endif /* _ISERIES_64_PCI_H */ | 88 | #endif /* _ISERIES_64_PCI_H */ |