summaryrefslogtreecommitdiff
path: root/Chipset/SB/PchWrap/PciHotPlug/PciHotPlug.h
blob: 295e7217330a2733c775a729a68836bef0a9ce9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//*************************************************************************
// $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PciHotPlug/PciHotPlug.h 2     4/24/13 5:02a Scottyang $
//
// $Revision: 2 $
//
// $Date: 4/24/13 5:02a $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PciHotPlug/PciHotPlug.h $
// 
// 2     4/24/13 5:02a Scottyang
// 
// 1     2/08/12 8:37a Yurenlai
// Intel Lynx Point/SB eChipset initially releases.
// 
//*************************************************************************

#ifndef _PCI_HOT_PLUG_H_
#define _PCI_HOT_PLUG_H_

//
// External include files do NOT need to be explicitly specified in real EDKII 
// environment
//
#if !defined (EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)

#include "EdkIIGlueDxe.h"

#include "PchRegs.h"
#include "PchRegsRcrb.h"

#include EFI_PROTOCOL_DEFINITION (PciHotPlugInit)
#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
#include "Acpi.h"

// without these include guards, setup.h would include AMI EFI definitions conflicting with those from EDK
#define __UEFI_HII__H__
#if EFI_SPECIFICATION_VERSION >= 0x2000A
#define __HII_CONFIG_ACCESS__H__
#else
#define __HII_PROTOCOL_H__
#define _HII_H_
#define __FORM_CALLBACK_PROTOCOL_H__
#endif
#include <Setup.h>
#endif

#define PCI_HOT_PLUG_DRIVER_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('G', 'U', 'L', 'P')

#define ACPI \
  { \
    ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
      ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (0x0A03), 0 \
  }

#define PCI(device, function) \
  { \
    HARDWARE_DEVICE_PATH, HW_PCI_DP, (UINT8) (sizeof (PCI_DEVICE_PATH)), (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8), \
      (UINTN) function, (UINTN) device \
  }

#define END \
  { \
    END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, END_DEVICE_PATH_LENGTH, 0 \
  }

#define LPC(eisaid, function) \
  { \
    ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
      ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (eisaid), function \
  }

typedef struct PCIE_HOT_PLUG_DEVICE_PATH {
  ACPI_HID_DEVICE_PATH      PciRootBridgeNode;
  PCI_DEVICE_PATH           PciRootPortNode;
  EFI_DEVICE_PATH_PROTOCOL  EndDeviceNode;
} PCIE_HOT_PLUG_DEVICE_PATH;

typedef struct {
  UINTN                           Signature;
  EFI_HANDLE                      Handle; // Handle for protocol this driver installs on
  EFI_PCI_HOT_PLUG_INIT_PROTOCOL  HotPlugInitProtocol;
} PCI_HOT_PLUG_INSTANCE;

EFI_STATUS
GetRootHpcList (
  IN  EFI_PCI_HOT_PLUG_INIT_PROTOCOL    *This,
  OUT UINTN                             *PhpcCount,
  OUT EFI_HPC_LOCATION                  **PhpcList
  )
/*++

Routine Description:

   This procedure returns a list of Root Hot Plug controllers that require
   initialization during boot process

Arguments:

  This      - The pointer to the instance of the EFI_PCI_HOT_PLUG_INIT protocol.
  PhpcCount - The number of Root HPCs returned.
  PhpcList  - The list of Root HPCs. HpcCount defines the number of elements in this list.
Returns:

  EFI_SUCCESS.

--*/
;

EFI_STATUS
InitializeRootHpc (
  IN  EFI_PCI_HOT_PLUG_INIT_PROTOCOL  *This,
  IN  EFI_DEVICE_PATH_PROTOCOL        *PhpcDevicePath,
  IN  UINT64                          PhpcPciAddress,
  IN  EFI_EVENT                       Event, OPTIONAL
  OUT EFI_HPC_STATE                   *PhpcState
  )
/*++

Routine Description:

  This procedure Initializes one Root Hot Plug Controller
  This process may casue initialization of its subordinate buses

Arguments:

  This            - The pointer to the instance of the EFI_PCI_HOT_PLUG_INIT protocol.
  PhpcDevicePath  - The Device Path to the HPC that is being initialized.
  PhpcPciAddress  - The address of the Hot Plug Controller function on the PCI bus.
  Event           - The event that should be signaled when the Hot Plug Controller initialization is complete. Set to NULL if the caller wants to wait until the entire initialization process is complete. The event must be of the type EFI_EVT_SIGNAL.
  PhpcState       - The state of the Hot Plug Controller hardware. The type EFI_Hpc_STATE is defined in section 3.1.

Returns:

  EFI_SUCCESS.
--*/
;

EFI_STATUS
GetResourcePadding (
  IN  EFI_PCI_HOT_PLUG_INIT_PROTOCOL  *This,
  IN  EFI_DEVICE_PATH_PROTOCOL        *PhpcDevicePath,
  IN  UINT64                          PhpcPciAddress,
  OUT EFI_HPC_STATE                   *PhpcState,
  OUT VOID                            **Padding,
  OUT EFI_HPC_PADDING_ATTRIBUTES      *Attributes
  )
/*++

Routine Description:

  Returns the resource padding required by the PCI bus that is controlled by the specified Hot Plug Controller. 

Arguments:

  This            - The pointer to the instance of the EFI_PCI_HOT_PLUG_INIT protocol. initialized.
  PhpcDevicePath  - The Device Path to the Hot Plug Controller.
  PhpcPciAddress  - The address of the Hot Plug Controller function on the PCI bus.
  PhpcState       - The state of the Hot Plug Controller hardware. The type EFI_HPC_STATE is defined in section 3.1.
  Padding         - This is the amount of resource padding required by the PCI bus under the control of the specified Hpc. Since the caller does not know the size of this buffer, this buffer is allocated by the callee and freed by the caller.
  Attributes      - Describes how padding is accounted for.

Returns:

  EFI_SUCCESS.
--*/
;

#endif
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************