Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi add support for reset registers in PCI config s...
details: https://anonhg.NetBSD.org/src/rev/5492d664c864
branches: trunk
changeset: 767844:5492d664c864
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Aug 01 11:25:59 2011 +0000
description:
add support for reset registers in PCI config space
diffstat:
sys/dev/acpi/acpi.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
sys/dev/acpi/acpireg.h | 6 +++++-
sys/dev/acpi/acpivar.h | 4 +++-
3 files changed, 50 insertions(+), 4 deletions(-)
diffs (103 lines):
diff -r 866fb38fd003 -r 5492d664c864 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c Mon Aug 01 11:20:26 2011 +0000
+++ b/sys/dev/acpi/acpi.c Mon Aug 01 11:25:59 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.247 2011/07/17 02:32:01 jakllsch Exp $ */
+/* $NetBSD: acpi.c,v 1.248 2011/08/01 11:25:59 jmcneill Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.247 2011/07/17 02:32:01 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.248 2011/08/01 11:25:59 jmcneill Exp $");
#include "opt_acpi.h"
#include "opt_pcifixup.h"
@@ -348,6 +348,46 @@
return (config_search_ia(acpi_submatch, parent, ifattr, NULL) != NULL);
}
+int
+acpi_reset(void)
+{
+ struct acpi_softc *sc = acpi_softc;
+ ACPI_GENERIC_ADDRESS *ResetReg;
+ ACPI_PCI_ID PciId;
+ ACPI_STATUS status;
+
+ if (sc == NULL)
+ return ENXIO;
+
+ ResetReg = &AcpiGbl_FADT.ResetRegister;
+
+ /* Check if the reset register is supported */
+ if (!(AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) ||
+ !ResetReg->Address) {
+ return ENOENT;
+ }
+
+ switch (ResetReg->SpaceId) {
+ case ACPI_ADR_SPACE_PCI_CONFIG:
+ PciId.Segment = PciId.Bus = 0;
+ PciId.Device = ACPI_GAS_PCI_DEV(ResetReg->Address);
+ PciId.Function = ACPI_GAS_PCI_FUNC(ResetReg->Address);
+ status = AcpiOsWritePciConfiguration(&PciId,
+ ACPI_GAS_PCI_REGOFF(ResetReg->Address),
+ AcpiGbl_FADT.ResetValue, ResetReg->BitWidth);
+ break;
+ case ACPI_ADR_SPACE_SYSTEM_IO:
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+ status = AcpiReset();
+ break;
+ default:
+ status = AE_TYPE;
+ break;
+ }
+
+ return ACPI_FAILURE(status) ? EIO : 0;
+}
+
/*
* Autoconfiguration.
*/
diff -r 866fb38fd003 -r 5492d664c864 sys/dev/acpi/acpireg.h
--- a/sys/dev/acpi/acpireg.h Mon Aug 01 11:20:26 2011 +0000
+++ b/sys/dev/acpi/acpireg.h Mon Aug 01 11:25:59 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpireg.h,v 1.11 2010/10/12 19:10:50 gsutre Exp $ */
+/* $NetBSD: acpireg.h,v 1.12 2011/08/01 11:25:59 jmcneill Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -61,6 +61,10 @@
#define ACPI_ADR_PCI_FUNC(x) ((x) & 0xffff)
#define ACPI_ADR_PCI_ALLFUNCS 0xffff
+#define ACPI_GAS_PCI_DEV(x) (((x) >> 32) & 0xffff)
+#define ACPI_GAS_PCI_FUNC(x) (((x) >> 16) & 0xffff)
+#define ACPI_GAS_PCI_REGOFF(x) ((x) & 0xffff)
+
/*
* ACPI driver components.
*/
diff -r 866fb38fd003 -r 5492d664c864 sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h Mon Aug 01 11:20:26 2011 +0000
+++ b/sys/dev/acpi/acpivar.h Mon Aug 01 11:25:59 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpivar.h,v 1.72 2011/06/21 03:37:21 jruoho Exp $ */
+/* $NetBSD: acpivar.h,v 1.73 2011/08/01 11:25:59 jmcneill Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -297,6 +297,8 @@
void acpi_disable(void);
int acpi_check(device_t, const char *);
+int acpi_reset(void);
+
ACPI_PHYSICAL_ADDRESS acpi_OsGetRootPointer(void);
bool acpi_register_notify(struct acpi_devnode *,
Home |
Main Index |
Thread Index |
Old Index