]> Pileus Git - ~andy/linux/blobdiff - drivers/acpi/acpi_extlog.c
Merge tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[~andy/linux] / drivers / acpi / acpi_extlog.c
index 5d33c54154050b452b996e4433ab676e4829f50e..c4a5d87ede7e81cb16ada28d6bf896351b42e79b 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <linux/module.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
 #include <linux/cper.h>
 #include <linux/ratelimit.h>
 #include <linux/edac.h>
 #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
 
@@ -46,7 +43,7 @@ struct extlog_l1_head {
 
 static int old_edac_report_status;
 
-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;
@@ -156,62 +153,27 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
        return NOTIFY_STOP;
 }
 
-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",