OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-ppc64/] [iSeries/] [iSeries_pci.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _ISERIES_64_PCI_H
2
#define _ISERIES_64_PCI_H
3
/************************************************************************/
4
/* File iSeries_pci.h created by Allan Trautman on Tue Feb 20, 2001.    */
5
/************************************************************************/
6
/* Define some useful macros for the iSeries pci routines.              */
7
/* Copyright (C) 20yy  Allan H Trautman, IBM Corporation                */
8
/*                                                                      */
9
/* This program is free software; you can redistribute it and/or modify */
10
/* it under the terms of the GNU General Public License as published by */
11
/* the Free Software Foundation; either version 2 of the License, or    */
12
/* (at your option) any later version.                                  */
13
/*                                                                      */
14
/* This program is distributed in the hope that it will be useful,      */
15
/* but WITHOUT ANY WARRANTY; without even the implied warranty of       */
16
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
17
/* GNU General Public License for more details.                         */
18
/*                                                                      */
19
/* You should have received a copy of the GNU General Public License    */
20
/* along with this program; if not, write to the:                       */
21
/* Free Software Foundation, Inc.,                                      */
22
/* 59 Temple Place, Suite 330,                                          */
23
/* Boston, MA  02111-1307  USA                                          */
24
/************************************************************************/
25
/* Change Activity:                                                     */
26
/*   Created Feb 20, 2001                                               */
27
/*   Added device reset, March 22, 2001                                 */
28
/*   Ported to ppc64, May 25, 2001                                      */
29
/* End Change Activity                                                  */
30
/************************************************************************/
31
#include <asm/iSeries/HvCallPci.h>
32
 
33
struct pci_dev;                         /* For Forward Reference        */
34
struct iSeries_Device_Node;
35
/************************************************************************/
36
/* Gets iSeries Bus, SubBus, of DevFn using pci_dev* structure          */
37
/************************************************************************/
38
#define ISERIES_BUS(DevPtr)    DevPtr->DsaAddr.busNumber
39
#define ISERIES_SUBBUS(DevPtr) DevPtr->DsaAddr.subBusNumber
40
#define ISERIES_DEVICE(DevPtr) DevPtr->DsaAddr.deviceId
41
#define ISERIES_DEVFUN(DevPtr) DevPtr->DevFn
42
#define ISERIES_DSA(DevPtr)   (*(u64*)&DevPtr->DsaAddr)
43
#define ISERIES_DEVNODE(PciDev) ((struct iSeries_Device_Node*)PciDev->sysdata)
44
 
45
#define EADsMaxAgents 7
46
/************************************************************************************/
47
/* Decodes Linux DevFn to iSeries DevFn, bridge device, or function.                */
48
/* For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h                      */
49
/************************************************************************************/
50
#define ISERIES_DECODE_DEVFN(linuxdevfn)  (((linuxdevfn & 0x71) << 1) | (linuxdevfn & 0x07))
51
#define ISERIES_DECODE_DEVICE(linuxdevfn) (((linuxdevfn & 0x38) >> 3) |(((linuxdevfn & 0x40) >> 2) + 0x10))
52
#define ISERIES_DECODE_FUNCTION(linuxdevfn) (linuxdevfn & 0x07)
53
#define ISERIES_PCI_AGENTID(idsel,func) ((idsel & 0x0F) << 4) | (func  & 0x07)
54
 
55
#define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus)   ((subbus >> 5) & 0x7)
56
#define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 0x7)
57
 
58
#define ISERIES_ENCODE_DEVICE(agentid)  ((0x10) | ((agentid&0x20)>>2) | (agentid&07))
59
/************************************************************************************/
60
/* Converts Virtual Address to Real Address for Hypervisor calls                    */
61
/************************************************************************************/
62
#define REALADDR(virtaddr)  (0x8000000000000000 | (virt_to_absolute((u64)virtaddr) ))
63
 
64
/************************************************************************************/
65
/* Define TRUE and FALSE Values for Al                                              */
66
/************************************************************************************/
67
#ifndef TRUE
68
#define TRUE 1
69
#endif
70
#ifndef FALSE
71
#define FALSE 0
72
#endif
73
 
74
/************************************************************************/
75
/* iSeries Device Information                                           */
76
/************************************************************************/
77
struct iSeries_Device_Node {
78
        struct list_head Device_List;    /* Must be first for cast to wo*/
79
        struct pci_dev*  PciDev;         /* Pointer to pci_dev structure*/
80
        struct HvCallPci_DsaAddr DsaAddr;/* Direct Select Address       */
81
                                         /* busNumber,subBusNumber,     */
82
                                         /* deviceId, barNumber         */
83
        HvAgentId        AgentId;        /* Hypervisor DevFn            */
84
        int              DevFn;          /* Linux devfn                 */
85
        int              BarOffset;
86
        int              Irq;            /* Assigned IRQ                */
87
        int              ReturnCode;     /* Return Code Holder          */
88
        int              IoRetry;        /* Current Retry Count         */
89
        int              Flags;          /* Possible flags(disable/bist)*/
90
        u16              Vendor;         /* Vendor ID                   */
91
        u8               LogicalSlot;    /* Hv Slot Index for Tces      */
92
        struct TceTable* DevTceTable;    /* Device TCE Table            */
93
        spinlock_t       IoLock;         /* Lock to single thread device*/
94
        u8               PhbId;          /* Phb Card is on.             */
95
        u16              Board;          /* Board Number                */
96
        u8               FrameId;        /* iSeries spcn Frame Id       */
97
        char             CardLocation[4];/* Char format of planar vpd   */
98
        char             Location[20];   /* Frame  1, Card C10          */
99
};
100
/************************************************************************/
101
/* Location Data extracted from the VPD list and device info.           */
102
/************************************************************************/
103
struct LocationDataStruct {     /* Location data structure for device  */
104
        u16  Bus;               /* iSeries Bus Number              0x00*/
105
        u16  Board;             /* iSeries Board                   0x02*/
106
        u8   FrameId;           /* iSeries spcn Frame Id           0x04*/
107
        u8   PhbId;             /* iSeries Phb Location            0x05*/
108
        u8   AgentId;           /* iSeries AgentId                 0x06*/
109
        u8   Card;
110
        char CardLocation[4];
111
};
112
typedef struct LocationDataStruct  LocationData;
113
#define LOCATION_DATA_SIZE      48
114
/************************************************************************/
115
/* Flight Recorder tracing                                              */
116
/************************************************************************/
117
extern int  iSeries_Set_PciTraceFlag(int TraceFlag);
118
extern int  iSeries_Get_PciTraceFlag(void);
119
 
120
/************************************************************************/
121
/* Functions                                                            */
122
/************************************************************************/
123
extern LocationData* iSeries_GetLocationData(struct pci_dev* PciDev);
124
extern int           iSeries_Device_Information(struct pci_dev*,char*, int);
125
extern void          iSeries_Get_Location_Code(struct iSeries_Device_Node*);
126
extern int           iSeries_Device_ToggleReset(struct pci_dev* PciDev, int AssertTime, int DelayTime);
127
 
128
#endif /* _ISERIES_64_PCI_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.