Fix StallOp implementaion. I've noticed that StallOp corresponds to

OsdSleepUsec(), SleepOp corresponds to OsdSleep() by reading ACPICA
source code.
 - Add OsdSleepUsec() which uses DELAY() simply.
 - Change unit of acpi_sleep() argument; microseconds to milliseconds.
This commit is contained in:
Mitsuru IWASAKI 2000-10-02 08:58:50 +00:00
parent 7324718bc0
commit 6a8954b084
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66537
7 changed files with 16 additions and 12 deletions

View File

@ -973,7 +973,7 @@ acpi_attach_resource(acpi_softc_t *sc, int type, int *wantidx, u_long start, u_l
#include <sys/proc.h>
int
acpi_sleep(u_int32_t micro)
acpi_sleep(u_int32_t milli)
{
static u_int8_t count = 0;
int x, error;
@ -981,7 +981,7 @@ acpi_sleep(u_int32_t micro)
x = error = 0;
if (micro == 0) {
if (milli == 0) {
return (1);
}
@ -989,7 +989,7 @@ acpi_sleep(u_int32_t micro)
return (2);
}
timo = ((hz * micro) / 1000000L) ? ((hz * micro) / 1000000L) : 1;
timo = ((hz * milli) / 1000) ? ((hz * milli) / 1000) : 1;
error = tsleep((caddr_t)acpi_sleep + count, PWAIT, "acpislp", timo);
if (error != 0 && error != EWOULDBLOCK) {
return (2);

View File

@ -249,5 +249,5 @@ extern int acpi_debug;
/*
* System service interface
*/
extern int acpi_sleep(u_int32_t micro);
extern int acpi_sleep(u_int32_t milli);

View File

@ -47,7 +47,7 @@
printf(fmt, args); \
} while(0)
#define AML_DEBUGGER(x, y) /* no debugger in kernel */
#define AML_STALL(micro) DELAY(micro)
#define AML_STALL(micro) OsdSleepUsec(micro)
#define AML_SLEEP(sec, milli) OsdSleep(sec, milli)
#else /* !_KERNEL */
#define AML_SYSASSERT(x) assert(x)

View File

@ -57,7 +57,6 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#ifndef ACPI_NO_OSDFUNC_INLINE

View File

@ -32,6 +32,7 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <machine/acpi_machdep.h>
#include <machine/vmparam.h>
#include <vm/vm.h>
@ -282,12 +283,12 @@ OsdWritePciCfgDword(UINT32 Bus, UINT32 DeviceFunction, UINT32 Register, UINT32 V
}
_ACPICA_INLINE_ ACPI_STATUS
OsdSleepUsec(UINT32 Microseconds)
OsdSleep(UINT32 Seconds, UINT32 Milliseconds)
{
int error;
ACPI_STATUS status;
error = acpi_sleep(Microseconds);
error = acpi_sleep(Seconds * 1000 + Milliseconds);
switch (error) {
case 0:
/* The running thread slept for the time specified */
@ -308,8 +309,13 @@ OsdSleepUsec(UINT32 Microseconds)
}
_ACPICA_INLINE_ ACPI_STATUS
OsdSleep(UINT32 Seconds, UINT32 Milliseconds)
OsdSleepUsec(UINT32 Microseconds)
{
return OsdSleepUsec(Seconds * 1000000L + Milliseconds * 1000);
if (Microseconds == 0) {
return (AE_BAD_PARAMETER);
}
DELAY(Microseconds);
return (AE_OK);
}

View File

@ -47,7 +47,7 @@
printf(fmt, args); \
} while(0)
#define AML_DEBUGGER(x, y) /* no debugger in kernel */
#define AML_STALL(micro) DELAY(micro)
#define AML_STALL(micro) OsdSleepUsec(micro)
#define AML_SLEEP(sec, milli) OsdSleep(sec, milli)
#else /* !_KERNEL */
#define AML_SYSASSERT(x) assert(x)

View File

@ -57,7 +57,6 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#ifndef ACPI_NO_OSDFUNC_INLINE