From owner-freebsd-acpi@FreeBSD.ORG Tue Dec 8 13:36:05 2009 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07DB11065672; Tue, 8 Dec 2009 13:36:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CFE4F8FC0A; Tue, 8 Dec 2009 13:36:04 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7329446B6C; Tue, 8 Dec 2009 08:36:04 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id C90A38A01D; Tue, 8 Dec 2009 08:36:03 -0500 (EST) From: John Baldwin To: freebsd-acpi@freebsd.org Date: Tue, 8 Dec 2009 07:49:55 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <20091208060339.GK98273@pollux.cenkes.org> In-Reply-To: <20091208060339.GK98273@pollux.cenkes.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912080749.55710.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 08 Dec 2009 08:36:03 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: 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: Tue, 08 Dec 2009 13:36:05 -0000 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