Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
On 15 Jun 2013 16:34 , Markus Schatzl wrote: ... the gpios for the 6501 work. At least set out. set in doesn't as far as I can see now: starting pre-securelevel daemons:gpioctl: GPIOPINSET: Operation not supported by device gpioctl: GPIOPINSET: Operation not supported by device I have to check this in more detail with a scope, but I can switch my fan on and off with sensorsd now, which is cool. I have to revise the above statement, it's just the additional modifiers that don't work. All 16 GPIO pins on gpio0 work as expected as in and out, however exclusively with those two. Any other modifier flags are not working. Voltage on output pins is 3.3 V. Regards, /Markus
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
On 14 Jun 2013 21:31 , Brad Smith wrote: This was commited 3 months ago.. CVSROOT: /cvs Module name: src Changes by: dera...@cvs.openbsd.org 2013/03/12 10:31:50 ... Thanks for mentioning it, I did not expect it to enter the tree this way. Now with an updated bios.c, a slightly changed soekris_match() in Matt's soekris.c and a rebuilt GENERIC 5.3 including soekris0 at isa? port 0x680 gpio*at soekris? the gpios for the 6501 work. At least set out. set in doesn't as far as I can see now: starting pre-securelevel daemons:gpioctl: GPIOPINSET: Operation not supported by device gpioctl: GPIOPINSET: Operation not supported by device I have to check this in more detail with a scope, but I can switch my fan on and off with sensorsd now, which is cool. Cheers, /Markus int soekris_match(struct device *parent, void *match, void *aux) { struct isa_attach_args *ia = aux; bus_space_tag_t iot; bus_space_handle_t ioh; int iobase; iot = ia-ia_iot; iobase = ia-ipa_io[0].base; if (bus_space_map(iot, iobase, SOEKRIS_IOSIZE, 0, ioh)) return (0); bus_space_unmap(iot, ioh, SOEKRIS_IOSIZE); ia-ia_iosize = SOEKRIS_IOSIZE; ia-ipa_nio = 1; ia-ipa_nmem = 0; ia-ipa_nirq = 0; ia-ipa_ndrq = 0; return (1); }
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
* Matt Dainty m...@bodgit-n-scarper.com [2013-02-20 19:30:43]: ... 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. Hi, as I've been stumbling over this again, would anybody be willing to commit Matt's code into base? Cheers, /Markus
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
On 2013/06/14 23:32, Markus Schatzl wrote: * Matt Dainty m...@bodgit-n-scarper.com [2013-02-20 19:30:43]: ... 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. Hi, as I've been stumbling over this again, would anybody be willing to commit Matt's code into base? Cheers, /Markus I thought it was already?
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
On 14 Jun 2013 23:01 , Stuart Henderson wrote: On 2013/06/14 23:32, Markus Schatzl wrote: * Matt Dainty m...@bodgit-n-scarper.com [2013-02-20 19:30:43]: ... 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. Hi, as I've been stumbling over this again, would anybody be willing to commit Matt's code into base? Cheers, /Markus I thought it was already? Doesn't seem to be the case; at least there's no soekris.c in dev/isa. However, my newbuilt kernel with the soekris patch drops into ddb right away (5.3 release, GENERIC config, Soekris 6501, comBIOS 1.41c, dmesg attached). Probably the bus_space_map() that goes wrong, but I'm not into kernel debugging too much. As I received the device in exchange for a defect one very recently (has an aluminum heatsink on the CPU now), some things might have changed compared to about 18 months ago. Let me know if I can provide any further information. Stopped at soekris_match+0x1d: repe cmpsb (%esi),%es:(%edi) soekris_match(d1e02500,d1dfe400,d0bcba6c,d0736c60,800cf800) at soekris_match+0x 1d isascan(d1e02500,d1dfe400,1,0,d09f9e70) at isascan+0xe3 config_scan(d0736d70,d1e02500,d0bcbdc4,d03f4a8b,0) at config_scan+0x93 config_attach(d1e01680,d09e0980,d0bcbdc4,d0732bc0,0) at config_attach+0x1bb pcib_callback(d1e01680,20,8,0,d09f4870) at pcib_callback+0x50 config_process_deferred_children(d1cd0d80,0,0,d03f4a8b,0) at config_process_def erred_children+0x4f config_attach(d1dbcfc0,d09df060,d0bcbe54,d05b5950,0) at config_attach+0x1c3 mainbus_attach(0,d1dbcfc0,0,d09df040,0) at mainbus_attach+0x21b config_attach(0,d09df040,0,0,d0a534c0) at config_attach+0x1bb config_rootfound(d08fd1ec,0,0,d03e5961,0) at config_rootfound+0x46 ddb trace soekris_match(d1e02500,d1dfe400,d0bcba6c,d0736c60,800cf800) at soekris_match+0x 1d isascan(d1e02500,d1dfe400,1,0,d09f9e70) at isascan+0xe3 config_scan(d0736d70,d1e02500,d0bcbdc4,d03f4a8b,0) at config_scan+0x93 config_attach(d1e01680,d09e0980,d0bcbdc4,d0732bc0,0) at config_attach+0x1bb pcib_callback(d1e01680,20,8,0,d09f4870) at pcib_callback+0x50 config_process_deferred_children(d1cd0d80,0,0,d03f4a8b,0) at config_process_def erred_children+0x4f config_attach(d1dbcfc0,d09df060,d0bcbe54,d05b5950,0) at config_attach+0x1c3 mainbus_attach(0,d1dbcfc0,0,d09df040,0) at mainbus_attach+0x21b config_attach(0,d09df040,0,0,d0a534c0) at config_attach+0x1bb config_rootfound(d08fd1ec,0,0,d03e5961,0) at config_rootfound+0x46 cpu_configure(d0b0f800,1,1000,cff3f000,1) at cpu_configure+0x29 main(d02004f6,d02004fe,0,0,0) at main+0x3dd All the best, /Markus OpenBSD 5.3-stable (GENERIC) #0: Fri Jun 14 23:49:53 CEST 2013 r...@ahoi.target23.de:/usr/src/sys/arch/i386/compile/GENERIC cpu0: Genuine Intel(R) CPU @ 1.00GHz (GenuineIntel 686-class) 1.01 GHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF real mem = 1073131520 (1023MB) avail mem = 1044602880 (996MB) OpenBSD 5.3 (GENERIC) #50: Tue Mar 12 18:35:23 MDT 2013 dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC cpu0: Genuine Intel(R) CPU @ 1.00GHz (GenuineIntel 686-class) 1.01 GHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF real mem = 1073131520 (1023MB) avail mem = 1044611072 (996MB) mainbus0 at root bios0 at mainbus0: AT/286+ BIOS, date 20/21/15, BIOS32 rev. 0 @ 0xfac40 mpbios0 at bios0: Intel MP Specification 1.4 cpu0 at mainbus0: apid 0 (boot processor) cpu0: apic clock running at 100MHz cpu at mainbus0: not configured mpbios0: bus 0 is type PCI mpbios0: bus 64 is type ISA ioapic0 at mainbus0: apid 0 pa 0xfec0, version 20, 24 pins pcibios0 at bios0: rev 2.0 @ 0xf/0x1 pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xf3880/96 (4 entries) pcibios0: no compatible PCI ICU found: ICU vendor 0x8086 product 0x8186 pcibios0: Warning, unable to fix up PCI interrupt routing pcibios0: PCI bus #13 is the last bus bios0: ROM list: 0xc8000/0x2400 0xca800/0x4c00 0xcf800/0xee00 cpu0: unknown Enhanced SpeedStep CPU, msr 0x060f0a1202000a12 cpu0: using only highest and lowest power states cpu0: Enhanced SpeedStep 1001 MHz: speeds: 1000, 600 MHz pci0 at mainbus0 bus 0: configuration mode 1 (bios) pchb0 at pci0 dev 0 function 0 Intel E600 Host rev 0x03 pchb1 at pci0 dev 1 function 0 Intel E600 Config rev 0x00 ppb0 at pci0 dev 23 function 0 Intel E600 PCIE rev 0x00 pci1 at ppb0 bus 1 ppb1 at pci1 dev 0 function 0 Intel EG20T PCIE rev 0x01 pci2 at ppb1 bus 2 Intel EG20T Packet Hub rev 0x01 at pci2 dev 0 function 0 not configured Intel EG20T Ethernet rev 0x01 at pci2 dev 0 function 1 not configured Intel EG20T
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
On 14/06/13 9:18 PM, Markus Schatzl wrote: On 14 Jun 2013 23:01 , Stuart Henderson wrote: On 2013/06/14 23:32, Markus Schatzl wrote: * Matt Dainty m...@bodgit-n-scarper.com [2013-02-20 19:30:43]: ... 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. Hi, as I've been stumbling over this again, would anybody be willing to commit Matt's code into base? Cheers, /Markus I thought it was already? Doesn't seem to be the case; at least there's no soekris.c in dev/isa. This was commited 3 months ago.. CVSROOT:/cvs Module name:src Changes by: dera...@cvs.openbsd.org 2013/03/12 10:31:50 Modified files: sys/arch/i386/i386: bios.c sys/arch/amd64/amd64: bios.c Log message: Fake 'SMBIOS detection' for the Soekris boxes, by Matt Dainty This will make it easier to have device drivers for some oddities these machines have -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
* 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. 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. Thanks 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.origTue 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
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
On Tue, Mar 12, 2013 at 05:13:01AM -0400, Matt Dainty 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. 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. Thanks Matt Putting in workarounds for particular vendors always puts my teeth on edge. How many other bios weirdos will end up here? Ken --- sys/arch/amd64/amd64/bios.c.origTue 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); +
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
* Kenneth R Westerback kwesterb...@rogers.com [2013-03-12 06:39:02]: On Tue, Mar 12, 2013 at 05:13:01AM -0400, Matt Dainty 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. 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. Thanks Matt Putting in workarounds for particular vendors always puts my teeth on edge. How many other bios weirdos will end up here? Ken I was originally using something similar to this code in my GPIO/LED driver as part of the *_match() function as a means to accurately probe the hardware. It was suggested to move this code to bios(4) so that it could provide some value in populating hw.{vendor,product} particularly if it worked on the older boards, which it seems to. But it has a purpose rather than purely populating sysctl. 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.origTue 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
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
Date: Tue, 12 Mar 2013 05:13:01 -0400 From: Matt Dainty m...@bodgit-n-scarper.com * 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. 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.origTue 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) { +
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
* 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. 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.origTue 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) || +
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
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 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.origTue 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); +
Re: Add Soekris comBIOS detection to bios(4) on i386/amd64
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.origTue 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); +
Add Soekris comBIOS detection to bios(4) on i386/amd64
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. You should hopefully get something like the following: $ sysctl hw ... hw.vendor=Soekris Engineering hw.product=net6501 Also any other hardware that lacks SMBIOS and in the case of i386 doesn't need to disable probing of SMBIOS with flags 0x0008. Thanks Matt --- sys/arch/amd64/amd64/bios.c.origTue 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) { +