mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2024-11-23 08:26:23 -06:00
53ca89f8ae
* Add a file containing useful macro definitions, currently a single top-level macro for obtaining the size of an array; use it to replace a sizeof(x) / sizeof(x[0]) construct in system/smbus.c . This requires switching the GCC build mode from C11 to C11 with GCC extensions. * Initial NUMA awareness (#12) support: parse the ACPI SRAT to build up new internal structures related to proximity domains and affinity; use these structures in setup_vm_map() and calculate_chunk() to skip the work on the processors which don't belong to the proximity domain currently being tested. Tested on a number of 1S single-domain, 2S multi-domain and 4S multi-domain platforms. SKIP_RANGE(iterations) trick by Martin Whitaker.
75 lines
1.5 KiB
C
75 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef _ACPI_H_
|
|
#define _ACPI_H_
|
|
/**
|
|
* \file
|
|
*
|
|
* Provides support for ACPI (Find & parse tables)
|
|
*
|
|
*//*
|
|
* Copyright (C) 2020-2022 Martin Whitaker.
|
|
* Copyright (C) 2004-2022 Sam Demeulemeester.
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#define FADT_PM_TMR_BLK_OFFSET 76
|
|
#define FADT_MINOR_REV_OFFSET 131
|
|
#define FADT_X_PM_TMR_BLK_OFFSET 208
|
|
|
|
/**
|
|
* A struct containing various ACPI-related infos for later uses.
|
|
*/
|
|
|
|
typedef struct __attribute__ ((packed)) {
|
|
uintptr_t rsdp_addr;
|
|
uintptr_t madt_addr;
|
|
uintptr_t fadt_addr;
|
|
uintptr_t hpet_addr;
|
|
uintptr_t srat_addr;
|
|
//uintptr_t slit_addr;
|
|
uintptr_t pm_addr;
|
|
uint8_t ver_maj;
|
|
uint8_t ver_min;
|
|
bool pm_is_io;
|
|
} acpi_t;
|
|
|
|
/**
|
|
* A struct for the headers of most ACPI tables.
|
|
*/
|
|
typedef struct {
|
|
char signature[4]; // "RSDT" or "XSDT"
|
|
uint32_t length;
|
|
uint8_t revision;
|
|
uint8_t checksum;
|
|
char oem_id[6];
|
|
char oem_table_id[8];
|
|
char oem_revision[4];
|
|
char creator_id[4];
|
|
char creator_revision[4];
|
|
} rsdt_header_t;
|
|
|
|
/**
|
|
* The search step that located the ACPI RSDP (for debug).
|
|
*/
|
|
extern const char *rsdp_source;
|
|
|
|
/**
|
|
* Global ACPI config struct
|
|
*/
|
|
extern acpi_t acpi_config;
|
|
|
|
/**
|
|
* ACPI Table Checksum Function
|
|
*/
|
|
int acpi_checksum(const void *data, int length);
|
|
|
|
/**
|
|
* Look for specific ACPI Tables Addresses (RSDP, MADT, ...)
|
|
* and parse some of the tables
|
|
*/
|
|
void acpi_init(void);
|
|
|
|
#endif /* _ACPI_H_ */
|