From owner-freebsd-acpi@FreeBSD.ORG Wed Dec 9 20:25:41 2009 Return-Path: Delivered-To: freebsd-acpi@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id D40911065676; Wed, 9 Dec 2009 20:25:39 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: "Moore, Robert" Date: Wed, 9 Dec 2009 15:25:27 -0500 User-Agent: KMail/1.6.2 References: <20091208060339.GK98273@pollux.cenkes.org> <200912091437.09680.jkim@FreeBSD.org> <4911F71203A09E4D9981D27F9D83085840DA9C6B@orsmsx503.amr.corp.intel.com> In-Reply-To: <4911F71203A09E4D9981D27F9D83085840DA9C6B@orsmsx503.amr.corp.intel.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912091525.29882.jkim@FreeBSD.org> Cc: freebsd-acpi@FreeBSD.org, Andrew Pantyukhin Subject: Re: libi386/biosacpi.c - bad RSDP checksum search X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 20:25:41 -0000 On Wednesday 09 December 2009 02:59 pm, Moore, Robert wrote: > Part of the reason I asked the question is because the ACPICA Table > Manager (the code that scans and extracts ACPI tables) has been > specifically designed to be available at any time, even before > virtual memory is available and before the rest of the ACPICA > subsystem is initialized. Although I really hate duplicate codes, bootloader is extremely small and stand-alone environment. Thus, we cannot use ACPICA there. :-( > I haven't heard of this type of table scan before, but so be it. > However, as you have seen, you are stuck with finding and fixing > bugs that have been already resolved in the ACPICA code. We are trying to get rid of any duplicate codes when found. However, FreeBSD ACPI was implemented long ago when ACPICA wasn't sophisticated enough for us at the time. Jung-uk Kim > Bob > > >-----Original Message----- > >From: Jung-uk Kim [mailto:jkim@FreeBSD.org] > >Sent: Wednesday, December 09, 2009 11:37 AM > >To: freebsd-acpi@FreeBSD.org > >Cc: Moore, Robert; Andrew Pantyukhin > >Subject: Re: libi386/biosacpi.c - bad RSDP checksum search > > > >On Wednesday 09 December 2009 01:46 pm, Moore, Robert wrote: > >> Might be a dumb question, but why is the bootloader looking > >> around for ACPI tables in the first place? > > > >FreeBSD/i386 bootloader loads ACPI kernel module if the root > > pointer is found and ACPI is not disabled by user. Then, the > > pointer is passed to kernel as a hint for AcpiOsGetRootPointer() > > later. FreeBSD/amd64 just happened to share the same bootloader. > > :-) > > > >Jung-uk Kim > > > >> Thanks, > >> Bob > >> > >> >-----Original Message----- > >> >From: owner-freebsd-acpi@freebsd.org [mailto:owner-freebsd- > >> >acpi@freebsd.org] On Behalf Of John Baldwin > >> >Sent: Tuesday, December 08, 2009 4:50 AM > >> >To: freebsd-acpi@freebsd.org > >> >Cc: Andrew Pantyukhin > >> >Subject: Re: libi386/biosacpi.c - bad RSDP checksum search > >> > > >> >On Tuesday 08 December 2009 1:03:40 am Andrew Pantyukhin wrote: > >> >> Our boot loader stops searching memory at the first > >> >> occurrence of "RSD PTR" while there are BIOSes (e.g. some IBM > >> >> System x) that have multiple such strings and the first one > >> >> does not contain the correct checksum. > >> >> > >> >> The acpi-ca code does the right thing and continues the > >> >> search. > >> >> > >> >> Any ACPI experts interested in fixing this? I'll be ready to > >> >> test. > >> > > >> >Are you sure? It looks like it keeps going if the checksum > >> > fails. Note the > >> >'continue' after the printf() about a bad checksum. > >> > > >> >/* > >> > * Find the RSDP in low memory. See section 5.2.2 of the ACPI > >> > spec. */ > >> >static ACPI_TABLE_RSDP * > >> >biosacpi_find_rsdp(void) > >> >{ > >> > ACPI_TABLE_RSDP *rsdp; > >> > uint16_t *addr; > >> > > >> > /* EBDA is the 1 KB addressed by the 16 bit pointer at > >> > 0x40E. */ addr = (uint16_t *)PTOV(0x40E); > >> > if ((rsdp = biosacpi_search_rsdp((char *)(*addr << 4), > >> > 0x400)) != NULL) return (rsdp); > >> > > >> > /* Check the upper memory BIOS space, 0xe0000 - 0xfffff. */ > >> > if ((rsdp = biosacpi_search_rsdp((char *)0xe0000, 0x20000)) > >> > != NULL) return (rsdp); > >> > > >> > return (NULL); > >> >} > >> > > >> >static ACPI_TABLE_RSDP * > >> >biosacpi_search_rsdp(char *base, int length) > >> >{ > >> > ACPI_TABLE_RSDP *rsdp; > >> > u_int8_t *cp, sum; > >> > int ofs, idx; > >> > > >> > /* search on 16-byte boundaries */ > >> > for (ofs = 0; ofs < length; ofs += 16) { > >> > rsdp = (ACPI_TABLE_RSDP *)PTOV(base + ofs); > >> > > >> > /* compare signature, validate checksum */ > >> > if (!strncmp(rsdp->Signature, ACPI_SIG_RSDP, > >> > strlen(ACPI_SIG_RSDP))) { > >> > cp = (u_int8_t *)rsdp; > >> > sum = 0; > >> > for (idx = 0; idx < RSDP_CHECKSUM_LENGTH; idx++) > >> > sum += *(cp + idx); > >> > if (sum != 0) { > >> > printf("acpi: bad RSDP checksum (%d)\n", sum); > >> > continue; > >> > } > >> > return(rsdp); > >> > } > >> > } > >> > return(NULL); > >> >} > >> > > >> >-- > >> >John Baldwin > >> >_______________________________________________ > >> >freebsd-acpi@freebsd.org mailing list > >> >http://lists.freebsd.org/mailman/listinfo/freebsd-acpi > >> >To unsubscribe, send any mail to > >> > "freebsd-acpi-unsubscribe@freebsd.org" > >> > >> _______________________________________________ > >> freebsd-acpi@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-acpi > >> To unsubscribe, send any mail to > >> "freebsd-acpi-unsubscribe@freebsd.org"