mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
smbios: add smbios 3.0 support
This patch adds support for SMBIOS 3.0 entry point. When caller invokes smbios_set_defaults(), it can specify entry point as 2.1 or 3.0. Then smbios_get_tables() will return the entry point table in right format. Acked-by: Gabriel Somlo <somlo@cmu.edu> Tested-by: Gabriel Somlo <somlo@cmu.edu> Tested-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Wei Huang <wei@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-id: 1440615870-9518-2-git-send-email-wei@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
8012c84ff9
commit
8629912006
5 changed files with 113 additions and 39 deletions
|
@ -23,25 +23,27 @@ struct smbios_phys_mem_area {
|
|||
uint64_t length;
|
||||
};
|
||||
|
||||
void smbios_entry_add(QemuOpts *opts);
|
||||
void smbios_set_cpuid(uint32_t version, uint32_t features);
|
||||
void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
const char *version, bool legacy_mode,
|
||||
bool uuid_encoded);
|
||||
uint8_t *smbios_get_table_legacy(size_t *length);
|
||||
void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
|
||||
const unsigned int mem_array_size,
|
||||
uint8_t **tables, size_t *tables_len,
|
||||
uint8_t **anchor, size_t *anchor_len);
|
||||
|
||||
/*
|
||||
* SMBIOS spec defined tables
|
||||
*/
|
||||
typedef enum SmbiosEntryPointType {
|
||||
SMBIOS_ENTRY_POINT_21,
|
||||
SMBIOS_ENTRY_POINT_30,
|
||||
} SmbiosEntryPointType;
|
||||
|
||||
/* SMBIOS entry point (anchor).
|
||||
* BIOS must place this at a 16-bit-aligned address between 0xf0000 and 0xfffff.
|
||||
/* SMBIOS Entry Point
|
||||
* There are two types of entry points defined in the SMBIOS specification
|
||||
* (see below). BIOS must place the entry point(s) at a 16-bit-aligned
|
||||
* address between 0xf0000 and 0xfffff. Note that either entry point type
|
||||
* can be used in a 64-bit target system, except that SMBIOS 2.1 entry point
|
||||
* only allows the SMBIOS struct table to reside below 4GB address space.
|
||||
*/
|
||||
struct smbios_entry_point {
|
||||
|
||||
/* SMBIOS 2.1 (32-bit) Entry Point
|
||||
* - introduced since SMBIOS 2.1
|
||||
* - supports structure table below 4GB only
|
||||
*/
|
||||
struct smbios_21_entry_point {
|
||||
uint8_t anchor_string[4];
|
||||
uint8_t checksum;
|
||||
uint8_t length;
|
||||
|
@ -58,6 +60,28 @@ struct smbios_entry_point {
|
|||
uint8_t smbios_bcd_revision;
|
||||
} QEMU_PACKED;
|
||||
|
||||
/* SMBIOS 3.0 (64-bit) Entry Point
|
||||
* - introduced since SMBIOS 3.0
|
||||
* - supports structure table at 64-bit address space
|
||||
*/
|
||||
struct smbios_30_entry_point {
|
||||
uint8_t anchor_string[5];
|
||||
uint8_t checksum;
|
||||
uint8_t length;
|
||||
uint8_t smbios_major_version;
|
||||
uint8_t smbios_minor_version;
|
||||
uint8_t smbios_doc_rev;
|
||||
uint8_t entry_point_revision;
|
||||
uint8_t reserved;
|
||||
uint32_t structure_table_max_size;
|
||||
uint64_t structure_table_address;
|
||||
} QEMU_PACKED;
|
||||
|
||||
typedef union {
|
||||
struct smbios_21_entry_point ep21;
|
||||
struct smbios_30_entry_point ep30;
|
||||
} QEMU_PACKED SmbiosEntryPoint;
|
||||
|
||||
/* This goes at the beginning of every SMBIOS structure. */
|
||||
struct smbios_structure_header {
|
||||
uint8_t type;
|
||||
|
@ -232,4 +256,14 @@ struct smbios_type_127 {
|
|||
struct smbios_structure_header header;
|
||||
} QEMU_PACKED;
|
||||
|
||||
void smbios_entry_add(QemuOpts *opts);
|
||||
void smbios_set_cpuid(uint32_t version, uint32_t features);
|
||||
void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
const char *version, bool legacy_mode,
|
||||
bool uuid_encoded, SmbiosEntryPointType ep_type);
|
||||
uint8_t *smbios_get_table_legacy(size_t *length);
|
||||
void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
|
||||
const unsigned int mem_array_size,
|
||||
uint8_t **tables, size_t *tables_len,
|
||||
uint8_t **anchor, size_t *anchor_len);
|
||||
#endif /*QEMU_SMBIOS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue