ACPI: Switch to use generic guid_t in acpi_evaluate_dsm()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 5 Jun 2017 16:40:46 +0000 (19:40 +0300)
committerChristoph Hellwig <hch@lst.de>
Wed, 7 Jun 2017 10:20:49 +0000 (12:20 +0200)
acpi_evaluate_dsm() and friends take a pointer to a raw buffer of 16
bytes. Instead we convert them to use guid_t type. At the same time we
convert current users.

acpi_str_to_uuid() becomes useless after the conversion and it's safe to
get rid of it.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Cc: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
26 files changed:
drivers/acpi/acpi_extlog.c
drivers/acpi/bus.c
drivers/acpi/nfit/core.c
drivers/acpi/utils.c
drivers/char/tpm/tpm_crb.c
drivers/char/tpm/tpm_ppi.c
drivers/gpu/drm/i915/intel_acpi.c
drivers/gpu/drm/nouveau/nouveau_acpi.c
drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
drivers/hid/i2c-hid/i2c-hid.c
drivers/iommu/dmar.c
drivers/mmc/host/sdhci-pci-core.c
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
drivers/pci/pci-acpi.c
drivers/pci/pci-label.c
drivers/usb/dwc3/dwc3-pci.c
drivers/usb/host/xhci-pci.c
drivers/usb/misc/ucsi.c
drivers/usb/typec/typec_wcove.c
include/acpi/acpi_bus.h
include/linux/acpi.h
include/linux/pci-acpi.h
sound/soc/intel/skylake/skl-nhlt.c
tools/testing/nvdimm/test/iomap.c
tools/testing/nvdimm/test/nfit.c
tools/testing/nvdimm/test/nfit_test.h

index 193529417cc3e13dfce591a74ea51c1ebd020602..560fdae8cc59015d78b13a73b377343e96495257 100644 (file)
@@ -190,9 +190,9 @@ static bool __init extlog_get_l1addr(void)
                return false;
        if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
                return false;
-       if (!acpi_check_dsm(handle, guid.b, EXTLOG_DSM_REV, 1 << EXTLOG_FN_ADDR))
+       if (!acpi_check_dsm(handle, &guid, EXTLOG_DSM_REV, 1 << EXTLOG_FN_ADDR))
                return false;
