1 /** @file
2   Sample ACPI Platform Driver
3 
4   Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
5   SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef _ACPI_PLATFORM_H_INCLUDED_
10 #define _ACPI_PLATFORM_H_INCLUDED_
11 
12 #include <PiDxe.h>
13 
14 #include <Protocol/AcpiTable.h>
15 #include <Protocol/FirmwareVolume2.h>
16 #include <Protocol/PciIo.h>
17 
18 #include <Library/BaseLib.h>
19 #include <Library/UefiBootServicesTableLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/PcdLib.h>
22 #include <Library/XenPlatformLib.h>
23 
24 #include <IndustryStandard/Acpi.h>
25 
26 typedef struct {
27   EFI_PCI_IO_PROTOCOL *PciIo;
28   UINT64              PciAttributes;
29 } ORIGINAL_ATTRIBUTES;
30 
31 typedef struct S3_CONTEXT S3_CONTEXT;
32 
33 EFI_STATUS
34 EFIAPI
35 InstallAcpiTable (
36   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
37   IN   VOID                          *AcpiTableBuffer,
38   IN   UINTN                         AcpiTableBufferSize,
39   OUT  UINTN                         *TableKey
40   );
41 
42 BOOLEAN
43 QemuDetected (
44   VOID
45   );
46 
47 EFI_STATUS
48 EFIAPI
49 QemuInstallAcpiTable (
50   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
51   IN   VOID                          *AcpiTableBuffer,
52   IN   UINTN                         AcpiTableBufferSize,
53   OUT  UINTN                         *TableKey
54   );
55 
56 EFI_STATUS
57 EFIAPI
58 InstallXenTables (
59   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
60   );
61 
62 EFI_STATUS
63 EFIAPI
64 InstallQemuFwCfgTables (
65   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
66   );
67 
68 EFI_STATUS
69 EFIAPI
70 InstallAcpiTables (
71   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiTable
72   );
73 
74 VOID
75 EnablePciDecoding (
76   OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
77   OUT UINTN               *Count
78   );
79 
80 VOID
81 RestorePciDecoding (
82   IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
83   IN UINTN               Count
84   );
85 
86 EFI_STATUS
87 AllocateS3Context (
88   OUT S3_CONTEXT **S3Context,
89   IN  UINTN      WritePointerCount
90   );
91 
92 VOID
93 ReleaseS3Context (
94   IN S3_CONTEXT *S3Context
95   );
96 
97 EFI_STATUS
98 SaveCondensedWritePointerToS3Context (
99   IN OUT S3_CONTEXT *S3Context,
100   IN     UINT16     PointerItem,
101   IN     UINT8      PointerSize,
102   IN     UINT32     PointerOffset,
103   IN     UINT64     PointerValue
104   );
105 
106 EFI_STATUS
107 TransferS3ContextToBootScript (
108   IN S3_CONTEXT *S3Context
109   );
110 
111 #endif
112 
113