acpigen.c 2.1 KB

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