Remove the ACPIIO_ENABLE and ACPIIO_DISABLE ioctls as well as all

callers.  These ioctls attempted to enable and disable the ACPI
interpreter at runtime.  In practice, it is not possible to boot with
ACPI and then disable it on many systems and trying to do so can cause
crashes, interrupt storms, etc.  Binary compatibility with userland is
retained.

MFC after:	2 days
This commit is contained in:
Nate Lawson 2004-08-18 05:48:24 +00:00
parent ca36a5dc0d
commit e079f9491a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133933
5 changed files with 10 additions and 92 deletions

View File

@ -625,7 +625,7 @@ acpi_child_location_str_method(device_t cbdev, device_t child, char *buf,
size_t buflen)
{
struct acpi_device *dinfo = device_get_ivars(child);
if (dinfo->ad_handle)
snprintf(buf, buflen, "handle=%s", acpi_name(dinfo->ad_handle));
else
@ -1581,7 +1581,7 @@ acpi_ForeachPackageObject(ACPI_OBJECT *pkg,
{
ACPI_OBJECT *comp;
int i;
if (pkg == NULL || pkg->Type != ACPI_TYPE_PACKAGE)
return (AE_BAD_PARAMETER);
@ -1636,7 +1636,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOURCE *res)
{
ACPI_RESOURCE *rp;
void *newp;
/* Initialise the buffer if necessary. */
if (buf->Pointer == NULL) {
buf->Length = ACPI_INITIAL_RESOURCE_BUFFER_SIZE;
@ -1648,7 +1648,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOURCE *res)
}
if (res == NULL)
return (AE_OK);
/*
* Scan the current buffer looking for the terminator.
* This will either find the terminator or hit the end
@ -1687,10 +1687,10 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOURCE *res)
buf->Pointer = newp;
buf->Length += buf->Length;
}
/* Insert the new resource. */
bcopy(res, rp, res->Length + ACPI_RESOURCE_LENGTH_NO_DATA);
/* And add the terminator. */
rp = ACPI_NEXT_RESOURCE(rp);
rp->Id = ACPI_RSTYPE_END_TAG;
@ -2145,49 +2145,6 @@ acpi_parse_prw(ACPI_HANDLE h, struct acpi_prw_data *prw)
return (error);
}
/*
* Enable/Disable ACPI
*/
ACPI_STATUS
acpi_Enable(struct acpi_softc *sc)
{
ACPI_STATUS status;
u_int32_t flags;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
status = AE_ERROR;
flags = ACPI_NO_ADDRESS_SPACE_INIT | ACPI_NO_HARDWARE_INIT |
ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT;
ACPI_SERIAL_BEGIN(acpi);
if (!sc->acpi_enabled)
status = AcpiEnableSubsystem(flags);
if (ACPI_SUCCESS(status))
sc->acpi_enabled = 1;
ACPI_SERIAL_END(acpi);
return_ACPI_STATUS (status);
}
ACPI_STATUS
acpi_Disable(struct acpi_softc *sc)
{
ACPI_STATUS status;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
status = AE_ERROR;
ACPI_SERIAL_BEGIN(acpi);
if (sc->acpi_enabled)
status = AcpiDisable();
if (ACPI_SUCCESS(status))
sc->acpi_enabled = 0;
ACPI_SERIAL_END(acpi);
return_ACPI_STATUS (status);
}
/*
* ACPI Event Handlers
*/
@ -2463,14 +2420,6 @@ acpiioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td)
/* Core system ioctls. */
switch (cmd) {
case ACPIIO_ENABLE:
if (ACPI_FAILURE(acpi_Enable(sc)))
error = ENXIO;
break;
case ACPIIO_DISABLE:
if (ACPI_FAILURE(acpi_Disable(sc)))
error = ENXIO;
break;
case ACPIIO_SETSLPSTATE:
error = EINVAL;
state = *(int *)addr;

View File

@ -30,8 +30,6 @@
/*
* Core ACPI subsystem ioctls
*/
#define ACPIIO_ENABLE _IO('P', 1)
#define ACPIIO_DISABLE _IO('P', 2)
#define ACPIIO_SETSLPSTATE _IOW('P', 3, int)
struct acpi_battdesc {

View File

@ -274,8 +274,6 @@ int acpi_wake_init(device_t dev, int type);
int acpi_wake_set_enable(device_t dev, int enable);
int acpi_parse_prw(ACPI_HANDLE h, struct acpi_prw_data *prw);
ACPI_STATUS acpi_Startup(void);
ACPI_STATUS acpi_Enable(struct acpi_softc *sc);
ACPI_STATUS acpi_Disable(struct acpi_softc *sc);
void acpi_UserNotify(const char *subsystem, ACPI_HANDLE h,
uint8_t notify);
struct resource *acpi_bus_alloc_gas(device_t dev, int *rid,

View File

@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 12, 2001
.Dd August 16, 2004
.Dt ACPICONF 8
.Os
.Sh NAME
@ -35,7 +35,7 @@
.Nd control ACPI power management
.Sh SYNOPSIS
.Nm
.Op Fl deh
.Op Fl h
.Op Fl i Ar batt
.Op Fl s Ar type
.Sh DESCRIPTION
@ -45,10 +45,6 @@ utility allows the user control of the ACPI power management
functions.
The following command-line options are recognized:
.Bl -tag -width ".Fl s Ar type"
.It Fl d
Disables ACPI power management.
.It Fl e
Enables ACPI power management.
.It Fl h
Displays a summary of available options.
.It Fl i Ar batt

View File

@ -57,21 +57,6 @@ acpi_init()
}
}
#if 0
static int
acpi_enable_disable(int enable)
{
if (ioctl(acpifd, enable, NULL) == -1) {
if (enable == ACPIIO_ENABLE)
err(EX_IOERR, "enable failed");
else
err(EX_IOERR, "disable failed");
}
return (0);
}
#endif
static int
acpi_sleep(int sleep_type)
{
@ -138,7 +123,7 @@ acpi_battinfo(int num)
static void
usage(const char* prog)
{
printf("usage: %s [-deh] [-i batt] [-s 1-5]\n", prog);
printf("usage: %s [-h] [-i batt] [-s 1-5]\n", prog);
exit(0);
}
@ -155,19 +140,11 @@ main(int argc, char *argv[])
sleep_type = -1;
acpi_init();
while ((c = getopt(argc, argv, "dehi:s:")) != -1) {
while ((c = getopt(argc, argv, "hi:s:")) != -1) {
switch (c) {
case 'i':
acpi_battinfo(atoi(optarg));
break;
#if 0
case 'd':
acpi_enable_disable(ACPIIO_DISABLE);
break;
case 'e':
acpi_enable_disable(ACPIIO_ENABLE);
break;
#endif
case 's':
if (optarg[0] == 'S')
sleep_type = optarg[1] - '0';