-       obj = acpi_evaluate_dsm_typed(handle, guid.b, EXTLOG_DSM_REV,
+       obj = acpi_evaluate_dsm_typed(handle, &guid, EXTLOG_DSM_REV,
                                      EXTLOG_FN_ADDR, NULL, ACPI_TYPE_INTEGER);
        if (!obj) {
                return false;
index 042cd16265b319eb55b62714d424729bd6e029d0..5a6fbe0fcaf2b82db279c40bd031abac2b4b6125 100644 (file)
@@ -196,29 +196,6 @@ static void acpi_print_osc_error(acpi_handle handle,
        pr_debug("\n");
 }
 
-acpi_status acpi_str_to_uuid(char *str, u8 *uuid)
-{
-       int i;
-       static int opc_map_to_uuid[16] = {6, 4, 2, 0, 11, 9, 16, 14, 19, 21,
-               24, 26, 28, 30, 32, 34};
-
-       if (strlen(str) != 36)
-               return AE_BAD_PARAMETER;
-       for (i = 0; i < 36; i++) {
-               if (i == 8 || i == 13 || i == 18 || i == 23) {
-                       if (str[i] != '-')
-                               return AE_BAD_PARAMETER;
-               } else if (!isxdigit(str[i]))
-                       return AE_BAD_PARAMETER;
-       }
-       for (i = 0; i < 16; i++) {
-               uuid[i] = hex_to_bin(str[opc_map_to_uuid[i]]) << 4;
-               uuid[i] |= hex_to_bin(str[opc_map_to_uuid[i] + 1]);
-       }
-       return AE_OK;
-}
-EXPORT_SYMBOL_GPL(acpi_str_to_uuid);
-
 acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
 {
        acpi_status status;
index d9b39d0e9d6ac2def35174ae74dd8217a1172725..097eff0b963d5b6d1685809a16980efeaf406975 100644 (file)
@@ -289,7 +289,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
                        in_buf.buffer.pointer,
                        min_t(u32, 256, in_buf.buffer.length), true);
 
-       out_obj = acpi_evaluate_dsm(handle, guid.b, 1, func, &in_obj);
+       out_obj = acpi_evaluate_dsm(handle, guid, 1, func, &in_obj);
        if (!out_obj) {
                dev_dbg(dev, "%s:%s _DSM failed cmd: %s\n", __func__, dimm_name,
                                cmd_name);
@@ -1476,7 +1476,7 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
 
        guid = to_nfit_uuid(nfit_mem->family);
        for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
-               if (acpi_check_dsm(adev_dimm->handle, guid.b, 1, 1ULL << i))
+               if (acpi_check_dsm(adev_dimm->handle, guid, 1, 1ULL << i))
                        set_bit(i, &nfit_mem->dsm_mask);
 
        return 0;
@@ -1621,7 +1621,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
                return;
 
        for (i = ND_CMD_ARS_CAP; i <= ND_CMD_CLEAR_ERROR; i++)
-               if (acpi_check_dsm(adev->handle, guid.b, 1, 1ULL << i))
+               if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
                        set_bit(i, &nd_desc->cmd_mask);
 }
 
index 27d0dcfcf47d6895a0f05963152172f87da0e7c8..b9d956c916f5e65ca737b5c02c45d266c65e00d1 100644 (file)
@@ -613,19 +613,19 @@ acpi_status acpi_evaluate_lck(acpi_handle handle, int lock)
 /**
  * acpi_evaluate_dsm - evaluate device's _DSM method
  * @handle: ACPI device handle
- * @uuid: UUID of requested functions, should be 16 bytes
+ * @guid: GUID of requested functions, should be 16 bytes
  * @rev: revision number of requested function
  * @func: requested function number
  * @argv4: the function specific parameter
  *
- * Evaluate device's _DSM method with specified UUID, revision id and
+ * Evaluate device's _DSM method with specified GUID, revision id and
  * function number. Caller needs to free the returned object.
  *
  * Though ACPI defines the fourth parameter for _DSM should be a package,
  * some old BIOSes do expect a buffer or an integer etc.
  */
 union acpi_object *
-acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 func,
+acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
                  union acpi_object *argv4)
 {
        acpi_status ret;
@@ -638,7 +638,7 @@ acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 func,
 
        params[0].type = ACPI_TYPE_BUFFER;
        params[0].buffer.length = 16;
-       params[0].buffer.pointer = (char *)uuid;
+       params[0].buffer.pointer = (u8 *)guid;
        params[1].type = ACPI_TYPE_INTEGER;
        params[1].integer.value = rev;
        params[2].type = ACPI_TYPE_INTEGER;
@@ -666,7 +666,7 @@ EXPORT_SYMBOL(acpi_evaluate_dsm);
 /**
  * acpi_check_dsm - check if _DSM method supports requested functions.
  * @handle: ACPI device handle
- * @uuid: UUID of requested functions, should be 16 bytes at least
+ * @guid: GUID of requested functions, should be 16 bytes at least
  * @rev: revision number of requested functions
  * @funcs: bitmap of requested functions
  *
@@ -674,7 +674,7 @@ EXPORT_SYMBOL(acpi_evaluate_dsm);
  * functions. Currently only support 64 functions at maximum, should be
  * enough for now.
  */
-bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
+bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs)
 {
        int i;
        u64 mask = 0;
@@ -683,7 +683,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
        if (funcs == 0)
                return false;
 
-       obj = acpi_evaluate_dsm(handle, uuid, rev, 0, NULL);
+       obj = acpi_evaluate_dsm(handle, guid, rev, 0, NULL);
        if (!obj)
                return false;
 
@@ -697,7 +697,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
 
        /*
         * Bit 0 indicates whether there's support for any functions other than
-        * function 0 for the specified UUID and revision.
+        * function 0 for the specified GUID and revision.
         */
        if ((mask & 0x1) && (mask & funcs) == funcs)
                return true;
index b917b9d5f71021fcc433e6ca4e1552974750f237..c378c7b15d497a1c153b45892e572410c1898b42 100644 (file)
 
 #define ACPI_SIG_TPM2 "TPM2"
 
-static const u8 CRB_ACPI_START_UUID[] = {
-       /* 0000 */ 0xAB, 0x6C, 0xBF, 0x6B, 0x63, 0x54, 0x14, 0x47,
-       /* 0008 */ 0xB7, 0xCD, 0xF0, 0x20, 0x3C, 0x03, 0x68, 0xD4
-};
+static const guid_t crb_acpi_start_guid =
+       GUID_INIT(0x6BBF6CAB, 0x5463, 0x4714,
+                 0xB7, 0xCD, 0xF0, 0x20, 0x3C, 0x03, 0x68, 0xD4);
 
 enum crb_defaults {
        CRB_ACPI_START_REVISION_ID = 1,
@@ -266,7 +265,7 @@ static int crb_do_acpi_start(struct tpm_chip *chip)
        int rc;
 
        obj = acpi_evaluate_dsm(chip->acpi_dev_handle,
-                               CRB_ACPI_START_UUID,
+                               &crb_acpi_start_guid,
                                CRB_ACPI_START_REVISION_ID,
                                CRB_ACPI_START_INDEX,
                                NULL);
index 692a2c6ae036635da19ce4427aa86aacf6bef8d5..86dd8521feef5e2d2ee0ef6392ea3a0d13875d39 100644 (file)
 #define PPI_VS_REQ_START       128
 #define PPI_VS_REQ_END         255
 
-static const u8 tpm_ppi_uuid[] = {
-       0xA6, 0xFA, 0xDD, 0x3D,
-       0x1B, 0x36,
-       0xB4, 0x4E,
-       0xA4, 0x24,
-       0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53
-};
+static const guid_t tpm_ppi_guid =
+       GUID_INIT(0x3DDDFAA6, 0x361B, 0x4EB4,
+                 0xA4, 0x24, 0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53);
 
 static inline union acpi_object *
 tpm_eval_dsm(acpi_handle ppi_handle, int func, acpi_object_type type,
             union acpi_object *argv4)
 {
        BUG_ON(!ppi_handle);
-       return acpi_evaluate_dsm_typed(ppi_handle, tpm_ppi_uuid,
+       return acpi_evaluate_dsm_typed(ppi_handle, &tpm_ppi_guid,
                                       TPM_PPI_REVISION_ID,
                                       func, argv4, type);
 }
@@ -107,7 +103,7 @@ static ssize_t tpm_store_ppi_request(struct device *dev,
         * is updated with function index from SUBREQ to SUBREQ2 since PPI
         * version 1.1
         */
-       if (acpi_check_dsm(chip->acpi_dev_handle, tpm_ppi_uuid,
+       if (acpi_check_dsm(chip->acpi_dev_handle, &tpm_ppi_guid,
                           TPM_PPI_REVISION_ID, 1 << TPM_PPI_FN_SUBREQ2))
                func = TPM_PPI_FN_SUBREQ2;
 
@@ -268,7 +264,7 @@ static ssize_t show_ppi_operations(acpi_handle dev_handle, char *buf, u32 start,
                "User not required",
        };
 
-       if (!acpi_check_dsm(dev_handle, tpm_ppi_uuid, TPM_PPI_REVISION_ID,
+       if (!acpi_check_dsm(dev_handle, &tpm_ppi_guid, TPM_PPI_REVISION_ID,
                            1 << TPM_PPI_FN_GETOPR))
                return -EPERM;
 
@@ -341,12 +337,12 @@ void tpm_add_ppi(struct tpm_chip *chip)
        if (!chip->acpi_dev_handle)
                return;
 
-       if (!acpi_check_dsm(chip->acpi_dev_handle, tpm_ppi_uuid,
+       if (!acpi_check_dsm(chip->acpi_dev_handle, &tpm_ppi_guid,
                            TPM_PPI_REVISION_ID, 1 << TPM_PPI_FN_VERSION))
                return;
 
        /* Cache PPI version string. */
-       obj = acpi_evaluate_dsm_typed(chip->acpi_dev_handle, tpm_ppi_uuid,
+       obj = acpi_evaluate_dsm_typed(chip->acpi_dev_handle, &tpm_ppi_guid,
                                      TPM_PPI_REVISION_ID, TPM_PPI_FN_VERSION,
                                      NULL, ACPI_TYPE_STRING);
        if (obj) {
index eb638a1e69d20c985263398e89928d218d30531e..42fb436f6cdc9dc410681d4af0d5f4148b58dc07 100644 (file)
@@ -15,13 +15,9 @@ static struct intel_dsm_priv {
        acpi_handle dhandle;
 } intel_dsm_priv;
 
-static const u8 intel_dsm_guid[] = {
-       0xd3, 0x73, 0xd8, 0x7e,
-       0xd0, 0xc2,
-       0x4f, 0x4e,
-       0xa8, 0x54,
-       0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c
-};
+static const guid_t intel_dsm_guid =
+       GUID_INIT(0x7ed873d3, 0xc2d0, 0x4e4f,
+                 0xa8, 0x54, 0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c);
 
 static char *intel_dsm_port_name(u8 id)
 {
@@ -80,7 +76,7 @@ static void intel_dsm_platform_mux_info(void)
        int i;
        union acpi_object *pkg, *connector_count;
 
-       pkg = acpi_evaluate_dsm_typed(intel_dsm_priv.dhandle, intel_dsm_guid,
+       pkg = acpi_evaluate_dsm_typed(intel_dsm_priv.dhandle, &intel_dsm_guid,
                        INTEL_DSM_REVISION_ID, INTEL_DSM_FN_PLATFORM_MUX_INFO,
                        NULL, ACPI_TYPE_PACKAGE);
        if (!pkg) {
@@ -118,7 +114,7 @@ static bool intel_dsm_pci_probe(struct pci_dev *pdev)
        if (!dhandle)
                return false;
 
-       if (!acpi_check_dsm(dhandle, intel_dsm_guid, INTEL_DSM_REVISION_ID,
+       if (!acpi_check_dsm(dhandle, &intel_dsm_guid, INTEL_DSM_REVISION_ID,
                            1 << INTEL_DSM_FN_PLATFORM_MUX_INFO)) {
                DRM_DEBUG_KMS("no _DSM method for intel device\n");
                return false;
index 39468c2180277618caddceb0681d1bdd39f53140..7459ef9943ec10bb2925854e9a11378b2e093bf7 100644 (file)
@@ -60,15 +60,13 @@ bool nouveau_is_v1_dsm(void) {
 }
 
 #ifdef CONFIG_VGA_SWITCHEROO
-static const char nouveau_dsm_muid[] = {
-       0xA0, 0xA0, 0x95, 0x9D, 0x60, 0x00, 0x48, 0x4D,
-       0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4,
-};
+static const guid_t nouveau_dsm_muid =
+       GUID_INIT(0x9D95A0A0, 0x0060, 0x4D48,
+                 0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4);
 
-static const char nouveau_op_dsm_muid[] = {
-       0xF8, 0xD8, 0x86, 0xA4, 0xDA, 0x0B, 0x1B, 0x47,
-       0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0,
-};
+static const guid_t nouveau_op_dsm_muid =
+       GUID_INIT(0xA486D8F8, 0x0BDA, 0x471B,
+                 0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0);
 
 static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
 {
@@ -86,7 +84,7 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
                args_buff[i] = (arg >> i * 8) & 0xFF;
 
        *result = 0;
-       obj = acpi_evaluate_dsm_typed(handle, nouveau_op_dsm_muid, 0x00000100,
+       obj = acpi_evaluate_dsm_typed(handle, &nouveau_op_dsm_muid, 0x00000100,
                                      func, &argv4, ACPI_TYPE_BUFFER);
        if (!obj) {
                acpi_handle_info(handle, "failed to evaluate _DSM\n");
@@ -138,7 +136,7 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg)
                .integer.value = arg,
        };
 
-       obj = acpi_evaluate_dsm_typed(handle, nouveau_dsm_muid, 0x00000102,
+       obj = acpi_evaluate_dsm_typed(handle, &nouveau_dsm_muid, 0x00000102,
                                      func, &argv4, ACPI_TYPE_INTEGER);
        if (!obj) {
                acpi_handle_info(handle, "failed to evaluate _DSM\n");
@@ -259,7 +257,7 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out
        if (!acpi_has_method(dhandle, "_DSM"))
                return;
 
-       supports_mux = acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
+       supports_mux = acpi_check_dsm(dhandle, &nouveau_dsm_muid, 0x00000102,
                                      1 << NOUVEAU_DSM_POWER);
        optimus_funcs = nouveau_dsm_get_optimus_functions(dhandle);
 
index e3e2f5e838152bfc5f6f0eaa6b6b4fe1cbc15a84..f44682d62f750dcb5311505f67dc8691472e6463 100644 (file)
@@ -81,10 +81,9 @@ mxm_shadow_dsm(struct nvkm_mxm *mxm, u8 version)
 {
        struct nvkm_subdev *subdev = &mxm->subdev;
        struct nvkm_device *device = subdev->device;
-       static char muid[] = {
-               0x00, 0xA4, 0x04, 0x40, 0x7D, 0x91, 0xF2, 0x4C,
-               0xB8, 0x9C, 0x79, 0xB6, 0x2F, 0xD5, 0x56, 0x65
-       };
+       static guid_t muid =
+               GUID_INIT(0x4004A400, 0x917D, 0x4CF2,
+                         0xB8, 0x9C, 0x79, 0xB6, 0x2F, 0xD5, 0x56, 0x65);
        u32 mxms_args[] = { 0x00000000 };
        union acpi_object argv4 = {
                .buffer.type = ACPI_TYPE_BUFFER,
@@ -105,7 +104,7 @@ mxm_shadow_dsm(struct nvkm_mxm *mxm, u8 version)
         * unless you pass in exactly the version it supports..
         */
        rev = (version & 0xf0) << 4 | (version & 0x0f);
-       obj = acpi_evaluate_dsm(handle, muid, rev, 0x00000010, &argv4);
+       obj = acpi_evaluate_dsm(handle, &muid, rev, 0x00000010, &argv4);
        if (!obj) {
                nvkm_debug(subdev, "DSM MXMS failed\n");
                return false;
index fb55fb4c39fcfecaca55c0b8720d28d2f9717678..04015032a35a204b10593f71faac6812b82e45e8 100644 (file)
@@ -872,10 +872,9 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
 static int i2c_hid_acpi_pdata(struct i2c_client *client,
                struct i2c_hid_platform_data *pdata)
 {
-       static u8 i2c_hid_guid[] = {
-               0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45,
-               0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE,
-       };
+       static guid_t i2c_hid_guid =
+               GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
+                         0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
        union acpi_object *obj;
        struct acpi_device *adev;
        acpi_handle handle;
@@ -884,7 +883,7 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
        if (!handle || acpi_bus_get_device(handle, &adev))
                return -ENODEV;
 
-       obj = acpi_evaluate_dsm_typed(handle, i2c_hid_guid, 1, 1, NULL,
+       obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL,
                                      ACPI_TYPE_INTEGER);
        if (!obj) {
                dev_err(&client->dev, "device _DSM execution failed\n");
index cbf7763d8091035deb45d2c36a7fc7201e6b4ab0..c8b0329c85d2801e1cd99c74c9959f03ee1790d2 100644 (file)
@@ -1808,10 +1808,9 @@ IOMMU_INIT_POST(detect_intel_iommu);
  * for Directed-IO Architecture Specifiction, Rev 2.2, Section 8.8
  * "Remapping Hardware Unit Hot Plug".
  */
-static u8 dmar_hp_uuid[] = {
-       /* 0000 */    0xA6, 0xA3, 0xC1, 0xD8, 0x9B, 0xBE, 0x9B, 0x4C,
-       /* 0008 */    0x91, 0xBF, 0xC3, 0xCB, 0x81, 0xFC, 0x5D, 0xAF
-};
+static guid_t dmar_hp_guid =
+       GUID_INIT(0xD8C1A3A6, 0xBE9B, 0x4C9B,
+                 0x91, 0xBF, 0xC3, 0xCB, 0x81, 0xFC, 0x5D, 0xAF);
 
 /*
  * Currently there's only one revision and BIOS will not check the revision id,
@@ -1824,7 +1823,7 @@ static u8 dmar_hp_uuid[] = {
 
 static inline bool dmar_detect_dsm(acpi_handle handle, int func)
 {
-       return acpi_check_dsm(handle, dmar_hp_uuid, DMAR_DSM_REV_ID, 1 << func);
+       return acpi_check_dsm(handle, &dmar_hp_guid, DMAR_DSM_REV_ID, 1 << func);
 }
 
 static int dmar_walk_dsm_resource(acpi_handle handle, int func,
@@ -1843,7 +1842,7 @@ static int dmar_walk_dsm_resource(acpi_handle handle, int func,
        if (!dmar_detect_dsm(handle, func))
                return 0;
 
-       obj = acpi_evaluate_dsm_typed(handle, dmar_hp_uuid, DMAR_DSM_REV_ID,
+       obj = acpi_evaluate_dsm_typed(handle, &dmar_hp_guid, DMAR_DSM_REV_ID,
                                      func, NULL, ACPI_TYPE_BUFFER);
        if (!obj)
                return -ENODEV;
index 92fc3f7c538d73e9e496aacfeae45f37cd3c1a96..9577beb278e7d51fc1ed08db0f52053abebec1ec 100644 (file)
@@ -404,10 +404,9 @@ struct intel_host {
        bool    d3_retune;
 };
 
-const u8 intel_dsm_uuid[] = {
-       0xA5, 0x3E, 0xC1, 0xF6, 0xCD, 0x65, 0x1F, 0x46,
-       0xAB, 0x7A, 0x29, 0xF7, 0xE8, 0xD5, 0xBD, 0x61,
-};
+const guid_t intel_dsm_guid =
+       GUID_INIT(0xF6C13EA5, 0x65CD, 0x461F,
+                 0xAB, 0x7A, 0x29, 0xF7, 0xE8, 0xD5, 0xBD, 0x61);
 
 static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
                       unsigned int fn, u32 *result)
@@ -416,7 +415,7 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
        int err = 0;
        size_t len;
 
-       obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), intel_dsm_uuid, 0, fn, NULL);
+       obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL);
        if (!obj)
                return -EOPNOTSUPP;
 
index e13aa064a8e943da7c9538e88bc425f299e944ca..6b15a507999c42749165482aa5e7d26a4d3dcf1c 100644 (file)
@@ -29,10 +29,9 @@ enum _dsm_rst_type {
        HNS_ROCE_RESET_FUNC     = 0x7,
 };
 
-const u8 hns_dsaf_acpi_dsm_uuid[] = {
-       0x1A, 0xAA, 0x85, 0x1A, 0x93, 0xE2, 0x5E, 0x41,
-       0x8E, 0x28, 0x8D, 0x69, 0x0A, 0x0F, 0x82, 0x0A
-};
+const guid_t hns_dsaf_acpi_dsm_guid =
+       GUID_INIT(0x1A85AA1A, 0xE293, 0x415E,
+                 0x8E, 0x28, 0x8D, 0x69, 0x0A, 0x0F, 0x82, 0x0A);
 
 static void dsaf_write_sub(struct dsaf_device *dsaf_dev, u32 reg, u32 val)
 {
@@ -151,7 +150,7 @@ static void hns_dsaf_acpi_srst_by_port(struct dsaf_device *dsaf_dev, u8 op_type,
        argv4.package.elements = obj_args;
 
        obj = acpi_evaluate_dsm(ACPI_HANDLE(dsaf_dev->dev),
-                               hns_dsaf_acpi_dsm_uuid, 0, op_type, &argv4);
+                               &hns_dsaf_acpi_dsm_guid, 0, op_type, &argv4);
        if (!obj) {
                dev_warn(dsaf_dev->dev, "reset port_type%d port%d fail!",
                         port_type, port);
@@ -434,7 +433,7 @@ static phy_interface_t hns_mac_get_phy_if_acpi(struct hns_mac_cb *mac_cb)
        argv4.package.elements = &obj_args,
 
        obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
-                               hns_dsaf_acpi_dsm_uuid, 0,
+                               &hns_dsaf_acpi_dsm_guid, 0,
                                HNS_OP_GET_PORT_TYPE_FUNC, &argv4);
 
        if (!obj || obj->type != ACPI_TYPE_INTEGER)
@@ -474,7 +473,7 @@ int hns_mac_get_sfp_prsnt_acpi(struct hns_mac_cb *mac_cb, int *sfp_prsnt)
        argv4.package.elements = &obj_args,
 
        obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
-                               hns_dsaf_acpi_dsm_uuid, 0,
+                               &hns_dsaf_acpi_dsm_guid, 0,
                                HNS_OP_GET_SFP_STAT_FUNC, &argv4);
 
        if (!obj || obj->type != ACPI_TYPE_INTEGER)
@@ -565,7 +564,7 @@ hns_mac_config_sds_loopback_acpi(struct hns_mac_cb *mac_cb, bool en)
        argv4.package.elements = obj_args;
 
        obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dsaf_dev->dev),
-                               hns_dsaf_acpi_dsm_uuid, 0,
+                               &hns_dsaf_acpi_dsm_guid, 0,
                                HNS_OP_SERDES_LP_FUNC, &argv4);
        if (!obj) {
                dev_warn(mac_cb->dsaf_dev->dev, "set port%d serdes lp fail!",
index 001860361434623fcf84de1c2533df03835de8a0..47070cff508c4496e51060e1167d33d426ad1e93 100644 (file)
 #include "pci.h"
 
 /*
- * The UUID is defined in the PCI Firmware Specification available here:
+ * The GUID is defined in the PCI Firmware Specification available here:
  * https://www.pcisig.com/members/downloads/pcifw_r3_1_13Dec10.pdf
  */
-const u8 pci_acpi_dsm_uuid[] = {
-       0xd0, 0x37, 0xc9, 0xe5, 0x53, 0x35, 0x7a, 0x4d,
-       0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d
-};
+const guid_t pci_acpi_dsm_guid =
+       GUID_INIT(0xe5c937d0, 0x3553, 0x4d7a,
+                 0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d);
 
 #if defined(CONFIG_PCI_QUIRKS) && defined(CONFIG_ARM64)
 static int acpi_get_rc_addr(struct acpi_device *adev, struct resource *res)
@@ -680,7 +679,7 @@ void acpi_pci_add_bus(struct pci_bus *bus)
        if (!pci_is_root_bus(bus))
                return;
 
-       obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), pci_acpi_dsm_uuid, 3,
+       obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
                                RESET_DELAY_DSM, NULL);
        if (!obj)
                return;
@@ -745,7 +744,7 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
        if (bridge->ignore_reset_delay)
                pdev->d3cold_delay = 0;
 
-       obj = acpi_evaluate_dsm(handle, pci_acpi_dsm_uuid, 3,
+       obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3,
                                FUNCTION_DELAY_DSM, NULL);
        if (!obj)
                return;
index 51357377efbce65d4ad8454ffd678fc4df8de7a2..2d8db3ead6e82f91106db1ae883d354e2fdb5c71 100644 (file)
@@ -172,7 +172,7 @@ static int dsm_get_label(struct device *dev, char *buf,
        if (!handle)
                return -1;
 
-       obj = acpi_evaluate_dsm(handle, pci_acpi_dsm_uuid, 0x2,
+       obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 0x2,
                                DEVICE_LABEL_DSM, NULL);
        if (!obj)
                return -1;
@@ -212,7 +212,7 @@ static bool device_has_dsm(struct device *dev)
        if (!handle)
                return false;
 
-       return !!acpi_check_dsm(handle, pci_acpi_dsm_uuid, 0x2,
+       return !!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 0x2,
                                1 << DEVICE_LABEL_DSM);
 }
 
index 84a2cebfc712023182dbb4622cbc355b3545310d..fe851544d7fbaad82d3fdadc397da734d0a5bf4b 100644 (file)
@@ -42,7 +42,7 @@
 #define PCI_DEVICE_ID_INTEL_CNPLP              0x9dee
 #define PCI_DEVICE_ID_INTEL_CNPH               0xa36e
 
-#define PCI_INTEL_BXT_DSM_UUID         "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
+#define PCI_INTEL_BXT_DSM_GUID         "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
 #define PCI_INTEL_BXT_FUNC_PMU_PWR     4
 #define PCI_INTEL_BXT_STATE_D0         0
 #define PCI_INTEL_BXT_STATE_D3         3
  * struct dwc3_pci - Driver private structure
  * @dwc3: child dwc3 platform_device
  * @pci: our link to PCI bus
- * @uuid: _DSM UUID
+ * @guid: _DSM GUID
  * @has_dsm_for_pm: true for devices which need to run _DSM on runtime PM
  */
 struct dwc3_pci {
        struct platform_device *dwc3;
        struct pci_dev *pci;
 
-       u8 uuid[16];
+       guid_t guid;
 
        unsigned int has_dsm_for_pm:1;
 };
@@ -120,7 +120,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
 
                if (pdev->device == PCI_DEVICE_ID_INTEL_BXT ||
                                pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) {
-                       acpi_str_to_uuid(PCI_INTEL_BXT_DSM_UUID, dwc->uuid);
+                       guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid);
                        dwc->has_dsm_for_pm = true;
                }
 
@@ -292,7 +292,7 @@ static int dwc3_pci_dsm(struct dwc3_pci *dwc, int param)
        tmp.type = ACPI_TYPE_INTEGER;
        tmp.integer.value = param;
 
-       obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), dwc->uuid,
+       obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), &dwc->guid,
                        1, PCI_INTEL_BXT_FUNC_PMU_PWR, &argv4);
        if (!obj) {
                dev_err(&dwc->pci->dev, "failed to evaluate _DSM\n");
index fcf1f3f63e7af3d60a62675beddca912ac853428..4842be5687a738d2852af3643a8fee92d02341ca 100644 (file)
@@ -213,13 +213,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 #ifdef CONFIG_ACPI
 static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev)
 {
-       static const u8 intel_dsm_uuid[] = {
-               0xb7, 0x0c, 0x34, 0xac, 0x01, 0xe9, 0xbf, 0x45,
-               0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23,
-       };
+       static const guid_t intel_dsm_guid =
+               GUID_INIT(0xac340cb7, 0xe901, 0x45bf,
+                         0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23);
        union acpi_object *obj;
 
-       obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), intel_dsm_uuid, 3, 1,
+       obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), &intel_dsm_guid, 3, 1,
                                NULL);
        ACPI_FREE(obj);
 }
index 07397bddefa3b76fc0a5e0fbd68ad9d9bb8e8ea8..81251aaa20f92043f7a3ddbf2fe6c8103407a84c 100644 (file)
@@ -55,13 +55,13 @@ struct ucsi {
 
 static int ucsi_acpi_cmd(struct ucsi *ucsi, struct ucsi_control *ctrl)
 {
-       uuid_le uuid = UUID_LE(0x6f8398c2, 0x7ca4, 0x11e4,
-                              0xad, 0x36, 0x63, 0x10, 0x42, 0xb5, 0x00, 0x8f);
+       guid_t guid = GUID_INIT(0x6f8398c2, 0x7ca4, 0x11e4,
+                               0xad, 0x36, 0x63, 0x10, 0x42, 0xb5, 0x00, 0x8f);
        union acpi_object *obj;
 
        ucsi->data->ctrl.raw_cmd = ctrl->raw_cmd;
 
-       obj = acpi_evaluate_dsm(ACPI_HANDLE(ucsi->dev), uuid.b, 1, 1, NULL);
+       obj = acpi_evaluate_dsm(ACPI_HANDLE(ucsi->dev), &guid, 1, 1, NULL);
        if (!obj) {
                dev_err(ucsi->dev, "%s: failed to evaluate _DSM\n", __func__);
                return -EIO;
index d5a7b21fa3f198ef43598d170cd61f7494ac4826..c2ce252890277464538a6139773a4ffb7b9bf65b 100644 (file)
@@ -105,8 +105,8 @@ enum wcove_typec_role {
        WCOVE_ROLE_DEVICE,
 };
 
-static uuid_le uuid = UUID_LE(0x482383f0, 0x2876, 0x4e49,
-                             0x86, 0x85, 0xdb, 0x66, 0x21, 0x1a, 0xf0, 0x37);
+static guid_t guid = GUID_INIT(0x482383f0, 0x2876, 0x4e49,
+                              0x86, 0x85, 0xdb, 0x66, 0x21, 0x1a, 0xf0, 0x37);
 
 static int wcove_typec_func(struct wcove_typec *wcove,
                            enum wcove_typec_func func, int param)
@@ -118,7 +118,7 @@ static int wcove_typec_func(struct wcove_typec *wcove,
        tmp.type = ACPI_TYPE_INTEGER;
        tmp.integer.value = param;
 
-       obj = acpi_evaluate_dsm(ACPI_HANDLE(wcove->dev), uuid.b, 1, func,
+       obj = acpi_evaluate_dsm(ACPI_HANDLE(wcove->dev), &guid, 1, func,
                                &argv4);
        if (!obj) {
                dev_err(wcove->dev, "%s: failed to evaluate _DSM\n", __func__);
@@ -314,7 +314,7 @@ static int wcove_typec_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       if (!acpi_check_dsm(ACPI_HANDLE(&pdev->dev), uuid.b, 0, 0x1f)) {
+       if (!acpi_check_dsm(ACPI_HANDLE(&pdev->dev), &guid, 0, 0x1f)) {
                dev_err(&pdev->dev, "Missing _DSM functions\n");
                return -ENODEV;
        }
index 197f3fffc9a7151ed61d0b960f5e452f6beccb5c..ea7df16e71a782c6262b9f670a2f8552bb1e530a 100644 (file)
@@ -61,17 +61,18 @@ bool acpi_ata_match(acpi_handle handle);
 bool acpi_bay_match(acpi_handle handle);
 bool acpi_dock_match(acpi_handle handle);
 
-bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs);
-union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
+bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs);
+union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
                        u64 rev, u64 func, union acpi_object *argv4);
 
 static inline union acpi_object *
-acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, u64 rev, u64 func,
-                       union acpi_object *argv4, acpi_object_type type)
+acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
+                       u64 func, union acpi_object *argv4,
+                       acpi_object_type type)
 {
        union acpi_object *obj;
 
-       obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
+       obj = acpi_evaluate_dsm(handle, guid, rev, func, argv4);
        if (obj && obj->type != type) {
                ACPI_FREE(obj);
                obj = NULL;
index b0e1636ca5c38ea8d1fdb417bc96b73447b908f9..ab19365c905fee2c0e699a32d99fe33b57c7f2c8 100644 (file)
@@ -458,7 +458,6 @@ struct acpi_osc_context {
        struct acpi_buffer ret;         /* free by caller if success */
 };
 
-acpi_status acpi_str_to_uuid(char *str, u8 *uuid);
 acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
 
 /* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */
@@ -742,7 +741,7 @@ static inline bool acpi_driver_match_device(struct device *dev,
 }
 
 static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
-                                                  const u8 *uuid,
+                                                  const guid_t *guid,
                                                   int rev, int func,
                                                   union acpi_object *argv4)
 {
index 7a4e83a8c89ca8d960c75b6002aeff547fa2890e..dd86c97f2454b25746552c26e0e985363c18d352 100644 (file)
@@ -105,7 +105,7 @@ static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
 static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
 #endif
 
-extern const u8 pci_acpi_dsm_uuid[];
+extern const guid_t pci_acpi_dsm_guid;
 #define DEVICE_LABEL_DSM       0x07
 #define RESET_DELAY_DSM                0x08
 #define FUNCTION_DELAY_DSM     0x09
index e3f06672fd6df3268be67eb5790edcf91fa27585..e7d766d56c8e7dc60d12b39172f63c3a54f27b49 100644 (file)
@@ -21,8 +21,9 @@
 #include "skl.h"
 
 /* Unique identification for getting NHLT blobs */
-static u8 OSC_UUID[16] = {0x6E, 0x88, 0x9F, 0xA6, 0xEB, 0x6C, 0x94, 0x45,
-                               0xA4, 0x1F, 0x7B, 0x5D, 0xCE, 0x24, 0xC5, 0x53};
+static guid_t osc_guid =
+       GUID_INIT(0xA69F886E, 0x6CEB, 0x4594,
+                 0xA4, 0x1F, 0x7B, 0x5D, 0xCE, 0x24, 0xC5, 0x53);
 
 struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
 {
@@ -37,7 +38,7 @@ struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
                return NULL;
        }
 
-       obj = acpi_evaluate_dsm(handle, OSC_UUID, 1, 1, NULL);
+       obj = acpi_evaluate_dsm(handle, &osc_guid, 1, 1, NULL);
        if (obj && obj->type == ACPI_TYPE_BUFFER) {
                nhlt_ptr = (struct nhlt_resource_desc  *)obj->buffer.pointer;
                nhlt_table = (struct nhlt_acpi_table *)
index 64cae1a5deff956637a05b08c25565fe1718611b..e1f75a1914a15491b79ec95b0f18c6617565873b 100644 (file)
@@ -370,7 +370,7 @@ acpi_status __wrap_acpi_evaluate_object(acpi_handle handle, acpi_string path,
 }
 EXPORT_SYMBOL(__wrap_acpi_evaluate_object);
 
-union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
+union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
                u64 rev, u64 func, union acpi_object *argv4)
 {
        union acpi_object *obj = ERR_PTR(-ENXIO);
@@ -379,11 +379,11 @@ union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
        rcu_read_lock();
        ops = list_first_or_null_rcu(&iomap_head, typeof(*ops), list);
        if (ops)
-               obj = ops->evaluate_dsm(handle, uuid, rev, func, argv4);
+               obj = ops->evaluate_dsm(handle, guid, rev, func, argv4);
        rcu_read_unlock();
 
        if (IS_ERR(obj))
-               return acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
+               return acpi_evaluate_dsm(handle, guid, rev, func, argv4);
        return obj;
 }
 EXPORT_SYMBOL(__wrap_acpi_evaluate_dsm);
index c2187178fb13335ce8c54c1787949e85871494aa..28859da78edfe7fbedfea914a2a5788e143f5861 100644 (file)
@@ -1559,7 +1559,7 @@ static unsigned long nfit_ctl_handle;
 union acpi_object *result;
 
 static union acpi_object *nfit_test_evaluate_dsm(acpi_handle handle,
-               const u8 *uuid, u64 rev, u64 func, union acpi_object *argv4)
+               const guid_t *guid, u64 rev, u64 func, union acpi_object *argv4)
 {
        if (handle != &nfit_ctl_handle)
                return ERR_PTR(-ENXIO);
index f54c0032c6ff3a34e14504aa8fa5f219148267a3..d3d63dd5ed38e4d93d5d1edb4db6cc04fde9719f 100644 (file)
@@ -13,6 +13,7 @@
 #ifndef __NFIT_TEST_H__
 #define __NFIT_TEST_H__
 #include <linux/list.h>
+#include <linux/uuid.h>
 #include <linux/ioport.h>
 #include <linux/spinlock_types.h>
 
@@ -36,7 +37,8 @@ typedef void *acpi_handle;
 
 typedef struct nfit_test_resource *(*nfit_test_lookup_fn)(resource_size_t);
 typedef union acpi_object *(*nfit_test_evaluate_dsm_fn)(acpi_handle handle,
-               const u8 *uuid, u64 rev, u64 func, union acpi_object *argv4);
+                const guid_t *guid, u64 rev, u64 func,
+                union acpi_object *argv4);
 void __iomem *__wrap_ioremap_nocache(resource_size_t offset,
                unsigned long size);
 void __wrap_iounmap(volatile void __iomem *addr);