1 /****************************************************************************** 2 * libacpi.h 3 * 4 * libacpi interfaces 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU Lesser General Public License as published 8 * by the Free Software Foundation; version 2.1 only. with the special 9 * exception on linking described in file LICENSE. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Lesser General Public License for more details. 15 * 16 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. 17 */ 18 19 20 #ifndef __LIBACPI_H__ 21 #define __LIBACPI_H__ 22 23 #define ACPI_HAS_COM1 (1<<0) 24 #define ACPI_HAS_COM2 (1<<1) 25 #define ACPI_HAS_LPT1 (1<<2) 26 #define ACPI_HAS_HPET (1<<3) 27 #define ACPI_HAS_SSDT_PM (1<<4) 28 #define ACPI_HAS_SSDT_S3 (1<<5) 29 #define ACPI_HAS_SSDT_S4 (1<<6) 30 #define ACPI_HAS_TCPA (1<<7) 31 #define ACPI_HAS_IOAPIC (1<<8) 32 #define ACPI_HAS_WAET (1<<9) 33 #define ACPI_HAS_PMTIMER (1<<10) 34 #define ACPI_HAS_BUTTONS (1<<11) 35 #define ACPI_HAS_VGA (1<<12) 36 #define ACPI_HAS_8042 (1<<13) 37 #define ACPI_HAS_CMOS_RTC (1<<14) 38 #define ACPI_HAS_SSDT_LAPTOP_SLATE (1<<15) 39 40 struct xen_vmemrange; 41 struct acpi_numa { 42 uint32_t nr_vmemranges; 43 uint32_t nr_vnodes; 44 const unsigned int *vcpu_to_vnode; 45 const unsigned int *vdistance; 46 const struct xen_vmemrange *vmemrange; 47 }; 48 49 struct acpi_ctxt { 50 struct acpi_mem_ops { 51 void *(*alloc)(struct acpi_ctxt *ctxt, uint32_t size, uint32_t align); 52 void (*free)(struct acpi_ctxt *ctxt, void *v, uint32_t size); 53 unsigned long (*v2p)(struct acpi_ctxt *ctxt, void *v); 54 } mem_ops; 55 }; 56 57 struct acpi_config { 58 const unsigned char *dsdt_anycpu; 59 unsigned int dsdt_anycpu_len; 60 const unsigned char *dsdt_15cpu; 61 unsigned int dsdt_15cpu_len; 62 63 /* PCI I/O hole */ 64 uint32_t pci_start, pci_len; 65 uint64_t pci_hi_start, pci_hi_len; 66 67 uint32_t table_flags; 68 uint8_t acpi_revision; 69 70 uint64_t vm_gid[2]; 71 unsigned long vm_gid_addr; /* OUT parameter */ 72 73 struct { 74 uint32_t addr; 75 uint32_t length; 76 } pt; 77 78 struct acpi_numa numa; 79 const struct hvm_info_table *hvminfo; 80 81 const uint16_t *tis_hdr; 82 83 /* 84 * Address where acpi_info should be placed. 85 * This must match the OperationRegion(BIOS, SystemMemory, ....) 86 * definition in the DSDT 87 */ 88 unsigned long infop; 89 90 /* RSDP address */ 91 unsigned long rsdp; 92 93 /* x86-specific parameters */ 94 uint32_t (*lapic_id)(unsigned cpu); 95 uint32_t lapic_base_address; 96 uint32_t ioapic_base_address; 97 uint16_t pci_isa_irq_mask; 98 uint8_t ioapic_id; 99 }; 100 101 int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config); 102 103 #endif /* __LIBACPI_H__ */ 104 105 /* 106 * Local variables: 107 * mode: C 108 * c-file-style: "BSD" 109 * c-basic-offset: 4 110 * tab-width: 4 111 * indent-tabs-mode: nil 112 * End: 113 */ 114