summaryrefslogtreecommitdiff
path: root/tools/libacpi/libacpi.h
blob: deda39e5dbc4f269f1f0cd24ce976d1c306029e9 (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
/* SPDX-License-Identifier: LGPL-2.1-only */
/******************************************************************************
 * libacpi.h
 * 
 * libacpi interfaces
 * 
 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
 */


#ifndef __LIBACPI_H__
#define __LIBACPI_H__

#define ACPI_HAS_COM1              (1<<0)
#define ACPI_HAS_COM2              (1<<1)
#define ACPI_HAS_LPT1              (1<<2)
#define ACPI_HAS_HPET              (1<<3)
#define ACPI_HAS_SSDT_PM           (1<<4)
#define ACPI_HAS_SSDT_S3           (1<<5)
#define ACPI_HAS_SSDT_S4           (1<<6)
#define ACPI_HAS_TPM               (1<<7)
#define ACPI_HAS_IOAPIC            (1<<8)
#define ACPI_HAS_WAET              (1<<9)
#define ACPI_HAS_PMTIMER           (1<<10)
#define ACPI_HAS_BUTTONS           (1<<11)
#define ACPI_HAS_VGA               (1<<12)
#define ACPI_HAS_8042              (1<<13)
#define ACPI_HAS_CMOS_RTC          (1<<14)
#define ACPI_HAS_SSDT_LAPTOP_SLATE (1<<15)

struct xen_vmemrange;
struct acpi_numa {
    uint32_t nr_vmemranges;
    uint32_t nr_vnodes;
    const unsigned int *vcpu_to_vnode;
    const unsigned int *vdistance;
    const struct xen_vmemrange *vmemrange;
};

struct acpi_ctxt {
    struct acpi_mem_ops {
        void *(*alloc)(struct acpi_ctxt *ctxt, uint32_t size, uint32_t align);
        void (*free)(struct acpi_ctxt *ctxt, void *v, uint32_t size);
        unsigned long (*v2p)(struct acpi_ctxt *ctxt, void *v);
    } mem_ops;
};

struct acpi_config {
    const unsigned char *dsdt_anycpu;
    unsigned int dsdt_anycpu_len;
    const unsigned char *dsdt_15cpu;
    unsigned int dsdt_15cpu_len;

    /* PCI I/O hole */
    uint32_t pci_start, pci_len;
    uint64_t pci_hi_start, pci_hi_len;

    uint32_t table_flags;
    uint8_t acpi_revision;
    uint8_t tpm_version;

    uint64_t vm_gid[2];
    unsigned long vm_gid_addr; /* OUT parameter */

    struct {
        uint32_t addr;
        uint32_t length;
    } pt;

    struct acpi_numa numa;
    const struct hvm_info_table *hvminfo;

    const uint16_t *tis_hdr;
    const uint16_t *crb_id;

    /*
     * Address where acpi_info should be placed.
     * This must match the OperationRegion(BIOS, SystemMemory, ....)
     * definition in the DSDT
     */
    unsigned long infop;

    /* RSDP address */
    unsigned long rsdp;

    /* x86-specific parameters */
    uint32_t (*lapic_id)(unsigned cpu);
    uint32_t lapic_base_address;
    uint32_t ioapic_base_address;
    uint16_t pci_isa_irq_mask;
    uint8_t ioapic_id;
};

int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config);

#endif /* __LIBACPI_H__ */

/*
 * Local variables:
 * mode: C
 * c-file-style: "BSD"
 * c-basic-offset: 4
 * tab-width: 4
 * indent-tabs-mode: nil
 * End:
 */