ReactOS 0.4.16-dev-1494-gd054f63
tables.c
Go to the documentation of this file.
6
9)
11 table_array, struct uacpi_installed_table, static
12)
13
14static struct table_array tables;
15static uacpi_bool early_table_access;
16static uacpi_table_installation_handler installation_handler;
17
18#ifndef UACPI_BAREBONES_MODE
19
20static uacpi_handle table_mutex;
21
22#define ENSURE_TABLES_ONLINE() \
23 do { \
24 if (!early_table_access) \
25 UACPI_ENSURE_INIT_LEVEL_AT_LEAST( \
26 UACPI_INIT_LEVEL_SUBSYSTEM_INITIALIZED \
27 ); \
28 } while (0)
29
30#else
31
32/*
33 * Use a dummy function instead of a macro to prevent the following error:
34 * error: statement with no effect [-Werror=unused-value]
35 */
36static inline uacpi_status dummy_mutex_acquire_release(uacpi_handle mtx)
37{
38 UACPI_UNUSED(mtx);
39 return UACPI_STATUS_OK;
40}
41
42#define table_mutex UACPI_NULL
43#define uacpi_acquire_native_mutex_may_be_null dummy_mutex_acquire_release
44#define uacpi_release_native_mutex_may_be_null dummy_mutex_acquire_release
45
46#define ENSURE_TABLES_ONLINE() \
47 do { \
48 if (!early_table_access) \
49 return UACPI_STATUS_INIT_LEVEL_MISMATCH; \
50 } while (0)
51
52#endif // !UACPI_BAREBONES_MODE
53
56 const uacpi_char *expected_signature, uacpi_table *out_table
57);
59 void *virt, enum uacpi_table_origin origin, uacpi_table *out_table
60);
61
62UACPI_PACKED(struct uacpi_rxsdt {
63 struct acpi_sdt_hdr hdr;
64 uacpi_u8 ptr_bytes[];
65})
66
68 uacpi_phys_addr phys_addr, void *hdr
69)
70{
71 struct acpi_sdt_hdr *sdt = hdr;
72
75 "FACS 0x%016"UACPI_PRIX64" %08X\n", UACPI_FMT64(phys_addr),
76 sdt->length
77 );
78 return;
79 }
80
82 struct acpi_rsdp *rsdp = hdr;
83
85 "RSDP 0x%016"UACPI_PRIX64" %08X v%02X (%6.6s)\n",
86 UACPI_FMT64(phys_addr), rsdp->length, rsdp->revision,
87 rsdp->oemid
88 );
89 return;
90 }
91
93 "%.4s 0x%016"UACPI_PRIX64" %08X v%02X (%6.6s %8.8s)\n",
94 sdt->signature, UACPI_FMT64(phys_addr), sdt->length, sdt->revision,
95 sdt->oemid, sdt->oem_table_id
96 );
97}
98
100 uacpi_size entry_size)
101{
102 struct uacpi_rxsdt *rxsdt;
103 uacpi_size i, entry_bytes, map_len = sizeof(*rxsdt);
104 uacpi_phys_addr entry_addr;
106
107 rxsdt = uacpi_kernel_map(rxsdt_addr, map_len);
108 if (rxsdt == UACPI_NULL)
110
111 dump_table_header(rxsdt_addr, rxsdt);
112
114 entry_size == 8 ? ACPI_XSDT_SIGNATURE : ACPI_RSDT_SIGNATURE);
116 goto error_out;
117
118 map_len = rxsdt->hdr.length;
119 uacpi_kernel_unmap(rxsdt, sizeof(*rxsdt));
120
121 if (uacpi_unlikely(map_len < (sizeof(*rxsdt) + entry_size)))
123
124 // Make sure length is aligned to entry size so we don't OOB
125 entry_bytes = map_len - sizeof(*rxsdt);
126 entry_bytes &= ~(entry_size - 1);
127
128 rxsdt = uacpi_kernel_map(rxsdt_addr, map_len);
129 if (uacpi_unlikely(rxsdt == UACPI_NULL))
131
132 ret = uacpi_verify_table_checksum(rxsdt, map_len);
134 goto error_out;
135
136 for (i = 0; i < entry_bytes; i += entry_size) {
137 uacpi_u64 entry_phys_addr_large = 0;
138 uacpi_memcpy(&entry_phys_addr_large, &rxsdt->ptr_bytes[i], entry_size);
139
140 if (!entry_phys_addr_large)
141 continue;
142
143 entry_addr = uacpi_truncate_phys_addr_with_warn(entry_phys_addr_large);
146 );
149 goto error_out;
150 }
151
153
154error_out:
155 uacpi_kernel_unmap(rxsdt, map_len);
156 return ret;
157}
158
160{
162 uacpi_phys_addr rsdp_phys;
163 struct acpi_rsdp *rsdp;
164 uacpi_phys_addr rxsdt;
165 uacpi_size rxsdt_entry_size;
166
167 g_uacpi_rt_ctx.is_rev1 = UACPI_TRUE;
168
169 ret = uacpi_kernel_get_rsdp(&rsdp_phys);
171 return ret;
172
173 rsdp = uacpi_kernel_map(rsdp_phys, sizeof(struct acpi_rsdp));
174 if (rsdp == UACPI_NULL)
176
177 dump_table_header(rsdp_phys, rsdp);
178
179 if (rsdp->revision > 1 && rsdp->xsdt_addr &&
181 {
182 rxsdt = uacpi_truncate_phys_addr_with_warn(rsdp->xsdt_addr);
183 rxsdt_entry_size = 8;
184 } else {
185 rxsdt = (uacpi_phys_addr)rsdp->rsdt_addr;
186 rxsdt_entry_size = 4;
187 }
188
189 uacpi_kernel_unmap(rsdp, sizeof(struct acpi_rsdp));
190
191 if (!rxsdt) {
192 uacpi_error("both RSDT & XSDT tables are NULL!\n");
194 }
195
196 return initialize_from_rxsdt(rxsdt, rxsdt_entry_size);
197}
198
201)
202{
204
205#ifndef UACPI_BAREBONES_MODE
207#endif
208 if (uacpi_unlikely(early_table_access))
210
213
215
216 tables.dynamic_storage = temporary_buffer;
217 tables.dynamic_capacity = buffer_size / sizeof(struct uacpi_installed_table);
218 early_table_access = UACPI_TRUE;
219
223
224 return ret;
225}
226
227#ifndef UACPI_BAREBONES_MODE
229 void *user, struct uacpi_installed_table *tbl, uacpi_size idx
230)
231{
233
234 if (uacpi_unlikely(tbl->reference_count != 0)) {
236 "table "UACPI_PRI_TBL_HDR" (%zu) still has %d early reference(s)!\n",
238 );
239 }
240
242}
243
245{
246 if (early_table_access) {
247 uacpi_size num_tables;
248
250
251 // Reallocate the user buffer into a normal heap array
252 num_tables = table_array_size(&tables);
253 if (num_tables > table_array_inline_capacity(&tables)) {
254 void *new_buf;
255
256 /*
257 * Allocate a new buffer with size equal to exactly the number of
258 * dynamic tables (that live in the user provided temporary buffer).
259 */
260 num_tables -= table_array_inline_capacity(&tables);
261 new_buf = uacpi_kernel_alloc(
262 sizeof(struct uacpi_installed_table) * num_tables
263 );
264 if (uacpi_unlikely(new_buf == UACPI_NULL))
266
267 uacpi_memcpy(new_buf, tables.dynamic_storage,
268 sizeof(struct uacpi_installed_table) * num_tables);
269 tables.dynamic_storage = new_buf;
270 tables.dynamic_capacity = num_tables;
271 } else {
272 /*
273 * User-provided temporary buffer was not used at all, just remove
274 * any references to it.
275 */
276 tables.dynamic_storage = UACPI_NULL;
277 tables.dynamic_capacity = 0;
278 }
279
280 early_table_access = UACPI_FALSE;
281 } else {
283
286 return ret;
287 }
288
290 struct acpi_fadt *fadt = &g_uacpi_rt_ctx.fadt;
291 uacpi_table tbl;
292
293 if (fadt->x_firmware_ctrl) {
295
297 fadt->x_firmware_ctrl, UACPI_TABLE_ORIGIN_FIRMWARE_PHYSICAL,
299 );
302 return ret;
303
304 g_uacpi_rt_ctx.facs = tbl.ptr;
305 }
306 }
307
308 table_mutex = uacpi_kernel_create_mutex();
309 if (uacpi_unlikely(table_mutex == UACPI_NULL))
311
312 return UACPI_STATUS_OK;
313}
314#endif // !UACPI_BAREBONES_MODE
315
317{
319
320 for (i = 0; i < table_array_size(&tables); ++i) {
321 struct uacpi_installed_table *tbl = table_array_at(&tables, i);
322
323 switch (tbl->origin) {
324#ifndef UACPI_BAREBONES_MODE
326 uacpi_free(tbl->ptr, tbl->hdr.length);
327 break;
328#endif
331 if (tbl->reference_count != 0)
332 uacpi_kernel_unmap(tbl->ptr, tbl->hdr.length);
333 break;
334 default:
335 break;
336 }
337 }
338
339 if (early_table_access) {
340 uacpi_memzero(&tables, sizeof(tables));
341 early_table_access = UACPI_FALSE;
342 } else {
343 table_array_clear(&tables);
344 }
345
346 installation_handler = UACPI_NULL;
347
348#ifndef UACPI_BAREBONES_MODE
349 if (table_mutex)
350 uacpi_kernel_free_mutex(table_mutex);
351
352 table_mutex = UACPI_NULL;
353#endif
354}
355
358)
359{
361
364 return ret;
365
366 if (installation_handler != UACPI_NULL && handler != UACPI_NULL)
367 goto out;
368
369 installation_handler = handler;
370
371out:
373 return ret;
374}
375
376static uacpi_status initialize_fadt(const void*);
377
379{
381 uacpi_u8 csum = 0;
383
384 for (i = 0; i < size; ++i)
385 csum += bytes[i];
386
387 return csum;
388}
389
391{
394
396
397 if (uacpi_unlikely(csum != 0)) {
399 struct acpi_sdt_hdr *hdr = table;
400
403 lvl = UACPI_LOG_ERROR;
404 }
405
407 lvl, "invalid table "UACPI_PRI_TBL_HDR" checksum %d!\n",
409 );
410 }
411
412 return ret;
413}
414
415uacpi_bool uacpi_signatures_match(const void *const lhs, const void *const rhs)
416{
417 return uacpi_memcmp(lhs, rhs, sizeof(uacpi_object_name)) == 0;
418}
419
421{
423
426 struct acpi_sdt_hdr *hdr = table;
427
430 lvl = UACPI_LOG_ERROR;
431 }
432
434 lvl,
435 "invalid table "UACPI_PRI_TBL_HDR" signature (expected '%.4s')\n",
437 );
438 }
439
440 return ret;
441}
442
444 struct uacpi_installed_table **out_tbl, uacpi_size *out_idx
445)
446{
447 struct uacpi_installed_table *tbl;
448
449 if (early_table_access &&
450 table_array_size(&tables) == table_array_capacity(&tables)) {
451 uacpi_warn("early table access buffer capacity exhausted!\n");
453 }
454
455 tbl = table_array_alloc(&tables);
456 if (uacpi_unlikely(tbl == UACPI_NULL))
458
459 *out_tbl = tbl;
460 *out_idx = table_array_size(&tables) - 1;
461 return UACPI_STATUS_OK;
462}
463
465 uacpi_phys_addr phys_addr, struct acpi_sdt_hdr *out_hdr
466)
467{
468 void *virt;
469
470 virt = uacpi_kernel_map(phys_addr, sizeof(*out_hdr));
471 if (uacpi_unlikely(virt == UACPI_NULL))
473
474 uacpi_memcpy(out_hdr, virt, sizeof(*out_hdr));
475
476 uacpi_kernel_unmap(virt, sizeof(*out_hdr));
477 return UACPI_STATUS_OK;
478}
479
481{
482 switch (tbl->reference_count) {
483 case 0: {
485
486 if (tbl->flags & UACPI_TABLE_INVALID)
488
491 break;
492
493 tbl->ptr = uacpi_kernel_map(tbl->phys_addr, tbl->hdr.length);
494 if (uacpi_unlikely(tbl->ptr == UACPI_NULL))
496
497 if (!(tbl->flags & UACPI_TABLE_CSUM_VERIFIED)) {
498 ret = uacpi_verify_table_checksum(tbl->ptr, tbl->hdr.length);
500 uacpi_kernel_unmap(tbl->ptr, tbl->hdr.length);
502 tbl->ptr = UACPI_NULL;
503 return ret;
504 }
505
507 }
508 break;
509 }
510 case 0xFFFF - 1:
512 "too many references for "UACPI_PRI_TBL_HDR
513 ", mapping permanently\n", UACPI_FMT_TBL_HDR(&tbl->hdr)
514 );
515 break;
516 default:
517 break;
518 }
519
520 if (uacpi_likely(tbl->reference_count != 0xFFFF))
521 tbl->reference_count++;
522 return UACPI_STATUS_OK;
523}
524
526{
527 switch (tbl->reference_count) {
528 case 0:
530 "tried to unref table "UACPI_PRI_TBL_HDR" with no references\n",
532 );
534 case 1:
537 break;
538
539 uacpi_kernel_unmap(tbl->ptr, tbl->hdr.length);
540 tbl->ptr = UACPI_NULL;
541 break;
542 case 0xFFFF:
543 /*
544 * Consider the reference count (overflow) of 0xFFFF to be a permanently
545 * mapped table as we don't know the actual number of references.
546 */
547 return UACPI_STATUS_OK;
548 default:
549 break;
550 }
551
552 tbl->reference_count--;
553 return UACPI_STATUS_OK;
554}
555
557 struct acpi_sdt_hdr *hdr, uacpi_phys_addr phys_addr, void *virt_addr,
558 enum uacpi_table_origin origin, uacpi_table *out_table
559)
560{
563 uacpi_bool is_fadt;
565 uacpi_u8 flags = 0;
566
567 is_fadt = uacpi_signatures_match(hdr->signature, ACPI_FADT_SIGNATURE);
568
569 /*
570 * FACS is the only(?) table without a checksum because it has OSPM
571 * writable fields. Don't try to validate it here.
572 */
575 } else if (uacpi_check_flag(UACPI_FLAG_PROACTIVE_TBL_CSUM) || is_fadt ||
576 out_table != UACPI_NULL) {
577 void *mapping = virt_addr;
578
579 // We may already have a valid mapping, reuse it if we do
580 if (mapping == UACPI_NULL)
584
587 if (is_fadt)
590 }
591
592 if (virt_addr == UACPI_NULL)
594
596 return ret;
597 }
598
600 g_uacpi_rt_ctx.is_rev1 = hdr->revision < 2;
601
602 ret = table_alloc(&table, &idx);
604 return ret;
605
607
608 uacpi_memcpy(&table->hdr, hdr, sizeof(*hdr));
609 table->reference_count = 0;
610 table->phys_addr = phys_addr;
611 table->ptr = virt_addr;
612 table->flags = flags;
613 table->origin = origin;
614
615 if (out_table == UACPI_NULL)
616 return UACPI_STATUS_OK;
617
618 table->reference_count++;
619 out_table->ptr = virt_addr;
620 out_table->index = idx;
621 return UACPI_STATUS_OK;
622}
623
626 uacpi_table *out_table
627)
628{
630
631 switch (disposition) {
636 out_table
637 );
638 return ret;
644 out_table
645 );
646 default:
647 uacpi_error("invalid table installation disposition %d\n", disposition);
649 }
650}
651
654 const uacpi_char *expected_signature, uacpi_table *out_table
655)
656{
657 struct acpi_sdt_hdr hdr;
658 void *virt = UACPI_NULL;
660
663 return ret;
664
665 if (uacpi_unlikely(hdr.length < sizeof(struct acpi_sdt_hdr))) {
666 uacpi_error("invalid table '%.4s' (0x016%"UACPI_PRIX64") size: %u\n",
667 hdr.signature, UACPI_FMT64(phys), hdr.length);
669 }
670
671 if (expected_signature != UACPI_NULL) {
672 ret = uacpi_check_table_signature(&hdr, expected_signature);
674 return ret;
675 }
676
677 if (installation_handler != UACPI_NULL || out_table != UACPI_NULL) {
678 virt = uacpi_kernel_map(phys, hdr.length);
679 if (uacpi_unlikely(!virt))
681 }
682
684 installation_handler != UACPI_NULL) {
685 uacpi_u64 override;
687
688 disposition = installation_handler(virt, &override);
689
690 switch (disposition) {
692 break;
695 "table '%.4s' (0x016%"UACPI_PRIX64") installation denied "
696 "by host\n", hdr.signature, UACPI_FMT64(phys)
697 );
699 goto out;
700
701 default:
703 "table '%.4s' (0x016%"UACPI_PRIX64") installation "
704 "overridden by host\n", hdr.signature, UACPI_FMT64(phys)
705 );
706
707 ret = handle_table_override(disposition, override, out_table);
710
711 goto out;
712 }
713 }
714
715 ret = verify_and_install_table(&hdr, phys, virt, origin, out_table);
716out:
717 // We don't unmap only in this case
718 if (ret == UACPI_STATUS_OK && out_table != UACPI_NULL)
719 return ret;
720
721 if (virt != UACPI_NULL)
722 uacpi_kernel_unmap(virt, hdr.length);
723 return UACPI_STATUS_OK;
724}
725
728)
729{
731
734 return ret;
735
737 phys, origin, UACPI_NULL, out_table
738 );
740
741 return ret;
742}
743
745 void *virt, enum uacpi_table_origin origin, uacpi_table *out_table
746)
747{
748 struct acpi_sdt_hdr *hdr = virt;
749
750 if (uacpi_unlikely(hdr->length < sizeof(struct acpi_sdt_hdr))) {
751 uacpi_error("invalid table '%.4s' (%p) size: %u\n",
752 hdr->signature, virt, hdr->length);
754 }
755
756#ifndef UACPI_BAREBONES_MODE
758 installation_handler != UACPI_NULL) {
759 uacpi_u64 override;
761
762 disposition = installation_handler(virt, &override);
763
764 switch (disposition) {
766 break;
769 "table "UACPI_PRI_TBL_HDR" installation denied by host\n",
771 );
772 return UACPI_STATUS_DENIED;
773
774 default: {
777 "table "UACPI_PRI_TBL_HDR" installation overridden by host\n",
779 );
780
781 ret = handle_table_override(disposition, override, out_table);
784
785 return ret;
786 }
787 }
788 }
789#endif
790
792 hdr, 0, virt, origin, out_table
793 );
794}
795
797 void *virt, enum uacpi_table_origin origin, uacpi_table *out_table
798)
799{
801
804 return ret;
805
807
809 return ret;
810}
811
813{
815
817 virt, UACPI_TABLE_ORIGIN_HOST_VIRTUAL, out_table
818 );
819}
820
823)
824{
826
829 );
830}
831
834)
835{
838 struct uacpi_installed_table *tbl;
840
842
845 return ret;
846
847 for (idx = base_idx; idx < table_array_size(&tables); ++idx) {
848 tbl = table_array_at(&tables, idx);
849
850 if (tbl->flags & UACPI_TABLE_INVALID)
851 continue;
852
853 dec = cb(user, tbl, idx);
855 break;
856 }
857
859 return ret;
860}
861
865};
866
868 union {
871 };
872
876};
877
879 void *user, struct uacpi_installed_table *tbl, uacpi_size idx
880)
881{
882 struct table_search_ctx *ctx = user;
885
886 switch (ctx->search_type) {
887 case SEARCH_TYPE_BY_ID: {
888 const uacpi_table_identifiers *id = ctx->id;
889
890 if (!uacpi_signatures_match(&id->signature, tbl->hdr.signature))
892 if (id->oemid[0] != '\0' &&
893 uacpi_memcmp(id->oemid, tbl->hdr.oemid, sizeof(id->oemid)) != 0)
895
896 if (id->oem_table_id[0] != '\0' &&
897 uacpi_memcmp(id->oem_table_id, tbl->hdr.oem_table_id,
898 sizeof(id->oem_table_id)) != 0)
900
901 break;
902 }
903
905 if (!ctx->match_cb(tbl))
907 break;
908
909 default:
912 }
913
914 ret = table_ref_unlocked(tbl);
916 out_table = ctx->out_table;
917 out_table->ptr = tbl->ptr;
919 ctx->status = ret;
921 }
922
923 /*
924 * Don't abort nor propagate bad checksums, just pretend this table never
925 * existed and go on with the search.
926 */
929
930 ctx->status = ret;
932}
933
934#ifndef UACPI_BAREBONES_MODE
937)
938{
940 struct table_search_ctx ctx = {
941 .match_cb = cb,
942 .search_type = SEARCH_TYPE_MATCH,
943 .out_table = out_table,
944 .status = UACPI_STATUS_NOT_FOUND,
945 };
946
949 return ret;
950
951 return ctx.status;
952}
953#endif
954
956 uacpi_size base_idx, const uacpi_table_identifiers *id,
958)
959{
961 struct table_search_ctx ctx = {
962 .id = id,
963 .out_table = out_table,
964 .search_type = SEARCH_TYPE_BY_ID,
965 .status = UACPI_STATUS_NOT_FOUND,
966 };
967
970 return ret;
971
972 return ctx.status;
973}
974
976 const uacpi_char *signature_string, struct uacpi_table *out_table
977)
978{
979 struct uacpi_table_identifiers id = {
980 .signature = {
981 .text = {
982 signature_string[0],
983 signature_string[1],
984 signature_string[2],
985 signature_string[3]
986 }
987 }
988 };
989
991
992 return find_table(0, &id, out_table);
993}
994
996 uacpi_table *in_out_table
997)
998{
999 struct uacpi_table_identifiers id = { 0 };
1000
1002
1003 if (uacpi_unlikely(in_out_table->ptr == UACPI_NULL))
1005
1006 uacpi_memcpy(&id.signature, in_out_table->hdr->signature,
1007 sizeof(id.signature));
1008 uacpi_table_unref(in_out_table);
1009
1010 return find_table(in_out_table->index + 1, &id, in_out_table);
1011}
1012
1014 const uacpi_table_identifiers *id, uacpi_table *out_table
1015)
1016{
1018
1019 return find_table(0, id, out_table);
1020}
1021
1022#define TABLE_CTL_SET_FLAGS (1 << 0)
1023#define TABLE_CTL_CLEAR_FLAGS (1 << 1)
1024#define TABLE_CTL_VALIDATE_SET_FLAGS (1 << 2)
1025#define TABLE_CTL_VALIDATE_CLEAR_FLAGS (1 << 3)
1026#define TABLE_CTL_GET (1 << 4)
1027#define TABLE_CTL_PUT (1 << 5)
1028
1031
1036
1037 void *out_tbl;
1038};
1039
1041{
1043 struct uacpi_installed_table *tbl;
1044
1046
1049 return ret;
1050
1051 if (uacpi_unlikely(table_array_size(&tables) <= idx)) {
1053 "requested invalid table index %zu (%zu tables installed)\n",
1054 idx, table_array_size(&tables)
1055 );
1057 goto out;
1058 }
1059
1060 tbl = table_array_at(&tables, idx);
1063
1065 uacpi_u8 mask = req->expect_set;
1066
1067 if (uacpi_unlikely((tbl->flags & mask) != mask)) {
1069 "unexpected table '%.4s' flags %02X, expected %02X to be set\n",
1070 tbl->hdr.signature, tbl->flags, mask
1071 );
1073 goto out;
1074 }
1075 }
1076
1078 uacpi_u8 mask = req->expect_clear;
1079
1080 if (uacpi_unlikely((tbl->flags & mask) != 0)) {
1082 "unexpected table '%.4s' flags %02X, expected %02X "
1083 "to be clear\n", tbl->hdr.signature, tbl->flags, mask
1084 );
1086 goto out;
1087 }
1088 }
1089
1090 if (req->type & TABLE_CTL_GET) {
1091 ret = table_ref_unlocked(tbl);
1093 goto out;
1094
1095 req->out_tbl = tbl->ptr;
1096 }
1097
1098 if (req->type & TABLE_CTL_PUT) {
1101 goto out;
1102 }
1103
1104 if (req->type & TABLE_CTL_SET_FLAGS)
1105 tbl->flags |= req->set;
1106 if (req->type & TABLE_CTL_CLEAR_FLAGS)
1107 tbl->flags &= ~req->clear;
1108
1109out:
1111 return ret;
1112}
1113
1114#ifndef UACPI_BAREBONES_MODE
1117)
1118{
1120 struct table_ctl_request req = {
1123 .set = UACPI_TABLE_LOADED,
1124 .expect_clear = UACPI_TABLE_LOADED,
1125 };
1126
1127 ret = table_ctl(idx, &req);
1129 return ret;
1130
1131 ret = uacpi_execute_table(req.out_tbl, cause);
1132
1133 req.type = TABLE_CTL_PUT;
1134 table_ctl(idx, &req);
1135 return ret;
1136}
1137
1139{
1141}
1142
1144{
1145 table_ctl(idx, &(struct table_ctl_request) {
1147 });
1148}
1149#endif // !UACPI_BAREBONES_MODE
1150
1152{
1153 return table_ctl(tbl->index, &(struct table_ctl_request) {
1154 .type = TABLE_CTL_GET
1155 });
1156}
1157
1159{
1160 return table_ctl(tbl->index, &(struct table_ctl_request) {
1161 .type = TABLE_CTL_PUT
1162 });
1163}
1164
1166 116, 132, 244, 244, 268, 276
1167};
1168
1169static void fadt_ensure_correct_revision(struct acpi_fadt *fadt)
1170{
1171 uacpi_size current_rev, rev;
1172
1173 current_rev = fadt->hdr.revision;
1174
1175 for (rev = 0; rev < UACPI_ARRAY_SIZE(fadt_version_sizes); ++rev) {
1176 if (fadt->hdr.length <= fadt_version_sizes[rev])
1177 break;
1178 }
1179
1182 "FADT revision (%zu) is likely greater than the last "
1183 "supported, reducing to %zu\n", current_rev, rev
1184 );
1185 fadt->hdr.revision = rev;
1186 return;
1187 }
1188
1189 rev++;
1190
1191 if (current_rev != rev && !(rev == 3 && current_rev == 4)) {
1192 uacpi_warn(
1193 "FADT length %u doesn't match expected for revision %zu, "
1194 "assuming version %zu\n", fadt->hdr.length, current_rev,
1195 rev
1196 );
1197 fadt->hdr.revision = rev;
1198 }
1199}
1200
1202 struct acpi_gas *gas, uacpi_u64 address, uacpi_u8 byte_size
1203)
1204{
1205 gas->address = address;
1206 gas->address_space_id = UACPI_ADDRESS_SPACE_SYSTEM_IO;
1207 gas->register_bit_width = UACPI_MIN(255, byte_size * 8);
1208 gas->register_bit_offset = 0;
1209 gas->access_size = 0;
1210}
1211
1212
1216};
1217
1218#define fadt_offset(field) uacpi_offsetof(struct acpi_fadt, field)
1219
1220/*
1221 * We convert all the legacy registers into GAS format and write them into
1222 * the x_* fields for convenience and faster access at runtime.
1223 */
1225 {
1226 .offset = fadt_offset(pm1a_evt_blk),
1227 .xoffset = fadt_offset(x_pm1a_evt_blk),
1228 .length_offset = fadt_offset(pm1_evt_len),
1229 },
1230 {
1231 .offset = fadt_offset(pm1b_evt_blk),
1232 .xoffset = fadt_offset(x_pm1b_evt_blk),
1233 .length_offset = fadt_offset(pm1_evt_len),
1234 },
1235 {
1236 .offset = fadt_offset(pm1a_cnt_blk),
1237 .xoffset = fadt_offset(x_pm1a_cnt_blk),
1238 .length_offset = fadt_offset(pm1_cnt_len),
1239 },
1240 {
1241 .offset = fadt_offset(pm1b_cnt_blk),
1242 .xoffset = fadt_offset(x_pm1b_cnt_blk),
1243 .length_offset = fadt_offset(pm1_cnt_len),
1244 },
1245 {
1246 .offset = fadt_offset(pm2_cnt_blk),
1247 .xoffset = fadt_offset(x_pm2_cnt_blk),
1248 .length_offset = fadt_offset(pm2_cnt_len),
1249 },
1250 {
1251 .offset = fadt_offset(pm_tmr_blk),
1252 .xoffset = fadt_offset(x_pm_tmr_blk),
1253 .length_offset = fadt_offset(pm_tmr_len),
1254 },
1255 {
1256 .offset = fadt_offset(gpe0_blk),
1257 .xoffset = fadt_offset(x_gpe0_blk),
1258 .length_offset = fadt_offset(gpe0_blk_len),
1259 },
1260 {
1261 .offset = fadt_offset(gpe1_blk),
1262 .xoffset = fadt_offset(x_gpe1_blk),
1263 .length_offset = fadt_offset(gpe1_blk_len),
1264 },
1265};
1266
1268{
1269 return ((uacpi_u8*)&g_uacpi_rt_ctx.fadt) + offset;
1270}
1271
1273{
1274 uacpi_size i;
1275 struct register_description *desc;
1276 struct acpi_gas *gas;
1277 uacpi_u32 legacy_addr;
1279
1280 for (i = 0; i < UACPI_ARRAY_SIZE(fadt_registers); ++i) {
1281 desc = &fadt_registers[i];
1282
1283 legacy_addr = *(uacpi_u32*)fadt_relative(desc->offset);
1284 length = *(uacpi_u8*)fadt_relative(desc->length_offset);
1285 gas = fadt_relative(desc->xoffset);
1286
1287 if (gas->address)
1288 continue;
1289
1290 gas_init_system_io(gas, legacy_addr, length);
1291 }
1292}
1293
1294#ifndef UACPI_BAREBONES_MODE
1296 struct acpi_gas *src, struct acpi_gas *dst0, struct acpi_gas *dst1
1297)
1298{
1299 uacpi_size byte_length;
1300
1301 if (src->address == 0)
1302 return;
1303
1304 byte_length = src->register_bit_width / 8;
1305 byte_length /= 2;
1306
1307 gas_init_system_io(dst0, src->address, byte_length);
1308 gas_init_system_io(dst1, src->address + byte_length, byte_length);
1309}
1310
1311static void split_event_blocks(void)
1312{
1314 &g_uacpi_rt_ctx.fadt.x_pm1a_evt_blk,
1315 &g_uacpi_rt_ctx.pm1a_status_blk,
1316 &g_uacpi_rt_ctx.pm1a_enable_blk
1317 );
1319 &g_uacpi_rt_ctx.fadt.x_pm1b_evt_blk,
1320 &g_uacpi_rt_ctx.pm1b_status_blk,
1321 &g_uacpi_rt_ctx.pm1b_enable_blk
1322 );
1323}
1324#endif // !UACPI_BAREBONES_MODE
1325
1326static uacpi_status initialize_fadt(const void *virt)
1327{
1329 struct acpi_fadt *fadt = &g_uacpi_rt_ctx.fadt;
1330 const struct acpi_sdt_hdr *hdr = virt;
1331
1332 /*
1333 * Here we (roughly) follow ACPICA initialization sequence to make sure we
1334 * handle potential BIOS quirks with garbage inside FADT correctly.
1335 */
1336
1337 uacpi_memcpy(fadt, hdr, UACPI_MIN(sizeof(*fadt), hdr->length));
1338
1339#if !defined(UACPI_REDUCED_HARDWARE) && !defined(UACPI_BAREBONES_MODE)
1340 g_uacpi_rt_ctx.is_hardware_reduced = fadt->flags & ACPI_HW_REDUCED_ACPI;
1341#endif
1342
1344
1345 /*
1346 * These are reserved prior to version 3, so zero them out to work around
1347 * BIOS implementations that might dirty these.
1348 */
1349 if (fadt->hdr.revision <= 2) {
1350 fadt->preferred_pm_profile = 0;
1351 fadt->pstate_cnt = 0;
1352 fadt->cst_cnt = 0;
1353 fadt->iapc_boot_arch = 0;
1354 }
1355
1356 if (!fadt->x_dsdt)
1357 fadt->x_dsdt = fadt->dsdt;
1358
1359 if (fadt->x_dsdt) {
1363 );
1366 return ret;
1367 }
1368
1369 /*
1370 * Unconditionally use 32 bit FACS if it exists, as 64 bit FACS is known
1371 * to cause issues on some firmware:
1372 * https://bugzilla.kernel.org/show_bug.cgi?id=74021
1373 *
1374 * Note that we don't install it here as FACS needs permanent mapping, which
1375 * we might not be able to obtain at this point in case of early table
1376 * access.
1377 */
1378 if (fadt->firmware_ctrl)
1379 fadt->x_firmware_ctrl = fadt->firmware_ctrl;
1380
1383#ifndef UACPI_BAREBONES_MODE
1385#endif
1386 }
1387
1388 return UACPI_STATUS_OK;
1389}
1390
1391uacpi_status uacpi_table_fadt(struct acpi_fadt **out_fadt)
1392{
1394
1395 *out_fadt = &g_uacpi_rt_ctx.fadt;
1396 return UACPI_STATUS_OK;
1397}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
ios_base &_STLP_CALL dec(ios_base &__s)
Definition: _ios_base.h:321
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
int rev
Definition: sort.c:17
void user(int argc, const char *argv[])
Definition: cmds.c:1350
static uacpi_status uacpi_acquire_native_mutex_may_be_null(uacpi_handle mtx)
Definition: mutex.h:34
static uacpi_status uacpi_release_native_mutex_may_be_null(uacpi_handle mtx)
Definition: mutex.h:44
unsigned int idx
Definition: utils.c:41
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
#define ACPI_FACS_SIGNATURE
Definition: acpi.h:18
#define ACPI_RSDP_SIGNATURE
Definition: acpi.h:13
#define ACPI_XSDT_SIGNATURE
Definition: acpi.h:15
#define ACPI_DSDT_SIGNATURE
Definition: acpi.h:23
#define ACPI_HW_REDUCED_ACPI
Definition: acpi.h:724
#define ACPI_FADT_SIGNATURE
Definition: acpi.h:17
#define ACPI_RSDT_SIGNATURE
Definition: acpi.h:14
#define UACPI_ENSURE_INIT_LEVEL_IS(lvl)
Definition: context.h:141
static uacpi_bool uacpi_check_flag(uacpi_u64 flag)
Definition: context.h:90
static uacpi_bool uacpi_is_hardware_reduced(void)
Definition: context.h:100
struct uacpi_runtime_context g_uacpi_rt_ctx
Definition: uacpi.c:17
#define UACPI_ARRAY_SIZE(arr)
Definition: helpers.h:5
#define UACPI_UNUSED(x)
Definition: helpers.h:7
#define uacpi_trace(...)
Definition: log.h:18
#define uacpi_info(...)
Definition: log.h:19
void uacpi_logger_initialize(void)
Definition: uacpi.c:27
#define uacpi_error(...)
Definition: log.h:21
#define uacpi_warn(...)
Definition: log.h:20
#define uacpi_log_lvl(lvl,...)
Definition: log.h:14
#define uacpi_memzero(ptr, size)
Definition: stdlib.h:99
#define uacpi_memcmp
Definition: stdlib.h:61
#define uacpi_memcpy
Definition: stdlib.h:34
#define uacpi_free(mem, _)
Definition: stdlib.h:96
#define UACPI_MIN(x, y)
Definition: stdlib.h:102
uacpi_log_level
Definition: log.h:7
@ UACPI_LOG_ERROR
Definition: log.h:35
@ UACPI_LOG_WARN
Definition: log.h:29
#define uacpi_likely(expr)
Definition: compiler.h:59
#define uacpi_unlikely(expr)
Definition: compiler.h:58
#define UACPI_PACKED(decl)
Definition: compiler.h:25
#define UACPI_STATIC_TABLE_ARRAY_LEN
Definition: config.h:154
#define UACPI_PRIX64
Definition: types.h:61
size_t uacpi_size
Definition: types.h:37
uint32_t uacpi_u32
Definition: types.h:21
bool uacpi_bool
Definition: types.h:31
#define UACPI_FALSE
Definition: types.h:30
uint64_t uacpi_u64
Definition: types.h:22
char uacpi_char
Definition: types.h:44
uint16_t uacpi_u16
Definition: types.h:20
#define UACPI_NULL
Definition: types.h:33
uint8_t uacpi_u8
Definition: types.h:19
#define UACPI_FMT64(val)
Definition: types.h:62
uacpi_uintptr uacpi_virt_addr
Definition: types.h:36
#define UACPI_TRUE
Definition: types.h:29
#define uacpi_likely_success(expr)
Definition: status.h:53
#define uacpi_unlikely_error(expr)
Definition: status.h:49
uacpi_status
Definition: status.h:10
@ UACPI_STATUS_INVALID_ARGUMENT
Definition: status.h:18
@ UACPI_STATUS_INTERNAL_ERROR
Definition: status.h:21
@ UACPI_STATUS_NOT_FOUND
Definition: status.h:17
@ UACPI_STATUS_OUT_OF_MEMORY
Definition: status.h:13
@ UACPI_STATUS_OVERRIDDEN
Definition: status.h:30
@ UACPI_STATUS_INVALID_TABLE_LENGTH
Definition: status.h:16
@ UACPI_STATUS_INVALID_SIGNATURE
Definition: status.h:15
@ UACPI_STATUS_ALREADY_EXISTS
Definition: status.h:20
@ UACPI_STATUS_MAPPING_FAILED
Definition: status.h:12
@ UACPI_STATUS_OK
Definition: status.h:11
@ UACPI_STATUS_DENIED
Definition: status.h:31
@ UACPI_STATUS_INIT_LEVEL_MISMATCH
Definition: status.h:23
@ UACPI_STATUS_BAD_CHECKSUM
Definition: status.h:14
uacpi_iteration_decision
Definition: types.h:28
@ UACPI_ITERATION_DECISION_BREAK
Definition: types.h:30
@ UACPI_ITERATION_DECISION_CONTINUE
Definition: types.h:29
uacpi_u64 uacpi_phys_addr
Definition: types.h:17
@ UACPI_INIT_LEVEL_EARLY
Definition: types.h:60
@ UACPI_ADDRESS_SPACE_SYSTEM_IO
Definition: types.h:38
return ret
Definition: mutex.c:146
static uacpi_status initialize_from_rxsdt(uacpi_phys_addr rxsdt_addr, uacpi_size entry_size)
Definition: tables.c:99
static uacpi_u8 table_checksum(void *table, uacpi_size size)
Definition: tables.c:378
static uacpi_status verify_and_install_table(struct acpi_sdt_hdr *hdr, uacpi_phys_addr phys_addr, void *virt_addr, enum uacpi_table_origin origin, uacpi_table *out_table)
Definition: tables.c:556
uacpi_status uacpi_table_fadt(struct acpi_fadt **out_fadt)
Definition: tables.c:1391
#define TABLE_CTL_GET
Definition: tables.c:1026
#define TABLE_CTL_VALIDATE_CLEAR_FLAGS
Definition: tables.c:1025
#define TABLE_CTL_VALIDATE_SET_FLAGS
Definition: tables.c:1024
#define ENSURE_TABLES_ONLINE()
static void gas_init_system_io(struct acpi_gas *gas, uacpi_u64 address, uacpi_u8 byte_size)
Definition: tables.c:1201
uacpi_status uacpi_table_find(const uacpi_table_identifiers *id, uacpi_table *out_table)
Definition: tables.c:1013
static uacpi_status initialize_fadt(const void *)
Definition: tables.c:1326
uacpi_u16 fadt_version_sizes[]
Definition: tables.c:1165
uacpi_bool uacpi_signatures_match(const void *const lhs, const void *const rhs)
Definition: tables.c:415
static uacpi_status table_install_with_origin_unlocked(void *virt, enum uacpi_table_origin origin, uacpi_table *out_table)
Definition: tables.c:744
uacpi_status uacpi_table_find_next_with_same_signature(uacpi_table *in_out_table)
Definition: tables.c:995
#define TABLE_CTL_PUT
Definition: tables.c:1027
static uacpi_status find_table(uacpi_size base_idx, const uacpi_table_identifiers *id, uacpi_table *out_table)
Definition: tables.c:955
static uacpi_iteration_decision warn_if_early_referenced(void *user, struct uacpi_installed_table *tbl, uacpi_size idx)
Definition: tables.c:228
uacpi_status uacpi_table_load_with_cause(uacpi_size idx, enum uacpi_table_load_cause cause)
Definition: tables.c:1115
uacpi_status uacpi_table_install_with_origin(void *virt, enum uacpi_table_origin origin, uacpi_table *out_table)
Definition: tables.c:796
void uacpi_deinitialize_tables(void)
Definition: tables.c:316
static uacpi_status handle_table_override(uacpi_table_installation_disposition disposition, uacpi_u64 address, uacpi_table *out_table)
Definition: tables.c:624
#define TABLE_CTL_CLEAR_FLAGS
Definition: tables.c:1023
#define TABLE_CTL_SET_FLAGS
Definition: tables.c:1022
uacpi_status uacpi_table_unref(uacpi_table *tbl)
Definition: tables.c:1158
uacpi_status uacpi_table_install(void *virt, uacpi_table *out_table)
Definition: tables.c:812
static uacpi_status table_ctl(uacpi_size idx, struct table_ctl_request *req)
Definition: tables.c:1040
uacpi_status uacpi_initialize_tables(void)
Definition: tables.c:244
static uacpi_status table_unref_unlocked(struct uacpi_installed_table *tbl)
Definition: tables.c:525
static uacpi_iteration_decision do_search_tables(void *user, struct uacpi_installed_table *tbl, uacpi_size idx)
Definition: tables.c:878
uacpi_status uacpi_table_load(uacpi_size idx)
Definition: tables.c:1138
static uacpi_status table_alloc(struct uacpi_installed_table **out_tbl, uacpi_size *out_idx)
Definition: tables.c:443
static void * fadt_relative(uacpi_size offset)
Definition: tables.c:1267
static void convert_registers_to_gas(void)
Definition: tables.c:1272
uacpi_status uacpi_table_find_by_signature(const uacpi_char *signature_string, struct uacpi_table *out_table)
Definition: tables.c:975
uacpi_status uacpi_table_ref(uacpi_table *tbl)
Definition: tables.c:1151
static struct register_description fadt_registers[]
Definition: tables.c:1224
uacpi_status uacpi_table_match(uacpi_size base_idx, uacpi_table_match_callback cb, uacpi_table *out_table)
Definition: tables.c:935
static uacpi_status get_external_table_header(uacpi_phys_addr phys_addr, struct acpi_sdt_hdr *out_hdr)
Definition: tables.c:464
uacpi_status uacpi_check_table_signature(void *table, const uacpi_char *expect)
Definition: tables.c:420
static uacpi_status initialize_from_rsdp(void)
Definition: tables.c:159
uacpi_status uacpi_table_install_physical(uacpi_phys_addr addr, uacpi_table *out_table)
Definition: tables.c:821
static void fadt_ensure_correct_revision(struct acpi_fadt *fadt)
Definition: tables.c:1169
static uacpi_status table_install_physical_with_origin_unlocked(uacpi_phys_addr phys, enum uacpi_table_origin origin, const uacpi_char *expected_signature, uacpi_table *out_table)
Definition: tables.c:652
static uacpi_status table_ref_unlocked(struct uacpi_installed_table *tbl)
Definition: tables.c:480
search_type
Definition: tables.c:862
@ SEARCH_TYPE_MATCH
Definition: tables.c:864
@ SEARCH_TYPE_BY_ID
Definition: tables.c:863
#define fadt_offset(field)
Definition: tables.c:1218
static void split_event_blocks(void)
Definition: tables.c:1311
uacpi_status uacpi_set_table_installation_handler(uacpi_table_installation_handler handler)
Definition: tables.c:356
void uacpi_table_mark_as_loaded(uacpi_size idx)
Definition: tables.c:1143
uacpi_status uacpi_table_install_physical_with_origin(uacpi_phys_addr phys, enum uacpi_table_origin origin, uacpi_table *out_table)
Definition: tables.c:726
static void dump_table_header(uacpi_phys_addr phys_addr, void *hdr)
Definition: tables.c:67
static void split_one_block(struct acpi_gas *src, struct acpi_gas *dst0, struct acpi_gas *dst1)
Definition: tables.c:1295
uacpi_status uacpi_verify_table_checksum(void *table, uacpi_size size)
Definition: tables.c:390
uacpi_status uacpi_setup_early_table_access(void *temporary_buffer, uacpi_size buffer_size)
Definition: tables.c:199
uacpi_status uacpi_for_each_table(uacpi_size base_idx, uacpi_table_iteration_callback cb, void *user)
Definition: tables.c:832
struct nls_table * tables
Definition: nls_base.c:22
#define DYNAMIC_ARRAY_WITH_INLINE_STORAGE_IMPL(name, type, prefix)
#define DYNAMIC_ARRAY_WITH_INLINE_STORAGE(name, type, inline_capacity)
Definition: dynamic_array.h:7
GLuint address
Definition: glext.h:9393
GLenum src
Definition: glext.h:6340
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UACPI_TABLE_CSUM_VERIFIED
Definition: tables.h:27
#define UACPI_PRI_TBL_HDR
Definition: tables.h:69
uacpi_iteration_decision(* uacpi_table_iteration_callback)(void *user, struct uacpi_installed_table *tbl, uacpi_size idx)
Definition: tables.h:56
#define UACPI_TABLE_LOADED
Definition: tables.h:26
#define UACPI_FMT_TBL_HDR(hdr)
Definition: tables.h:70
uacpi_table_origin
Definition: tables.h:9
@ UACPI_TABLE_ORIGIN_HOST_VIRTUAL
Definition: tables.h:15
@ UACPI_TABLE_ORIGIN_HOST_PHYSICAL
Definition: tables.h:16
@ UACPI_TABLE_ORIGIN_FIRMWARE_PHYSICAL
Definition: tables.h:13
@ UACPI_TABLE_ORIGIN_FIRMWARE_VIRTUAL
Definition: tables.h:11
#define UACPI_TABLE_INVALID
Definition: tables.h:28
uacpi_bool(* uacpi_table_match_callback)(struct uacpi_installed_table *tbl)
Definition: tables.h:63
static uacpi_phys_addr uacpi_truncate_phys_addr_with_warn(uacpi_u64 large_addr)
Definition: utilities.h:8
#define UACPI_VIRT_ADDR_TO_PTR(vaddr)
Definition: utilities.h:21
uacpi_status uacpi_execute_table(void *, enum uacpi_table_load_cause cause)
Definition: interpreter.c:1549
uacpi_table_load_cause
Definition: interpreter.h:9
@ UACPI_TABLE_LOAD_CAUSE_HOST
Definition: interpreter.h:13
voidpf uLong int origin
Definition: ioapi.h:144
char hdr[14]
Definition: iptest.cpp:33
void * uacpi_kernel_alloc(uacpi_size size)
Definition: uacpiosl.c:111
uacpi_handle uacpi_kernel_create_mutex(void)
Definition: uacpiosl.c:139
void uacpi_kernel_free_mutex(uacpi_handle)
Definition: uacpiosl.c:146
void uacpi_kernel_unmap(void *addr, uacpi_size len)
Definition: uacpiosl.c:198
void * uacpi_kernel_map(uacpi_phys_addr addr, uacpi_size len)
Definition: uacpiosl.c:191
uacpi_status uacpi_kernel_get_rsdp(uacpi_phys_addr *out_rsdp_address)
Definition: uacpiosl.c:204
static const WCHAR desc[]
Definition: protectdata.c:36
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
Definition: ffs.h:52
uacpi_size offset
Definition: tables.c:1214
uacpi_size xoffset
Definition: tables.c:1214
uacpi_size length_offset
Definition: tables.c:1215
uacpi_u8 expect_clear
Definition: tables.c:1033
void * out_tbl
Definition: tables.c:1037
uacpi_u8 type
Definition: tables.c:1030
uacpi_u8 clear
Definition: tables.c:1035
uacpi_u8 expect_set
Definition: tables.c:1032
uacpi_u8 set
Definition: tables.c:1034
const uacpi_table_identifiers * id
Definition: tables.c:869
uacpi_status status
Definition: tables.c:875
uacpi_table * out_table
Definition: tables.c:873
uacpi_u8 search_type
Definition: tables.c:874
uacpi_table_match_callback match_cb
Definition: tables.c:870
uacpi_phys_addr phys_addr
Definition: tables.h:20
uacpi_u16 reference_count
Definition: tables.h:24
uacpi_u8 flags
Definition: tables.h:29
struct acpi_sdt_hdr hdr
Definition: tables.h:21
uacpi_u8 origin
Definition: tables.h:30
uacpi_object_name signature
Definition: tables.h:14
void * ptr
Definition: tables.h:26
struct acpi_sdt_hdr * hdr
Definition: tables.h:27
uacpi_size index
Definition: tables.h:31
uacpi_table_installation_disposition
Definition: tables.h:93
@ UACPI_TABLE_INSTALLATION_DISPOSITON_DENY
Definition: tables.h:102
@ UACPI_TABLE_INSTALLATION_DISPOSITON_PHYSICAL_OVERRIDE
Definition: tables.h:114
@ UACPI_TABLE_INSTALLATION_DISPOSITON_VIRTUAL_OVERRIDE
Definition: tables.h:108
@ UACPI_TABLE_INSTALLATION_DISPOSITON_ALLOW
Definition: tables.h:95
uacpi_table_installation_disposition(* uacpi_table_installation_handler)(struct acpi_sdt_hdr *hdr, uacpi_u64 *out_override_address)
Definition: tables.h:118
#define UACPI_FLAG_BAD_CSUM_FATAL
Definition: uacpi.h:64
#define UACPI_FLAG_BAD_XSDT
Definition: uacpi.h:75
#define UACPI_FLAG_PROACTIVE_TBL_CSUM
Definition: uacpi.h:96
#define UACPI_FLAG_BAD_TBL_SIGNATURE_FATAL
Definition: uacpi.h:70
uacpi_char text[4]
Definition: types.h:24
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383