900-v4.18-firmware-dmi-Add-access-to-the-SKU-ID-string.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From b23908d3c48a37c46c6a26df2cdeab1610b360ba Mon Sep 17 00:00:00 2001
  2. From: Simon Glass <sjg@chromium.org>
  3. Date: Sun, 17 Jun 2018 14:09:42 +0200
  4. Subject: [PATCH] firmware: dmi: Add access to the SKU ID string
  5. This is used in some systems from user space for determining the identity
  6. of the device.
  7. Expose this as a file so that that user-space tools don't need to read
  8. from /sys/firmware/dmi/tables/DMI
  9. Signed-off-by: Simon Glass <sjg@chromium.org>
  10. Signed-off-by: Jean Delvare <jdelvare@suse.de>
  11. ---
  12. drivers/firmware/dmi-id.c | 2 ++
  13. drivers/firmware/dmi_scan.c | 1 +
  14. include/linux/mod_devicetable.h | 1 +
  15. 3 files changed, 4 insertions(+)
  16. --- a/drivers/firmware/dmi-id.c
  17. +++ b/drivers/firmware/dmi-id.c
  18. @@ -47,6 +47,7 @@ DEFINE_DMI_ATTR_WITH_SHOW(product_name,
  19. DEFINE_DMI_ATTR_WITH_SHOW(product_version, 0444, DMI_PRODUCT_VERSION);
  20. DEFINE_DMI_ATTR_WITH_SHOW(product_serial, 0400, DMI_PRODUCT_SERIAL);
  21. DEFINE_DMI_ATTR_WITH_SHOW(product_uuid, 0400, DMI_PRODUCT_UUID);
  22. +DEFINE_DMI_ATTR_WITH_SHOW(product_sku, 0444, DMI_PRODUCT_SKU);
  23. DEFINE_DMI_ATTR_WITH_SHOW(product_family, 0444, DMI_PRODUCT_FAMILY);
  24. DEFINE_DMI_ATTR_WITH_SHOW(board_vendor, 0444, DMI_BOARD_VENDOR);
  25. DEFINE_DMI_ATTR_WITH_SHOW(board_name, 0444, DMI_BOARD_NAME);
  26. @@ -193,6 +194,7 @@ static void __init dmi_id_init_attr_tabl
  27. ADD_DMI_ATTR(product_serial, DMI_PRODUCT_SERIAL);
  28. ADD_DMI_ATTR(product_uuid, DMI_PRODUCT_UUID);
  29. ADD_DMI_ATTR(product_family, DMI_PRODUCT_FAMILY);
  30. + ADD_DMI_ATTR(product_sku, DMI_PRODUCT_SKU);
  31. ADD_DMI_ATTR(board_vendor, DMI_BOARD_VENDOR);
  32. ADD_DMI_ATTR(board_name, DMI_BOARD_NAME);
  33. ADD_DMI_ATTR(board_version, DMI_BOARD_VERSION);
  34. --- a/drivers/firmware/dmi_scan.c
  35. +++ b/drivers/firmware/dmi_scan.c
  36. @@ -435,6 +435,7 @@ static void __init dmi_decode(const stru
  37. dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
  38. dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7);
  39. dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8);
  40. + dmi_save_ident(dm, DMI_PRODUCT_SKU, 25);
  41. dmi_save_ident(dm, DMI_PRODUCT_FAMILY, 26);
  42. break;
  43. case 2: /* Base Board Information */
  44. --- a/include/linux/mod_devicetable.h
  45. +++ b/include/linux/mod_devicetable.h
  46. @@ -471,6 +471,7 @@ enum dmi_field {
  47. DMI_PRODUCT_VERSION,
  48. DMI_PRODUCT_SERIAL,
  49. DMI_PRODUCT_UUID,
  50. + DMI_PRODUCT_SKU,
  51. DMI_PRODUCT_FAMILY,
  52. DMI_BOARD_VENDOR,
  53. DMI_BOARD_NAME,