|
@@ -66,6 +66,11 @@ static unsigned int fadt_pm1_cnt_len;
|
|
|
static unsigned int fadt_smi_cmd;
|
|
static unsigned int fadt_smi_cmd;
|
|
|
static unsigned int fadt_acpi_enable;
|
|
static unsigned int fadt_acpi_enable;
|
|
|
static unsigned int fadt_flags;
|
|
static unsigned int fadt_flags;
|
|
|
|
|
+static unsigned int fadt_reset_space;
|
|
|
|
|
+static unsigned int fadt_reset_addr;
|
|
|
|
|
+static unsigned int fadt_reset_value;
|
|
|
|
|
+static unsigned int fadt_reset_width;
|
|
|
|
|
+static unsigned int fadt_reset_access;
|
|
|
static unsigned int dsdt_addr;
|
|
static unsigned int dsdt_addr;
|
|
|
static unsigned int ssdt_addr[4];
|
|
static unsigned int ssdt_addr[4];
|
|
|
static unsigned int nssdt;
|
|
static unsigned int nssdt;
|
|
@@ -325,6 +330,16 @@ static void parse_fadt(const unsigned char *t, unsigned int len)
|
|
|
fadt_acpi_enable = t[52];
|
|
fadt_acpi_enable = t[52];
|
|
|
if (len >= 116)
|
|
if (len >= 116)
|
|
|
fadt_flags = *(const unsigned int *)(t + 112);
|
|
fadt_flags = *(const unsigned int *)(t + 112);
|
|
|
|
|
+ /* ACPI 2.0+ reset register (GAS at 116, value at 128). */
|
|
|
|
|
+ if (len >= 129) {
|
|
|
|
|
+ fadt_reset_space = t[116];
|
|
|
|
|
+ fadt_reset_width = t[117];
|
|
|
|
|
+ fadt_reset_access = t[119];
|
|
|
|
|
+ fadt_reset_value = t[128];
|
|
|
|
|
+ x = *(const unsigned long long *)(t + 120);
|
|
|
|
|
+ if (x && (unsigned int)(x >> 32) == 0)
|
|
|
|
|
+ fadt_reset_addr = (unsigned int)x;
|
|
|
|
|
+ }
|
|
|
/* ACPI 2.0+ firmware may publish the DSDT only in X_DSDT. */
|
|
/* ACPI 2.0+ firmware may publish the DSDT only in X_DSDT. */
|
|
|
if (len >= 148) {
|
|
if (len >= 148) {
|
|
|
x = *(const unsigned long long *)(t + 140);
|
|
x = *(const unsigned long long *)(t + 140);
|
|
@@ -498,6 +513,11 @@ int acpi_init(void)
|
|
|
fadt_smi_cmd = 0;
|
|
fadt_smi_cmd = 0;
|
|
|
fadt_acpi_enable = 0;
|
|
fadt_acpi_enable = 0;
|
|
|
fadt_flags = 0;
|
|
fadt_flags = 0;
|
|
|
|
|
+ fadt_reset_space = 0;
|
|
|
|
|
+ fadt_reset_addr = 0;
|
|
|
|
|
+ fadt_reset_value = 0;
|
|
|
|
|
+ fadt_reset_width = 0;
|
|
|
|
|
+ fadt_reset_access = 0;
|
|
|
dsdt_addr = 0;
|
|
dsdt_addr = 0;
|
|
|
nssdt = 0;
|
|
nssdt = 0;
|
|
|
dsdt_ptr = 0;
|
|
dsdt_ptr = 0;
|
|
@@ -640,6 +660,29 @@ static void nvidia_s5_prepare(unsigned int smi_base)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* Reset the machine through the FADT reset register (ACPI 2.0+), the only
|
|
|
|
|
+ * reliable reset on machines without a working 8042. Returns 0 when the
|
|
|
|
|
+ * register write was issued, -1 when the firmware does not provide one. */
|
|
|
|
|
+int acpi_reset(void)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int addr = fadt_reset_addr;
|
|
|
|
|
+
|
|
|
|
|
+ if (!fadt_ok || !(fadt_flags & (1u << 10)) || !addr)
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ if (fadt_reset_space == 1) { /* System I/O */
|
|
|
|
|
+ if (addr > 0xFFFFu)
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ if (fadt_reset_access >= 2 || fadt_reset_width >= 16)
|
|
|
|
|
+ port_outw((unsigned short)addr,
|
|
|
|
|
+ (unsigned short)fadt_reset_value);
|
|
|
|
|
+ else
|
|
|
|
|
+ port_outb((unsigned short)addr,
|
|
|
|
|
+ (unsigned char)fadt_reset_value);
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ return -1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
int acpi_poweroff(void)
|
|
int acpi_poweroff(void)
|
|
|
{
|
|
{
|
|
|
unsigned int t0, sci, smi, cmd;
|
|
unsigned int t0, sci, smi, cmd;
|