1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 
6 #pragma once
7 
8 #include <stdint.h>
9 #include <zircon/compiler.h>
10 #include <zircon/types.h>
11 #include <acpica/acpi.h>
12 #include <acpica/actypes.h>
13 
14 #define ACPI_UUID_SIZE 16u
15 
16 __BEGIN_CDECLS;
17 
18 zx_status_t acpi_bbn_call(ACPI_HANDLE dev_obj, uint8_t* out_bbn);
19 zx_status_t acpi_crt_call(ACPI_HANDLE dev_obj, uint64_t* out);
20 
21 // Call the ACPI _OSC method on a device object.
22 //
23 // Returns values:
24 //  ZX_ERR_INVALID_ARGS: dwords_in or dwords_out are NULL, dword_cnt is less than 2,
25 //                       or the UUID is incorrectly formatted.
26 //  ZX_ERR_BUFFER_TOO_SMALL: The dwords provided are not large enough for the result
27 //                           from the method.
28 //  ZX_ERR_INTERNAL: The method returned an error bit that should be checked in dwords_out[0]
29 zx_status_t acpi_osc_call(ACPI_HANDLE dev_obj,
30                           const char* uuid_str,
31                           uint64_t revision,
32                           size_t dword_cnt,
33                           uint32_t* dwords_in,
34                           uint32_t* dwords_out,
35                           bool* bit_masked);
36 zx_status_t acpi_psv_call(ACPI_HANDLE dev_obj, uint64_t* out);
37 zx_status_t acpi_seg_call(ACPI_HANDLE dev_obj, uint16_t* out_seg);
38 zx_status_t acpi_tmp_call(ACPI_HANDLE dev_obj, uint64_t* out);
39 
40 __END_CDECLS;
41