From owner-freebsd-acpi@FreeBSD.ORG Sat May 8 02:22:14 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2DFD116A4CE for ; Sat, 8 May 2004 02:22:14 -0700 (PDT) Received: from secretcore.dyndns.org (pD9EAEF3C.dip.t-dialin.net [217.234.239.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id A4B0F43D2F for ; Sat, 8 May 2004 02:22:12 -0700 (PDT) (envelope-from chris@secretcore.dyndns.org) Received: from secretcore.dyndns.org (secretcore.dyndns.org [127.0.0.1]) i489LwJ2003949 for ; Sat, 8 May 2004 11:21:59 +0200 (CEST) (envelope-from chris@secretcore.dyndns.org) Received: (from chris@localhost) by secretcore.dyndns.org (8.12.11/8.12.10/Submit) id i489LvQ6003948 for acpi@freebsd.org; Sat, 8 May 2004 11:21:57 +0200 (CEST) (envelope-from chris) Date: Sat, 8 May 2004 11:21:57 +0200 From: christian uhrhan To: acpi@freebsd.org Message-ID: <20040508092157.GA2218@secretcore.dyndns.org> Mail-Followup-To: acpi@freebsd.org References: <20040507231846.F52653@root.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040507231846.F52653@root.org> User-Agent: Mutt/1.4.2.1i Subject: Re: New ACPI blacklist format X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2004 09:22:14 -0000 On Fri, May 07, 2004 at 11:28:15PM -0700, Nate Lawson wrote: > I have extracted a set of known-broken tables/versions from various > sources. Since. as far as I know, C does not allow variable length > initializers, I've settled on the following format: > > struct acpi_table_desc { > char *signature; > char *oem_id; > char *oem_table_id; > char *oem_rev_op; > char *oem_revision; > char *creator_id; > char *creator_rev_op; > char *creator_revision; > }; > > struct acpi_blacklist { > int quirk; > struct acpi_table_desc *match; > }; > > #define ACPI_BROKEN 0x1 > > static struct acpi_table_desc Abit_BP6[] = { > { "FACP", "AWARD", "AWRDACPI", "<=", "30302e31", "", "", "" }, > }; > static struct acpi_table_desc AMI_INT[] = { /* 01/18/00 */ > { "FACP", "AWARD", "", "<=", "10", "", "", "" }, > { "DSDT", "", "", "<=", "5", "", "", "" }, > }; > static struct acpi_table_desc Compaq_ViperII[] = { > { "FACP", "COMPAQ", "VIPER II", "<=", "06040000", "PTL", "<=", "000F4240" }, > }; > > static struct acpi_blacklist acpi_blacklist_table[] = { > { ACPI_BROKEN, Abit_BP6 }, > { ACPI_BROKEN, AMI_INT }, > { ACPI_BROKEN, Compaq_ViperII }, > }; > > Each entry in acpi_table_desc lists a table ID and then a set of strings > to match against the table. Multiple tables may be matched for a given > system (i.e. AMI_INT above). The op values will be "<=", "=", and ">=". > The quirk associated with each system will be a bitmask returned from the > quirk matching function. > > In English, the last entry means, "Check the table named 'FACP' for an OEM > ID of 'COMPAQ' and table ID of 'VIPER II' and OEM revision <= '06040000' > ..." Substring matches will work too (e.g., "COMPA"). > > Is there any better way to compact this? > I would say it's a good way to handle it. btw: you should mark the end of the list static struct acpi_blacklist acpi_blacklist_table[] = { { ACPI_BROKEN, Abit_BP6 }, { ACPI_BROKEN, AMI_INT }, { ACPI_BROKEN, Compaq_ViperII }, { 0, NULL }, }; It's easy to go through each element by a simple for so i would say it's a good way to it. Maybe it would also a good idea to define a constant for each acpi_table_desc-entry: enum atdindex { atdsignature, atdoem_id, atdoem_table_id, atdrev_op, atdrevision, atdcreator_id, atdcreator_rev_op, atdcreator_revision }; so by reading the code you could read which element you selected acpi_blacklist_table[0].match[atdsignature] only a suggestion :) -cu