New ACPI blacklist format
John Baldwin
jhb at FreeBSD.org
Mon May 10 07:06:01 PDT 2004
On Saturday 08 May 2004 02:37 pm, Nate Lawson wrote:
> On Sat, 8 May 2004, M. Warner Losh wrote:
> > In message: <20040507231846.F52653 at root.org>
> >
> > Nate Lawson <nate at root.org> writes:
> > : 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:
> >
> > It does.
> >
> > : 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", "", "", "" },
> > : };
> >
> > { .signature = "FACP", .oem_id="AWARD", .oem_table_id="AWARDACPI",
> > .oem_rev_op = "<=", }
> >
> > :The op values will be "<=", "=", and ">=".
> >
> > These are likely better as a enum.
> >
> > : Is there any better way to compact this?
> >
> > Using shorter structure names would get it all onthe same line.
>
> Sure, good comments. What I meant by compacting was to get a variable
> number of acpi_table_desc elements in a single blacklist entry without
> defining a separate static. Something like this:
>
> static struct acpi_blacklist blacklist[] = {
> {
> .quirk = ACPI_BROKEN,
> {
> { "FACP", ... },
> { "DSDT", ... }
> }
> },
> {
> .quirk = ...
> }
> };
>
> The compiler didn't allow this.
I like the idea of having a flat file that Marcel or Warner suggested and
generating the .c code from that file. I also think using enums or #define's
for the logical operations is much better than having to do string compares
in the kernel. Note that the file parser could translate 'oemrev <= foo' to
an appropriate constant.
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-arch
mailing list