4 * Copyright (c) 2009 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
35 typedef uint32_t acpisrat_nodeid_t
;
38 acpisrat_nodeid_t nodeid
;
43 /* clockdomain has a meaningful value when the ACPI MADT table has
44 * ACPI_MADT_TYPE_LOCAL_X2APIC and/or ACPI_MADT_TYPE_LOCAL_X2APIC_NMI
45 * entries or ACPI CPU device have a _CDM.
51 acpisrat_nodeid_t nodeid
;
57 /* Returns true if ACPI SRAT table is available.
59 * If table does not exist, all functions below
60 * have undefined behaviour.
62 bool acpisrat_exist(void);
64 /* Initializes parser. Must be the first function
65 * being called when table is available.
67 int acpisrat_init(void);
69 /* Re-parse ACPI SRAT table. Useful after
70 * hotplugging cpu or RAM.
72 int acpisrat_refresh(void);
74 /* Free allocated memory. Should be called
75 * when acpisrat is no longer of any use.
77 int acpisrat_exit(void);
79 void acpisrat_dump(void);
81 /* Get number of NUMA nodes */
82 uint32_t acpisrat_nodes(void);
84 /* Get number of cpus in the node.
85 * 0 means, this is a cpu-less node.
87 uint32_t acpisrat_node_cpus(acpisrat_nodeid_t
);
89 /* Get number of memory ranges in the node
90 * 0 means, this node has no RAM.
92 uint32_t acpisrat_node_memoryranges(acpisrat_nodeid_t
);
94 /* Retrieve cpu and memory info. */
95 void acpisrat_cpu(acpisrat_nodeid_t
, uint32_t cpunum
, struct acpisrat_cpu
*);
96 void acpisrat_mem(acpisrat_nodeid_t
, uint32_t memrange
, struct acpisrat_mem
*);
98 #endif /* ACPI_SRAT_H */