summaryrefslogtreecommitdiffstats
path: root/MdePkg/Include/Protocol/MmBase.h
blob: 1e1d7b7eaab96a5dffaeabc1ba5bbc92faa597c5 (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
/** @file
  EFI MM Base Protocol as defined in the PI 1.5 specification.

  This protocol is utilized by all MM drivers to locate the MM infrastructure services and determine
  whether the driver is being invoked inside MMRAM or outside of MMRAM.

  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef _MM_BASE_H_
#define _MM_BASE_H_

#include <Pi/PiMmCis.h>

#define EFI_MM_BASE_PROTOCOL_GUID \
  { \
    0xf4ccbfb7, 0xf6e0, 0x47fd, {0x9d, 0xd4, 0x10, 0xa8, 0xf1, 0x50, 0xc1, 0x91 }  \
  }

typedef struct _EFI_MM_BASE_PROTOCOL  EFI_MM_BASE_PROTOCOL;

/**
  Service to indicate whether the driver is currently executing in the MM Initialization phase.

  This service is used to indicate whether the driver is currently executing in the MM Initialization
  phase. For MM drivers, this will return TRUE in InMmram while inside the driver's entry point and
  otherwise FALSE. For combination MM/DXE drivers, this will return FALSE in the DXE launch. For the
  MM launch, it behaves as an MM driver.

  @param[in]  This               The EFI_MM_BASE_PROTOCOL instance.
  @param[out] InMmram            Pointer to a Boolean which, on return, indicates that the driver is
                                 currently executing inside of MMRAM (TRUE) or outside of MMRAM (FALSE).

  @retval EFI_SUCCESS            The call returned successfully.
  @retval EFI_INVALID_PARAMETER  InMmram was NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MM_INSIDE_OUT)(
  IN CONST EFI_MM_BASE_PROTOCOL    *This,
  OUT BOOLEAN                      *InMmram
  )
;

/**
  Returns the location of the Management Mode Service Table (MMST).

  This function returns the location of the Management Mode Service Table (MMST).  The use of the
  API is such that a driver can discover the location of the MMST in its entry point and then cache it in
  some driver global variable so that the MMST can be invoked in subsequent handlers.

  @param[in]     This            The EFI_MM_BASE_PROTOCOL instance.
  @param[in,out] Mmst            On return, points to a pointer to the Management Mode Service Table (MMST).

  @retval EFI_SUCCESS            The operation was successful.
  @retval EFI_INVALID_PARAMETER  Mmst was invalid.
  @retval EFI_UNSUPPORTED        Not in MM.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MM_GET_MMST_LOCATION)(
  IN CONST EFI_MM_BASE_PROTOCOL  *This,
  IN OUT EFI_MM_SYSTEM_TABLE     **Mmst
  )
;

///
/// EFI MM Base Protocol is utilized by all MM drivers to locate the MM infrastructure
/// services and determine whether the driver is being invoked inside MMRAM or outside of MMRAM.
///
struct _EFI_MM_BASE_PROTOCOL {
  EFI_MM_INSIDE_OUT         InMm;
  EFI_MM_GET_MMST_LOCATION  GetMmstLocation;
};

extern EFI_GUID gEfiMmBaseProtocolGuid;

#endif