Skip to content

Commit 534f685

Browse files
Wer-Wolfij-intel
authored andcommitted
platform/x86: intel-wmi-sbl-fw-update: Use new buffer-based WMI API
Use the new buffer-based WMI API to also support ACPI firmware implementations that return a ACPI buffer instead of a ACPI integer. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://patch.msgid.link/20260116204116.4030-6-W_Armin@gmx.de Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 0e1a814 commit 534f685

1 file changed

Lines changed: 18 additions & 25 deletions

File tree

drivers/platform/x86/intel/wmi/sbl-fw-update.c

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* https://slimbootloader.github.io/security/firmware-update.html
1515
*/
1616

17-
#include <linux/acpi.h>
1817
#include <linux/device.h>
1918
#include <linux/module.h>
2019
#include <linux/slab.h>
@@ -25,41 +24,35 @@
2524

2625
static int get_fwu_request(struct device *dev, u32 *out)
2726
{
28-
union acpi_object *obj;
27+
struct wmi_buffer buffer;
28+
__le32 *result;
29+
int ret;
2930

30-
obj = wmidev_block_query(to_wmi_device(dev), 0);
31-
if (!obj)
32-
return -ENODEV;
31+
ret = wmidev_query_block(to_wmi_device(dev), 0, &buffer);
32+
if (ret < 0)
33+
return ret;
3334

34-
if (obj->type != ACPI_TYPE_INTEGER) {
35-
dev_warn(dev, "wmidev_block_query returned invalid value\n");
36-
kfree(obj);
37-
return -EINVAL;
35+
if (buffer.length < sizeof(*result)) {
36+
kfree(buffer.data);
37+
return -ENODATA;
3838
}
3939

40-
*out = obj->integer.value;
41-
kfree(obj);
40+
result = buffer.data;
41+
*out = le32_to_cpu(*result);
42+
kfree(result);
4243

4344
return 0;
4445
}
4546

4647
static int set_fwu_request(struct device *dev, u32 in)
4748
{
48-
struct acpi_buffer input;
49-
acpi_status status;
50-
u32 value;
51-
52-
value = in;
53-
input.length = sizeof(u32);
54-
input.pointer = &value;
55-
56-
status = wmidev_block_set(to_wmi_device(dev), 0, &input);
57-
if (ACPI_FAILURE(status)) {
58-
dev_err(dev, "wmidev_block_set failed\n");
59-
return -ENODEV;
60-
}
49+
__le32 value = cpu_to_le32(in);
50+
struct wmi_buffer buffer = {
51+
.length = sizeof(value),
52+
.data = &value,
53+
};
6154

62-
return 0;
55+
return wmidev_set_block(to_wmi_device(dev), 0, &buffer);
6356
}
6457

6558
static ssize_t firmware_update_request_show(struct device *dev,

0 commit comments

Comments
 (0)