1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#pragma pack(push,1)
14/* These table not checked. */
15
16typedef struct acpi_mcfg_desc {
17    uint64_t  address;
18    uint16_t segment;
19    uint8_t  bus_end;
20    uint8_t  bus_start;
21    uint8_t  res[4];
22} acpi_mcfg_desc_t;
23
24typedef struct acpi_mcfg {
25    acpi_header_t header;
26    uint8_t       res[8];
27    /* list of descriptors */
28//     acpi_mcfg_descriptor_t descriptor
29} acpi_mcfg_t;
30
31#pragma pack(pop)
32
33static inline acpi_mcfg_desc_t*
34acpi_mcfg_desc_first(acpi_mcfg_t* hdr)
35{
36    return (acpi_mcfg_desc_t*)(hdr + 1);
37}
38
39static inline acpi_mcfg_desc_t*
40acpi_mcfg_desc_next(acpi_mcfg_t* mcfg, acpi_mcfg_desc_t* cur)
41{
42    char* next = (char*)(cur + 1);
43    char* end = (char*)mcfg + mcfg->header.length;
44    if (next < end) {
45        return (acpi_mcfg_desc_t*)next;
46    } else {
47        return NULL;
48    }
49}
50