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
86
87
88
89
90
91
92
93
94
95
96
/** @file
 
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
 
**/
 
#include <Library/BoardInitLib.h>
#include <Library/MultiBoardInitSupportLib.h>
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
 
/**
  A hook for board-specific initialization after PCI enumeration.
 
  @retval EFI_SUCCESS   The board initialization was successful.
  @retval EFI_NOT_READY The board has not been detected yet.
**/
EFI_STATUS
EFIAPI
BoardInitAfterPciEnumeration (
  VOID
  )
{
  BOARD_NOTIFICATION_INIT_FUNC    *BoardNotificationInit;
  EFI_STATUS                      Status;
 
  Status = gBS->LocateProtocol (
                  &gBoardNotificationInitGuid,
                  NULL,
                  (VOID **)&BoardNotificationInit
                  );
  if (!EFI_ERROR(Status)) {
    if (BoardNotificationInit->BoardInitAfterPciEnumeration != NULL) {
      return BoardNotificationInit->BoardInitAfterPciEnumeration ();
    }
  }
  return EFI_SUCCESS;
}
 
/**
  A hook for board-specific functionality for the ReadyToBoot event.
 
  @retval EFI_SUCCESS   The board initialization was successful.
  @retval EFI_NOT_READY The board has not been detected yet.
**/
EFI_STATUS
EFIAPI
BoardInitReadyToBoot (
  VOID
  )
{
  BOARD_NOTIFICATION_INIT_FUNC    *BoardNotificationInit;
  EFI_STATUS                      Status;
 
  Status = gBS->LocateProtocol (
                  &gBoardNotificationInitGuid,
                  NULL,
                  (VOID **)&BoardNotificationInit
                  );
  if (!EFI_ERROR(Status)) {
    if (BoardNotificationInit->BoardInitReadyToBoot != NULL) {
      return BoardNotificationInit->BoardInitReadyToBoot ();
    }
  }
  return EFI_SUCCESS;
}
 
/**
  A hook for board-specific functionality for the ExitBootServices event.
 
  @retval EFI_SUCCESS   The board initialization was successful.
  @retval EFI_NOT_READY The board has not been detected yet.
**/
EFI_STATUS
EFIAPI
BoardInitEndOfFirmware (
  VOID
  )
{
  BOARD_NOTIFICATION_INIT_FUNC    *BoardNotificationInit;
  EFI_STATUS                      Status;
 
  Status = gBS->LocateProtocol (
                  &gBoardNotificationInitGuid,
                  NULL,
                  (VOID **)&BoardNotificationInit
                  );
  if (!EFI_ERROR(Status)) {
    if (BoardNotificationInit->BoardInitEndOfFirmware != NULL) {
      return BoardNotificationInit->BoardInitEndOfFirmware ();
    }
  }
  return EFI_SUCCESS;
}