summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/Osd
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2001-07-21 04:10:01 +0000
committermsmith <msmith@FreeBSD.org>2001-07-21 04:10:01 +0000
commit78bfafdf45a43736768284338517fe432be1e28f (patch)
treed35f0597a7301eee14350647364075ad0ae631b5 /sys/dev/acpica/Osd
parentb364b2c8850111f8b2f950fc2d143da52c324434 (diff)
downloadFreeBSD-src-78bfafdf45a43736768284338517fe432be1e28f.zip
FreeBSD-src-78bfafdf45a43736768284338517fe432be1e28f.tar.gz
Update the OSD module to match the ACPI CA 20010717 import.
Submitted by: "Grover, Andrew" <andrew.grover@intel.com> (OsdHardware.c)
Diffstat (limited to 'sys/dev/acpica/Osd')
-rw-r--r--sys/dev/acpica/Osd/OsdDebug.c33
-rw-r--r--sys/dev/acpica/Osd/OsdEnvironment.c8
-rw-r--r--sys/dev/acpica/Osd/OsdHardware.c142
-rw-r--r--sys/dev/acpica/Osd/OsdMemory.c109
-rw-r--r--sys/dev/acpica/Osd/OsdSchedule.c2
-rw-r--r--sys/dev/acpica/Osd/OsdSynch.c12
6 files changed, 162 insertions, 144 deletions
diff --git a/sys/dev/acpica/Osd/OsdDebug.c b/sys/dev/acpica/Osd/OsdDebug.c
index e7d4777..776e871 100644
--- a/sys/dev/acpica/Osd/OsdDebug.c
+++ b/sys/dev/acpica/Osd/OsdDebug.c
@@ -49,13 +49,6 @@
#include "acdebug.h"
#include <dev/acpica/acpivar.h>
-ACPI_STATUS
-AcpiOsBreakpoint(NATIVE_CHAR *Message)
-{
- Debugger(Message);
- return(AE_OK);
-}
-
UINT32
AcpiOsGetLine(NATIVE_CHAR *Buffer)
{
@@ -80,6 +73,32 @@ AcpiOsDbgAssert(void *FailedAssertion, void *FileName, UINT32 LineNumber, NATIVE
printf("ACPI: assertion %s\n", (char *)FailedAssertion);
}
+ACPI_STATUS
+AcpiOsSignal (
+ UINT32 Function,
+ void *Info)
+{
+ ACPI_SIGNAL_FATAL_INFO *fatal;
+ NATIVE_CHAR *message;
+
+ switch(Function) {
+ case ACPI_SIGNAL_FATAL:
+ fatal = (ACPI_SIGNAL_FATAL_INFO *)Info;
+ panic("ACPI fatal signal, type 0x%x code 0x%x argument 0x%x",
+ fatal->Type, fatal->Code, fatal->Argument);
+ break;
+
+ case ACPI_SIGNAL_BREAKPOINT:
+ message = (NATIVE_CHAR *)Info;
+ Debugger(message);
+ break;
+
+ default:
+ return(AE_BAD_PARAMETER);
+ }
+ return(AE_OK);
+}
+
#ifdef ENABLE_DEBUGGER
void
acpi_EnterDebugger(void)
diff --git a/sys/dev/acpica/Osd/OsdEnvironment.c b/sys/dev/acpica/Osd/OsdEnvironment.c
index 93e784d..8b8e663 100644
--- a/sys/dev/acpica/Osd/OsdEnvironment.c
+++ b/sys/dev/acpica/Osd/OsdEnvironment.c
@@ -54,3 +54,11 @@ AcpiOsTerminate(void)
{
return(NULL);
}
+
+ACPI_STATUS
+AcpiOsGetRootPointer(
+ UINT32 Flags,
+ ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
+{
+ return(AcpiFindRootPointer(Flags, RsdpPhysicalAddress));
+}
diff --git a/sys/dev/acpica/Osd/OsdHardware.c b/sys/dev/acpica/Osd/OsdHardware.c
index fb3071c..876b0b3 100644
--- a/sys/dev/acpica/Osd/OsdHardware.c
+++ b/sys/dev/acpica/Osd/OsdHardware.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2000 Michael Smith
+ * Copyright (c) 2000, 2001 Michael Smith
* Copyright (c) 2000 BSDi
* All rights reserved.
*
@@ -51,98 +51,98 @@
#define ACPI_BUS_SPACE_IO I386_BUS_SPACE_IO
#define ACPI_BUS_HANDLE 0
-UINT8
-AcpiOsIn8(ACPI_IO_ADDRESS InPort)
-{
- return(bus_space_read_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort));
-}
-
-UINT16
-AcpiOsIn16(ACPI_IO_ADDRESS InPort)
-{
- return(bus_space_read_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort));
-}
-
-UINT32
-AcpiOsIn32(ACPI_IO_ADDRESS InPort)
-{
- return(bus_space_read_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort));
-}
-
-void
-AcpiOsOut8(ACPI_IO_ADDRESS OutPort, UINT8 Value)
-{
- bus_space_write_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
-}
-
-void
-AcpiOsOut16(ACPI_IO_ADDRESS OutPort, UINT16 Value)
-{
- bus_space_write_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
-}
-
-void
-AcpiOsOut32(ACPI_IO_ADDRESS OutPort, UINT32 Value)
-{
- bus_space_write_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
-}
-
ACPI_STATUS
-AcpiOsReadPciCfgByte (UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT8 *Value)
+AcpiOsReadPort (
+ ACPI_IO_ADDRESS InPort,
+ void *Value,
+ UINT32 Width)
{
- u_int32_t result;
+ switch (Width) {
+ case 8:
+ *(u_int8_t *)Value = bus_space_read_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+ break;
+ case 16:
+ *(u_int16_t *)Value = bus_space_read_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+ break;
+ case 32:
+ *(u_int32_t *)Value = bus_space_read_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort);
+ break;
+ default:
+ /* debug trap goes here */
+ }
- if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
- result = pci_cfgregread(Bus, DeviceFunction >> 16, DeviceFunction & 0xff, Register, 1);
- *Value = (UINT8)result;
return(AE_OK);
}
ACPI_STATUS
-AcpiOsReadPciCfgWord (UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT16 *Value)
+AcpiOsWritePort (
+ ACPI_IO_ADDRESS OutPort,
+ NATIVE_UINT Value,
+ UINT32 Width)
{
- u_int32_t result;
+ switch (Width) {
+ case 8:
+ bus_space_write_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
+ break;
+ case 16:
+ bus_space_write_2(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
+ break;
+ case 32:
+ bus_space_write_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value);
+ break;
+ default:
+ /* debug trap goes here */
+ }
- if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
- result = pci_cfgregread(Bus, DeviceFunction >> 16, DeviceFunction & 0xff, Register, 2);
- *Value = (UINT16)result;
return(AE_OK);
}
ACPI_STATUS
-AcpiOsReadPciCfgDword (UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 *Value)
+AcpiOsReadPciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 Register,
+ void *Value,
+ UINT32 Width)
{
- if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
- *Value = pci_cfgregread(Bus, DeviceFunction >> 16, DeviceFunction & 0xff, Register, 4);
- return(AE_OK);
-}
+ u_int32_t byte_width = Width / 8;
+ u_int32_t val;
-ACPI_STATUS
-AcpiOsWritePciCfgByte (UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT8 Value)
-{
if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
- pci_cfgregwrite(Bus, DeviceFunction >> 16, DeviceFunction & 0xff, Register, (u_int32_t)Value, 1);
- return(AE_OK);
-}
+ return(AE_NOT_EXIST);
+
+ val = pci_cfgregread(PciId->Bus, PciId->Device, PciId->Function, Register, byte_width);
+ switch (Width) {
+ case 8:
+ *(u_int8_t *)Value = val & 0xff;
+ break;
+ case 16:
+ *(u_int16_t *)Value = val & 0xffff;
+ break;
+ case 32:
+ *(u_int32_t *)Value = val;
+ break;
+ default:
+ /* debug trap goes here */
+ }
+
-ACPI_STATUS
-AcpiOsWritePciCfgWord (UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT16 Value)
-{
- if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
- pci_cfgregwrite(Bus, DeviceFunction >> 16, DeviceFunction & 0xff, Register, (u_int32_t)Value, 2);
return(AE_OK);
}
+
ACPI_STATUS
-AcpiOsWritePciCfgDword (UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 Value)
+AcpiOsWritePciConfiguration (
+ ACPI_PCI_ID *PciId,
+ UINT32 Register,
+ NATIVE_UINT Value,
+ UINT32 Width)
{
+ u_int32_t byte_width = Width / 8;
+
if (!pci_cfgregopen())
- return(AE_NOT_EXIST);
- pci_cfgregwrite(Bus, DeviceFunction >> 16, DeviceFunction & 0xff, Register, (u_int32_t)Value, 4);
+ return(AE_NOT_EXIST);
+
+ pci_cfgregwrite(PciId->Bus, PciId->Device, PciId->Function, Register, Value, byte_width);
+
return(AE_OK);
}
diff --git a/sys/dev/acpica/Osd/OsdMemory.c b/sys/dev/acpica/Osd/OsdMemory.c
index 8112eb8..5055f94 100644
--- a/sys/dev/acpica/Osd/OsdMemory.c
+++ b/sys/dev/acpica/Osd/OsdMemory.c
@@ -79,6 +79,13 @@ AcpiOsUnmapMemory (void *LogicalAddress, UINT32 Length)
pmap_unmapdev((vm_offset_t)LogicalAddress, Length);
}
+ACPI_STATUS
+AcpiOsGetPhysicalAddress(void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
+{
+ /* we can't necessarily do this, so cop out */
+ return(AE_BAD_ADDRESS);
+}
+
/*
* There is no clean way to do this. We make the charitable assumption
* that callers will not pass garbage to us.
@@ -95,92 +102,70 @@ AcpiOsWritable (void *Pointer, UINT32 Length)
return(TRUE);
}
-static __inline
-UINT32
-AcpiOsMemInX (UINT32 Length, ACPI_PHYSICAL_ADDRESS InAddr)
+ACPI_STATUS
+AcpiOsReadMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ void *Value,
+ UINT32 Width)
{
- UINT32 Value;
void *LogicalAddress;
- if (AcpiOsMapMemory(InAddr, Length, &LogicalAddress) != AE_OK) {
- return(0);
+ if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK) {
+ return(AE_NOT_EXIST);
}
- switch (Length) {
- case 1:
- Value = (*(volatile u_int8_t *)LogicalAddress) & 0xff;
+ switch (Width) {
+ case 8:
+ *(u_int8_t *)Value = (*(volatile u_int8_t *)LogicalAddress);
+ break;
+ case 16:
+ *(u_int16_t *)Value = (*(volatile u_int16_t *)LogicalAddress);
break;
- case 2:
- Value = (*(volatile u_int16_t *)LogicalAddress) & 0xffff;
+ case 32:
+ *(u_int32_t *)Value = (*(volatile u_int32_t *)LogicalAddress);
break;
- case 4:
- Value = (*(volatile u_int32_t *)LogicalAddress);
+ case 64:
+ *(u_int64_t *)Value = (*(volatile u_int64_t *)LogicalAddress);
break;
+ default:
+ /* debug trap goes here */
}
- AcpiOsUnmapMemory(LogicalAddress, Length);
+ AcpiOsUnmapMemory(LogicalAddress, Width / 8);
- return(Value);
+ return(AE_OK);
}
-UINT8
-AcpiOsMemIn8 (ACPI_PHYSICAL_ADDRESS InAddr)
-{
- return((UINT8)AcpiOsMemInX(1, InAddr));
-}
-
-UINT16
-AcpiOsMemIn16 (ACPI_PHYSICAL_ADDRESS InAddr)
-{
- return((UINT16)AcpiOsMemInX(2, InAddr));
-}
-
-UINT32
-AcpiOsMemIn32 (ACPI_PHYSICAL_ADDRESS InAddr)
-{
- return((UINT32)AcpiOsMemInX(4, InAddr));
-}
-
-static __inline
-void
-AcpiOsMemOutX (UINT32 Length, ACPI_PHYSICAL_ADDRESS OutAddr, UINT32 Value)
+ACPI_STATUS
+AcpiOsWriteMemory (
+ ACPI_PHYSICAL_ADDRESS Address,
+ NATIVE_UINT Value,
+ UINT32 Width)
{
void *LogicalAddress;
- if (AcpiOsMapMemory(OutAddr, Length, &LogicalAddress) != AE_OK) {
- return;
+ if (AcpiOsMapMemory(Address, Width / 8, &LogicalAddress) != AE_OK) {
+ return(AE_NOT_EXIST);
}
- switch (Length) {
- case 1:
+ switch (Width) {
+ case 8:
(*(volatile u_int8_t *)LogicalAddress) = Value & 0xff;
break;
- case 2:
+ case 16:
(*(volatile u_int16_t *)LogicalAddress) = Value & 0xffff;
break;
- case 4:
- (*(volatile u_int32_t *)LogicalAddress) = Value;
+ case 32:
+ (*(volatile u_int32_t *)LogicalAddress) = Value & 0xffffffff;
+ break;
+ case 64:
+ (*(volatile u_int64_t *)LogicalAddress) = Value;
break;
+ default:
+ /* debug trap goes here */
}
- AcpiOsUnmapMemory(LogicalAddress, Length);
-}
-
-void
-AcpiOsMemOut8 (ACPI_PHYSICAL_ADDRESS OutAddr, UINT8 Value)
-{
- AcpiOsMemOutX(1, OutAddr, (UINT32)Value);
-}
-
-void
-AcpiOsMemOut16 (ACPI_PHYSICAL_ADDRESS OutAddr, UINT16 Value)
-{
- AcpiOsMemOutX(2, OutAddr, (UINT32)Value);
-}
+ AcpiOsUnmapMemory(LogicalAddress, Width / 8);
-void
-AcpiOsMemOut32 (ACPI_PHYSICAL_ADDRESS OutAddr, UINT32 Value)
-{
- AcpiOsMemOutX(4, OutAddr, (UINT32)Value);
+ return(AE_OK);
}
-
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index 1bbf7f7..feaec99 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -139,7 +139,7 @@ AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds)
}
void
-AcpiOsSleepUsec (UINT32 Microseconds)
+AcpiOsStall (UINT32 Microseconds)
{
FUNCTION_TRACE(__func__);
diff --git a/sys/dev/acpica/Osd/OsdSynch.c b/sys/dev/acpica/Osd/OsdSynch.c
index 01311e4..5c5141d 100644
--- a/sys/dev/acpica/Osd/OsdSynch.c
+++ b/sys/dev/acpica/Osd/OsdSynch.c
@@ -136,6 +136,10 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT32 Timeout)
DEBUG_PRINT(TRACE_MUTEX, ("get %d units from semaphore %p (has %d), timeout %d\n",
Units, as, as->as_units, Timeout));
for (;;) {
+ if (as->as_inits == ACPI_NO_UNIT_LIMIT) {
+ result = AE_OK;
+ break;
+ }
if (as->as_units >= Units) {
as->as_units -= Units;
result = AE_OK;
@@ -177,9 +181,11 @@ AcpiOsSignalSemaphore(ACPI_HANDLE Handle, UINT32 Units)
mtx_lock(&as->as_mtx);
DEBUG_PRINT(TRACE_MUTEX, ("return %d units to semaphore %p (has %d)\n",
Units, as, as->as_units));
- as->as_units += Units;
- if (as->as_units > as->as_maxunits)
- as->as_units = as->as_maxunits;
+ if (as->as_units != ACPI_NO_UNIT_LIMIT) {
+ as->as_units += Units;
+ if (as->as_units > as->as_maxunits)
+ as->as_units = as->as_maxunits;
+ }
wakeup(as);
mtx_unlock(&as->as_mtx);
return_ACPI_STATUS(AE_OK);
OpenPOWER on IntegriCloud