summaryrefslogtreecommitdiff
path: root/IntelFrameworkPkg/Include/Ppi/DeviceRecoveryModule.h
blob: 1c75509a7d5083f25e7aaad79282efdaca66a5e3 (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
/** @file
  This file declares Device Recovery Module PPI.
  The interface of this PPI does the following:
    - Reports the number of recovery DXE capsules that exist on the associated device(s)
    - Finds the requested firmware binary capsule
    - Loads that capsule into memory
  A device can be either a group of devices, such as a block device, or an individual device.T he
  module determines the internal search order, with capsule number 1 as the highest load priority and
  number N as the lowest priority.

  Copyright (c) 2007 - 2009, Intel Corporation
  All rights reserved. This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

  @par Revision Reference:
  This PPI is defined in Framework of EFI Recovery spec.
  Version 0.9

**/

#ifndef _PEI_DEVICE_RECOVERY_MODULE_PPI_H_
#define _PEI_DEVICE_RECOVERY_MODULE_PPI_H_

#include <PiPei.h>

#define EFI_PEI_DEVICE_RECOVERY_MODULE_PPI_GUID \
  { \
    0x0DE2CE25, 0x446A, 0x45a7, {0xBF, 0xC9, 0x37, 0xDA, 0x26, 0x34, 0x4B, 0x37 } \
  }

typedef struct _EFI_PEI_DEVICE_RECOVERY_MODULE_PPI EFI_PEI_DEVICE_RECOVERY_MODULE_PPI;

/**
  Returns the number of DXE capsules residing on the device.

  This function searches for DXE capsules from the associated device and returns the number
  and maximum size in bytes of the capsules discovered. Entry 1 is assumed to be the
  highest load priority and entry N is assumed to be the lowest priority.

  @param[in]  PeiServices            General-purpose services that are available to every PEIM
  @param[in]  This                   Indicates the EFI_PEI_DEVICE_RECOVERY_MODULE_PPI instance.
  @param[out] NumberRecoveryCapsules Pointer to a caller-allocated UINTN. On output,
                                     *NumberRecoveryCapsules contains the number of recovery capsule
                                     images available for retrieval from this PEIM instance.

  @retval EFI_SUCCESS           One or more capsules were discovered.
  @retval EFI_DEVICE_ERROR      A device error occurred.
  @retval EFI_NOT_FOUND         A recovery DXE capsule cannot be found.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE)(
  IN     EFI_PEI_SERVICES                               **PeiServices,
  IN     EFI_PEI_DEVICE_RECOVERY_MODULE_PPI             *This,
     OUT UINTN                                          *NumberRecoveryCapsules
  );

/**
  Returns the size and type of the requested recovery capsule.

  This function gets the size and type of the requested recovery capsule.

  @param[in]  PeiServices     General-purpose services that are available to every PEIM
  @param[in]  This            Indicates the EFI_PEI_DEVICE_RECOVERY_MODULE_PPI instance.
  @param[in]  CapsuleInstance Specifies for which capsule instance to retrieve the information.
                              This parameter must be between one and the value returned by
                              GetNumberRecoveryCapsules() in NumberRecoveryCapsules.
  @param[out] Size            A pointer to a caller-allocated UINTN in which the size of
                              the requested recovery module is returned.
  @param[out] CapsuleType     A pointer to a caller-allocated EFI_GUID in
                              which the type of the requested recovery capsule is returned.

  @retval EFI_SUCCESS           One or more capsules were discovered.
  @retval EFI_DEVICE_ERROR      A device error occurred.
  @retval EFI_NOT_FOUND         A recovery DXE capsule cannot be found.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO)(
  IN     EFI_PEI_SERVICES                              **PeiServices,
  IN     EFI_PEI_DEVICE_RECOVERY_MODULE_PPI            *This,
  IN     UINTN                                         CapsuleInstance,
     OUT UINTN                                         *Size,
     OUT EFI_GUID                                      *CapsuleType
  );

/**
  Loads a DXE capsule from some media into memory.

  This function retrieves a DXE capsule from some device and loads it into memory.
  Note that the published interface is device neutral.

  @param[in, out] PeiServices     General-purpose services that are available to every PEIM
  @param[in]      This            Indicates the EFI_PEI_DEVICE_RECOVERY_MODULE_PPI instance.
  @param[in]      CapsuleInstance Specifies which capsule instance to retrieve.
  @param[out]     Buffer          Specifies a caller-allocated buffer in which the requested
                                  recovery capsule will be returned.

  @retval EFI_SUCCESS           One or more capsules were discovered.
  @retval EFI_DEVICE_ERROR      A device error occurred.
  @retval EFI_NOT_FOUND         A recovery DXE capsule cannot be found.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_DEVICE_LOAD_RECOVERY_CAPSULE)(
  IN OUT EFI_PEI_SERVICES                         **PeiServices,
  IN     EFI_PEI_DEVICE_RECOVERY_MODULE_PPI       *This,
  IN     UINTN                                    CapsuleInstance,
     OUT VOID                                     *Buffer
  );

///
/// Presents a standard interface to EFI_PEI_DEVICE_RECOVERY_MODULE_PPI,
/// regardless of the underlying device(s).
///
struct _EFI_PEI_DEVICE_RECOVERY_MODULE_PPI {
  EFI_PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE  GetNumberRecoveryCapsules;
  EFI_PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO    GetRecoveryCapsuleInfo;
  EFI_PEI_DEVICE_LOAD_RECOVERY_CAPSULE        LoadRecoveryCapsule;
};

extern EFI_GUID gEfiPeiDeviceRecoveryModulePpiGuid;

#endif  /* _PEI_DEVICE_RECOVERY_MODULE_PPI_H_ */