summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Bhyve/AcpiTables/Hpet.aslc
blob: 73bb784e436fa37e1e7237af3dc8cd6d513f292e (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
/*
 * Copyright (c) 2020, Rebecca Cran <rebecca@bsdio.com>
 * Copyright (c) 2014, Pluribus Networks, Inc.
 *
 * SPDX-License-Identifier: BSD-2-Clause-Patent
 */

#include <IndustryStandard/HighPrecisionEventTimerTable.h>

#include "Platform.h"

#define EFI_ACPI_HPET_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('H', 'P', 'E', 'T')
#define EFI_ACPI_OEM_TABLE_ID                      SIGNATURE_64('B','V','H','P','E','T',' ',' ')

//
// Ensure proper structure formats
//
#pragma pack (1)

//
// ACPI HPET structure
//
typedef struct {
  EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER  Header;
} EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_DESCRIPTION_TABLE;

#pragma pack ()

//
// HPET Description Table
//
EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_DESCRIPTION_TABLE Hpet = {
  {
    {
      EFI_ACPI_HPET_DESCRIPTION_TABLE_SIGNATURE,
      sizeof (EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_DESCRIPTION_TABLE),
      EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_REVISION,
      0x00,                              // Checksum will be updated at runtime
      {EFI_ACPI_OEM_ID},
      EFI_ACPI_OEM_TABLE_ID,
      EFI_ACPI_OEM_REVISION,
      EFI_ACPI_CREATOR_ID,
      EFI_ACPI_CREATOR_REVISION
    },

    //
    // HPET specific fields
    //
    0x0000A400,                          // EventTimerBlockId
    {
      EFI_ACPI_2_0_SYSTEM_MEMORY,
      0,
      0,
      EFI_ACPI_RESERVED_BYTE,
      0xFED00000,
    },
    0                                    // HpetNumber
  }
};


VOID*
ReferenceAcpiTable (
  VOID
  )
{
  //
  // Reference the table being generated to prevent the optimizer from removing the
  // data structure from the exeutable
  //
  return (VOID*)&Hpet;
}