summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/SampleCode/AsfSupport/AsfSupport.h
blob: dad873d6e4dea06c5117a4759540faba90c59122 (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
/** @file
  ASF BDS Support include file

@copyright
  Copyright (c) 2005-2012 Intel Corporation. All rights reserved
  This software and associated documentation (if any) is furnished
  under a license and may only be used or copied in accordance
  with the terms of the license. Except as permitted by such
  license, no part of this software or documentation may be
  reproduced, stored in a retrieval system, or transmitted in any
  form or by any means without the express written consent of
  Intel Corporation.

  This file contains a 'Sample Driver' and is licensed as such
  under the terms of your license agreement with Intel or your
  vendor.  This file may be modified by the user, subject to
  the additional terms of the license agreement
**/
#ifndef _ASF_SUPPORT_H_
#define _ASF_SUPPORT_H_

#include "EdkIIGlueDxe.h"
#include "BdsLib.h"
#include "Pci22.h"
#include "Amt.h"
#include "AmtLib.h"
#include "MeAccess.h"

#include EFI_PROTOCOL_DEFINITION (LegacyBios)
#include EFI_PROTOCOL_DEFINITION (SimpleNetwork)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)

#include EFI_PROTOCOL_CONSUMER (AlertStandardformat)
#include EFI_PROTOCOL_CONSUMER (DiskInfo)

#include EFI_PROTOCOL_DEFINITION (IderControllerDriver)

#define IDER_PRIMARY_SECONDARY_MASK   0x02
#define IDER_MASTER_SLAVE_MASK        0x01
#define IDER_PRIMARY_SECONDARY_SHIFT  1

#define IS_IDER(BUS, DEVICE,FUNCTION) \
  (BUS == ME_BUS && DEVICE == ME_DEVICE_NUMBER && FUNCTION == IDER_FUNCTION_NUMBER)
#define IS_PXE(TYPE, CLASS) \
  (TYPE == BBS_TYPE_BEV && CLASS == PCI_CLASS_NETWORK)
#define IS_CDROM(TYPE, CLASS) \
  (TYPE == BBS_TYPE_BEV && CLASS == PCI_CLASS_MASS_STORAGE)

#define SECURE_BOOT_ENABLED               1
#define SECURE_BOOT_DISABLED              0

#define RESTORE_SECURE_BOOT_NONE          0
#define RESTORE_SECURE_BOOT_ENABLED       1

#define RESTORE_SECURE_BOOT_GUID \
  { \
    0x118b3c6f, 0x98d6, 0x4d05, 0x96, 0xb2, 0x90, 0xe4, 0xcb, 0xb7, 0x40, 0x34 \
  }

typedef union {
  UINT32  Data32;
  UINT16  Data16[2];
} DATA32_UNION;

/**
  Retrieve the ASF boot options previously recorded by the ASF driver.

  @param[in] None.

  @retval EFI_SUCCESS        Initialized Boot Options global variable and AMT protocol
**/
EFI_STATUS
BdsAsfInitialization (
  IN  VOID
  )
;

/**
  This routine makes necessary Secure Boot & CSM state changes for IDEr boot

  @param[in] None.

  @retval EFI_SUCCESS      Changes applied succesfully
**/
EFI_STATUS
ManageSecureBootState(
  IN VOID
  )
;

/**
  This function will create a BootOption from the give device path and
  description string.

  @param[in]  DevicePath     The device path which the option represent
  @param[in]  Description     The description of the boot option

  @retval BDS_COMMON_OPTION - Pointer to created boot option
**/
BDS_COMMON_OPTION *
BdsCreateBootOption (
  IN  EFI_DEVICE_PATH_PROTOCOL       *DevicePath,
  IN  CHAR16                         *Description
  )
;

/**
  Dump all devices of BBS.

  @param[in] LocalBbsTable      BBS table entry.
**/
VOID
PrintBbsTable (
  IN BBS_TABLE                      *LocalBbsTable
  )
;

/**
  This will return if Media in IDE-R is present.

  @param[in] None.

  @retval TRUE    Media is present.
  @retval FALSE   Media is not present.
**/
BOOLEAN
BdsCheckIderMedia (
  IN  VOID
  )
;

/**
  This function will create a SHELL BootOption to boot.

  @param[in]  None.

  @retval EFI_DEVICE_PATH_PROTOCOL Shell Device path for booting.
**/
EFI_DEVICE_PATH_PROTOCOL *
BdsCreateShellDevicePath (
  VOID
  )
;

/**
  This function will create a BootOption from the give device path and
  description string.

  @param[in]  DevicePath     The device path which the option represent
  @param[in]  Description     The description of the boot option

  @retval BDS_COMMON_OPTION - Pointer to created boot option
**/
BDS_COMMON_OPTION *
BdsCreateBootOption (
  IN  EFI_DEVICE_PATH_PROTOCOL       *DevicePath,
  IN  CHAR16                         *Description
  )
;

#endif