Deleted Added
full compact
acpi_powerres.c (79357) acpi_powerres.c (79493)
1/*-
2 * Copyright (c) 2001 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2001 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/acpica/acpi_powerres.c 79357 2001-07-06 09:00:07Z msmith $
26 * $FreeBSD: head/sys/dev/acpica/acpi_powerres.c 79493 2001-07-09 21:24:59Z msmith $
27 */
28
29#include "opt_acpi.h" /* XXX trim includes */
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/proc.h>
33#include <sys/lock.h>
34#include <sys/malloc.h>

--- 105 unchanged lines hidden (view full) ---

140 *
141 * It's OK to call this if we already know about the resource.
142 */
143static ACPI_STATUS
144acpi_pwr_register_resource(ACPI_HANDLE res)
145{
146 ACPI_STATUS status;
147 ACPI_BUFFER buf;
27 */
28
29#include "opt_acpi.h" /* XXX trim includes */
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/proc.h>
33#include <sys/lock.h>
34#include <sys/malloc.h>

--- 105 unchanged lines hidden (view full) ---

140 *
141 * It's OK to call this if we already know about the resource.
142 */
143static ACPI_STATUS
144acpi_pwr_register_resource(ACPI_HANDLE res)
145{
146 ACPI_STATUS status;
147 ACPI_BUFFER buf;
148 ACPI_OPERAND_OBJECT *obj;
148 ACPI_OBJECT *obj;
149 struct acpi_powerresource *rp, *srp;
150
151 FUNCTION_TRACE(__func__);
152
153 rp = NULL;
154 obj = NULL;
155
156 /* look to see if we know about this resource */

--- 9 unchanged lines hidden (view full) ---

166 rp->ap_resource = res;
167
168 /* get the Power Resource object */
169 if ((status = acpi_EvaluateIntoBuffer(res, NULL, NULL, &buf)) != AE_OK) {
170 DEBUG_PRINT(TRACE_OBJECTS, ("no power resource object\n"));
171 goto out;
172 }
173 obj = buf.Pointer;
149 struct acpi_powerresource *rp, *srp;
150
151 FUNCTION_TRACE(__func__);
152
153 rp = NULL;
154 obj = NULL;
155
156 /* look to see if we know about this resource */

--- 9 unchanged lines hidden (view full) ---

166 rp->ap_resource = res;
167
168 /* get the Power Resource object */
169 if ((status = acpi_EvaluateIntoBuffer(res, NULL, NULL, &buf)) != AE_OK) {
170 DEBUG_PRINT(TRACE_OBJECTS, ("no power resource object\n"));
171 goto out;
172 }
173 obj = buf.Pointer;
174 if (obj->Common.Type != ACPI_TYPE_POWER) {
174 if (obj->Type != ACPI_TYPE_POWER) {
175 DEBUG_PRINT(TRACE_OBJECTS, ("questionable power resource object %s\n", acpi_name(res)));
175 DEBUG_PRINT(TRACE_OBJECTS, ("questionable power resource object %s\n", acpi_name(res)));
176 /* XXX ACPI CA seems to return ACPI_TYPE_ANY, needs to be fixed */
177 rp->ap_systemlevel = 0;
178 rp->ap_order = 0;
179 } else {
180 rp->ap_systemlevel = obj->PowerResource.SystemLevel;
181 rp->ap_order = obj->PowerResource.ResourceOrder;
176 status = AE_TYPE;
177 goto out;
182 }
178 }
179 rp->ap_systemlevel = obj->PowerResource.SystemLevel;
180 rp->ap_order = obj->PowerResource.ResourceOrder;
183
184 /* sort the resource into the list */
185 status = AE_OK;
186 srp = TAILQ_FIRST(&acpi_powerresources);
187 if ((srp == NULL) || (rp->ap_order < srp->ap_order)) {
188 TAILQ_INSERT_HEAD(&acpi_powerresources, rp, ap_link);
189 goto done;
190 }

--- 425 unchanged lines hidden ---
181
182 /* sort the resource into the list */
183 status = AE_OK;
184 srp = TAILQ_FIRST(&acpi_powerresources);
185 if ((srp == NULL) || (rp->ap_order < srp->ap_order)) {
186 TAILQ_INSERT_HEAD(&acpi_powerresources, rp, ap_link);
187 goto done;
188 }

--- 425 unchanged lines hidden ---