Hi,
This series allows the default values for specific fields on acpi and smbios tables to be set at build time, by editing config.h.
The current defaults are not changed, but it will allow build-time setting of specific strings on config.h if necessary.
Eduardo Habkost (2): acpi: allow header strings be configured on config.h smbios: allow vendor/manufacturer/version/product names be set on config.h
src/acpi.c | 8 ++++---- src/config.h | 13 +++++++++++++ src/smbios.c | 16 ++++++++-------- 3 files changed, 25 insertions(+), 12 deletions(-)
Instead of using CONFIG_APPNAME for everything, let CONFIG_OEM_* defines to be set on config.h.
The current CONFIG_APPNAME* defaults are kept, but it will allow build-time fine-tuned configuration on config.h.
Signed-off-by: Eduardo Habkost ehabkost@redhat.com --- src/acpi.c | 8 ++++---- src/config.h | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c index 0559443..0c78883 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -286,9 +286,9 @@ build_header(struct acpi_table_header *h, u32 sig, int len, u8 rev) h->signature = sig; h->length = cpu_to_le32(len); h->revision = rev; - memcpy(h->oem_id, CONFIG_APPNAME6, 6); - memcpy(h->oem_table_id, CONFIG_APPNAME4, 4); - memcpy(h->asl_compiler_id, CONFIG_APPNAME4, 4); + memcpy(h->oem_id, CONFIG_OEM_ID_6, 6); + memcpy(h->oem_table_id, CONFIG_OEM_TABLE_ID_4, 4); + memcpy(h->asl_compiler_id, CONFIG_ASL_COMPILER_ID_4, 4); memcpy(h->oem_table_id + 4, (void*)&sig, 4); h->oem_revision = cpu_to_le32(1); h->asl_compiler_revision = cpu_to_le32(1); @@ -672,7 +672,7 @@ acpi_bios_init(void) // Build rsdp pointer table memset(rsdp, 0, sizeof(*rsdp)); rsdp->signature = RSDP_SIGNATURE; - memcpy(rsdp->oem_id, CONFIG_APPNAME6, 6); + memcpy(rsdp->oem_id, CONFIG_OEM_ID_6, 6); rsdp->rsdt_physical_address = cpu_to_le32((u32)rsdt); rsdp->checksum -= checksum(rsdp, 20); RsdpAddr = rsdp; diff --git a/src/config.h b/src/config.h index ad569c6..92a02aa 100644 --- a/src/config.h +++ b/src/config.h @@ -12,6 +12,11 @@ #define CONFIG_APPNAME6 "BOCHS " #define CONFIG_APPNAME4 "BXPC"
+/* ACPI header fields */ +#define CONFIG_OEM_ID_6 CONFIG_APPNAME6 +#define CONFIG_OEM_TABLE_ID_4 CONFIG_APPNAME4 +#define CONFIG_ASL_COMPILER_ID_4 CONFIG_APPNAME4 + // Configure as a coreboot payload. #define CONFIG_COREBOOT 0
Instead of using the same string for every field, let those fields to be set individually on config.h
The current default value is kept (CONFIG_APPNAME), but it should allow fine-tuned configuration at build-time on config.h.
Signed-off-by: Eduardo Habkost ehabkost@redhat.com --- src/config.h | 8 ++++++++ src/smbios.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/config.h b/src/config.h index 92a02aa..1302140 100644 --- a/src/config.h +++ b/src/config.h @@ -17,6 +17,14 @@ #define CONFIG_OEM_TABLE_ID_4 CONFIG_APPNAME4 #define CONFIG_ASL_COMPILER_ID_4 CONFIG_APPNAME4
+/* SMBIOS fields */ +#define CONFIG_SMBIOS_VENDOR CONFIG_APPNAME +#define CONFIG_SMBIOS_VERSION CONFIG_APPNAME +#define CONFIG_SMBIOS_MANUFACTURER CONFIG_APPNAME +#define CONFIG_SMBIOS_PROD_NAME CONFIG_APPNAME +#define CONFIG_SMBIOS_TYPE3_NAME CONFIG_APPNAME +#define CONFIG_SMBIOS_CPU_NAME CONFIG_APPNAME + // Configure as a coreboot payload. #define CONFIG_COREBOOT 0
diff --git a/src/smbios.c b/src/smbios.c index e19a62d..eec271d 100644 --- a/src/smbios.c +++ b/src/smbios.c @@ -88,8 +88,8 @@ smbios_init_type_0(void *start) p->header.length = sizeof(struct smbios_type_0); p->header.handle = 0;
- load_str_field_with_default(0, vendor_str, CONFIG_APPNAME); - load_str_field_with_default(0, bios_version_str, CONFIG_APPNAME); + load_str_field_with_default(0, vendor_str, CONFIG_SMBIOS_VENDOR); + load_str_field_with_default(0, bios_version_str, CONFIG_SMBIOS_VERSION);
p->bios_starting_address_segment = 0xe800;
@@ -135,8 +135,8 @@ smbios_init_type_1(void *start) p->header.length = sizeof(struct smbios_type_1); p->header.handle = 0x100;
- load_str_field_with_default(1, manufacturer_str, CONFIG_APPNAME); - load_str_field_with_default(1, product_name_str, CONFIG_APPNAME); + load_str_field_with_default(1, manufacturer_str, CONFIG_SMBIOS_MANUFACTURER); + load_str_field_with_default(1, product_name_str, CONFIG_SMBIOS_PROD_NAME); load_str_field_or_skip(1, version_str); load_str_field_or_skip(1, serial_number_str);
@@ -185,9 +185,9 @@ smbios_init_type_3(void *start) p->contained_element_count = 0;
start += sizeof(struct smbios_type_3); - memcpy((char *)start, CONFIG_APPNAME"\0\0", sizeof(CONFIG_APPNAME) + 1); + memcpy((char *)start, CONFIG_SMBIOS_TYPE3_NAME"\0\0", sizeof(CONFIG_SMBIOS_TYPE3_NAME) + 1);
- return start + sizeof(CONFIG_APPNAME) + 1; + return start + sizeof(CONFIG_SMBIOS_TYPE3_NAME) + 1; }
/* Type 4 -- Processor Information */ @@ -228,9 +228,9 @@ smbios_init_type_4(void *start, unsigned int cpu_number)
snprintf((char*)start, 6, "CPU%2x", cpu_number); start += 6; - memcpy((char *)start, CONFIG_APPNAME"\0\0", sizeof(CONFIG_APPNAME) + 1); + memcpy((char *)start, CONFIG_SMBIOS_CPU_NAME"\0\0", sizeof(CONFIG_SMBIOS_CPU_NAME) + 1);
- return start + sizeof(CONFIG_APPNAME) + 1; + return start + sizeof(CONFIG_SMBIOS_CPU_NAME) + 1; }
/* Type 16 -- Physical Memory Array */
On 6/18/10 10:19 PM, Eduardo Habkost wrote:
Instead of using the same string for every field, let those fields to be set individually on config.h
The current default value is kept (CONFIG_APPNAME), but it should allow fine-tuned configuration at build-time on config.h.
Signed-off-by: Eduardo Habkost ehabkost@redhat.com
Out of curiosity: What's the use case?
Stefan
On Sat, Jun 19, 2010 at 11:09:08AM +0200, Stefan Reinauer wrote:
On 6/18/10 10:19 PM, Eduardo Habkost wrote:
Instead of using the same string for every field, let those fields to be set individually on config.h
The current default value is kept (CONFIG_APPNAME), but it should allow fine-tuned configuration at build-time on config.h.
Signed-off-by: Eduardo Habkost ehabkost@redhat.com
Out of curiosity: What's the use case?
Basically it is to give better vendor/product information on the smbios tags for KVM virtual machines running on RHEL hosts. The most relevant field for me is the BIOS name/version field on smbios, that can be used to identify the specific SeaBIOS build being used, but I also want to set better defaults for the other fields, in case they are not explicitly set by the Qemu process.
On my case, I don't plan to customize all the defines: some smbios fields and the ACPI stuff was added just for completeness. The rationale is that CONFIG_APPNAME is useful, but it affects too many different fields, so I am making the existing config option a bit more flexible.
On Mon, Jun 21, 2010 at 10:28:18AM -0300, Eduardo Habkost wrote:
On Sat, Jun 19, 2010 at 11:09:08AM +0200, Stefan Reinauer wrote:
On 6/18/10 10:19 PM, Eduardo Habkost wrote:
Instead of using the same string for every field, let those fields to be set individually on config.h
The current default value is kept (CONFIG_APPNAME), but it should allow fine-tuned configuration at build-time on config.h.
Signed-off-by: Eduardo Habkost ehabkost@redhat.com
Out of curiosity: What's the use case?
Basically it is to give better vendor/product information on the smbios tags for KVM virtual machines running on RHEL hosts. The most relevant field for me is the BIOS name/version field on smbios, that can be used to identify the specific SeaBIOS build being used, but I also want to set better defaults for the other fields, in case they are not explicitly set by the Qemu process.
On my case, I don't plan to customize all the defines: some smbios fields and the ACPI stuff was added just for completeness. The rationale is that CONFIG_APPNAME is useful, but it affects too many different fields, so I am making the existing config option a bit more flexible.
Which fields do you need to customize, and what problem are you running into if they aren't changed?
-Kevin
On Mon, Jun 21, 2010 at 10:54:14PM -0400, Kevin O'Connor wrote:
On Mon, Jun 21, 2010 at 10:28:18AM -0300, Eduardo Habkost wrote:
On Sat, Jun 19, 2010 at 11:09:08AM +0200, Stefan Reinauer wrote:
On 6/18/10 10:19 PM, Eduardo Habkost wrote:
Instead of using the same string for every field, let those fields to be set individually on config.h
The current default value is kept (CONFIG_APPNAME), but it should allow fine-tuned configuration at build-time on config.h.
Signed-off-by: Eduardo Habkost ehabkost@redhat.com
Out of curiosity: What's the use case?
Basically it is to give better vendor/product information on the smbios tags for KVM virtual machines running on RHEL hosts. The most relevant field for me is the BIOS name/version field on smbios, that can be used to identify the specific SeaBIOS build being used, but I also want to set better defaults for the other fields, in case they are not explicitly set by the Qemu process.
On my case, I don't plan to customize all the defines: some smbios fields and the ACPI stuff was added just for completeness. The rationale is that CONFIG_APPNAME is useful, but it affects too many different fields, so I am making the existing config option a bit more flexible.
Which fields do you need to customize, and what problem are you running into if they aren't changed?
The Bios Information and System Information fields are the most important to me.
There are some software that use those fields to identify if the system as a KVM virtual machine running inside a Red Hat host. Anyway, support reasons are stronger than specific software problems: users and support people can use the smbios information to identify on which kind of system the operating system is running, and seeing "Bios: seabios; Vendor: Red Hat; Product: KVM" is more informative than seeing "Qemu" or "Bochs" on every field.
Long term, Qemu may load its own table and/or set their own fields through the paravirt interface. This is something to help setting defaults for users who don't specify those values on the Qemu command-line (and have a Qemu version that doesn't set default values unless explicitly specified).