On Mon, 4 Mar 2013 15:18:45 +0100 Gerhard Roth <gerhard_r...@genua.de> wrote: > On Mon, 4 Mar 2013 06:02:19 -0500 Matt Dainty <m...@bodgit-n-scarper.com> > wrote: > > * Matt Dainty <m...@bodgit-n-scarper.com> [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. > > > > > > I've tested this with a net6501 & amd64 so I would appreciate testing > > > on any other Soekris hardware under i386; net4501, net4801 & net5501. > > > > I'm lacking a test report for a net4801, however as I've had reports > > of success for all other Soekris board types, I'd be surprised if it > > didn't work. > > Hi, > > I can confirm that your patch works for i386 on net4501: > > # sysctl hw > hw.machine=i386 > hw.model=Geode(TM) Integrated Processor by National Semi ("Geode by NSC" > 586-class) > hw.ncpu=1 > hw.byteorder=1234 > hw.pagesize=4096 > ... > hw.cpuspeed=267 > hw.vendor=Soekris Engineering > hw.product=net4801 > hw.version=1 > hw.physmem=133754880 > hw.usermem=133742592 > hw.ncpufound=1 > hw.allowpowerdown=1 > > Gerhard
Sorry, stupid me mixed up 4801 and 4501 :( But as you see from the sysctl output, I tested on 4801. So this should fill up your gap. Gerhard > > > > > > Also any other hardware that lacks SMBIOS and in the case of i386 > > > doesn't need to disable probing of SMBIOS with "flags 0x0008". > > > > I would still appreciate some testing on other systems that lack any > > SMBIOS, just to make sure it doesn't cause problems there. However as > > this code walks over the same area of memory, I would again be > > surprised if this caused problems when the SMBIOS probe didn't. > > > > Matt > > > > > --- 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) { > > > + 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; > > > > > > -- genua Gesellschaft fuer Netzwerk- und Unix-Administration mbH Domagkstrasse 7, 85551 Kirchheim bei Muenchen tel +49 89 991950-0, fax -999, www.genua.de Geschaeftsfuehrer: Dr. Magnus Harlander, Dr. Michaela Harlander, Bernhard Schneck. Amtsgericht Muenchen HRB 98238