> Date: Tue, 12 Mar 2013 05:13:01 -0400
> From: Matt Dainty <[email protected]>
>
> * Matt Dainty <[email protected]> [2013-02-20 19:30:43]:
> > Attached are two patches for bios(4) on i386 & amd64 that add support
> > for detecting the comBIOS on Soekris hardware, which then fills in the
> > hw.vendor & hw.product sysctl variables as this hardware lacks any
> > SMBIOS to provide them. The idea is then these can be used in the
> > GPIO/LED driver for the net6501 I posted a while ago to simplify the
> > match logic.
>
> Are there any objections to this being committed? It seems to work on
> all Soekris boards. I can send the revised GPIO/LED driver for the
> net6501.
I'm not thrilled by this, but given that Soekrissen are kinda popular
among our user base it makes some sense. One nit:
> > --- sys/arch/amd64/amd64/bios.c.orig Tue Feb 19 01:56:56 2013
> > +++ sys/arch/amd64/amd64/bios.c Wed Feb 20 08:37:12 2013
> > @@ -95,6 +95,7 @@
> > vaddr_t va;
> > paddr_t pa, end;
> > u_int8_t *p;
> > + int smbiosrev = 0;
> >
> > /* see if we have SMBIOS extentions */
> > for (p = ISA_HOLE_VADDR(SMBIOS_START);
> > @@ -137,6 +138,10 @@
> > printf(": SMBIOS rev. %d.%d @ 0x%lx (%d entries)",
> > hdr->majrev, hdr->minrev, hdr->addr, hdr->count);
> >
> > + smbiosrev = hdr->majrev * 100 + hdr->minrev;
> > + if (hdr->minrev < 10)
> > + smbiosrev = hdr->majrev * 100 + hdr->minrev * 10;
> > +
> > bios.cookie = 0;
> > if (smbios_find_table(SMBIOS_TYPE_BIOS, &bios)) {
> > sb = bios.tblhdr;
> > @@ -158,6 +163,39 @@
> > break;
> > }
> > printf("\n");
> > +
> > + /* No SMBIOS extensions, go looking for Soekris comBIOS */
> > + if (!smbiosrev) {
I think smbiosrev == 0 makes more sense here.
> > + const char *signature = "Soekris Engineering";
> > +
> > + for (p = ISA_HOLE_VADDR(SMBIOS_START);
> > + p <= (u_int8_t *)ISA_HOLE_VADDR(SMBIOS_END -
> > + (strlen(signature) - 1)); p++)
> > + if (!memcmp(p, signature, strlen(signature))) {
> > + hw_vendor = malloc(strlen(signature) + 1,
> > + M_DEVBUF, M_NOWAIT);
> > + if (hw_vendor)
> > + strlcpy(hw_vendor, signature,
> > + strlen(signature) + 1);
> > + p += strlen(signature);
> > + break;
> > + }
> > +
> > + for (; hw_vendor &&
> > + p <= (u_int8_t *)ISA_HOLE_VADDR(SMBIOS_END - 6); p++)
> > + /*
> > + * Search only for "net6501" in the comBIOS as that's
> > + * the only Soekris platform that can run amd64
> > + */
> > + if (!memcmp(p, "net6501", 7)) {
> > + hw_prod = malloc(8, M_DEVBUF, M_NOWAIT);
> > + if (hw_prod) {
> > + memcpy(hw_prod, p, 7);
> > + hw_prod[7] = '\0';
> > + }
> > + break;
> > + }
> > + }
> >
> > #if NACPI > 0
> > {
> > --- sys/arch/i386/i386/bios.c.orig Tue Feb 19 06:36:42 2013
> > +++ sys/arch/i386/i386/bios.c Wed Feb 20 08:58:17 2013
> > @@ -330,6 +330,43 @@
> >
> > printf("\n");
> >
> > + /* No SMBIOS extensions, go looking for Soekris comBIOS */
> > + if (!(flags & BIOSF_SMBIOS) && !smbiosrev) {
> > + const char *signature = "Soekris Engineering";
> > +
> > + for (va = ISA_HOLE_VADDR(SMBIOS_START);
> > + va <= (u_int8_t *)ISA_HOLE_VADDR(SMBIOS_END -
> > + (strlen(signature) - 1)); va++)
> > + if (!memcmp((u_int8_t *)va, signature,
> > + strlen(signature))) {
> > + hw_vendor = malloc(strlen(signature) + 1,
> > + M_DEVBUF, M_NOWAIT);
> > + if (hw_vendor)
> > + strlcpy(hw_vendor, signature,
> > + strlen(signature) + 1);
> > + va += strlen(signature);
> > + break;
> > + }
> > +
> > + for (; hw_vendor &&
> > + va <= (u_int8_t *)ISA_HOLE_VADDR(SMBIOS_END - 6); va++)
> > + /*
> > + * Search for "net(4(5xx|801)|[56]501)" which matches
> > + * the strings found in the comBIOS images
> > + */
> > + if (!memcmp((u_int8_t *)va, "net45xx", 7) ||
> > + !memcmp((u_int8_t *)va, "net4801", 7) ||
> > + !memcmp((u_int8_t *)va, "net5501", 7) ||
> > + !memcmp((u_int8_t *)va, "net6501", 7)) {
> > + hw_prod = malloc(8, M_DEVBUF, M_NOWAIT);
> > + if (hw_prod) {
> > + memcpy(hw_prod, (u_int8_t *)va, 7);
> > + hw_prod[7] = '\0';
> > + }
> > + break;
> > + }
> > + }
> > +
> > #if NAPM > 0
> > if (apm && ncpu < 2 && smbiosrev < 240) {
> > struct bios_attach_args ba;
> >
>
>