From: VIVEK KUMAR CHAUBEY <vivek.kumar.chaubey@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: andrew.cooper3@citrix.com,
Vivek Kumar Chaubey <vivekkumar.chaubey@citrix.com>
Subject: [PATCH v3] hvmloader: support system enclosure asset tag (SMBIOS type 3)
Date: Mon, 21 Aug 2017 12:49:38 +0100 [thread overview]
Message-ID: <1503316178-15058-1-git-send-email-vivekkumar.chaubey@citrix.com> (raw)
From: Vivek Kumar Chaubey <vivekkumar.chaubey@citrix.com>
Allow setting system enclosure asset tag for HVM guest. Guest OS can
check and perform desired operation like support installation.
Also added documentation of '~/bios-string/*' xenstore keys into
docs/misc/xenstore-paths.markdown
Signed-off-by: Vivek Kumar Chaubey <vivekkumar.chaubey@citrix.com>
---
Changes since v2(Review changes):
* Remove style changes to existing lines
* Add documentation for xenstore keys '~/bios-strings/*' to
docs/misc/xenstore-paths.markdown
---
docs/misc/xenstore-paths.markdown | 22 ++++++++++++++++++++++
tools/firmware/hvmloader/smbios.c | 14 +++++++++++---
xen/include/public/hvm/hvm_xs_strings.h | 1 +
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/docs/misc/xenstore-paths.markdown b/docs/misc/xenstore-paths.markdown
index 6c80a9e..92258fa 100644
--- a/docs/misc/xenstore-paths.markdown
+++ b/docs/misc/xenstore-paths.markdown
@@ -211,6 +211,28 @@ will not relocate guest memory.
The BIOS used by this domain.
+#### ~/bios-strings/bios-vendor = STRING [HVM,INTERNAL]
+#### ~/bios-strings/bios-version = STRING [HVM,INTERNAL]
+#### ~/bios-strings/system-manufacturer = STRING [HVM,INTERNAL]
+#### ~/bios-strings/system-product-name = STRING [HVM,INTERNAL]
+#### ~/bios-strings/system-version = STRING [HVM,INTERNAL]
+#### ~/bios-strings/system-serial-number = STRING [HVM,INTERNAL]
+#### ~/bios-strings/enclosure-manufacturer = STRING [HVM,INTERNAL]
+#### ~/bios-strings/enclosure-serial-number = STRING [HVM,INTERNAL]
+#### ~/bios-strings/enclosure-asset-tag = STRING [HVM,INTERNAL]
+#### ~/bios-strings/battery-manufacturer = STRING [HVM,INTERNAL]
+#### ~/bios-strings/battery-device-name = STRING [HVM,INTERNAL]
+
+These xenstore values are used to override some of the default string
+values in the SMBIOS table constructed in hvmloader. See the SMBIOS
+table specification at http://www.dmtf.org/standards/smbios/
+
+#### ~/bios-strings/oem-* = STRING [HVM,INTERNAL]
+
+1 to 99 OEM strings can be set in xenstore using values of the form
+'~/bios-strings/oem-1' to '~/bios-strings/oem-99'. These strings will be
+loaded into the SMBIOS type 11 structure.
+
#### ~/platform/* = ("0"|"1") [HVM,INTERNAL]
Various boolean platform properties.
diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c
index 210c7b0..154747d 100644
--- a/tools/firmware/hvmloader/smbios.c
+++ b/tools/firmware/hvmloader/smbios.c
@@ -531,6 +531,7 @@ smbios_type_3_init(void *start)
const char *s;
void *pts;
uint32_t length;
+ uint32_t counter = 0;
pts = get_smbios_pt_struct(3, &length);
if ( (pts != NULL)&&(length > 0) )
@@ -546,7 +547,7 @@ smbios_type_3_init(void *start)
p->header.length = sizeof(struct smbios_type_3);
p->header.handle = SMBIOS_HANDLE_TYPE3;
- p->manufacturer_str = 1;
+ p->manufacturer_str = ++counter;
p->type = 0x01; /* other */
p->version_str = 0;
p->serial_number_str = 0;
@@ -562,13 +563,20 @@ smbios_type_3_init(void *start)
strcpy((char *)start, s);
start += strlen(s) + 1;
- /* No internal defaults for this if the value is not set */
+ /* No internal defaults for following ones if the value is not set */
s = xenstore_read(HVM_XS_ENCLOSURE_SERIAL_NUMBER, NULL);
if ( (s != NULL)&&(*s != '\0') )
{
strcpy((char *)start, s);
start += strlen(s) + 1;
- p->serial_number_str = 2;
+ p->serial_number_str = ++counter;
+ }
+ s = xenstore_read(HVM_XS_ENCLOSURE_ASSET_TAG, NULL);
+ if ( (s != NULL) && (*s != '\0') )
+ {
+ strcpy(start, s);
+ start += strlen(s) + 1;
+ p->asset_tag_str = ++counter;
}
*((uint8_t *)start) = 0;
diff --git a/xen/include/public/hvm/hvm_xs_strings.h b/xen/include/public/hvm/hvm_xs_strings.h
index 146b0b0..fea1dd4 100644
--- a/xen/include/public/hvm/hvm_xs_strings.h
+++ b/xen/include/public/hvm/hvm_xs_strings.h
@@ -71,6 +71,7 @@
#define HVM_XS_SYSTEM_SERIAL_NUMBER "bios-strings/system-serial-number"
#define HVM_XS_ENCLOSURE_MANUFACTURER "bios-strings/enclosure-manufacturer"
#define HVM_XS_ENCLOSURE_SERIAL_NUMBER "bios-strings/enclosure-serial-number"
+#define HVM_XS_ENCLOSURE_ASSET_TAG "bios-strings/enclosure-asset-tag"
#define HVM_XS_BATTERY_MANUFACTURER "bios-strings/battery-manufacturer"
#define HVM_XS_BATTERY_DEVICE_NAME "bios-strings/battery-device-name"
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-08-21 11:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 11:49 VIVEK KUMAR CHAUBEY [this message]
2017-08-22 11:02 ` [PATCH v3] hvmloader: support system enclosure asset tag (SMBIOS type 3) Roger Pau Monné
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1503316178-15058-1-git-send-email-vivekkumar.chaubey@citrix.com \
--to=vivek.kumar.chaubey@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=vivekkumar.chaubey@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).