Date: Sun, 06 Apr 2008 14:22:17 +0300 From: Andriy Gapon <avg@icyb.net.ua> To: Nate Lawson <nate@root.org> Cc: freebsd-acpi@freebsd.org Subject: Re: mismatch between FACP and chipset spec Message-ID: <47F8B269.6030606@icyb.net.ua> In-Reply-To: <47C70B87.5060301@icyb.net.ua> References: <47C67001.20101@icyb.net.ua> <47C6FACC.9090502@root.org> <47C70B87.5060301@icyb.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------000400010100020701020907 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit on 28/02/2008 21:29 Andriy Gapon said the following: > on 28/02/2008 20:17 Nate Lawson said the following: >> Andriy Gapon wrote: >>> But addresses given for PM1a_CNT_BLK are not documented at all! On the >>> other hand ACPI description of that register perfectly matches >>> description of PIIX4 PMCNTRL register that is located at 0x4004 with a >>> given base address. So, this is 0x4040 vs. 0x4004, looks like a possible >>> typo/mistake by an author of ACPI tables for this motherboard. >> 440BX is pretty old, and typos like that were common back then. ACPI >> was less used and drivers would just hardcode 0x4004 or whatever. >> >>> Question: is there any way I can way override the address of >>> PM1a_CNT_BLK? My guess is that there is zero chance that there would be >>> any BIOS updates for this old and exotic motherboard (MP2-BX-X). >> No generic way. You'd have to add a quirk to acpi.c/acpi_quirks and use >> that to override FADT. >> >>> I think that this register is mostly useful for BM_RLD bit which is used >>> in C3 support. I don't use C3 (there is an errata for C3 with this >>> chipset and there is no PM2_CNT register defined anyway), but I am >>> curios anyway. >> Seems like a lot of effort for no gain. Since you are getting good at >> debugging, can we get you newer hardware to play with? :) > > Nate, > > thank you for pointing me to acpi_quirks and for confirming my doubts > over worthwhileness of this endeavor. I knew that I wouldn't be able to keep my hands off it :-) Actually that PM1a_CNT_BLK typo caused one very minor annoyance for me (but still an annoyance!) - 'shutdown -p' would cause the machine to hang right after 'Powering system off using ACPI' line. It seems that ACPI power off requires a write to PM1a_CNT_BLK area and the hardware doesn't tolerate a write to a bogus IO register. Attached is small patch that fixes the issue for my particular system. It is a bit ugly but I couldn't think of another way for a quirk like this. -- Andriy Gapon --------------000400010100020701020907 Content-Type: text/x-patch; name="mp2bxx.piix4.PM1a_CNT_BLK-poweroff.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mp2bxx.piix4.PM1a_CNT_BLK-poweroff.patch" --- sys/dev/acpica/acpi_quirk.c.orig 2008-04-05 01:01:08.000000000 +0300 +++ sys/dev/acpica/acpi_quirk.c 2008-04-05 01:55:54.000000000 +0300 @@ -71,6 +71,7 @@ static int aq_strcmp(char *actual, char *possible); static int aq_match_header(ACPI_TABLE_HEADER *hdr, const struct acpi_q_rule *match); +static void aq_special(void); static int aq_revcmp(int revision, enum ops_t op, int value) @@ -154,6 +155,7 @@ bzero(&fadt, sizeof(xsdt)); /* Then, override the quirks with any matched from table signatures. */ + done = FALSE; for (entry = acpi_quirks_table; entry->match; entry++) { done = TRUE; for (match = entry->match; match->sig[0] != '\0'; match++) { @@ -180,5 +182,48 @@ } } + /* Special quirks that can not be expressed in a generic form */ + if (!done) + aq_special(); + return (0); } + +void aq_special(void) +{ + static const struct acpi_q_rule MP2_BX_X[] = { + { "FADT", OEM, {"AWARD "}, {"AWRDACPI"} }, + { "FADT", OEM_REV, {.op = OP_EQL}, {.rev = 0x42302e31} }, + { "FADT", CREATOR, {"AWRD"} }, + { "FADT", CREATOR_REV, {.op = OP_EQL}, {.rev = 0x0} }, + { "" } + }; + + const struct acpi_q_rule *match; + ACPI_TABLE_HEADER fadt; + int done; + + if (ACPI_FAILURE(AcpiGetTableHeader(ACPI_SIG_FADT, 0, &fadt))) + bzero(&fadt, sizeof(fadt)); + + /* Code specific to MP2-BX-X motherboard. */ + done = TRUE; + for (match = &MP2_BX_X[0]; match->sig[0] != '\0'; match++) { + if (aq_match_header(&fadt, match) == FALSE) { + done = FALSE; + break; + } + } + if (done) { + /* This MP2-BX-X FADT specifies PM1a_CNT_BLK=0x4040-0x4041, + * while in fact it should be 0x4004-0x4005 according to + * PIIX4E specification (PMCNTRL IO register). + */ + printf("MP2-BX-X: changing PM1a_CNT_BLK from 0x%x to 0x4004\n", + AcpiGbl_FADT.Pm1aControlBlock); + AcpiGbl_FADT.Pm1aControlBlock = 0x4004; + AcpiGbl_FADT.Pm1ControlLength = 2; + return; + } +} + --------------000400010100020701020907--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47F8B269.6030606>