]> Git Repo - u-boot.git/blob - arch/x86/lib/acpigen.c
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
[u-boot.git] / arch / x86 / lib / acpigen.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2020 Google LLC
4  */
5
6 #include <acpi/acpigen.h>
7 #include <acpi/acpi_table.h>
8 #include <asm/acpigen.h>
9
10 void acpigen_write_empty_pct(struct acpi_ctx *ctx)
11 {
12         /*
13          * Name (_PCT, Package (0x02)
14          * {
15          *      ResourceTemplate ()
16          *      {
17          *              Register (FFixedHW,
18          *                      0x00,               // Bit Width
19          *                      0x00,               // Bit Offset
20          *                      0x0000000000000000, // Address
21          *                      ,)
22          *      },
23          *
24          *      ResourceTemplate ()
25          *      {
26          *              Register (FFixedHW,
27          *                      0x00,               // Bit Width
28          *                      0x00,               // Bit Offset
29          *                      0x0000000000000000, // Address
30          *                      ,)
31          *      }
32          * })
33          */
34         static char stream[] = {
35                 /* 00000030    "0._PCT.," */
36                 0x08, 0x5f, 0x50, 0x43, 0x54, 0x12, 0x2c,
37                 /* 00000038    "........" */
38                 0x02, 0x11, 0x14, 0x0a, 0x11, 0x82, 0x0c, 0x00,
39                 /* 00000040    "........" */
40                 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41                 /* 00000048    "....y..." */
42                 0x00, 0x00, 0x00, 0x00, 0x79, 0x00, 0x11, 0x14,
43                 /* 00000050    "........" */
44                 0x0a, 0x11, 0x82, 0x0c, 0x00, 0x7f, 0x00, 0x00,
45                 /* 00000058    "........" */
46                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47                 0x00, 0x79, 0x00
48         };
49         acpigen_emit_stream(ctx, stream, ARRAY_SIZE(stream));
50 }
51
52 void acpigen_write_empty_ptc(struct acpi_ctx *ctx)
53 {
54         /*
55          * Name (_PTC, Package (0x02)
56          * {
57          *      ResourceTemplate ()
58          *      {
59          *              Register (FFixedHW,
60          *                      0x00,               // Bit Width
61          *                      0x00,               // Bit Offset
62          *                      0x0000000000000000, // Address
63          *                      ,)
64          *      },
65          *
66          *      ResourceTemplate ()
67          *      {
68          *              Register (FFixedHW,
69          *                      0x00,               // Bit Width
70          *                      0x00,               // Bit Offset
71          *                      0x0000000000000000, // Address
72          *                      ,)
73          *      }
74          * })
75          */
76         struct acpi_gen_regaddr addr = {
77                 .space_id    = ACPI_ADDRESS_SPACE_FIXED,
78                 .bit_width   = 0,
79                 .bit_offset  = 0,
80                 .access_size = 0,
81                 .addrl       = 0,
82                 .addrh       = 0,
83         };
84
85         acpigen_write_name(ctx, "_PTC");
86         acpigen_write_package(ctx, 2);
87
88         /* ControlRegister */
89         acpigen_write_register_resource(ctx, &addr);
90
91         /* StatusRegister */
92         acpigen_write_register_resource(ctx, &addr);
93
94         acpigen_pop_len(ctx);
95 }
This page took 0.032051 seconds and 4 git commands to generate.