Sat Sep 28 11:24:10 2019 UTC ()
joshua stein, PR kern/54493: acpi_i2c uses incorrect arguments for _DSM call

The last argument to the _DSM call has to be ACPI_TYPE_PACKAGE, as defined in in
clude/acpredef.h for _DSM.

Avoids an ACPI warning at boot.


(bouyer)
diff -r1.4 -r1.5 src/sys/dev/acpi/acpi_i2c.c

cvs diff -r1.4 -r1.5 src/sys/dev/acpi/acpi_i2c.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi_i2c.c 2018/05/05 17:16:23 1.4
+++ src/sys/dev/acpi/acpi_i2c.c 2019/09/28 11:24:10 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $ */ 1/* $NetBSD: acpi_i2c.c,v 1.5 2019/09/28 11:24:10 bouyer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 The NetBSD Foundation, Inc. 4 * Copyright (c) 2017 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Manuel Bouyer. 8 * by Manuel Bouyer.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.5 2019/09/28 11:24:10 bouyer Exp $");
34 34
35#include <dev/acpi/acpireg.h> 35#include <dev/acpi/acpireg.h>
36#include <dev/acpi/acpivar.h> 36#include <dev/acpi/acpivar.h>
37#include <dev/acpi/acpi_i2c.h> 37#include <dev/acpi/acpi_i2c.h>
38 38
39#define _COMPONENT ACPI_BUS_COMPONENT 39#define _COMPONENT ACPI_BUS_COMPONENT
40ACPI_MODULE_NAME ("acpi_i2c") 40ACPI_MODULE_NAME ("acpi_i2c")
41 41
42static void 42static void
43acpi_enter_i2c_hid(struct acpi_devnode *devnode, prop_dictionary_t dev) 43acpi_enter_i2c_hid(struct acpi_devnode *devnode, prop_dictionary_t dev)
44{ 44{
45 ACPI_OBJECT_LIST arg; 45 ACPI_OBJECT_LIST arg;
46 ACPI_OBJECT obj[4]; 46 ACPI_OBJECT obj[4];
@@ -58,27 +58,27 @@ acpi_enter_i2c_hid(struct acpi_devnode * @@ -58,27 +58,27 @@ acpi_enter_i2c_hid(struct acpi_devnode *
58 58
59 obj[0].Type = ACPI_TYPE_BUFFER; 59 obj[0].Type = ACPI_TYPE_BUFFER;
60 obj[0].Buffer.Length = sizeof(i2c_hid_guid); 60 obj[0].Buffer.Length = sizeof(i2c_hid_guid);
61 obj[0].Buffer.Pointer = i2c_hid_guid; 61 obj[0].Buffer.Pointer = i2c_hid_guid;
62 62
63 /* rev */ 63 /* rev */
64 obj[1].Type = ACPI_TYPE_INTEGER; 64 obj[1].Type = ACPI_TYPE_INTEGER;
65 obj[1].Integer.Value = 1; 65 obj[1].Integer.Value = 1;
66 66
67 /* func */ 67 /* func */
68 obj[2].Type = ACPI_TYPE_INTEGER; 68 obj[2].Type = ACPI_TYPE_INTEGER;
69 obj[2].Integer.Value = 1; 69 obj[2].Integer.Value = 1;
70 70
71 obj[3].Type = ACPI_TYPE_ANY; 71 obj[3].Type = ACPI_TYPE_PACKAGE;
72 obj[3].Buffer.Length = 0; 72 obj[3].Buffer.Length = 0;
73 73
74 buf.Pointer = NULL; 74 buf.Pointer = NULL;
75 buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 75 buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
76 76
77 rv = AcpiEvaluateObject(devnode->ad_handle, "_DSM", &arg, &buf); 77 rv = AcpiEvaluateObject(devnode->ad_handle, "_DSM", &arg, &buf);
78 78
79 if (ACPI_FAILURE(rv)) { 79 if (ACPI_FAILURE(rv)) {
80 aprint_error("failed to evaluate _DSM for %s: %s\n", 80 aprint_error("failed to evaluate _DSM for %s: %s\n",
81 devnode->ad_name, AcpiFormatException(rv)); 81 devnode->ad_name, AcpiFormatException(rv));
82 return; 82 return;
83 } 83 }
84 84