CVS commit: src/sys/dev/acpi/acpica

2019-02-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 15 20:48:57 UTC 2019

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
Avoid UB in OsdHardware.c

UBSan: Undefined Behavior in src/sys/dev/acpi/acpica/OsdHardware.c:265:17,
left shift of 255 by 24 places cannot be represented in type 'int'

This file isn't part of upstream acpica so just fix it locally.

Reported and initial patch by 


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpica/OsdHardware.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.10 src/sys/dev/acpi/acpica/OsdHardware.c:1.11
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.10	Tue Jan 26 22:52:14 2016
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Fri Feb 15 20:48:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.11 2019/02/15 20:48:57 kamil Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.11 2019/02/15 20:48:57 kamil Exp $");
 
 #include 
 #include 
@@ -262,13 +262,13 @@ AcpiOsWritePciConfiguration(ACPI_PCI_ID 
 	switch (Width) {
 	case 8:
 		tmp = pci_conf_read(pc, tag, Register & ~3);
-		tmp &= ~(0xff << ((Register & 3) * 8));
+		tmp &= ~(0xffu << ((Register & 3) * 8));
 		tmp |= (Value << ((Register & 3) * 8));
 		break;
 
 	case 16:
 		tmp = pci_conf_read(pc, tag, Register & ~3);
-		tmp &= ~(0x << ((Register & 3) * 8));
+		tmp &= ~(0xu << ((Register & 3) * 8));
 		tmp |= (Value << ((Register & 3) * 8));
 		break;
 



CVS commit: src/sys/dev/acpi/acpica

2018-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 12 21:36:24 UTC 2018

Modified Files:
src/sys/dev/acpi/acpica: acpi_func.h

Log Message:
Implement ACPI_FLUSH_CPU_CACHE on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpica/acpi_func.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/acpi_func.h
diff -u src/sys/dev/acpi/acpica/acpi_func.h:1.5 src/sys/dev/acpi/acpica/acpi_func.h:1.6
--- src/sys/dev/acpi/acpica/acpi_func.h:1.5	Thu Apr 19 21:50:08 2018
+++ src/sys/dev/acpi/acpica/acpi_func.h	Fri Oct 12 21:36:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_func.h,v 1.5 2018/04/19 21:50:08 christos Exp $	*/
+/*	$NetBSD: acpi_func.h,v 1.6 2018/10/12 21:36:24 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2000 Michael Smith
@@ -83,10 +83,12 @@ acpi_release_global_lock(uint32_t *lock)
 /*
  * XXX: Should be in a MD header.
  */
-#ifndef __ia64__
-#define	ACPI_FLUSH_CPU_CACHE()	wbinvd()
+#if defined(__ia64__)
+#define	ACPI_FLUSH_CPU_CACHE()	/* XXX: ia64_fc()? */
+#elif defined(__aarch64__)
+#define	ACPI_FLUSH_CPU_CACHE()	cpu_dcache_wbinv_all()
 #else
-#define ACPI_FLUSH_CPU_CACHE()	/* XXX: ia64_fc()? */
+#define	ACPI_FLUSH_CPU_CACHE()	wbinvd()
 #endif
 
 #endif /* !_SYS_DEV_ACPI_ACPICA_ACPI_FUNC_H */



CVS commit: src/sys/dev/acpi/acpica

2017-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov 12 02:59:55 UTC 2017

Modified Files:
src/sys/dev/acpi/acpica: OsdSchedule.c

Log Message:
Provide a primitive incrementing counter if we are call since the new
Acpi dispatcher requires us to have one when we are cold (shudder).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/acpi/acpica/OsdSchedule.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.18 src/sys/dev/acpi/acpica/OsdSchedule.c:1.19
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.18	Sat Jan  9 16:14:42 2016
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Sat Nov 11 21:59:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.18 2016/01/09 21:14:42 christos Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.19 2017/11/12 02:59:55 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.18 2016/01/09 21:14:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.19 2017/11/12 02:59:55 christos Exp $");
 
 #include 
 #include 
@@ -168,12 +168,14 @@ AcpiOsStall(UINT32 Microseconds)
 UINT64
 AcpiOsGetTimer(void)
 {
+	static UINT64 xt;
 	struct timeval tv;
 	UINT64 t;
 
 	/* XXX During early boot there is no (decent) timer available yet. */
-	if (cold)
-		panic("acpi: timer op not yet supported during boot");
+	if (cold) {
+		return xt += 100;
+	}
 
 	microtime();
 	t = (UINT64)10 * tv.tv_usec;



CVS commit: src/sys/dev/acpi/acpica

2017-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 25 13:38:40 UTC 2017

Modified Files:
src/sys/dev/acpi/acpica: OsdMisc.c

Log Message:
implement new interfaces


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/acpi/acpica/OsdMisc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMisc.c
diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.15 src/sys/dev/acpi/acpica/OsdMisc.c:1.16
--- src/sys/dev/acpi/acpica/OsdMisc.c:1.15	Sat Jan  9 16:14:42 2016
+++ src/sys/dev/acpi/acpica/OsdMisc.c	Wed Jan 25 08:38:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMisc.c,v 1.15 2016/01/09 21:14:42 christos Exp $	*/
+/*	$NetBSD: OsdMisc.c,v 1.16 2017/01/25 13:38:40 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,13 +36,50 @@
  */
 
 /*
+ * Copyright (C) 2000 - 2017, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions, and the following disclaimer,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *substantially similar to the "NO WARRANTY" disclaimer below
+ *("Disclaimer") and any redistribution must be conditioned upon
+ *including a substantially similar Disclaimer requirement for further
+ *binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *of any contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/*
  * OS Services Layer
  *
  * 6.10: Miscellaneous
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdMisc.c,v 1.15 2016/01/09 21:14:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdMisc.c,v 1.16 2017/01/25 13:38:40 christos Exp $");
 
 #include "opt_acpi.h"
 #include "opt_ddb.h"
@@ -59,6 +96,8 @@ __KERNEL_RCSID(0, "$NetBSD: OsdMisc.c,v 
 #include 
 
 #ifdef ACPI_DEBUG
+#include 
+#include 
 #include 
 #endif
 
@@ -189,6 +228,33 @@ AcpiOsPhysicalTableOverride (
 	return AE_SUPPORT;
 }
 
+/**
+ *
+ * FUNCTION:AcpiOsEnterSleep
+ * 
+ * PARAMETERS:  SleepState  - Which sleep state to enter
+ *  RegaValue   - Register A value
+ *  RegbValue   - Register B value
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: A hook before writing sleep registers to enter the sleep
+ *  state. Return AE_CTRL_TERMINATE to skip further sleep register
+ *  writes.
+ *
+ */
+ 
+ACPI_STATUS
+AcpiOsEnterSleep (
+UINT8   SleepState,
+UINT32  RegaValue,
+UINT32  RegbValue)  
+{
+
+return AE_OK;  
+}   
+
+
 /*
  * acpi_osd_debugger:
  *
@@ -198,7 +264,6 @@ void
 acpi_osd_debugger(void)
 {
 #ifdef ACPI_DEBUG
-	ACPI_PARSE_OBJECT obj;
 	label_t	acpi_jmpbuf;
 	label_t	*savejmp;
 
@@ -208,7 +273,7 @@ acpi_osd_debugger(void)
 	db_recover = _jmpbuf;
 
 	acpi_indebugger = 1;
-	AcpiDbUserCommands('A', );
+	AcpiDbUserCommands();
 	acpi_indebugger = 0;
 
 	db_recover = savejmp;
@@ -216,3 +281,140 @@ acpi_osd_debugger(void)
 	printf("ACPI: WARNING: ACPICA debugger not present.\n");
 #endif
 }
+
+#ifdef ACPI_DEBUG
+
+#define _COMPONENT  ACPI_CA_DEBUGGER
+ACPI_MODULE_NAME("osnetbsdbg")
+
+
+/**
+ *
+ * FUNCTION:AcpiOsWaitCommandReady
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: Negotiate with the debugger foreground thread (the user
+ *  thread) to wait 

CVS commit: src/sys/dev/acpi/acpica

2016-01-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 26 22:52:15 UTC 2016

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
The new acpi code tries to read the pci configuration registers in the
acpi_probe() phase, before acpi_softc is allocated. Detect this and use
a NULL chipset handle instead of crashing.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/acpica/OsdHardware.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.9 src/sys/dev/acpi/acpica/OsdHardware.c:1.10
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.9	Fri Dec 27 13:53:25 2013
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Tue Jan 26 17:52:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.9 2013/12/27 18:53:25 christos Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.9 2013/12/27 18:53:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdHardware.c,v 1.10 2016/01/26 22:52:14 christos Exp $");
 
 #include 
 #include 
@@ -212,15 +212,15 @@ AcpiOsReadPciConfiguration(ACPI_PCI_ID *
 {
 	pcitag_t tag;
 	pcireg_t tmp;
+	pci_chipset_tag_t pc = acpi_softc ? acpi_softc->sc_pc : NULL;
 
 	/* XXX Need to deal with "segment" ("hose" in Alpha terminology). */
 
 	if (PciId->Bus >= 256 || PciId->Device >= 32 || PciId->Function >= 8)
 		return AE_BAD_PARAMETER;
 
-	tag = pci_make_tag(acpi_softc->sc_pc, PciId->Bus, PciId->Device,
-	PciId->Function);
-	tmp = pci_conf_read(acpi_softc->sc_pc, tag, Register & ~3);
+	tag = pci_make_tag(pc, PciId->Bus, PciId->Device, PciId->Function);
+	tmp = pci_conf_read(pc, tag, Register & ~3);
 
 	switch (Width) {
 	case 8:
@@ -253,21 +253,21 @@ AcpiOsWritePciConfiguration(ACPI_PCI_ID 
 {
 	pcitag_t tag;
 	pcireg_t tmp;
+	pci_chipset_tag_t pc = acpi_softc ? acpi_softc->sc_pc : NULL;
 
 	/* XXX Need to deal with "segment" ("hose" in Alpha terminology). */
 
-	tag = pci_make_tag(acpi_softc->sc_pc, PciId->Bus, PciId->Device,
-	PciId->Function);
+	tag = pci_make_tag(pc, PciId->Bus, PciId->Device, PciId->Function);
 
 	switch (Width) {
 	case 8:
-		tmp = pci_conf_read(acpi_softc->sc_pc, tag, Register & ~3);
+		tmp = pci_conf_read(pc, tag, Register & ~3);
 		tmp &= ~(0xff << ((Register & 3) * 8));
 		tmp |= (Value << ((Register & 3) * 8));
 		break;
 
 	case 16:
-		tmp = pci_conf_read(acpi_softc->sc_pc, tag, Register & ~3);
+		tmp = pci_conf_read(pc, tag, Register & ~3);
 		tmp &= ~(0x << ((Register & 3) * 8));
 		tmp |= (Value << ((Register & 3) * 8));
 		break;
@@ -280,7 +280,7 @@ AcpiOsWritePciConfiguration(ACPI_PCI_ID 
 		return AE_BAD_PARAMETER;
 	}
 
-	pci_conf_write(acpi_softc->sc_pc, tag, Register & ~3, tmp);
+	pci_conf_write(pc, tag, Register & ~3, tmp);
 
 	return AE_OK;
 }



CVS commit: src/sys/dev/acpi/acpica

2016-01-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  9 21:14:42 UTC 2016

Modified Files:
src/sys/dev/acpi/acpica: OsdMisc.c OsdSchedule.c

Log Message:
merge new acpica


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/acpi/acpica/OsdMisc.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/acpica/OsdSchedule.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMisc.c
diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.14 src/sys/dev/acpi/acpica/OsdMisc.c:1.15
--- src/sys/dev/acpi/acpica/OsdMisc.c:1.14	Fri Dec 27 15:55:59 2013
+++ src/sys/dev/acpi/acpica/OsdMisc.c	Sat Jan  9 16:14:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMisc.c,v 1.14 2013/12/27 20:55:59 christos Exp $	*/
+/*	$NetBSD: OsdMisc.c,v 1.15 2016/01/09 21:14:42 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdMisc.c,v 1.14 2013/12/27 20:55:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdMisc.c,v 1.15 2016/01/09 21:14:42 christos Exp $");
 
 #include "opt_acpi.h"
 #include "opt_ddb.h"
@@ -198,17 +198,10 @@ void
 acpi_osd_debugger(void)
 {
 #ifdef ACPI_DEBUG
-	static int beenhere;
 	ACPI_PARSE_OBJECT obj;
 	label_t	acpi_jmpbuf;
 	label_t	*savejmp;
 
-	if (beenhere == 0) {
-		printf("Initializing ACPICA debugger...\n");
-		AcpiDbInitialize();
-		beenhere = 1;
-	}
-
 	printf("Entering ACPICA debugger...\n");
 	savejmp = db_recover;
 	setjmp(_jmpbuf);

Index: src/sys/dev/acpi/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.17 src/sys/dev/acpi/acpica/OsdSchedule.c:1.18
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.17	Fri Dec 27 13:53:25 2013
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Sat Jan  9 16:14:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.17 2013/12/27 18:53:25 christos Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.18 2016/01/09 21:14:42 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.17 2013/12/27 18:53:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdSchedule.c,v 1.18 2016/01/09 21:14:42 christos Exp $");
 
 #include 
 #include 
@@ -113,9 +113,6 @@ AcpiOsExecute(ACPI_EXECUTE_TYPE Type, AC
 	case OSL_NOTIFY_HANDLER:
 		pri = 3;
 		break;
-	case OSL_DEBUGGER_THREAD:
-		pri = 0;
-		break;
 	default:
 		return AE_BAD_PARAMETER;
 	}



CVS commit: src/sys/dev/acpi/acpica

2014-01-18 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sat Jan 18 09:51:08 UTC 2014

Modified Files:
src/sys/dev/acpi/acpica: README

Log Message:
+ Please also update ACPI_DATE in include/acapps.h.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpica/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/README
diff -u src/sys/dev/acpi/acpica/README:1.5 src/sys/dev/acpi/acpica/README:1.6
--- src/sys/dev/acpi/acpica/README:1.5	Fri Dec 27 18:53:16 2013
+++ src/sys/dev/acpi/acpica/README	Sat Jan 18 09:51:08 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: README,v 1.5 2013/12/27 18:53:16 christos Exp $
+#	$NetBSD: README,v 1.6 2014/01/18 09:51:08 apb Exp $
 
 This is the Intel ACPI Component Architecture, Intel's reference
 implementation of the core operating system ACPI support.  The
@@ -15,6 +15,8 @@ something sane that we can use. The curr
 	mv components/* .
 	rmdir components
 
+Please also update ACPI_DATE in include/acapps.h.
+
 The routines that the operating system must provide are documented
 in the following document:
 



CVS commit: src/sys/dev/acpi/acpica

2013-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 27 18:53:16 UTC 2013

Modified Files:
src/sys/dev/acpi/acpica: README

Log Message:
- remove function list that was out of date
- explain magical munging so that people are not scared to update in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpica/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/README
diff -u src/sys/dev/acpi/acpica/README:1.4 src/sys/dev/acpi/acpica/README:1.5
--- src/sys/dev/acpi/acpica/README:1.4	Sat Jul 24 02:10:43 2010
+++ src/sys/dev/acpi/acpica/README	Fri Dec 27 13:53:16 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: README,v 1.4 2010/07/24 06:10:43 jruoho Exp $
+#	$NetBSD: README,v 1.5 2013/12/27 18:53:16 christos Exp $
 
 This is the Intel ACPI Component Architecture, Intel's reference
 implementation of the core operating system ACPI support.  The
@@ -8,7 +8,12 @@ system as the glue between the OS and th
 Please, do not import an updated ACPICA snapshot from Intel unless
 you absolutely know what you're doing -- The Intel directory layout
 changes from release to release, and we must munge it (by hand) into
-something sane that we can use.
+something sane that we can use. The current version of munge is:
+
+	mv source/* .
+	rmdir source
+	mv components/* .
+	rmdir components
 
 The routines that the operating system must provide are documented
 in the following document:
@@ -19,32 +24,9 @@ Copies of the document may be retrieved 
 
 	http://www.acpica.org/download/acpica-reference.pdf
 
-Machine-dependent code must provide at least the following routines:
-
-ACPI_STATUS	acpi_md_OsInitialize(void);
-ACPI_STATUS	acpi_md_OsTerminate(void);
-ACPI_STATUS	acpi_md_OsGetRootPointer(UINT32 Flags,
-		ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
-
-UINT8		acpi_md_OsIn8(ACPI_IO_ADDRESS InPort);
-UINT16		acpi_md_OsIn16(ACPI_IO_ADDRESS InPort);
-UINT32		acpi_md_OsIn32(ACPI_IO_ADDRESS InPort);
-
-void		acpi_md_OsOut8(ACPI_IO_ADDRESS OutPort, UINT8 Value);
-void		acpi_md_OsOut16(ACPI_IO_ADDRESS OutPort, UINT16 Value);
-void		acpi_md_OsOut32(ACPI_IO_ADDRESS OutPort, UINT32 Value);
-
-ACPI_STATUS	acpi_md_OsInstallInterruptHandler(UINT32 InterruptNumber,
-		OSD_HANDLER ServiceRoutine, void *Context, void **cookiep);
-void		acpi_md_OsRemoveInterruptHandler(void *cookie);
-
-ACPI_STATUS	acpi_md_OsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress,
-		UINT32 Length, void **LogicalAddress);
-void		acpi_md_OsUnmapMemory(void *LogicalAddress, UINT32 Length);
-ACPI_STATUS	acpi_md_OsGetPhysicalAddress(void *LogicalAddress,
-		ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
-
-BOOLEAN		acpi_md_OsReadable(void *Pointer, UINT32 Length);
-BOOLEAN		acpi_md_OsWritable(void *Pointer, UINT32 Length);
+Structure:
 
-	-- Jason R. Thorpe thor...@wasabisystems.com
+sys/external/bsd/acpica/dist	The imported source
+sys/external/bsd/acpica/conf	The config glue
+sys/dev/acpi			Device drivers
+sys/dev/acpica			OS dependent functions that are required



CVS commit: src/sys/dev/acpi/acpica

2013-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 27 18:53:25 UTC 2013

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c OsdMisc.c OsdSchedule.c

Log Message:
Add new functions


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/acpica/OsdHardware.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/acpica/OsdMisc.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/acpi/acpica/OsdSchedule.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.8 src/sys/dev/acpi/acpica/OsdHardware.c:1.9
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.8	Thu Feb 17 05:23:43 2011
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Fri Dec 27 13:53:25 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.8 2011/02/17 10:23:43 jruoho Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.9 2013/12/27 18:53:25 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.8 2011/02/17 10:23:43 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.9 2013/12/27 18:53:25 christos Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -125,7 +125,7 @@ AcpiOsWritePort(ACPI_IO_ADDRESS Address,
  *	Read a value from a memory location.
  */
 ACPI_STATUS
-AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value, UINT32 Width)
+AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address, UINT64 *Value, UINT32 Width)
 {
 	void *LogicalAddress;
 	ACPI_STATUS rv = AE_OK;
@@ -147,6 +147,10 @@ AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS A
 		*Value = *(volatile uint32_t *) LogicalAddress;
 		break;
 
+	case 64:
+		*Value = *(volatile uint64_t *) LogicalAddress;
+		break;
+
 	default:
 		rv = AE_BAD_PARAMETER;
 	}
@@ -162,7 +166,7 @@ AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS A
  *	Write a value to a memory location.
  */
 ACPI_STATUS
-AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width)
+AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT64 Value, UINT32 Width)
 {
 	void *LogicalAddress;
 	ACPI_STATUS rv = AE_OK;
@@ -184,6 +188,10 @@ AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS 
 		*(volatile uint32_t *) LogicalAddress = Value;
 		break;
 
+	case 64:
+		*(volatile uint64_t *) LogicalAddress = Value;
+		break;
+
 	default:
 		rv = AE_BAD_PARAMETER;
 	}

Index: src/sys/dev/acpi/acpica/OsdMisc.c
diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.12 src/sys/dev/acpi/acpica/OsdMisc.c:1.13
--- src/sys/dev/acpi/acpica/OsdMisc.c:1.12	Tue Jun 28 05:09:43 2011
+++ src/sys/dev/acpi/acpica/OsdMisc.c	Fri Dec 27 13:53:25 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMisc.c,v 1.12 2011/06/28 09:09:43 jruoho Exp $	*/
+/*	$NetBSD: OsdMisc.c,v 1.13 2013/12/27 18:53:25 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.12 2011/06/28 09:09:43 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.13 2013/12/27 18:53:25 christos Exp $);
 
 #include opt_acpi.h
 #include opt_ddb.h
@@ -165,6 +165,30 @@ AcpiOsPredefinedOverride(const ACPI_PRED
 	return AE_OK;
 }
 
+
+/*
+ * AcpiOsPhysicalTableOverride:
+ *
+ * ExistingTable   - Header of current table (probably firmware)
+ * NewAddress  - Where new table address is returned
+ *   (Physical address)
+ * NewTableLength  - Where new table length is returned
+ *
+ * RETURN:  Status, address/length of new table. Null pointer returned
+ *  if no table is available to override.
+ *
+ * DESCRIPTION: Returns AE_SUPPORT, function not used in user space.
+ */
+ACPI_STATUS
+AcpiOsPhysicalTableOverride (
+ACPI_TABLE_HEADER   *ExistingTable,
+ACPI_PHYSICAL_ADDRESS   *NewAddress,
+UINT32  *NewTableLength)
+{
+
+	return AE_SUPPORT;
+}
+
 /*
  * acpi_osd_debugger:
  *

Index: src/sys/dev/acpi/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.16 src/sys/dev/acpi/acpica/OsdSchedule.c:1.17
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.16	Thu Feb 17 05:35:50 2011
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Fri Dec 27 13:53:25 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.16 2011/02/17 10:35:50 jmcneill Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.17 2013/12/27 18:53:25 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.16 2011/02/17 10:35:50 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.17 2013/12/27 18:53:25 christos Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -184,3 +184,16 @@ AcpiOsGetTimer(void)
 
 	return t;
 }
+
+/*
+ *
+ * AcpiOsWaitEventsComplete:
+ *
+ * 	Wait for all asynchronous events to complete. This implementation
+ *	does nothing.
+ */
+void
+AcpiOsWaitEventsComplete(void)
+{
+	return;
+}



CVS commit: src/sys/dev/acpi/acpica

2013-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 27 20:55:59 UTC 2013

Modified Files:
src/sys/dev/acpi/acpica: OsdMisc.c

Log Message:
use ACPI_DEBUG not ACPI_DEBUGGER which is used internally by acpica


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/acpica/OsdMisc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMisc.c
diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.13 src/sys/dev/acpi/acpica/OsdMisc.c:1.14
--- src/sys/dev/acpi/acpica/OsdMisc.c:1.13	Fri Dec 27 13:53:25 2013
+++ src/sys/dev/acpi/acpica/OsdMisc.c	Fri Dec 27 15:55:59 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMisc.c,v 1.13 2013/12/27 18:53:25 christos Exp $	*/
+/*	$NetBSD: OsdMisc.c,v 1.14 2013/12/27 20:55:59 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.13 2013/12/27 18:53:25 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.14 2013/12/27 20:55:59 christos Exp $);
 
 #include opt_acpi.h
 #include opt_ddb.h
@@ -197,7 +197,7 @@ AcpiOsPhysicalTableOverride (
 void
 acpi_osd_debugger(void)
 {
-#ifdef ACPI_DEBUGGER
+#ifdef ACPI_DEBUG
 	static int beenhere;
 	ACPI_PARSE_OBJECT obj;
 	label_t	acpi_jmpbuf;



CVS commit: src/sys/dev/acpi/acpica

2012-04-22 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Apr 22 06:33:05 UTC 2012

Modified Files:
src/sys/dev/acpi/acpica: OsdMemory.c

Log Message:
As in Linux, prevent BIOS from trying to map addresses beyond ULONG_MAX.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpica/OsdMemory.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMemory.c
diff -u src/sys/dev/acpi/acpica/OsdMemory.c:1.4 src/sys/dev/acpi/acpica/OsdMemory.c:1.5
--- src/sys/dev/acpi/acpica/OsdMemory.c:1.4	Thu Feb 17 10:21:43 2011
+++ src/sys/dev/acpi/acpica/OsdMemory.c	Sun Apr 22 06:33:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMemory.c,v 1.4 2011/02/17 10:21:43 jruoho Exp $	*/
+/*	$NetBSD: OsdMemory.c,v 1.5 2012/04/22 06:33:04 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdMemory.c,v 1.4 2011/02/17 10:21:43 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdMemory.c,v 1.5 2012/04/22 06:33:04 jruoho Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -61,12 +61,17 @@ MALLOC_DECLARE(M_ACPI);
 void *
 AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length)
 {
-	ACPI_STATUS Status;
 	void *LogicalAddress = NULL;
+	ACPI_STATUS Status;
+
+	if (PhysicalAddress  ULONG_MAX)
+		return NULL;
 
 	Status = acpi_md_OsMapMemory(PhysicalAddress, Length, LogicalAddress);
-	if (ACPI_FAILURE (Status))
+
+	if (ACPI_FAILURE(Status))
 		return NULL;
+
 	return LogicalAddress;
 }
 



CVS commit: src/sys/dev/acpi/acpica

2011-06-28 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Jun 28 09:09:43 UTC 2011

Modified Files:
src/sys/dev/acpi/acpica: OsdMisc.c

Log Message:
Adjust a prototype due ACPICA 20110623.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/acpica/OsdMisc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMisc.c
diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.11 src/sys/dev/acpi/acpica/OsdMisc.c:1.12
--- src/sys/dev/acpi/acpica/OsdMisc.c:1.11	Thu Feb 17 12:08:46 2011
+++ src/sys/dev/acpi/acpica/OsdMisc.c	Tue Jun 28 09:09:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMisc.c,v 1.11 2011/02/17 12:08:46 jruoho Exp $	*/
+/*	$NetBSD: OsdMisc.c,v 1.12 2011/06/28 09:09:43 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.11 2011/02/17 12:08:46 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.12 2011/06/28 09:09:43 jruoho Exp $);
 
 #include opt_acpi.h
 #include opt_ddb.h
@@ -122,7 +122,7 @@
 }
 
 ACPI_STATUS
-AcpiOsGetLine(char *Buffer)
+AcpiOsGetLine(char *Buffer, UINT32 BufferLength, UINT32 *BytesRead)
 {
 #if defined(DDB)
 	char *cp;



CVS commit: src/sys/dev/acpi/acpica

2011-02-17 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Feb 17 10:20:32 UTC 2011

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
ACPICA 20100915:

Removed the AcpiOsDerivePciId OSL interface. The various host
implementations of this function were not OS-dependent and are now obsolete
and can be removed from all host OSLs.  This function has been replaced by
AcpiHwDerivePciId, which is now part of the ACPICA core code.
AcpiHwDerivePciId has been implemented without recursion.  Adds one new
module, hwpci.c.  ACPICA BZ 857.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/acpica/OsdHardware.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.6 src/sys/dev/acpi/acpica/OsdHardware.c:1.7
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.6	Sat Jul 10 21:31:00 2010
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Thu Feb 17 10:20:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.6 2010/07/10 21:31:00 gsutre Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.7 2011/02/17 10:20:32 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.6 2010/07/10 21:31:00 gsutre Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.7 2011/02/17 10:20:32 jruoho Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -276,117 +276,3 @@
 
 	return AE_OK;
 }
-
-/*
- * acpi_os_derive_pciid_rec:
- *
- *	Helper function for AcpiOsDerivePciId.  The parameters are:
- *	- chandle:	a handle to the node whose PCI id shall be derived.
- *	- rhandle:	a handle the PCI root bridge upstream of chandle.
- *	- pciid:	where the derived PCI id is returned.
- *
- *	This function assumes that rhandle is a proper ancestor of chandle,
- *	and that pciid has already been filled by ACPICA:
- *	- segment# and bus# obtained from _SEG and _BBN on rhandle,
- *	- device# and function# obtained from _ADR on the ACPI device node
- *	  whose scope chandle is in).
- */
-static ACPI_STATUS
-acpi_os_derive_pciid_rec(ACPI_HANDLE chandle, ACPI_HANDLE rhandle, ACPI_PCI_ID *pciid)
-{
-	ACPI_HANDLE phandle;
-	ACPI_INTEGER address;
-	ACPI_OBJECT_TYPE objtype;
-	ACPI_STATUS rv;
-	uint16_t valb;
-
-	KASSERT(chandle != rhandle);
-
-	/*
-	 * Get parent device node.  This is should not fail since chandle has
-	 * at least one ancestor that is a device node: rhandle.
-	 */
-	phandle = chandle;
-	do {
-		rv = AcpiGetParent(phandle, phandle);
-		if (ACPI_FAILURE(rv))
-			return rv;
-		rv = AcpiGetType(phandle, objtype);
-		if (ACPI_FAILURE(rv))
-			return rv;
-	}
-	while (objtype != ACPI_TYPE_DEVICE);
-
-	/*
-	 * If the parent is rhandle then we have nothing to do since ACPICA
-	 * has pre-filled the PCI id to the best it could.
-	 */
-	if (phandle == rhandle)
-		return AE_OK;
-
-	/* Recursive call to get PCI id of the parent */
-	rv = acpi_os_derive_pciid_rec(phandle, rhandle, pciid);
-	if (ACPI_FAILURE(rv))
-		return rv;
-
-	/*
-	 * If this is not an ACPI device, return the PCI id of its parent.
-	 */
-	rv = AcpiGetType(chandle, objtype);
-	if (ACPI_FAILURE(rv))
-		return rv;
-	if (objtype != ACPI_TYPE_DEVICE)
-		return AE_OK;
-
-	/*
-	 * This is an ACPI device node.  Its parent device node is not a PCI
-	 * root bridge.  Check that it is a PCI-to-PCI bridge and get its
-	 * secondary bus#.
-	 */
-	rv = acpi_pcidev_ppb_downbus(pciid-Segment, pciid-Bus, pciid-Device,
-	pciid-Function, valb);
-	if (ACPI_FAILURE(rv))
-		return rv;
-
-	/* Get address (contains dev# and fun# for PCI devices). */
-	rv = acpi_eval_integer(chandle, METHOD_NAME__ADR, address);
-	if (ACPI_FAILURE(rv))
-		return rv;
-
-	pciid-Bus = valb;
-	pciid-Device = ACPI_HIWORD(ACPI_LODWORD(address));
-	pciid-Function = ACPI_LOWORD(ACPI_LODWORD(address));
-	return AE_OK;
-}
-
-/*
- * AcpiOsDerivePciId:
- *
- *	Derive correct PCI bus# by traversing bridges.
- *
- *	In ACPICA release 20100331 (as well as older versions), the interface
- *	of this function is not correctly documented in the ACPICA programmer
- *	reference.  The correct interface parameters to this function are:
- *	- rhandle:	a handle the PCI root bridge upstream of handle.
- *	- chandle:	a handle to the PCI_Config operation region.
- *	- PciId:	where the derived PCI id is returned.
- */
-void
-AcpiOsDerivePciId(
-ACPI_HANDLErhandle,
-ACPI_HANDLEchandle,
-ACPI_PCI_ID**PciId)
-{
-	ACPI_PCI_ID pciid;
-	ACPI_STATUS rv;
-
-	if (chandle == rhandle)
-		return;
-
-	pciid = **PciId;
-	rv = acpi_os_derive_pciid_rec(chandle, rhandle, pciid);
-	if (ACPI_FAILURE(rv))
-		return;
-
-	(*PciId)-Bus = pciid.Bus;
-}



CVS commit: src/sys/dev/acpi/acpica

2011-02-17 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Feb 17 10:21:43 UTC 2011

Modified Files:
src/sys/dev/acpi/acpica: OsdMemory.c

Log Message:
ACPICA 20100806:

Obsolete Functions: AcpiOsValidateInterface - no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpica/OsdMemory.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMemory.c
diff -u src/sys/dev/acpi/acpica/OsdMemory.c:1.3 src/sys/dev/acpi/acpica/OsdMemory.c:1.4
--- src/sys/dev/acpi/acpica/OsdMemory.c:1.3	Tue Aug 18 16:41:02 2009
+++ src/sys/dev/acpi/acpica/OsdMemory.c	Thu Feb 17 10:21:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMemory.c,v 1.3 2009/08/18 16:41:02 jmcneill Exp $	*/
+/*	$NetBSD: OsdMemory.c,v 1.4 2011/02/17 10:21:43 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdMemory.c,v 1.3 2009/08/18 16:41:02 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdMemory.c,v 1.4 2011/02/17 10:21:43 jruoho Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -143,10 +143,3 @@
 
 	return acpi_md_OsWritable(Pointer, Length);
 }
-
-ACPI_STATUS
-AcpiOsValidateInterface(char *Interface)
-{
-
-	return AE_SUPPORT;
-}



CVS commit: src/sys/dev/acpi/acpica

2011-02-17 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Feb 17 10:23:44 UTC 2011

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
ACPICA 20100806:

Fixed a problem with the prototype for AcpiOsReadPciConfiguration.
The prototype in acpiosxf.h had the output value pointer as a (void *).
It should be a (UINT64 *). This may affect some host OSL code.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/acpica/OsdHardware.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.7 src/sys/dev/acpi/acpica/OsdHardware.c:1.8
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.7	Thu Feb 17 10:20:32 2011
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Thu Feb 17 10:23:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.7 2011/02/17 10:20:32 jruoho Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.8 2011/02/17 10:23:43 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.7 2011/02/17 10:20:32 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.8 2011/02/17 10:23:43 jruoho Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -199,7 +199,7 @@
  *	Read a value from a PCI configuration register.
  */
 ACPI_STATUS
-AcpiOsReadPciConfiguration(ACPI_PCI_ID *PciId, UINT32 Register, void *Value,
+AcpiOsReadPciConfiguration(ACPI_PCI_ID *PciId, UINT32 Register, UINT64 *Value,
 UINT32 Width)
 {
 	pcitag_t tag;



CVS commit: src/sys/dev/acpi/acpica

2011-02-17 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Feb 17 10:35:51 UTC 2011

Modified Files:
src/sys/dev/acpi/acpica: OsdSchedule.c

Log Message:
cast curlwp to uintptr_t before casting to ACPI_THREAD_ID, fixes i386 build


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/acpi/acpica/OsdSchedule.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.15 src/sys/dev/acpi/acpica/OsdSchedule.c:1.16
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.15	Sat Jun  5 16:57:48 2010
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Thu Feb 17 10:35:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.15 2010/06/05 16:57:48 jruoho Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.16 2011/02/17 10:35:50 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.15 2010/06/05 16:57:48 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.16 2011/02/17 10:35:50 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -87,7 +87,7 @@
 ACPI_THREAD_ID
 AcpiOsGetThreadId(void)
 {
-	return (ACPI_THREAD_ID)curlwp;
+	return (ACPI_THREAD_ID)(uintptr_t)curlwp;
 }
 
 /*



CVS commit: src/sys/dev/acpi/acpica

2011-02-17 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Feb 17 12:08:46 UTC 2011

Modified Files:
src/sys/dev/acpi/acpica: OsdMisc.c

Log Message:
Include acdebug.h for the ACPICA debugger.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpica/OsdMisc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMisc.c
diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.10 src/sys/dev/acpi/acpica/OsdMisc.c:1.11
--- src/sys/dev/acpi/acpica/OsdMisc.c:1.10	Thu Feb 17 07:34:42 2011
+++ src/sys/dev/acpi/acpica/OsdMisc.c	Thu Feb 17 12:08:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMisc.c,v 1.10 2011/02/17 07:34:42 jruoho Exp $	*/
+/*	$NetBSD: OsdMisc.c,v 1.11 2011/02/17 12:08:46 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.10 2011/02/17 07:34:42 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.11 2011/02/17 12:08:46 jruoho Exp $);
 
 #include opt_acpi.h
 #include opt_ddb.h
@@ -58,6 +58,10 @@
 #include dev/acpi/acpica.h
 #include dev/acpi/acpi_osd.h
 
+#ifdef ACPI_DEBUG
+#include external/bsd/acpica/dist/include/acdebug.h
+#endif
+
 #ifdef ACPI_DSDT_OVERRIDE
 #ifndef ACPI_DSDT_FILE
 #define ACPI_DSDT_FILE dsdt.hex



CVS commit: src/sys/dev/acpi/acpica

2010-07-24 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sat Jul 24 06:10:43 UTC 2010

Modified Files:
src/sys/dev/acpi/acpica: README

Log Message:
Update and fix a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpica/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/README
diff -u src/sys/dev/acpi/acpica/README:1.3 src/sys/dev/acpi/acpica/README:1.4
--- src/sys/dev/acpi/acpica/README:1.3	Thu Feb  6 00:27:06 2003
+++ src/sys/dev/acpi/acpica/README	Sat Jul 24 06:10:43 2010
@@ -1,11 +1,11 @@
-#	$NetBSD: README,v 1.3 2003/02/06 00:27:06 perry Exp $
+#	$NetBSD: README,v 1.4 2010/07/24 06:10:43 jruoho Exp $
 
 This is the Intel ACPI Component Architecture, Intel's reference
 implementation of the core operating system ACPI support.  The
-portion in the Osd/ subdirectory is provided by the oprerating
+portion in the acpica/ subdirectory is provided by the operating
 system as the glue between the OS and the ACPICA.
 
-Please, do not import an updated ACPI CA snapshot from Intel unless
+Please, do not import an updated ACPICA snapshot from Intel unless
 you absolutely know what you're doing -- The Intel directory layout
 changes from release to release, and we must munge it (by hand) into
 something sane that we can use.
@@ -13,14 +13,13 @@
 The routines that the operating system must provide are documented
 in the following document:
 
-	ACPI Component Architecture Programmer Reference
-	Intel Corp.
+	Intel Corp., ACPI Component Architecture Programmer Reference
 
 Copies of the document may be retrieved from:
 
-	http://developer.intel.com/technology/iapc/acpi/downloads.htm
+	http://www.acpica.org/download/acpica-reference.pdf
 
-Machine-dependent code must provide the following routines for Osd:
+Machine-dependent code must provide at least the following routines:
 
 ACPI_STATUS	acpi_md_OsInitialize(void);
 ACPI_STATUS	acpi_md_OsTerminate(void);



CVS commit: src/sys/dev/acpi/acpica

2010-07-10 Thread Grégoire Sutre
Module Name:src
Committed By:   gsutre
Date:   Sat Jul 10 21:31:00 UTC 2010

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
AcpiOsDerivePciId: make sure that we only update the PCI bus number,
and that we do so only if it was succesfully derived.

ok jruoho@, kochi@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpica/OsdHardware.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.5 src/sys/dev/acpi/acpica/OsdHardware.c:1.6
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.5	Tue Sep 15 19:41:30 2009
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Sat Jul 10 21:31:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.5 2009/09/15 19:41:30 drochner Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.6 2010/07/10 21:31:00 gsutre Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,13 +44,14 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.5 2009/09/15 19:41:30 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.6 2010/07/10 21:31:00 gsutre Exp $);
 
 #include sys/param.h
 #include sys/device.h
 
 #include dev/acpi/acpica.h
 #include dev/acpi/acpivar.h
+#include dev/acpi/acpi_pci.h
 
 #include machine/acpi_machdep.h
 
@@ -276,66 +277,99 @@
 	return AE_OK;
 }
 
-/* get PCI bus# from root bridge recursively */
-static int
-get_bus_number(
-ACPI_HANDLErhandle,
-ACPI_HANDLEchandle,
-ACPI_PCI_ID**PciId)
+/*
+ * acpi_os_derive_pciid_rec:
+ *
+ *	Helper function for AcpiOsDerivePciId.  The parameters are:
+ *	- chandle:	a handle to the node whose PCI id shall be derived.
+ *	- rhandle:	a handle the PCI root bridge upstream of chandle.
+ *	- pciid:	where the derived PCI id is returned.
+ *
+ *	This function assumes that rhandle is a proper ancestor of chandle,
+ *	and that pciid has already been filled by ACPICA:
+ *	- segment# and bus# obtained from _SEG and _BBN on rhandle,
+ *	- device# and function# obtained from _ADR on the ACPI device node
+ *	  whose scope chandle is in).
+ */
+static ACPI_STATUS
+acpi_os_derive_pciid_rec(ACPI_HANDLE chandle, ACPI_HANDLE rhandle, ACPI_PCI_ID *pciid)
 {
-	ACPI_HANDLE handle;
+	ACPI_HANDLE phandle;
+	ACPI_INTEGER address;
+	ACPI_OBJECT_TYPE objtype;
 	ACPI_STATUS rv;
-	ACPI_OBJECT_TYPE type;
-	ACPI_PCI_ID *id;
-	ACPI_INTEGER v;
-	int bus;
+	uint16_t valb;
 
-	id = *PciId;
+	KASSERT(chandle != rhandle);
 
-	rv = AcpiGetParent(chandle, handle);
-	if (ACPI_FAILURE(rv))
-		return 0;
+	/*
+	 * Get parent device node.  This is should not fail since chandle has
+	 * at least one ancestor that is a device node: rhandle.
+	 */
+	phandle = chandle;
+	do {
+		rv = AcpiGetParent(phandle, phandle);
+		if (ACPI_FAILURE(rv))
+			return rv;
+		rv = AcpiGetType(phandle, objtype);
+		if (ACPI_FAILURE(rv))
+			return rv;
+	}
+	while (objtype != ACPI_TYPE_DEVICE);
 
 	/*
-	 * When handle == rhandle, we have valid PciId-Bus
-	 * which was obtained from _BBN in evrgnini.c
-	 * so we don't have to reevaluate _BBN.
+	 * If the parent is rhandle then we have nothing to do since ACPICA
+	 * has pre-filled the PCI id to the best it could.
 	 */
-	if (handle != rhandle) {
-		bus = get_bus_number(rhandle, handle, PciId);
+	if (phandle == rhandle)
+		return AE_OK;
 
-		rv = AcpiGetType(handle, type);
-		if (ACPI_FAILURE(rv) || type != ACPI_TYPE_DEVICE)
-			return bus;
+	/* Recursive call to get PCI id of the parent */
+	rv = acpi_os_derive_pciid_rec(phandle, rhandle, pciid);
+	if (ACPI_FAILURE(rv))
+		return rv;
 
-		rv = acpi_eval_integer(handle, METHOD_NAME__ADR, v);
+	/*
+	 * If this is not an ACPI device, return the PCI id of its parent.
+	 */
+	rv = AcpiGetType(chandle, objtype);
+	if (ACPI_FAILURE(rv))
+		return rv;
+	if (objtype != ACPI_TYPE_DEVICE)
+		return AE_OK;
 
-		if (ACPI_FAILURE(rv))
-			return bus;
+	/*
+	 * This is an ACPI device node.  Its parent device node is not a PCI
+	 * root bridge.  Check that it is a PCI-to-PCI bridge and get its
+	 * secondary bus#.
+	 */
+	rv = acpi_pcidev_ppb_downbus(pciid-Segment, pciid-Bus, pciid-Device,
+	pciid-Function, valb);
+	if (ACPI_FAILURE(rv))
+		return rv;
 
-		id-Bus = bus;
-		id-Device = ACPI_HIWORD((ACPI_INTEGER)v);
-		id-Function = ACPI_LOWORD((ACPI_INTEGER)v);
-
-		/* read HDR_TYPE register */
-		rv = AcpiOsReadPciConfiguration(id, 0x0e, v, 8);
-		if (ACPI_SUCCESS(rv) 
-			/* mask multifunction bit  check bridge type */
-			((v  0x7f) == 1 || (v  0x7f) == 2)) {
-			/* read SECONDARY_BUS register */
-			rv = AcpiOsReadPciConfiguration(id, 0x19, v, 8);
-			if (ACPI_SUCCESS(rv))
-id-Bus = v;
-		}
-	}
+	/* Get address (contains dev# and fun# for PCI devices). */
+	rv = acpi_eval_integer(chandle, METHOD_NAME__ADR, address);
+	if (ACPI_FAILURE(rv))
+		return rv;
 
-	return id-Bus;
+	pciid-Bus = valb;
+	pciid-Device = 

CVS commit: src/sys/dev/acpi/acpica

2010-06-05 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sat Jun  5 16:47:49 UTC 2010

Modified Files:
src/sys/dev/acpi/acpica: OsdSchedule.c

Log Message:
Remove the recently added warning about long Sleep() requests.

This is now in ACPICA (20100528):

Added support to limit the maximum time for the ASL Sleep()
operator. To prevent accidental deep sleeps, limit the maximum time
that Sleep() will actually sleep. Configurable, the default maximum
is two seconds. ACPICA bugzilla 854.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/acpica/OsdSchedule.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.13 src/sys/dev/acpi/acpica/OsdSchedule.c:1.14
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.13	Wed May 12 17:03:11 2010
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Sat Jun  5 16:47:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.13 2010/05/12 17:03:11 jruoho Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.14 2010/06/05 16:47:49 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.13 2010/05/12 17:03:11 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.14 2010/06/05 16:47:49 jruoho Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -140,12 +140,6 @@
 void
 AcpiOsSleep(ACPI_INTEGER Milliseconds)
 {
-	static bool once = false;
-
-	if (Milliseconds  2000  once != true) {
-		aprint_error(acpi0: WARNING: long Sleep()\n);
-		once = true;
-	}
 
 	if (cold || doing_shutdown || acpi_suspended)
 		DELAY(Milliseconds * 1000);



CVS commit: src/sys/dev/acpi/acpica

2010-06-05 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sat Jun  5 16:57:48 UTC 2010

Modified Files:
src/sys/dev/acpi/acpica: OsdSchedule.c

Log Message:
Remove also the debug-printf in case of long Stall() requests;

   /*
* sleep(9) isn't safe because AcpiOsStall may be called
* with interrupt-disabled. (eg. by AcpiEnterSleepState)
* we should watch out for long stall requests.
*/

ACPICA has long printed a similar warning by itself. Moreover, this message
was never reached as the interpreter does not invoke AcpiOsStall() when a
delay longer than 255 usec is requested.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/acpi/acpica/OsdSchedule.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.14 src/sys/dev/acpi/acpica/OsdSchedule.c:1.15
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.14	Sat Jun  5 16:47:49 2010
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Sat Jun  5 16:57:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.14 2010/06/05 16:47:49 jruoho Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.15 2010/06/05 16:57:48 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.14 2010/06/05 16:47:49 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.15 2010/06/05 16:57:48 jruoho Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -159,16 +159,6 @@
 void
 AcpiOsStall(UINT32 Microseconds)
 {
-	/*
-	 * sleep(9) isn't safe because AcpiOsStall may be called
-	 * with interrupt-disabled. (eg. by AcpiEnterSleepState)
-	 * we should watch out for long stall requests.
-	 */
-#ifdef ACPI_DEBUG
-	if (Microseconds  1000)
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, long stall: %uus\n,
-		Microseconds));
-#endif
 
 	delay(Microseconds);
 }



CVS commit: src/sys/dev/acpi/acpica

2010-05-12 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 12 17:03:11 UTC 2010

Modified Files:
src/sys/dev/acpi/acpica: OsdSchedule.c

Log Message:
Print a warning if AcpiOsSleep() is called with a value larger than two
seconds. It is known that there are systems in the field that pass bogus AML
values to the Sleep() operation code, possibly requesting delays that could
be measured in days.

Discussed with jmcne...@.

XXX: While the used mstohz(9) is documented to round to one second if the
 passed value is larger than 131072 ms, we may still need to force a
 sensible upper limit if this warning starts to appear.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/acpica/OsdSchedule.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdSchedule.c
diff -u src/sys/dev/acpi/acpica/OsdSchedule.c:1.12 src/sys/dev/acpi/acpica/OsdSchedule.c:1.13
--- src/sys/dev/acpi/acpica/OsdSchedule.c:1.12	Sun Aug 23 15:16:16 2009
+++ src/sys/dev/acpi/acpica/OsdSchedule.c	Wed May 12 17:03:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdSchedule.c,v 1.12 2009/08/23 15:16:16 jmcneill Exp $	*/
+/*	$NetBSD: OsdSchedule.c,v 1.13 2010/05/12 17:03:11 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.12 2009/08/23 15:16:16 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdSchedule.c,v 1.13 2010/05/12 17:03:11 jruoho Exp $);
 
 #include sys/param.h
 #include sys/malloc.h
@@ -140,6 +140,13 @@
 void
 AcpiOsSleep(ACPI_INTEGER Milliseconds)
 {
+	static bool once = false;
+
+	if (Milliseconds  2000  once != true) {
+		aprint_error(acpi0: WARNING: long Sleep()\n);
+		once = true;
+	}
+
 	if (cold || doing_shutdown || acpi_suspended)
 		DELAY(Milliseconds * 1000);
 	else {



CVS commit: src/sys/dev/acpi/acpica

2010-04-10 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sat Apr 10 06:56:30 UTC 2010

Modified Files:
src/sys/dev/acpi/acpica: OsdMisc.c

Log Message:
Update a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/acpica/OsdMisc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMisc.c
diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.7 src/sys/dev/acpi/acpica/OsdMisc.c:1.8
--- src/sys/dev/acpi/acpica/OsdMisc.c:1.7	Tue Aug 18 16:41:02 2009
+++ src/sys/dev/acpi/acpica/OsdMisc.c	Sat Apr 10 06:56:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMisc.c,v 1.7 2009/08/18 16:41:02 jmcneill Exp $	*/
+/*	$NetBSD: OsdMisc.c,v 1.8 2010/04/10 06:56:30 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.7 2009/08/18 16:41:02 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdMisc.c,v 1.8 2010/04/10 06:56:30 jruoho Exp $);
 
 #include opt_acpi.h
 #include opt_ddb.h
@@ -60,22 +60,26 @@
 
 #include external/intel-public/acpica/dist/include/accommon.h
 #include external/intel-public/acpica/dist/include/acdebug.h
+
 /*
- * for debugging DSDT (try this at your own risk!):
+ * For debugging or fixing a DSDT (try this at your own risk!):
+ *
+ *	1. Dump the raw DSDT with acpidump(8).
+ *
+ *	2. Disassemble with iasl(8) using the option -d.
+ *
+ *	3. Modify the ASL file.
+ *
+ *	4. Compile it with iasl(8), -tc
+ *
+ *	5. Copy the *.hex to src/sys/dev/acpi/acpica/Osd/dsdt.hex
+ *
+ *		- or -
  *
- * 1. dump your raw DSDT (with acpidump(*1) etc.)
- * 2. disassemble with iasl -d (*2)
- * 3. modify the ASL file
- * 4. compile it with iasl -tc
- * 5. copy *.hex to src/sys/dev/acpi/acpica/Osd/dsdt.hex
- *-or-
- *options ACPI_DSDT_FILE=\yourdsdt.hex\ in
- *your config file and yourdsdt.hex in the build directory
- * 6. options ACPI_DSDT_OVERRIDE in your kernel config file
- *and rebuild the kernel
+ *	   Use the option ACPI_DSDT_FILE=\/dir/yourdsdt.hex\ in
+ *	   the kernel config file.
  *
- * (*1) /usr/pkgsrc/sysutils/acpidump
- * (*2) /usr/pkgsrc/sysutils/acpi-iasl
+ *	6. Define ACPI_DSDT_OVERRIDE in the kernel config file and rebuild.
  */
 
 #ifdef ACPI_DSDT_OVERRIDE



CVS commit: src/sys/dev/acpi/acpica

2009-09-15 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Tue Sep 15 19:41:30 UTC 2009

Modified Files:
src/sys/dev/acpi/acpica: OsdHardware.c

Log Message:
fix undefined return values of Read/WriteMemory, found by clang
static analyzer


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpica/OsdHardware.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdHardware.c
diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.4 src/sys/dev/acpi/acpica/OsdHardware.c:1.5
--- src/sys/dev/acpi/acpica/OsdHardware.c:1.4	Wed Dec 12 23:33:22 2007
+++ src/sys/dev/acpi/acpica/OsdHardware.c	Tue Sep 15 19:41:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdHardware.c,v 1.4 2007/12/12 23:33:22 jmcneill Exp $	*/
+/*	$NetBSD: OsdHardware.c,v 1.5 2009/09/15 19:41:30 drochner Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.4 2007/12/12 23:33:22 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.5 2009/09/15 19:41:30 drochner Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -127,7 +127,7 @@
 AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value, UINT32 Width)
 {
 	void *LogicalAddress;
-	ACPI_STATUS rv;
+	ACPI_STATUS rv = AE_OK;
 
 	LogicalAddress = AcpiOsMapMemory(Address, Width / 8);
 	if (LogicalAddress == NULL)
@@ -164,7 +164,7 @@
 AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width)
 {
 	void *LogicalAddress;
-	ACPI_STATUS rv;
+	ACPI_STATUS rv = AE_OK;
 
 	LogicalAddress = AcpiOsMapMemory(Address, Width / 8);
 	if (LogicalAddress == NULL)