hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
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
/** @file
 
  @copyright
  Copyright 1999 - 2021 Intel Corporation. <BR>
 
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/
 
#ifndef _EFI_PCI_CALLBACK_H
#define _EFI_PCI_CALLBACK_H
 
#include <Include/IndustryStandard/Pci22.h>
#include <Protocol/CpuIo2.h>
#include <Protocol/PciRootBridgeIo.h>
 
 
//
// Global Id for PCI callback
//
#define EFI_PCI_CALLBACK_PROTOCOL_GUID \
  { \
    0x1ca0e202, 0xfe9e, 0x4776, 0x9f, 0xaa, 0x57, 0xc, 0x19, 0x61, 0x7a, 0x06 \
  }
 
typedef struct _EFI_PCI_CALLBACK_PROTOCOL EFI_PCI_CALLBACK_PROTOCOL;
 
typedef enum {
  EfiPciEnumerationDeviceScanning    = 1,
  EfiPciEnumerationBusNumberAssigned = 2,
  EfiPciEnumerationResourceAssigned  = 4,
} EFI_PCI_ENUMERATION_PHASE;
 
typedef struct {
  PCI_TYPE00                              PciHeader;
  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL        *PciRootBridgeIo;
  EFI_CPU_IO2_PROTOCOL                    *CpuIo;
} EFI_PCI_CALLBACK_CONTEXT;
 
typedef
VOID
(EFIAPI *EFI_PCI_CALLBACK_FUNC) (
  IN  EFI_HANDLE                                   RootBridgeHandle,
  IN  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS  PciAddress,
  IN  EFI_PCI_ENUMERATION_PHASE                    Phase,
  IN  EFI_PCI_CALLBACK_CONTEXT                     *Context
);
 
typedef
EFI_STATUS
(EFIAPI *EFI_REGISTER_PCI_CALLBACK) (
  IN  EFI_PCI_CALLBACK_PROTOCOL                   *This,
  IN  EFI_PCI_CALLBACK_FUNC                        Function,
  IN  EFI_PCI_ENUMERATION_PHASE                    Phase
)
/*++
 
Routine Description:
 
  Register a callback during PCI bus enumeration
 
Arguments:
 
  This       -  Protocol instance pointer.
  Function   -  Callback function pointer.
  Phase      -  PCI enumeration phase.
 
Returns:
 
  EFI_SUCCESS           - Function has registed successfully
  EFI_UNSUPPORTED       - The function has been regisered
  EFI_InVALID_PARAMETER - The parameter is incorrect
 
--*/
;
 
//
// Protocol definition
//
typedef struct _EFI_PCI_CALLBACK_PROTOCOL {
  EFI_REGISTER_PCI_CALLBACK   RegisterPciCallback;
} EFI_PCI_CALLBACK_PROTOCOL;
 
extern EFI_GUID gEfiPciCallbackProtocolGuid;
 
#endif