* [RFC Patch v1 01/13] ACPI: introduce helper interfaces to support ACPI _DSM method
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 02/13] ACPI, extlog: replace open-coded _DSM specific code with helper functions Jiang Liu
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, Rafael J. Wysocki, Robert Moore,
linux-acpi, linux-kernel, devel
Cc: Jiang Liu, Tony Luck
There are several drivers making use of ACPI _DSM method to detect
and invoke device specific methods. Currently every driver has
implemented its private version to support ACPI _DSM method.
So this patch introduces three helper functions to support ACPI _DSM
method, which will be used to replace open-coded versions.
It helps to simplify code and improve code readability.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/acpi/utils.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++
include/acpi/acpi_bus.h | 26 +++++++++++++
2 files changed, 124 insertions(+)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 6d408bf..9517b0a 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -574,3 +574,101 @@ acpi_status acpi_evaluate_lck(acpi_handle handle, int lock)
return status;
}
+
+/**
+ * acpi_evaluate_dsm: evaluate device's _DSM method
+ * @handle: ACPI device handle
+ * @uuid: UUID 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
+ * 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, int rev, int func,
+ union acpi_object *argv4)
+{
+ acpi_status ret;
+ struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL};
+ union acpi_object params[4];
+ struct acpi_object_list input = {
+ .count = 4,
+ .pointer = params,
+ };
+
+ params[0].type = ACPI_TYPE_BUFFER;
+ params[0].buffer.length = 16;
+ params[0].buffer.pointer = (char *)uuid;
+ params[1].type = ACPI_TYPE_INTEGER;
+ params[1].integer.value = rev;
+ params[2].type = ACPI_TYPE_INTEGER;
+ params[2].integer.value = func;
+ if (argv4) {
+ params[3] = *argv4;
+ } else {
+ params[3].type = ACPI_TYPE_PACKAGE;
+ params[3].package.count = 0;
+ params[3].package.elements = NULL;
+ }
+
+ ret = acpi_evaluate_object(handle, "_DSM", &input, &buf);
+ if (ACPI_SUCCESS(ret))
+ return (union acpi_object *)buf.pointer;
+
+ if (ret != AE_NOT_FOUND)
+ acpi_handle_warn(handle,
+ "failed to evaluate _DSM method (0x%x)\n", ret);
+
+ return NULL;
+}
+EXPORT_SYMBOL(acpi_evaluate_dsm);
+
+/**
+ * acpi_check_dsm: check whether _DSM method under @handle supports
+ * requested functions.
+ * @handle: ACPI device handle
+ * @uuid: UUID of requested functions, should be 16 bytes at least
+ * @rev: revision number of requested functions
+ * @funcs: bitmap of requested functions
+ * @exclude: excluding special value, used to support i915 and nouveau
+ *
+ * Evaluate device's _DSM method to check whether it supports requested
+ * functions. Currently only support 64 functions at maximum, should be
+ * enough for now.
+ */
+bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs)
+{
+ int i;
+ u64 mask = 0;
+ union acpi_object *obj;
+
+ if (funcs == 0)
+ return false;
+
+ obj = acpi_evaluate_dsm(handle, uuid, rev, 0, NULL);
+ if (!obj)
+ return false;
+
+ /* For compatibility, old BIOSes may return an integer */
+ if (obj->type == ACPI_TYPE_INTEGER)
+ mask = obj->integer.value;
+ else if (obj->type == ACPI_TYPE_BUFFER)
+ for (i = 0; i < obj->buffer.length && i < 8; i++)
+ mask |= (((u8)obj->buffer.pointer[i]) << (i * 8));
+ ACPI_FREE(obj);
+
+ /*
+ * Bit 0 indicates whether there's support for any functions other than
+ * function 0 for the specified UUID and revision.
+ */
+ if ((mask & 0x1) && (mask & funcs) == funcs)
+ return true;
+
+ return false;
+}
+EXPORT_SYMBOL(acpi_check_dsm);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c602c77..efccf39 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -66,6 +66,32 @@ 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, int rev, u64 funcs);
+union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
+ int rev, int func, union acpi_object *argv4);
+
+static inline union acpi_object *
+acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func,
+ union acpi_object *argv4, acpi_object_type type)
+{
+ union acpi_object *obj;
+
+ obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
+ if (obj && obj->type != type) {
+ ACPI_FREE(obj);
+ obj = NULL;
+ }
+
+ return obj;
+}
+
+#define ACPI_INIT_DSM_ARGV4(cnt, eles) \
+ { \
+ .type = ACPI_TYPE_PACKAGE, \
+ .package.count = (cnt), \
+ .package.elements = (eles) \
+ }
+
#ifdef CONFIG_ACPI
#include <linux/proc_fs.h>
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 02/13] ACPI, extlog: replace open-coded _DSM specific code with helper functions
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
2013-12-18 6:58 ` [RFC Patch v1 01/13] ACPI: introduce helper interfaces to support ACPI _DSM method Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 03/13] PCI, pci-label: release allocated ACPI object on error recovery path Jiang Liu
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, Rafael J. Wysocki, linux-acpi,
linux-kernel
Cc: Jiang Liu, Tony Luck
Use helper functions to simplify _DSM related code in acpi_extlog driver.
Also mark initialization data and functions with __init and __initdata
to reduce memory footprint.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/acpi/acpi_extlog.c | 61 +++++++++-----------------------------------
1 file changed, 12 insertions(+), 49 deletions(-)
diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
index a6869e1..928c4db 100644
--- a/drivers/acpi/acpi_extlog.c
+++ b/drivers/acpi/acpi_extlog.c
@@ -20,11 +20,9 @@
#define EXT_ELOG_ENTRY_MASK GENMASK_ULL(51, 0) /* elog entry address mask */
#define EXTLOG_DSM_REV 0x0
-#define EXTLOG_FN_QUERY 0x0
#define EXTLOG_FN_ADDR 0x1
#define FLAG_OS_OPTIN BIT(0)
-#define EXTLOG_QUERY_L1_EXIST BIT(1)
#define ELOG_ENTRY_VALID (1ULL<<63)
#define ELOG_ENTRY_LEN 0x1000
@@ -43,7 +41,7 @@ struct extlog_l1_head {
u8 rev1[12];
};
-static u8 extlog_dsm_uuid[] = "663E35AF-CC10-41A4-88EA-5470AF055295";
+static u8 extlog_dsm_uuid[] __initdata = "663E35AF-CC10-41A4-88EA-5470AF055295";
/* L1 table related physical address */
static u64 elog_base;
@@ -153,62 +151,27 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
return NOTIFY_DONE;
}
-static int extlog_get_dsm(acpi_handle handle, int rev, int func, u64 *ret)
+static bool __init extlog_get_l1addr(void)
{
- struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL};
- struct acpi_object_list input;
- union acpi_object params[4], *obj;
u8 uuid[16];
- int i;
+ acpi_handle handle;
+ union acpi_object *obj;
acpi_str_to_uuid(extlog_dsm_uuid, uuid);
- input.count = 4;
- input.pointer = params;
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = 16;
- params[0].buffer.pointer = uuid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = rev;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = func;
- params[3].type = ACPI_TYPE_PACKAGE;
- params[3].package.count = 0;
- params[3].package.elements = NULL;
-
- if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DSM", &input, &buf)))
- return -1;
-
- *ret = 0;
- obj = (union acpi_object *)buf.pointer;
- if (obj->type == ACPI_TYPE_INTEGER) {
- *ret = obj->integer.value;
- } else if (obj->type == ACPI_TYPE_BUFFER) {
- if (obj->buffer.length <= 8) {
- for (i = 0; i < obj->buffer.length; i++)
- *ret |= (obj->buffer.pointer[i] << (i * 8));
- }
- }
- kfree(buf.pointer);
-
- return 0;
-}
-
-static bool extlog_get_l1addr(void)
-{
- acpi_handle handle;
- u64 ret;
if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
return false;
-
- if (extlog_get_dsm(handle, EXTLOG_DSM_REV, EXTLOG_FN_QUERY, &ret) ||
- !(ret & EXTLOG_QUERY_L1_EXIST))
+ if (!acpi_check_dsm(handle, uuid, EXTLOG_DSM_REV, 1 << EXTLOG_FN_ADDR))
return false;
-
- if (extlog_get_dsm(handle, EXTLOG_DSM_REV, EXTLOG_FN_ADDR, &ret))
+ obj = acpi_evaluate_dsm_typed(handle, uuid, EXTLOG_DSM_REV,
+ EXTLOG_FN_ADDR, NULL, ACPI_TYPE_INTEGER);
+ if (!obj) {
return false;
+ } else {
+ l1_dirbase = obj->integer.value;
+ ACPI_FREE(obj);
+ }
- l1_dirbase = ret;
/* Spec says L1 directory must be 4K aligned, bail out if it isn't */
if (l1_dirbase & ((1 << 12) - 1)) {
pr_warn(FW_BUG "L1 Directory is invalid at physical %llx\n",
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 03/13] PCI, pci-label: release allocated ACPI object on error recovery path
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
2013-12-18 6:58 ` [RFC Patch v1 01/13] ACPI: introduce helper interfaces to support ACPI _DSM method Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 02/13] ACPI, extlog: replace open-coded _DSM specific code with helper functions Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 04/13] ACPI, PCI: replace open-coded _DSM specific code with helper functions Jiang Liu
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, linux-pci, linux-kernel
Cc: Jiang Liu, Tony Luck
Function dsm_get_label() leaks the returned ACPI object if
obj->package.count is not 2, so fix the possible memory leak.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/pci/pci-label.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index d51f45a..f6e01a5 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -233,11 +233,7 @@ dsm_get_label(acpi_handle handle, int func,
return -1;
obj = (union acpi_object *)output->pointer;
-
- switch (obj->type) {
- case ACPI_TYPE_PACKAGE:
- if (obj->package.count != 2)
- break;
+ if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2) {
len = obj->package.elements[0].integer.value;
if (buf) {
if (attribute == ACPI_ATTR_INDEX_SHOW)
@@ -250,10 +246,10 @@ dsm_get_label(acpi_handle handle, int func,
}
kfree(output->pointer);
return len;
- break;
- default:
- kfree(output->pointer);
}
+
+ kfree(output->pointer);
+
return -1;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 04/13] ACPI, PCI: replace open-coded _DSM specific code with helper functions
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (2 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 03/13] PCI, pci-label: release allocated ACPI object on error recovery path Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 05/13] PCI, pci-label: treat PCI label with index 0 as valid label Jiang Liu
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, linux-pci, linux-kernel
Cc: Jiang Liu, Tony Luck
Use helper functions to simplify _DSM related code in pci-label driver.
Also enforce more strict checks on objects returned by _DSM method.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/pci/pci-label.c | 121 +++++++++++++----------------------------------
1 file changed, 34 insertions(+), 87 deletions(-)
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index f6e01a5..f12dcd1 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -195,80 +195,58 @@ enum acpi_attr_enum {
static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
{
int len;
- len = utf16s_to_utf8s((const wchar_t *)obj->
- package.elements[1].string.pointer,
- obj->package.elements[1].string.length,
+ len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer,
+ obj->string.length,
UTF16_LITTLE_ENDIAN,
buf, PAGE_SIZE);
buf[len] = '\n';
}
static int
-dsm_get_label(acpi_handle handle, int func,
- struct acpi_buffer *output,
- char *buf, enum acpi_attr_enum attribute)
+dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
{
- struct acpi_object_list input;
- union acpi_object params[4];
- union acpi_object *obj;
- int len = 0;
-
- int err;
-
- input.count = 4;
- input.pointer = params;
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = sizeof(device_label_dsm_uuid);
- params[0].buffer.pointer = (char *)device_label_dsm_uuid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = 0x02;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = func;
- params[3].type = ACPI_TYPE_PACKAGE;
- params[3].package.count = 0;
- params[3].package.elements = NULL;
-
- err = acpi_evaluate_object(handle, "_DSM", &input, output);
- if (err)
+ acpi_handle handle;
+ union acpi_object *obj, *tmp;
+ int len = -1;
+
+ handle = ACPI_HANDLE(dev);
+ if (!handle)
return -1;
- obj = (union acpi_object *)output->pointer;
- if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2) {
- len = obj->package.elements[0].integer.value;
+ obj = acpi_evaluate_dsm(handle, device_label_dsm_uuid, 0x2,
+ DEVICE_LABEL_DSM, NULL);
+ if (!obj)
+ return -1;
+
+ tmp = obj->package.elements;
+ if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 &&
+ tmp[0].type == ACPI_TYPE_INTEGER &&
+ tmp[1].type == ACPI_TYPE_STRING) {
+ len = tmp[0].integer.value;
if (buf) {
- if (attribute == ACPI_ATTR_INDEX_SHOW)
+ /*
+ * This second string element is optional even when
+ * this _DSM is implemented; when not implemented,
+ * this entry must return a null string.
+ */
+ if (attr == ACPI_ATTR_INDEX_SHOW)
scnprintf(buf, PAGE_SIZE, "%llu\n",
- obj->package.elements[0].integer.value);
- else if (attribute == ACPI_ATTR_LABEL_SHOW)
- dsm_label_utf16s_to_utf8s(obj, buf);
- kfree(output->pointer);
- return strlen(buf);
+ tmp->integer.value);
+ else if (attr == ACPI_ATTR_LABEL_SHOW)
+ dsm_label_utf16s_to_utf8s(tmp + 1, buf);
+ len = strlen(buf) > 0 ? strlen(buf) : -1;
}
- kfree(output->pointer);
- return len;
}
- kfree(output->pointer);
+ ACPI_FREE(obj);
- return -1;
+ return len;
}
static bool
device_has_dsm(struct device *dev)
{
- acpi_handle handle;
- struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
-
- handle = ACPI_HANDLE(dev);
-
- if (!handle)
- return FALSE;
-
- if (dsm_get_label(handle, DEVICE_LABEL_DSM, &output, NULL,
- ACPI_ATTR_NONE) > 0)
- return TRUE;
-
- return FALSE;
+ return dsm_get_label(dev, NULL, ACPI_ATTR_NONE) > 0;
}
static umode_t
@@ -287,44 +265,13 @@ acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
static ssize_t
acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
{
- struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
- acpi_handle handle;
- int length;
-
- handle = ACPI_HANDLE(dev);
-
- if (!handle)
- return -1;
-
- length = dsm_get_label(handle, DEVICE_LABEL_DSM,
- &output, buf, ACPI_ATTR_LABEL_SHOW);
-
- if (length < 1)
- return -1;
-
- return length;
+ return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW);
}
static ssize_t
acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
{
- struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
- acpi_handle handle;
- int length;
-
- handle = ACPI_HANDLE(dev);
-
- if (!handle)
- return -1;
-
- length = dsm_get_label(handle, DEVICE_LABEL_DSM,
- &output, buf, ACPI_ATTR_INDEX_SHOW);
-
- if (length < 0)
- return -1;
-
- return length;
-
+ return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW);
}
static struct device_attribute acpi_attr_label = {
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 05/13] PCI, pci-label: treat PCI label with index 0 as valid label
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (3 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 04/13] ACPI, PCI: replace open-coded _DSM specific code with helper functions Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 06/13] ACPI, TPM: fix memory leak when walking ACPI namespace Jiang Liu
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, linux-pci, linux-kernel
Cc: Jiang Liu, Tony Luck
Current pci-label driver detects ACPI label by checking label index
returned by ACPI _DSM method, and treat it as valid if label index
is positive. According to ACPI Firmware specification 3.1, zero is
also an valid label index. So change code to detect availability of
ACPI slot label by checking availaiblity of ACPI _DSM function for
PCI label.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/pci/pci-label.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index f12dcd1..0260b14 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -187,7 +187,6 @@ static const char device_label_dsm_uuid[] = {
};
enum acpi_attr_enum {
- ACPI_ATTR_NONE = 0,
ACPI_ATTR_LABEL_SHOW,
ACPI_ATTR_INDEX_SHOW,
};
@@ -222,20 +221,16 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 &&
tmp[0].type == ACPI_TYPE_INTEGER &&
tmp[1].type == ACPI_TYPE_STRING) {
- len = tmp[0].integer.value;
- if (buf) {
- /*
- * This second string element is optional even when
- * this _DSM is implemented; when not implemented,
- * this entry must return a null string.
- */
- if (attr == ACPI_ATTR_INDEX_SHOW)
- scnprintf(buf, PAGE_SIZE, "%llu\n",
- tmp->integer.value);
- else if (attr == ACPI_ATTR_LABEL_SHOW)
- dsm_label_utf16s_to_utf8s(tmp + 1, buf);
- len = strlen(buf) > 0 ? strlen(buf) : -1;
- }
+ /*
+ * The second string element is optional even when
+ * this _DSM is implemented; when not implemented,
+ * this entry must return a null string.
+ */
+ if (attr == ACPI_ATTR_INDEX_SHOW)
+ scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value);
+ else if (attr == ACPI_ATTR_LABEL_SHOW)
+ dsm_label_utf16s_to_utf8s(tmp + 1, buf);
+ len = strlen(buf) > 0 ? strlen(buf) : -1;
}
ACPI_FREE(obj);
@@ -246,7 +241,14 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
static bool
device_has_dsm(struct device *dev)
{
- return dsm_get_label(dev, NULL, ACPI_ATTR_NONE) > 0;
+ acpi_handle handle;
+
+ handle = ACPI_HANDLE(dev);
+ if (!handle)
+ return false;
+
+ return !!acpi_check_dsm(handle, device_label_dsm_uuid, 0x2,
+ 1 << DEVICE_LABEL_DSM);
}
static umode_t
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 06/13] ACPI, TPM: fix memory leak when walking ACPI namespace
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (4 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 05/13] PCI, pci-label: treat PCI label with index 0 as valid label Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 07/13] ACPI, TPM: matching node name instead of full path when searching for TPM device Jiang Liu
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, tpmdd-devel, linux-kernel
Cc: Jiang Liu, Tony Luck
In function ppi_callback(), memory allocated by acpi_get_name() will get
leaked when current device isn't the desired TPM device, so fix the
memory leak.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: <stable@vger.kernel.org> # 3.6
---
drivers/char/tpm/tpm_ppi.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
index 8e562dc..e1f3337 100644
--- a/drivers/char/tpm/tpm_ppi.c
+++ b/drivers/char/tpm/tpm_ppi.c
@@ -27,15 +27,18 @@ static char *tpm_device_name = "TPM";
static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context,
void **return_value)
{
- acpi_status status;
+ acpi_status status = AE_OK;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
- if (strstr(buffer.pointer, context) != NULL) {
- *return_value = handle;
+
+ if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer))) {
+ if (strstr(buffer.pointer, context) != NULL) {
+ *return_value = handle;
+ status = AE_CTRL_TERMINATE;
+ }
kfree(buffer.pointer);
- return AE_CTRL_TERMINATE;
}
- return AE_OK;
+
+ return status;
}
static inline void ppi_assign_params(union acpi_object params[4],
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 07/13] ACPI, TPM: matching node name instead of full path when searching for TPM device
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (5 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 06/13] ACPI, TPM: fix memory leak when walking ACPI namespace Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 08/13] ACPI, TPM: replace open-coded _DSM specific code with helper functions Jiang Liu
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, tpmdd-devel, linux-kernel
Cc: Jiang Liu, Tony Luck
When searching ACPI object for TPM device, it should match current
ACPI object name instead of the full path.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/char/tpm/tpm_ppi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
index e1f3337..1e9cc11 100644
--- a/drivers/char/tpm/tpm_ppi.c
+++ b/drivers/char/tpm/tpm_ppi.c
@@ -30,7 +30,7 @@ static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context,
acpi_status status = AE_OK;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer))) {
+ if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer))) {
if (strstr(buffer.pointer, context) != NULL) {
*return_value = handle;
status = AE_CTRL_TERMINATE;
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 08/13] ACPI, TPM: replace open-coded _DSM specific code with helper functions
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (6 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 07/13] ACPI, TPM: matching node name instead of full path when searching for TPM device Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 09/13] ACPI, TPM: detecting PPI features by checking availability of _DSM functions Jiang Liu
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, tpmdd-devel, linux-kernel
Cc: Jiang Liu, Tony Luck
Use helper functions to simplify _DSM related code in TPM driver.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/char/tpm/tpm_ppi.c | 404 ++++++++++++++++----------------------------
1 file changed, 145 insertions(+), 259 deletions(-)
diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
index 1e9cc11..ad5143f 100644
--- a/drivers/char/tpm/tpm_ppi.c
+++ b/drivers/char/tpm/tpm_ppi.c
@@ -2,15 +2,6 @@
#include <acpi/acpi_drivers.h>
#include "tpm.h"
-static const u8 tpm_ppi_uuid[] = {
- 0xA6, 0xFA, 0xDD, 0x3D,
- 0x1B, 0x36,
- 0xB4, 0x4E,
- 0xA4, 0x24,
- 0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53
-};
-static char *tpm_device_name = "TPM";
-
#define TPM_PPI_REVISION_ID 1
#define TPM_PPI_FN_VERSION 1
#define TPM_PPI_FN_SUBREQ 2
@@ -24,250 +15,185 @@ static char *tpm_device_name = "TPM";
#define PPI_VS_REQ_END 255
#define PPI_VERSION_LEN 3
+static const u8 tpm_ppi_uuid[] = {
+ 0xA6, 0xFA, 0xDD, 0x3D,
+ 0x1B, 0x36,
+ 0xB4, 0x4E,
+ 0xA4, 0x24,
+ 0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53
+};
+
+static char *tpm_device_name = "TPM";
+static char tpm_ppi_version[PPI_VERSION_LEN + 1];
+static acpi_handle tpm_ppi_handle;
+
static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context,
void **return_value)
{
acpi_status status = AE_OK;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer))) {
- if (strstr(buffer.pointer, context) != NULL) {
- *return_value = handle;
- status = AE_CTRL_TERMINATE;
+ status = acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
+ if (ACPI_FAILURE(status))
+ return AE_OK;
+
+ if (strstr(buffer.pointer, context) != NULL) {
+ union acpi_object *obj;
+
+ /* Cache version string */
+ obj = acpi_evaluate_dsm_typed(handle, tpm_ppi_uuid,
+ TPM_PPI_REVISION_ID, TPM_PPI_FN_VERSION,
+ NULL, ACPI_TYPE_STRING);
+ if (obj) {
+ strlcpy(tpm_ppi_version, obj->string.pointer,
+ PPI_VERSION_LEN + 1);
+ ACPI_FREE(obj);
}
- kfree(buffer.pointer);
+
+ *return_value = handle;
+ status = AE_CTRL_TERMINATE;
}
+ kfree(buffer.pointer);
return status;
}
-static inline void ppi_assign_params(union acpi_object params[4],
- u64 function_num)
+static inline union acpi_object *
+tpm_eval_dsm(int func, acpi_object_type type, union acpi_object *argv4)
{
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = sizeof(tpm_ppi_uuid);
- params[0].buffer.pointer = (char *)tpm_ppi_uuid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = TPM_PPI_REVISION_ID;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = function_num;
- params[3].type = ACPI_TYPE_PACKAGE;
- params[3].package.count = 0;
- params[3].package.elements = NULL;
+ BUG_ON(!tpm_ppi_handle);
+ return acpi_evaluate_dsm_typed(tpm_ppi_handle, tpm_ppi_uuid,
+ TPM_PPI_REVISION_ID, func, argv4, type);
}
static ssize_t tpm_show_ppi_version(struct device *dev,
struct device_attribute *attr, char *buf)
{
- acpi_handle handle;
- acpi_status status;
- struct acpi_object_list input;
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object params[4];
- union acpi_object *obj;
-
- input.count = 4;
- ppi_assign_params(params, TPM_PPI_FN_VERSION);
- input.pointer = params;
- status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ppi_callback, NULL,
- tpm_device_name, &handle);
- if (ACPI_FAILURE(status))
- return -ENXIO;
-
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_STRING);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
- obj = (union acpi_object *)output.pointer;
- status = scnprintf(buf, PAGE_SIZE, "%s\n", obj->string.pointer);
- kfree(output.pointer);
- return status;
+ return scnprintf(buf, PAGE_SIZE, "%s\n", tpm_ppi_version);
}
static ssize_t tpm_show_ppi_request(struct device *dev,
struct device_attribute *attr, char *buf)
{
- acpi_handle handle;
- acpi_status status;
- struct acpi_object_list input;
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object params[4];
- union acpi_object *ret_obj;
-
- input.count = 4;
- ppi_assign_params(params, TPM_PPI_FN_GETREQ);
- input.pointer = params;
- status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ppi_callback, NULL,
- tpm_device_name, &handle);
- if (ACPI_FAILURE(status))
+ ssize_t size = -EINVAL;
+ union acpi_object *obj;
+
+ obj = tpm_eval_dsm(TPM_PPI_FN_GETREQ, ACPI_TYPE_PACKAGE, NULL);
+ if (!obj)
return -ENXIO;
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_PACKAGE);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
/*
* output.pointer should be of package type, including two integers.
* The first is function return code, 0 means success and 1 means
* error. The second is pending TPM operation requested by the OS, 0
* means none and >0 means operation value.
*/
- ret_obj = ((union acpi_object *)output.pointer)->package.elements;
- if (ret_obj->type == ACPI_TYPE_INTEGER) {
- if (ret_obj->integer.value) {
- status = -EFAULT;
- goto cleanup;
- }
- ret_obj++;
- if (ret_obj->type == ACPI_TYPE_INTEGER)
- status = scnprintf(buf, PAGE_SIZE, "%llu\n",
- ret_obj->integer.value);
+ if (obj->package.count == 2 &&
+ obj->package.elements[0].type == ACPI_TYPE_INTEGER &&
+ obj->package.elements[1].type == ACPI_TYPE_INTEGER) {
+ if (obj->package.elements[0].integer.value)
+ size = -EFAULT;
else
- status = -EINVAL;
- } else {
- status = -EINVAL;
+ size = scnprintf(buf, PAGE_SIZE, "%llu\n",
+ obj->package.elements[1].integer.value);
}
-cleanup:
- kfree(output.pointer);
- return status;
+
+ ACPI_FREE(obj);
+
+ return size;
}
static ssize_t tpm_store_ppi_request(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- char version[PPI_VERSION_LEN + 1];
- acpi_handle handle;
- acpi_status status;
- struct acpi_object_list input;
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object params[4];
- union acpi_object obj;
u32 req;
u64 ret;
+ int func = TPM_PPI_FN_SUBREQ;
+ union acpi_object *obj, tmp;
+ union acpi_object argv4 = ACPI_INIT_DSM_ARGV4(1, &tmp);
- input.count = 4;
- ppi_assign_params(params, TPM_PPI_FN_VERSION);
- input.pointer = params;
- status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ppi_callback, NULL,
- tpm_device_name, &handle);
- if (ACPI_FAILURE(status))
- return -ENXIO;
-
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_STRING);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
- strlcpy(version,
- ((union acpi_object *)output.pointer)->string.pointer,
- PPI_VERSION_LEN + 1);
- kfree(output.pointer);
- output.length = ACPI_ALLOCATE_BUFFER;
- output.pointer = NULL;
/*
* the function to submit TPM operation request to pre-os environment
* is updated with function index from SUBREQ to SUBREQ2 since PPI
* version 1.1
*/
- if (strcmp(version, "1.1") == -1)
- params[2].integer.value = TPM_PPI_FN_SUBREQ;
- else
- params[2].integer.value = TPM_PPI_FN_SUBREQ2;
+ if (strcmp(tpm_ppi_version, "1.1") >= 0)
+ func = TPM_PPI_FN_SUBREQ2;
+
/*
* PPI spec defines params[3].type as ACPI_TYPE_PACKAGE. Some BIOS
* accept buffer/string/integer type, but some BIOS accept buffer/
* string/package type. For PPI version 1.0 and 1.1, use buffer type
* for compatibility, and use package type since 1.2 according to spec.
*/
- if (strcmp(version, "1.2") == -1) {
- params[3].type = ACPI_TYPE_BUFFER;
- params[3].buffer.length = sizeof(req);
- sscanf(buf, "%d", &req);
- params[3].buffer.pointer = (char *)&req;
+ if (strcmp(tpm_ppi_version, "1.2") < 0) {
+ if (sscanf(buf, "%d", &req) != 1)
+ return -EINVAL;
+ argv4.type = ACPI_TYPE_BUFFER;
+ argv4.buffer.length = sizeof(req);
+ argv4.buffer.pointer = (u8 *)&req;
} else {
- params[3].package.count = 1;
- obj.type = ACPI_TYPE_INTEGER;
- sscanf(buf, "%llu", &obj.integer.value);
- params[3].package.elements = &obj;
+ tmp.type = ACPI_TYPE_INTEGER;
+ if (sscanf(buf, "%llu", &tmp.integer.value) != 1)
+ return -EINVAL;
+ }
+
+ obj = tpm_eval_dsm(func, ACPI_TYPE_INTEGER, &argv4);
+ if (!obj) {
+ return -ENXIO;
+ } else {
+ ret = obj->integer.value;
+ ACPI_FREE(obj);
}
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_INTEGER);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
- ret = ((union acpi_object *)output.pointer)->integer.value;
if (ret == 0)
- status = (acpi_status)count;
- else if (ret == 1)
- status = -EPERM;
- else
- status = -EFAULT;
- kfree(output.pointer);
- return status;
+ return (acpi_status)count;
+
+ return (ret == 1) ? -EPERM : -EFAULT;
}
static ssize_t tpm_show_ppi_transition_action(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- char version[PPI_VERSION_LEN + 1];
- acpi_handle handle;
- acpi_status status;
- struct acpi_object_list input;
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object params[4];
u32 ret;
- char *info[] = {
+ acpi_status status;
+ union acpi_object *obj = NULL;
+ union acpi_object tmp = {
+ .type = ACPI_TYPE_BUFFER,
+ .buffer.length = 0,
+ .buffer.pointer = NULL
+ };
+
+ static char *info[] = {
"None",
"Shutdown",
"Reboot",
"OS Vendor-specific",
"Error",
};
- input.count = 4;
- ppi_assign_params(params, TPM_PPI_FN_VERSION);
- input.pointer = params;
- status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ppi_callback, NULL,
- tpm_device_name, &handle);
- if (ACPI_FAILURE(status))
- return -ENXIO;
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_STRING);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
- strlcpy(version,
- ((union acpi_object *)output.pointer)->string.pointer,
- PPI_VERSION_LEN + 1);
/*
* PPI spec defines params[3].type as empty package, but some platforms
* (e.g. Capella with PPI 1.0) need integer/string/buffer type, so for
* compatibility, define params[3].type as buffer, if PPI version < 1.2
*/
- if (strcmp(version, "1.2") == -1) {
- params[3].type = ACPI_TYPE_BUFFER;
- params[3].buffer.length = 0;
- params[3].buffer.pointer = NULL;
+ if (strcmp(tpm_ppi_version, "1.2") < 0)
+ obj = &tmp;
+ obj = tpm_eval_dsm(TPM_PPI_FN_GETACT, ACPI_TYPE_INTEGER, obj);
+ if (!obj) {
+ return -ENXIO;
+ } else {
+ ret = obj->integer.value;
+ ACPI_FREE(obj);
}
- params[2].integer.value = TPM_PPI_FN_GETACT;
- kfree(output.pointer);
- output.length = ACPI_ALLOCATE_BUFFER;
- output.pointer = NULL;
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_INTEGER);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
- ret = ((union acpi_object *)output.pointer)->integer.value;
+
if (ret < ARRAY_SIZE(info) - 1)
status = scnprintf(buf, PAGE_SIZE, "%d: %s\n", ret, info[ret]);
else
status = scnprintf(buf, PAGE_SIZE, "%d: %s\n", ret,
info[ARRAY_SIZE(info)-1]);
- kfree(output.pointer);
return status;
}
@@ -275,27 +201,14 @@ static ssize_t tpm_show_ppi_response(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- acpi_handle handle;
- acpi_status status;
- struct acpi_object_list input;
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object params[4];
- union acpi_object *ret_obj;
- u64 req;
-
- input.count = 4;
- ppi_assign_params(params, TPM_PPI_FN_GETRSP);
- input.pointer = params;
- status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ppi_callback, NULL,
- tpm_device_name, &handle);
- if (ACPI_FAILURE(status))
+ acpi_status status = -EINVAL;
+ union acpi_object *obj, *ret_obj;
+ u64 req, res;
+
+ obj = tpm_eval_dsm(TPM_PPI_FN_GETRSP, ACPI_TYPE_PACKAGE, NULL);
+ if (!obj)
return -ENXIO;
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_PACKAGE);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
/*
* parameter output.pointer should be of package type, including
* 3 integers. The first means function return code, the second means
@@ -303,115 +216,81 @@ static ssize_t tpm_show_ppi_response(struct device *dev,
* the most recent TPM operation request. Only if the first is 0, and
* the second integer is not 0, the response makes sense.
*/
- ret_obj = ((union acpi_object *)output.pointer)->package.elements;
- if (ret_obj->type != ACPI_TYPE_INTEGER) {
- status = -EINVAL;
+ ret_obj = obj->package.elements;
+ if (obj->package.count < 3 ||
+ ret_obj[0].type != ACPI_TYPE_INTEGER ||
+ ret_obj[1].type != ACPI_TYPE_INTEGER ||
+ ret_obj[2].type != ACPI_TYPE_INTEGER)
goto cleanup;
- }
- if (ret_obj->integer.value) {
+
+ if (ret_obj[0].integer.value) {
status = -EFAULT;
goto cleanup;
}
- ret_obj++;
- if (ret_obj->type != ACPI_TYPE_INTEGER) {
- status = -EINVAL;
- goto cleanup;
- }
- if (ret_obj->integer.value) {
- req = ret_obj->integer.value;
- ret_obj++;
- if (ret_obj->type != ACPI_TYPE_INTEGER) {
- status = -EINVAL;
- goto cleanup;
- }
- if (ret_obj->integer.value == 0)
+
+ req = ret_obj[1].integer.value;
+ res = ret_obj[2].integer.value;
+ if (req) {
+ if (res == 0)
status = scnprintf(buf, PAGE_SIZE, "%llu %s\n", req,
"0: Success");
- else if (ret_obj->integer.value == 0xFFFFFFF0)
+ else if (res == 0xFFFFFFF0)
status = scnprintf(buf, PAGE_SIZE, "%llu %s\n", req,
"0xFFFFFFF0: User Abort");
- else if (ret_obj->integer.value == 0xFFFFFFF1)
+ else if (res == 0xFFFFFFF1)
status = scnprintf(buf, PAGE_SIZE, "%llu %s\n", req,
"0xFFFFFFF1: BIOS Failure");
- else if (ret_obj->integer.value >= 1 &&
- ret_obj->integer.value <= 0x00000FFF)
+ else if (res >= 1 && res <= 0x00000FFF)
status = scnprintf(buf, PAGE_SIZE, "%llu %llu: %s\n",
- req, ret_obj->integer.value,
- "Corresponding TPM error");
+ req, res, "Corresponding TPM error");
else
status = scnprintf(buf, PAGE_SIZE, "%llu %llu: %s\n",
- req, ret_obj->integer.value,
- "Error");
+ req, res, "Error");
} else {
status = scnprintf(buf, PAGE_SIZE, "%llu: %s\n",
- ret_obj->integer.value, "No Recent Request");
+ req, "No Recent Request");
}
+
cleanup:
- kfree(output.pointer);
+ ACPI_FREE(obj);
return status;
}
static ssize_t show_ppi_operations(char *buf, u32 start, u32 end)
{
- char *str = buf;
- char version[PPI_VERSION_LEN + 1];
- acpi_handle handle;
- acpi_status status;
- struct acpi_object_list input;
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object params[4];
- union acpi_object obj;
int i;
u32 ret;
- char *info[] = {
+ char *str = buf;
+ union acpi_object *obj, tmp;
+ union acpi_object argv = ACPI_INIT_DSM_ARGV4(1, &tmp);
+
+ static char *info[] = {
"Not implemented",
"BIOS only",
"Blocked for OS by BIOS",
"User required",
"User not required",
};
- input.count = 4;
- ppi_assign_params(params, TPM_PPI_FN_VERSION);
- input.pointer = params;
- status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ppi_callback, NULL,
- tpm_device_name, &handle);
- if (ACPI_FAILURE(status))
- return -ENXIO;
- status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output,
- ACPI_TYPE_STRING);
- if (ACPI_FAILURE(status))
- return -ENOMEM;
-
- strlcpy(version,
- ((union acpi_object *)output.pointer)->string.pointer,
- PPI_VERSION_LEN + 1);
- kfree(output.pointer);
- output.length = ACPI_ALLOCATE_BUFFER;
- output.pointer = NULL;
- if (strcmp(version, "1.2") == -1)
+ if (strcmp(tpm_ppi_version, "1.2") < 0)
return -EPERM;
- params[2].integer.value = TPM_PPI_FN_GETOPR;
- params[3].package.count = 1;
- obj.type = ACPI_TYPE_INTEGER;
- params[3].package.elements = &obj;
+ tmp.type = ACPI_TYPE_INTEGER;
for (i = start; i <= end; i++) {
- obj.integer.value = i;
- status = acpi_evaluate_object_typed(handle, "_DSM",
- &input, &output, ACPI_TYPE_INTEGER);
- if (ACPI_FAILURE(status))
+ tmp.integer.value = i;
+ obj = tpm_eval_dsm(TPM_PPI_FN_GETOPR, ACPI_TYPE_INTEGER, &argv);
+ if (!obj) {
return -ENOMEM;
+ } else {
+ ret = obj->integer.value;
+ ACPI_FREE(obj);
+ }
- ret = ((union acpi_object *)output.pointer)->integer.value;
if (ret > 0 && ret < ARRAY_SIZE(info))
str += scnprintf(str, PAGE_SIZE, "%d %d: %s\n",
i, ret, info[ret]);
- kfree(output.pointer);
- output.length = ACPI_ALLOCATE_BUFFER;
- output.pointer = NULL;
}
+
return str - buf;
}
@@ -453,6 +332,13 @@ static struct attribute_group ppi_attr_grp = {
int tpm_add_ppi(struct kobject *parent)
{
+ /* Cache TPM ACPI handle and version string */
+ acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ ppi_callback, NULL,
+ tpm_device_name, &tpm_ppi_handle);
+ if (tpm_ppi_handle == NULL)
+ return -ENODEV;
+
return sysfs_create_group(parent, &ppi_attr_grp);
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 09/13] ACPI, TPM: detecting PPI features by checking availability of _DSM functions
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (7 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 08/13] ACPI, TPM: replace open-coded _DSM specific code with helper functions Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 10/13] ACPI, i2c-hid: replace open-coded _DSM specific code with helper functions Jiang Liu
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, tpmdd-devel, linux-kernel
Cc: Jiang Liu, Tony Luck
Detecting physical presence interface features by checking availbility
of corresponding ACPI _DSM functions, it should be more accurate than
checking TPM version number.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/char/tpm/tpm_ppi.c | 45 +++++++++++++++++++-------------------------
1 file changed, 19 insertions(+), 26 deletions(-)
diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
index ad5143f..272c22d 100644
--- a/drivers/char/tpm/tpm_ppi.c
+++ b/drivers/char/tpm/tpm_ppi.c
@@ -23,39 +23,31 @@ static const u8 tpm_ppi_uuid[] = {
0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53
};
-static char *tpm_device_name = "TPM";
static char tpm_ppi_version[PPI_VERSION_LEN + 1];
static acpi_handle tpm_ppi_handle;
static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context,
void **return_value)
{
- acpi_status status = AE_OK;
- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *obj;
- status = acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
- if (ACPI_FAILURE(status))
+ if (!acpi_check_dsm(handle, tpm_ppi_uuid, TPM_PPI_REVISION_ID,
+ 1 << TPM_PPI_FN_VERSION))
return AE_OK;
- if (strstr(buffer.pointer, context) != NULL) {
- union acpi_object *obj;
-
- /* Cache version string */
- obj = acpi_evaluate_dsm_typed(handle, tpm_ppi_uuid,
- TPM_PPI_REVISION_ID, TPM_PPI_FN_VERSION,
- NULL, ACPI_TYPE_STRING);
- if (obj) {
- strlcpy(tpm_ppi_version, obj->string.pointer,
- PPI_VERSION_LEN + 1);
- ACPI_FREE(obj);
- }
-
- *return_value = handle;
- status = AE_CTRL_TERMINATE;
+ /* Cache version string */
+ obj = acpi_evaluate_dsm_typed(handle, tpm_ppi_uuid,
+ TPM_PPI_REVISION_ID, TPM_PPI_FN_VERSION,
+ NULL, ACPI_TYPE_STRING);
+ if (obj) {
+ strlcpy(tpm_ppi_version, obj->string.pointer,
+ PPI_VERSION_LEN + 1);
+ ACPI_FREE(obj);
}
- kfree(buffer.pointer);
- return status;
+ *return_value = handle;
+
+ return AE_CTRL_TERMINATE;
}
static inline union acpi_object *
@@ -118,7 +110,8 @@ 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 (strcmp(tpm_ppi_version, "1.1") >= 0)
+ if (acpi_check_dsm(tpm_ppi_handle, tpm_ppi_uuid, TPM_PPI_REVISION_ID,
+ 1 << TPM_PPI_FN_SUBREQ2))
func = TPM_PPI_FN_SUBREQ2;
/*
@@ -272,7 +265,8 @@ static ssize_t show_ppi_operations(char *buf, u32 start, u32 end)
"User not required",
};
- if (strcmp(tpm_ppi_version, "1.2") < 0)
+ if (!acpi_check_dsm(tpm_ppi_handle, tpm_ppi_uuid, TPM_PPI_REVISION_ID,
+ 1 << TPM_PPI_FN_GETOPR))
return -EPERM;
tmp.type = ACPI_TYPE_INTEGER;
@@ -334,8 +328,7 @@ int tpm_add_ppi(struct kobject *parent)
{
/* Cache TPM ACPI handle and version string */
acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- ppi_callback, NULL,
- tpm_device_name, &tpm_ppi_handle);
+ ppi_callback, NULL, NULL, &tpm_ppi_handle);
if (tpm_ppi_handle == NULL)
return -ENODEV;
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 10/13] ACPI, i2c-hid: replace open-coded _DSM specific code with helper functions
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (8 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 09/13] ACPI, TPM: detecting PPI features by checking availability of _DSM functions Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 11/13] ACPI, i915: " Jiang Liu
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, Benjamin Tissoires, Mika Westerberg,
Greg Kroah-Hartman, linux-input, linux-kernel
Cc: Jiang Liu, Tony Luck
Use helper functions to simplify _DSM related code in i2c-hid driver.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/hid/i2c-hid/i2c-hid.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 5f7e55f..d22668f 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -850,37 +850,23 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45,
0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE,
};
- union acpi_object params[4];
- struct acpi_object_list input;
+ union acpi_object *obj;
struct acpi_device *adev;
- unsigned long long value;
acpi_handle handle;
handle = ACPI_HANDLE(&client->dev);
if (!handle || acpi_bus_get_device(handle, &adev))
return -ENODEV;
- input.count = ARRAY_SIZE(params);
- input.pointer = params;
-
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = sizeof(i2c_hid_guid);
- params[0].buffer.pointer = i2c_hid_guid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = 1;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = 1; /* HID function */
- params[3].type = ACPI_TYPE_PACKAGE;
- params[3].package.count = 0;
- params[3].package.elements = NULL;
-
- if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_DSM", &input,
- &value))) {
+ 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");
return -ENODEV;
}
- pdata->hid_descriptor_address = value;
+ pdata->hid_descriptor_address = obj->integer.value;
+ ACPI_FREE(obj);
return 0;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 11/13] ACPI, i915: replace open-coded _DSM specific code with helper functions
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (9 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 10/13] ACPI, i2c-hid: replace open-coded _DSM specific code with helper functions Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 8:15 ` Daniel Vetter
2013-12-18 6:58 ` [RFC Patch v1 12/13] nouveau: fix memory leak in ACPI _DSM related code Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 13/13] ACPI, nouveau: replace open-coded _DSM specific code with helper functions Jiang Liu
12 siblings, 1 reply; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, intel-gfx, dri-devel, linux-kernel
Cc: Jiang Liu, Tony Luck
Use helper functions to simplify _DSM related code in i915 driver.
Function intel_dsm() is used to check functions supported by ACPI _DSM
method, but it has strange check for special value 0x80000002. After
digging into nouveau driver, I think the check is copied from nouveau
driver and is useless for i915 driver, so remove it.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/gpu/drm/i915/intel_acpi.c | 144 ++++++++-----------------------------
1 file changed, 30 insertions(+), 114 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c
index dfff090..1bfac94 100644
--- a/drivers/gpu/drm/i915/intel_acpi.c
+++ b/drivers/gpu/drm/i915/intel_acpi.c
@@ -12,8 +12,6 @@
#include "i915_drv.h"
#define INTEL_DSM_REVISION_ID 1 /* For Calpella anyway... */
-
-#define INTEL_DSM_FN_SUPPORTED_FUNCTIONS 0 /* No args */
#define INTEL_DSM_FN_PLATFORM_MUX_INFO 1 /* No args */
static struct intel_dsm_priv {
@@ -28,61 +26,6 @@ static const u8 intel_dsm_guid[] = {
0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c
};
-static int intel_dsm(acpi_handle handle, int func)
-{
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- struct acpi_object_list input;
- union acpi_object params[4];
- union acpi_object *obj;
- u32 result;
- int ret = 0;
-
- input.count = 4;
- input.pointer = params;
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = sizeof(intel_dsm_guid);
- params[0].buffer.pointer = (char *)intel_dsm_guid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = INTEL_DSM_REVISION_ID;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = func;
- params[3].type = ACPI_TYPE_PACKAGE;
- params[3].package.count = 0;
- params[3].package.elements = NULL;
-
- ret = acpi_evaluate_object(handle, "_DSM", &input, &output);
- if (ret) {
- DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret);
- return ret;
- }
-
- obj = (union acpi_object *)output.pointer;
-
- result = 0;
- switch (obj->type) {
- case ACPI_TYPE_INTEGER:
- result = obj->integer.value;
- break;
-
- case ACPI_TYPE_BUFFER:
- if (obj->buffer.length == 4) {
- result = (obj->buffer.pointer[0] |
- (obj->buffer.pointer[1] << 8) |
- (obj->buffer.pointer[2] << 16) |
- (obj->buffer.pointer[3] << 24));
- break;
- }
- default:
- ret = -EINVAL;
- break;
- }
- if (result == 0x80000002)
- ret = -ENODEV;
-
- kfree(output.pointer);
- return ret;
-}
-
static char *intel_dsm_port_name(u8 id)
{
switch (id) {
@@ -137,83 +80,56 @@ static char *intel_dsm_mux_type(u8 type)
static void intel_dsm_platform_mux_info(void)
{
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- struct acpi_object_list input;
- union acpi_object params[4];
- union acpi_object *pkg;
- int i, ret;
-
- input.count = 4;
- input.pointer = params;
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = sizeof(intel_dsm_guid);
- params[0].buffer.pointer = (char *)intel_dsm_guid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = INTEL_DSM_REVISION_ID;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = INTEL_DSM_FN_PLATFORM_MUX_INFO;
- params[3].type = ACPI_TYPE_PACKAGE;
- params[3].package.count = 0;
- params[3].package.elements = NULL;
-
- ret = acpi_evaluate_object(intel_dsm_priv.dhandle, "_DSM", &input,
- &output);
- if (ret) {
- DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret);
- goto out;
+ int i;
+ union acpi_object *pkg, *connector_count;
+
+ 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) {
+ DRM_DEBUG_DRIVER("failed to evaluate _DSM\n");
+ return;
}
- pkg = (union acpi_object *)output.pointer;
-
- if (pkg->type == ACPI_TYPE_PACKAGE) {
- union acpi_object *connector_count = &pkg->package.elements[0];
- DRM_DEBUG_DRIVER("MUX info connectors: %lld\n",
- (unsigned long long)connector_count->integer.value);
- for (i = 1; i < pkg->package.count; i++) {
- union acpi_object *obj = &pkg->package.elements[i];
- union acpi_object *connector_id =
- &obj->package.elements[0];
- union acpi_object *info = &obj->package.elements[1];
- DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n",
- (unsigned long long)connector_id->integer.value);
- DRM_DEBUG_DRIVER(" port id: %s\n",
- intel_dsm_port_name(info->buffer.pointer[0]));
- DRM_DEBUG_DRIVER(" display mux info: %s\n",
- intel_dsm_mux_type(info->buffer.pointer[1]));
- DRM_DEBUG_DRIVER(" aux/dc mux info: %s\n",
- intel_dsm_mux_type(info->buffer.pointer[2]));
- DRM_DEBUG_DRIVER(" hpd mux info: %s\n",
- intel_dsm_mux_type(info->buffer.pointer[3]));
- }
+ connector_count = &pkg->package.elements[0];
+ DRM_DEBUG_DRIVER("MUX info connectors: %lld\n",
+ (unsigned long long)connector_count->integer.value);
+ for (i = 1; i < pkg->package.count; i++) {
+ union acpi_object *obj = &pkg->package.elements[i];
+ union acpi_object *connector_id = &obj->package.elements[0];
+ union acpi_object *info = &obj->package.elements[1];
+ DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n",
+ (unsigned long long)connector_id->integer.value);
+ DRM_DEBUG_DRIVER(" port id: %s\n",
+ intel_dsm_port_name(info->buffer.pointer[0]));
+ DRM_DEBUG_DRIVER(" display mux info: %s\n",
+ intel_dsm_mux_type(info->buffer.pointer[1]));
+ DRM_DEBUG_DRIVER(" aux/dc mux info: %s\n",
+ intel_dsm_mux_type(info->buffer.pointer[2]));
+ DRM_DEBUG_DRIVER(" hpd mux info: %s\n",
+ intel_dsm_mux_type(info->buffer.pointer[3]));
}
-out:
- kfree(output.pointer);
+ ACPI_FREE(pkg);
}
static bool intel_dsm_pci_probe(struct pci_dev *pdev)
{
acpi_handle dhandle;
- int ret;
dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle)
return false;
- if (!acpi_has_method(dhandle, "_DSM")) {
+ 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;
}
- ret = intel_dsm(dhandle, INTEL_DSM_FN_SUPPORTED_FUNCTIONS);
- if (ret < 0) {
- DRM_DEBUG_KMS("failed to get supported _DSM functions\n");
- return false;
- }
-
intel_dsm_priv.dhandle = dhandle;
-
intel_dsm_platform_mux_info();
+
return true;
}
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 12/13] nouveau: fix memory leak in ACPI _DSM related code
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (10 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 11/13] ACPI, i915: " Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 13/13] ACPI, nouveau: replace open-coded _DSM specific code with helper functions Jiang Liu
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, Jiang Liu, Dave Airlie, Zhang Rui,
Greg Kroah-Hartman, dri-devel, linux-kernel
Cc: Tony Luck
Fix memory leak in function nouveau_optimus_dsm() and nouveau_dsm().
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/gpu/drm/nouveau/nouveau_acpi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 95c7404..03d4911 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -110,6 +110,7 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
if (obj->type == ACPI_TYPE_INTEGER)
if (obj->integer.value == 0x80000002) {
+ kfree(output.pointer);
return -ENODEV;
}
@@ -156,8 +157,10 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
obj = (union acpi_object *)output.pointer;
if (obj->type == ACPI_TYPE_INTEGER)
- if (obj->integer.value == 0x80000002)
+ if (obj->integer.value == 0x80000002) {
+ kfree(output.pointer);
return -ENODEV;
+ }
if (obj->type == ACPI_TYPE_BUFFER) {
if (obj->buffer.length == 4 && result) {
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC Patch v1 13/13] ACPI, nouveau: replace open-coded _DSM specific code with helper functions
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
` (11 preceding siblings ...)
2013-12-18 6:58 ` [RFC Patch v1 12/13] nouveau: fix memory leak in ACPI _DSM related code Jiang Liu
@ 2013-12-18 6:58 ` Jiang Liu
12 siblings, 0 replies; 14+ messages in thread
From: Jiang Liu @ 2013-12-18 6:58 UTC (permalink / raw)
To: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, Ben Skeggs, Greg Kroah-Hartman,
Jiang Liu, Dave Airlie, Zhang Rui, dri-devel, linux-kernel
Cc: Tony Luck
Use helper functions to simplify _DSM related code in nouveau driver.
After analyzing the ACPI _DSM related code, I changed nouveau_optimus_dsm()
to expect a buffer and nouveau_dsm() to expect an integer only.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/gpu/drm/nouveau/core/subdev/mxm/base.c | 48 +++-----
drivers/gpu/drm/nouveau/nouveau_acpi.c | 139 +++++++-----------------
2 files changed, 54 insertions(+), 133 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
index 1291204..13c5af8 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
@@ -87,55 +87,39 @@ mxm_shadow_dsm(struct nouveau_mxm *mxm, u8 version)
0xB8, 0x9C, 0x79, 0xB6, 0x2F, 0xD5, 0x56, 0x65
};
u32 mxms_args[] = { 0x00000000 };
- union acpi_object args[4] = {
- /* _DSM MUID */
- { .buffer.type = 3,
- .buffer.length = sizeof(muid),
- .buffer.pointer = muid,
- },
- /* spec says this can be zero to mean "highest revision", but
- * of course there's at least one bios out there which fails
- * unless you pass in exactly the version it supports..
- */
- { .integer.type = ACPI_TYPE_INTEGER,
- .integer.value = (version & 0xf0) << 4 | (version & 0x0f),
- },
- /* MXMS function */
- { .integer.type = ACPI_TYPE_INTEGER,
- .integer.value = 0x00000010,
- },
- /* Pointer to MXMS arguments */
- { .buffer.type = ACPI_TYPE_BUFFER,
- .buffer.length = sizeof(mxms_args),
- .buffer.pointer = (char *)mxms_args,
- },
+ union acpi_object argv4 = {
+ .buffer.type = ACPI_TYPE_BUFFER,
+ .buffer.length = sizeof(mxms_args),
+ .buffer.pointer = (char *)mxms_args,
};
- struct acpi_object_list list = { ARRAY_SIZE(args), args };
- struct acpi_buffer retn = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;
acpi_handle handle;
- int ret;
+ int rev;
handle = ACPI_HANDLE(&device->pdev->dev);
if (!handle)
return false;
- ret = acpi_evaluate_object(handle, "_DSM", &list, &retn);
- if (ret) {
- nv_debug(mxm, "DSM MXMS failed: %d\n", ret);
+ /*
+ * spec says this can be zero to mean "highest revision", but
+ * of course there's at least one bios out there which fails
+ * unless you pass in exactly the version it supports..
+ */
+ rev = (version & 0xf0) << 4 | (version & 0x0f);
+ obj = acpi_evaluate_dsm(handle, muid, rev, 0x00000010, &argv4);
+ if (!obj) {
+ nv_debug(mxm, "DSM MXMS failed\n");
return false;
}
- obj = retn.pointer;
if (obj->type == ACPI_TYPE_BUFFER) {
mxm->mxms = kmemdup(obj->buffer.pointer,
obj->buffer.length, GFP_KERNEL);
- } else
- if (obj->type == ACPI_TYPE_INTEGER) {
+ } else if (obj->type == ACPI_TYPE_INTEGER) {
nv_debug(mxm, "DSM MXMS returned 0x%llx\n", obj->integer.value);
}
- kfree(obj);
+ ACPI_FREE(obj);
return mxm->mxms != NULL;
}
#endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 03d4911..7ac7234 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -77,127 +77,66 @@ static const char nouveau_op_dsm_muid[] = {
static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
{
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- struct acpi_object_list input;
- union acpi_object params[4];
+ int i;
union acpi_object *obj;
- int i, err;
char args_buff[4];
+ union acpi_object argv4 = {
+ .type = ACPI_TYPE_BUFFER,
+ .buffer.length = 4,
+ .buffer.pointer = args_buff
+ };
- input.count = 4;
- input.pointer = params;
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = sizeof(nouveau_op_dsm_muid);
- params[0].buffer.pointer = (char *)nouveau_op_dsm_muid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = 0x00000100;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = func;
- params[3].type = ACPI_TYPE_BUFFER;
- params[3].buffer.length = 4;
/* ACPI is little endian, AABBCCDD becomes {DD,CC,BB,AA} */
for (i = 0; i < 4; i++)
args_buff[i] = (arg >> i * 8) & 0xFF;
- params[3].buffer.pointer = args_buff;
- err = acpi_evaluate_object(handle, "_DSM", &input, &output);
- if (err) {
- printk(KERN_INFO "failed to evaluate _DSM: %d\n", err);
- return err;
- }
-
- obj = (union acpi_object *)output.pointer;
-
- if (obj->type == ACPI_TYPE_INTEGER)
- if (obj->integer.value == 0x80000002) {
- kfree(output.pointer);
- return -ENODEV;
- }
-
- if (obj->type == ACPI_TYPE_BUFFER) {
- if (obj->buffer.length == 4 && result) {
- *result = 0;
+ *result = 0;
+ 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");
+ return AE_ERROR;
+ } else {
+ if (obj->buffer.length == 4) {
*result |= obj->buffer.pointer[0];
*result |= (obj->buffer.pointer[1] << 8);
*result |= (obj->buffer.pointer[2] << 16);
*result |= (obj->buffer.pointer[3] << 24);
}
+ ACPI_FREE(obj);
}
- kfree(output.pointer);
return 0;
}
-static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
+static int nouveau_dsm(acpi_handle handle, int func, int arg)
{
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- struct acpi_object_list input;
- union acpi_object params[4];
+ int ret = 0;
union acpi_object *obj;
- int err;
-
- input.count = 4;
- input.pointer = params;
- params[0].type = ACPI_TYPE_BUFFER;
- params[0].buffer.length = sizeof(nouveau_dsm_muid);
- params[0].buffer.pointer = (char *)nouveau_dsm_muid;
- params[1].type = ACPI_TYPE_INTEGER;
- params[1].integer.value = 0x00000102;
- params[2].type = ACPI_TYPE_INTEGER;
- params[2].integer.value = func;
- params[3].type = ACPI_TYPE_INTEGER;
- params[3].integer.value = arg;
-
- err = acpi_evaluate_object(handle, "_DSM", &input, &output);
- if (err) {
- printk(KERN_INFO "failed to evaluate _DSM: %d\n", err);
- return err;
- }
-
- obj = (union acpi_object *)output.pointer;
-
- if (obj->type == ACPI_TYPE_INTEGER)
- if (obj->integer.value == 0x80000002) {
- kfree(output.pointer);
- return -ENODEV;
- }
-
- if (obj->type == ACPI_TYPE_BUFFER) {
- if (obj->buffer.length == 4 && result) {
- *result = 0;
- *result |= obj->buffer.pointer[0];
- *result |= (obj->buffer.pointer[1] << 8);
- *result |= (obj->buffer.pointer[2] << 16);
- *result |= (obj->buffer.pointer[3] << 24);
- }
+ union acpi_object argv4 = {
+ .type = ACPI_TYPE_INTEGER,
+ .integer.value = arg,
+ };
+
+ 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");
+ return AE_ERROR;
+ } else {
+ if (obj->integer.value == 0x80000002)
+ ret = -ENODEV;
+ ACPI_FREE(obj);
}
- kfree(output.pointer);
- return 0;
-}
-
-/* Returns 1 if a DSM function is usable and 0 otherwise */
-static int nouveau_test_dsm(acpi_handle test_handle,
- int (*dsm_func)(acpi_handle, int, int, uint32_t *),
- int sfnc)
-{
- u32 result = 0;
-
- /* Function 0 returns a Buffer containing available functions. The args
- * parameter is ignored for function 0, so just put 0 in it */
- if (dsm_func(test_handle, 0, 0, &result))
- return 0;
-
- /* ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported. If
- * the n-th bit is enabled, function n is supported */
- return result & 1 && result & (1 << sfnc);
+ return ret;
}
static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id)
{
mxm_wmi_call_mxmx(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
mxm_wmi_call_mxds(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
- return nouveau_dsm(handle, NOUVEAU_DSM_LED, mux_id, NULL);
+ return nouveau_dsm(handle, NOUVEAU_DSM_LED, mux_id);
}
static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switcheroo_state state)
@@ -207,7 +146,7 @@ static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switchero
arg = NOUVEAU_DSM_POWER_SPEED;
else
arg = NOUVEAU_DSM_POWER_STAMINA;
- nouveau_dsm(handle, NOUVEAU_DSM_POWER, arg, NULL);
+ nouveau_dsm(handle, NOUVEAU_DSM_POWER, arg);
return 0;
}
@@ -263,14 +202,12 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
if (!dhandle)
return false;
- if (!acpi_has_method(dhandle, "_DSM"))
- return false;
-
- if (nouveau_test_dsm(dhandle, nouveau_dsm, NOUVEAU_DSM_POWER))
+ if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
+ 1 << NOUVEAU_DSM_POWER))
retval |= NOUVEAU_DSM_HAS_MUX;
- if (nouveau_test_dsm(dhandle, nouveau_optimus_dsm,
- NOUVEAU_DSM_OPTIMUS_CAPS))
+ if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x00000100,
+ 1 << NOUVEAU_DSM_OPTIMUS_CAPS))
retval |= NOUVEAU_DSM_HAS_OPT;
if (retval & NOUVEAU_DSM_HAS_OPT) {
--
1.7.10.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC Patch v1 11/13] ACPI, i915: replace open-coded _DSM specific code with helper functions
2013-12-18 6:58 ` [RFC Patch v1 11/13] ACPI, i915: " Jiang Liu
@ 2013-12-18 8:15 ` Daniel Vetter
0 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2013-12-18 8:15 UTC (permalink / raw)
To: Jiang Liu
Cc: Rafael J . Wysocki, Bjorn Helgaas, Lv Zheng, Len Brown,
Leonidas Da Silva Barbosa, Ashley Lai, Peter Huewe,
Rajiv Andrade, Marcel Selhorst, Sirrix AG, Daniel Vetter,
David Airlie, Jiri Kosina, intel-gfx, dri-devel, linux-kernel,
Tony Luck, Dave Airlie
On Wed, Dec 18, 2013 at 02:58:19PM +0800, Jiang Liu wrote:
> Use helper functions to simplify _DSM related code in i915 driver.
>
> Function intel_dsm() is used to check functions supported by ACPI _DSM
> method, but it has strange check for special value 0x80000002. After
> digging into nouveau driver, I think the check is copied from nouveau
> driver and is useless for i915 driver, so remove it.
>
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Looks like a neat cleanup, so ack from my side. I don't have any clue
about the special case, cc'ing Dave maybe he remembers.
-Daniel
> ---
> drivers/gpu/drm/i915/intel_acpi.c | 144 ++++++++-----------------------------
> 1 file changed, 30 insertions(+), 114 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c
> index dfff090..1bfac94 100644
> --- a/drivers/gpu/drm/i915/intel_acpi.c
> +++ b/drivers/gpu/drm/i915/intel_acpi.c
> @@ -12,8 +12,6 @@
> #include "i915_drv.h"
>
> #define INTEL_DSM_REVISION_ID 1 /* For Calpella anyway... */
> -
> -#define INTEL_DSM_FN_SUPPORTED_FUNCTIONS 0 /* No args */
> #define INTEL_DSM_FN_PLATFORM_MUX_INFO 1 /* No args */
>
> static struct intel_dsm_priv {
> @@ -28,61 +26,6 @@ static const u8 intel_dsm_guid[] = {
> 0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c
> };
>
> -static int intel_dsm(acpi_handle handle, int func)
> -{
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> - struct acpi_object_list input;
> - union acpi_object params[4];
> - union acpi_object *obj;
> - u32 result;
> - int ret = 0;
> -
> - input.count = 4;
> - input.pointer = params;
> - params[0].type = ACPI_TYPE_BUFFER;
> - params[0].buffer.length = sizeof(intel_dsm_guid);
> - params[0].buffer.pointer = (char *)intel_dsm_guid;
> - params[1].type = ACPI_TYPE_INTEGER;
> - params[1].integer.value = INTEL_DSM_REVISION_ID;
> - params[2].type = ACPI_TYPE_INTEGER;
> - params[2].integer.value = func;
> - params[3].type = ACPI_TYPE_PACKAGE;
> - params[3].package.count = 0;
> - params[3].package.elements = NULL;
> -
> - ret = acpi_evaluate_object(handle, "_DSM", &input, &output);
> - if (ret) {
> - DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret);
> - return ret;
> - }
> -
> - obj = (union acpi_object *)output.pointer;
> -
> - result = 0;
> - switch (obj->type) {
> - case ACPI_TYPE_INTEGER:
> - result = obj->integer.value;
> - break;
> -
> - case ACPI_TYPE_BUFFER:
> - if (obj->buffer.length == 4) {
> - result = (obj->buffer.pointer[0] |
> - (obj->buffer.pointer[1] << 8) |
> - (obj->buffer.pointer[2] << 16) |
> - (obj->buffer.pointer[3] << 24));
> - break;
> - }
> - default:
> - ret = -EINVAL;
> - break;
> - }
> - if (result == 0x80000002)
> - ret = -ENODEV;
> -
> - kfree(output.pointer);
> - return ret;
> -}
> -
> static char *intel_dsm_port_name(u8 id)
> {
> switch (id) {
> @@ -137,83 +80,56 @@ static char *intel_dsm_mux_type(u8 type)
>
> static void intel_dsm_platform_mux_info(void)
> {
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> - struct acpi_object_list input;
> - union acpi_object params[4];
> - union acpi_object *pkg;
> - int i, ret;
> -
> - input.count = 4;
> - input.pointer = params;
> - params[0].type = ACPI_TYPE_BUFFER;
> - params[0].buffer.length = sizeof(intel_dsm_guid);
> - params[0].buffer.pointer = (char *)intel_dsm_guid;
> - params[1].type = ACPI_TYPE_INTEGER;
> - params[1].integer.value = INTEL_DSM_REVISION_ID;
> - params[2].type = ACPI_TYPE_INTEGER;
> - params[2].integer.value = INTEL_DSM_FN_PLATFORM_MUX_INFO;
> - params[3].type = ACPI_TYPE_PACKAGE;
> - params[3].package.count = 0;
> - params[3].package.elements = NULL;
> -
> - ret = acpi_evaluate_object(intel_dsm_priv.dhandle, "_DSM", &input,
> - &output);
> - if (ret) {
> - DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret);
> - goto out;
> + int i;
> + union acpi_object *pkg, *connector_count;
> +
> + 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) {
> + DRM_DEBUG_DRIVER("failed to evaluate _DSM\n");
> + return;
> }
>
> - pkg = (union acpi_object *)output.pointer;
> -
> - if (pkg->type == ACPI_TYPE_PACKAGE) {
> - union acpi_object *connector_count = &pkg->package.elements[0];
> - DRM_DEBUG_DRIVER("MUX info connectors: %lld\n",
> - (unsigned long long)connector_count->integer.value);
> - for (i = 1; i < pkg->package.count; i++) {
> - union acpi_object *obj = &pkg->package.elements[i];
> - union acpi_object *connector_id =
> - &obj->package.elements[0];
> - union acpi_object *info = &obj->package.elements[1];
> - DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n",
> - (unsigned long long)connector_id->integer.value);
> - DRM_DEBUG_DRIVER(" port id: %s\n",
> - intel_dsm_port_name(info->buffer.pointer[0]));
> - DRM_DEBUG_DRIVER(" display mux info: %s\n",
> - intel_dsm_mux_type(info->buffer.pointer[1]));
> - DRM_DEBUG_DRIVER(" aux/dc mux info: %s\n",
> - intel_dsm_mux_type(info->buffer.pointer[2]));
> - DRM_DEBUG_DRIVER(" hpd mux info: %s\n",
> - intel_dsm_mux_type(info->buffer.pointer[3]));
> - }
> + connector_count = &pkg->package.elements[0];
> + DRM_DEBUG_DRIVER("MUX info connectors: %lld\n",
> + (unsigned long long)connector_count->integer.value);
> + for (i = 1; i < pkg->package.count; i++) {
> + union acpi_object *obj = &pkg->package.elements[i];
> + union acpi_object *connector_id = &obj->package.elements[0];
> + union acpi_object *info = &obj->package.elements[1];
> + DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n",
> + (unsigned long long)connector_id->integer.value);
> + DRM_DEBUG_DRIVER(" port id: %s\n",
> + intel_dsm_port_name(info->buffer.pointer[0]));
> + DRM_DEBUG_DRIVER(" display mux info: %s\n",
> + intel_dsm_mux_type(info->buffer.pointer[1]));
> + DRM_DEBUG_DRIVER(" aux/dc mux info: %s\n",
> + intel_dsm_mux_type(info->buffer.pointer[2]));
> + DRM_DEBUG_DRIVER(" hpd mux info: %s\n",
> + intel_dsm_mux_type(info->buffer.pointer[3]));
> }
>
> -out:
> - kfree(output.pointer);
> + ACPI_FREE(pkg);
> }
>
> static bool intel_dsm_pci_probe(struct pci_dev *pdev)
> {
> acpi_handle dhandle;
> - int ret;
>
> dhandle = ACPI_HANDLE(&pdev->dev);
> if (!dhandle)
> return false;
>
> - if (!acpi_has_method(dhandle, "_DSM")) {
> + 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;
> }
>
> - ret = intel_dsm(dhandle, INTEL_DSM_FN_SUPPORTED_FUNCTIONS);
> - if (ret < 0) {
> - DRM_DEBUG_KMS("failed to get supported _DSM functions\n");
> - return false;
> - }
> -
> intel_dsm_priv.dhandle = dhandle;
> -
> intel_dsm_platform_mux_info();
> +
> return true;
> }
>
> --
> 1.7.10.4
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-12-18 8:14 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
2013-12-18 6:58 ` [RFC Patch v1 01/13] ACPI: introduce helper interfaces to support ACPI _DSM method Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 02/13] ACPI, extlog: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 03/13] PCI, pci-label: release allocated ACPI object on error recovery path Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 04/13] ACPI, PCI: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 05/13] PCI, pci-label: treat PCI label with index 0 as valid label Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 06/13] ACPI, TPM: fix memory leak when walking ACPI namespace Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 07/13] ACPI, TPM: matching node name instead of full path when searching for TPM device Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 08/13] ACPI, TPM: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 09/13] ACPI, TPM: detecting PPI features by checking availability of _DSM functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 10/13] ACPI, i2c-hid: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 11/13] ACPI, i915: " Jiang Liu
2013-12-18 8:15 ` Daniel Vetter
2013-12-18 6:58 ` [RFC Patch v1 12/13] nouveau: fix memory leak in ACPI _DSM related code Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 13/13] ACPI, nouveau: replace open-coded _DSM specific code with helper functions Jiang Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®