Add machdep quirks functions. On i386, this disables acpi on systems with

BIOS dates earlier than Jan 1, 1999.  Add prototypes and quirks flags.
This commit is contained in:
Nate Lawson 2004-06-30 04:42:29 +00:00
parent bcc2d4d520
commit 1a26ea7f2c
4 changed files with 42 additions and 0 deletions

View File

@ -56,3 +56,9 @@ acpi_SetDefaultIntrModel(int model)
intr_model = model;
}
int
acpi_machdep_quirks(int *quirks)
{
return (0);
}

View File

@ -141,6 +141,10 @@ struct acpi_prw_data {
#define ACPI_INTR_APIC 1
#define ACPI_INTR_SAPIC 2
/* Quirk flags. */
#define ACPI_Q_OK 0
#define ACPI_Q_BROKEN (1 << 0) /* Disable ACPI completely. */
/*
* Note that the low ivar values are reserved to provide
* interface compatibility with ISA drivers which can also
@ -321,6 +325,8 @@ int acpi_disabled(char *subsys);
int acpi_machdep_init(device_t dev);
void acpi_install_wakeup_handler(struct acpi_softc *sc);
int acpi_sleep_machdep(struct acpi_softc *sc, int state);
int acpi_table_quirks(int *quirks);
int acpi_machdep_quirks(int *quirks);
/* Battery Abstraction. */
struct acpi_battinfo;

View File

@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/uio.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include "acpi.h"
#include <dev/acpica/acpivar.h>
@ -330,3 +332,25 @@ acpi_SetDefaultIntrModel(int model)
intr_model = model;
}
/* Check BIOS date. If 1998 or older, disable ACPI. */
int
acpi_machdep_quirks(int *quirks)
{
char *va;
int year;
/* BIOS address 0xffff5 contains the date in the format mm/dd/yy. */
va = pmap_mapdev(0xffff0, 16);
sscanf(va + 11, "%2d", &year);
pmap_unmapdev((vm_offset_t)va, 16);
/*
* Date must be >= 1/1/1999 or we don't trust ACPI. Note that this
* check must be changed by my 114th birthday.
*/
if (year > 90 && year < 99)
*quirks = ACPI_Q_BROKEN;
return (0);
}

View File

@ -43,3 +43,9 @@ acpi_machdep_init(device_t dev)
return (0);
}
int
acpi_machdep_quirks(int *quirks)
{
return (0);
}