MSI for bnx(4)

2011-06-19 Thread Brad
Unfortunately I don't have any systems at the moment that are supported
for MSI (with the -current code) although they loook to be MSI capable.
So if you have a bnx(4) adapter(s) please take this for a spin. I don't see
any indication from the FreeBSD/Linux drivers that any of these adapters
need any special handling.


Index: if_bnx.c
===
RCS file: /home/cvs/src/sys/dev/pci/if_bnx.c,v
retrieving revision 1.94
diff -u -p -r1.94 if_bnx.c
--- if_bnx.c18 Apr 2011 04:27:31 -  1.94
+++ if_bnx.c7 Jun 2011 23:40:06 -
@@ -668,7 +668,7 @@ bnx_attach(struct device *parent, struct
return;
}
 
-   if (pci_intr_map(pa, sc-bnx_ih)) {
+   if (pci_intr_map_msi(pa, sc-bnx_ih)  pci_intr_map(pa, sc-bnx_ih)) 
{
printf(: couldn't map interrupt\n);
goto bnx_attach_fail;
}

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: counting zero-length matches in sed(1)

2011-06-19 Thread Otto Moerbeek
On Sat, Jun 18, 2011 at 08:16:05PM -0600, Ingo Schwarze wrote:

 When a regular expression has zero-length matches in a string,
 both sed(1) global replacement (/g) and replacement of numbered
 instances (e.g. /2) are broken.  This is not even limited to sed -E.
 Both Otto's patch and my own refactoring patch on misc@ only address
 global replacement and leave numbered instances broken.
 
 Already now, code in the three parts of the switch statement
 is rather repetitive, and by fixing the numbered instances case,
 code duplication would become much worse.  Thus, i propose
 the following full rewrite of the whole switch statement.
 
 This is a bit scary because...
 Well, sed(1) is not exactly the tool we want to break.
 Hence, a test suite is included.
 Both my patch and GNU sed(1) pass the test suite.
 
 Our -current sed fails 43 of these tests, quite a few of them
 in spectacular ways, like
 
   $ echo | sed 's/$/x/2'   # expect 
   x
   $ echo aaa | sed 's/a*/x/2'   # expect aaa
   aaax
   $ echo abc | sed -E 's/a|$/x/g'   # expect xbcx
   x
   $ echo abc | sed -E 's/()/x/2'# expect axbc
   xabc
   $ echo abc | sed -E 's/()/x/42'   # expect abc
   xabc
 
 One common source of confusion on misc@ was that Perl allows
 empty matches right after other matches, like in:
 
   $ perl -Mstrict -we '$_ = abc; s/b|()/x/g; print $_\n;'
   xaxxcx
   $ perl -Mstrict -we '$_ = a; s/^|a|$/x/g; print $_\n;'
   xxx
 
 I consider that broken behaviour in Perl.  For example, think about
 the case of a =~ /^|a/.  The branch /^/ matches at 0, length 0.
 The branch /a/ matches at 0, length 1.  So by greediness, the latter
 ought to prevail.  But then, we have already consumed the character,
 and there is no way to get a second match.  Hence,
 
   $ echo abc | sed -E 's/b|()/x/g'
   xaxcx
   $ echo a | sed -E 's/^|a|$/x/g'  
   x
 
 Comments?

Very good you're attacking this! When I was working on my first diff,
it already crossed my mind: this code is too complex, it should be
rewritten.  That said, a full review of this will take some effort. I
hope to do it the coming week. 

-Otto

   Ingo
 
 
 Index: usr.bin/sed/process.c
 ===
 RCS file: /cvs/src/usr.bin/sed/process.c,v
 retrieving revision 1.15
 diff -u -p -r1.15 process.c
 --- usr.bin/sed/process.c 27 Oct 2009 23:59:43 -  1.15
 +++ usr.bin/sed/process.c 19 Jun 2011 01:47:19 -
 @@ -333,60 +333,47 @@ substitute(struct s_command *cp)
   n = cp-u.s-n;
   lastempty = 1;
  
 - switch (n) {
 - case 0: /* Global */
 - do {
 - if (lastempty || match[0].rm_so != match[0].rm_eo) {
 - /* Locate start of replaced string. */
 - re_off = match[0].rm_so;
 - /* Copy leading retained string. */
 - cspace(SS, s, re_off, APPEND);
 - /* Add in regular expression. */
 - regsub(SS, s, cp-u.s-new);
 - }
 + do {
 + /* Copy the leading retained string. */
 + if (n = 1  match[0].rm_so)
 + cspace(SS, s, match[0].rm_so, APPEND);
  
 - /* Move past this match. */
 - if (match[0].rm_so != match[0].rm_eo) {
 - s += match[0].rm_eo;
 - slen -= match[0].rm_eo;
 - lastempty = 0;
 + /* Skip zero-length matches right after other matches. */
 + if (lastempty || match[0].rm_so ||
 + match[0].rm_so != match[0].rm_eo) {
 + if (n = 1) {
 + /* Want this match: append replacement. */
 + regsub(SS, s, cp-u.s-new);
 + if (n == 1)
 + n = -1;
   } else {
 - if (match[0].rm_so == 0)
 - cspace(SS, s, match[0].rm_so + 1,
 - APPEND);
 - else
 - cspace(SS, s + match[0].rm_so, 1,
 - APPEND);
 - s += match[0].rm_so + 1;
 - slen -= match[0].rm_so + 1;
 - lastempty = 1;
 + /* Want a later match: append original. */
 + if (match[0].rm_eo)
 + cspace(SS, s, match[0].rm_eo, APPEND);
 + n--;
   }
 - } while (slen  0  regexec_e(re, s, REG_NOTBOL, 0, slen));
 - /* Copy trailing retained string. */
 - if (slen  0)
 - cspace(SS, s, 

use unique MIIDEVS strings

2011-06-19 Thread Stuart Henderson
some different versions of MII devices print identical strings
when they attach, this diff makes them unique.  ok?


Index: miidevs
===
RCS file: /cvs/src/sys/dev/mii/miidevs,v
retrieving revision 1.116
diff -u -p -r1.116 miidevs
--- miidevs 21 Jan 2011 09:46:13 -  1.116
+++ miidevs 19 Jun 2011 11:48:47 -
@@ -118,9 +118,9 @@ model AMD 79C873phy 0x0036  Am79C873 int
 model AGERE ET1011 0x0004  ET1011 10/100/1000baseT PHY
 
 /* Atheros PHYs */
-model ATHEROS F1   0x0001  F1 10/100/1000 PHY
+model ATHEROS F1   0x0001  F1 1 10/100/1000 PHY
 model ATHEROS F2   0x0002  F2 10/100 PHY
-model ATHEROS F1_7 0x0007  F1 10/100/1000 PHY
+model ATHEROS F1_7 0x0007  F1 2 10/100/1000 PHY
 
 /* Altima PHYs */
 model xxALTIMA AC_UNKNOWN  0x0001  AC_UNKNOWN 10/100 PHY
@@ -177,8 +177,8 @@ model xxCICADA CS8201B  0x0021  CS8201 10
 model CICADA CS82010x0001  CS8201 10/100/1000TX PHY
 model CICADA CS82040x0004  CS8204 10/100/1000TX PHY
 model CICADA VSC8211   0x000b  VSC8211 10/100/1000 PHY
-model CICADA CS8201A   0x0020  CS8201 10/100/1000TX PHY
-model CICADA CS8201B   0x0021  CS8201 10/100/1000TX PHY
+model CICADA CS8201A   0x0020  CS8201A 10/100/1000TX PHY
+model CICADA CS8201B   0x0021  CS8201B 10/100/1000TX PHY
 model CICADA CS82440x002c  CS8244 10/100/1000TX PHY
 
 /* Davicom PHYs */
@@ -299,8 +299,8 @@ model TDK 78Q2120   0x0014  78Q2120 10/100
 model TDK 78Q2121  0x0015  78Q2121 100baseTX PHY
 
 /* VIA Networking PHYs */
-model VIA VT6103   0x0032  VT6103 10/100 PHY
-model VIA VT6103_2 0x0034  VT6103 10/100 PHY
+model VIA VT6103   0x0032  VT6103 1 10/100 PHY
+model VIA VT6103_2 0x0034  VT6103 2 10/100 PHY
 
 /* Vitesse PHYs */
 model VITESSE VSC8601  0x0002  VSC8601 10/100/1000 PHY



Re: isprint() needs setlocale(); for usr.bin

2011-06-19 Thread Stefan Sperling
On Sun, May 08, 2011 at 01:34:27PM +0200, Stefan Sperling wrote:
 On Sun, May 08, 2011 at 01:22:55PM +0200, Stefan Sperling wrote:
  Setting LANG=C for system scripts makes sense to me if the default
  locale is something else. I suppose their problems are exacerbated by having
  implemented LC_NUMERIC and LC_TIME, which can change output of programs
  like bc(1) and date(1). We don't implement those.
 
 Point being that we might want to use LC_CTYPE instead of LC_ALL in
 this patch after all.

[ pinging old diffs ]

So... you still object to this going in?
Or is it fine with LC_CTYPE?

Note again that it does not change the default behaviour.

And none of these tools use wide character stuff. So they're going to have
a reduced amount of printable characters if the UTF-8 locale is active
(only ASCII), not more than they already do (default is all of latin1).

[[[
Make tools in usr.bin which use isprint() call setlocale() so that
the ctype map is initialised correctly. Prevents printing of invalid
UTF-8 if the UTF-8 locale is active.
]]]

Index: bc/bc.y
===
RCS file: /cvs/src/usr.bin/bc/bc.y,v
retrieving revision 1.37
diff -u -p -r1.37 bc.y
--- bc/bc.y 3 Jun 2011 06:52:37 -   1.37
+++ bc/bc.y 5 Jun 2011 09:14:35 -
@@ -38,6 +38,7 @@
 #include errno.h
 #include histedit.h
 #include limits.h
+#include locale.h
 #include search.h
 #include signal.h
 #include stdarg.h
@@ -1089,6 +1090,7 @@ main(int argc, char *argv[])
int p[2];
char*q;
 
+   setlocale(LC_CTYPE, );
init();
setlinebuf(stdout);
 
Index: bgplg/bgplgsh.c
===
RCS file: /cvs/src/usr.bin/bgplg/bgplgsh.c,v
retrieving revision 1.3
diff -u -p -r1.3 bgplgsh.c
--- bgplg/bgplgsh.c 2 Apr 2010 21:20:49 -   1.3
+++ bgplg/bgplgsh.c 5 Jun 2011 09:14:35 -
@@ -20,6 +20,7 @@
 #include sys/types.h
 #include sys/param.h
 
+#include locale.h
 #include stdio.h
 #include stdlib.h
 #include signal.h
@@ -225,6 +226,7 @@ main(void)
/* Ignore the whitespace character */
rl_basic_word_break_characters = \t\n\\\'`@$=;|{(;
 
+   setlocale(LC_CTYPE, );
while (!quit) {
v = -1;
gethostname(prompt, sizeof(prompt) - 2);
Index: chpass/chpass.c
===
RCS file: /cvs/src/usr.bin/chpass/chpass.c,v
retrieving revision 1.37
diff -u -p -r1.37 chpass.c
--- chpass/chpass.c 27 Oct 2009 23:59:36 -  1.37
+++ chpass/chpass.c 5 Jun 2011 09:14:35 -
@@ -45,6 +45,7 @@
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include locale.h
 #include unistd.h
 #include util.h
 
@@ -74,6 +75,9 @@ main(int argc, char *argv[])
 #ifdef YP
use_yp = _yp_check(NULL);
 #endif
+
+   setlocale(LC_CTYPE, );
+
/* We need to use the system timezone for date conversions. */
if ((tz = getenv(TZ)) != NULL) {
unsetenv(TZ);
Index: cvs/cvs.c
===
RCS file: /cvs/src/usr.bin/cvs/cvs.c,v
retrieving revision 1.151
diff -u -p -r1.151 cvs.c
--- cvs/cvs.c   23 Jul 2010 08:31:19 -  1.151
+++ cvs/cvs.c   5 Jun 2011 09:14:35 -
@@ -30,6 +30,7 @@
 #include ctype.h
 #include errno.h
 #include pwd.h
+#include locale.h
 #include stdlib.h
 #include string.h
 #include time.h
@@ -188,6 +189,7 @@ main(int argc, char **argv)
char fpath[MAXPATHLEN];
 
tzset();
+   setlocale(LC_CTYPE, );
 
TAILQ_INIT(cvs_variables);
SLIST_INIT(repo_locks);
Index: diff/diff.c
===
RCS file: /cvs/src/usr.bin/diff/diff.c,v
retrieving revision 1.57
diff -u -p -r1.57 diff.c
--- diff/diff.c 16 Jul 2010 23:27:58 -  1.57
+++ diff/diff.c 5 Jun 2011 09:14:35 -
@@ -27,6 +27,7 @@
 #include err.h
 #include errno.h
 #include getopt.h
+#include locale.h
 #include signal.h
 #include stdlib.h
 #include stdio.h
@@ -87,6 +88,7 @@ main(int argc, char **argv)
long  l;
int   ch, dflags, lastch, gotstdin, prevoptind, newarg;
 
+   setlocale(LC_CTYPE, );
oargv = argv;
gotstdin = 0;
dflags = 0;
Index: finger/finger.c
===
RCS file: /cvs/src/usr.bin/finger/finger.c,v
retrieving revision 1.18
diff -u -p -r1.18 finger.c
--- finger/finger.c 12 Nov 2009 15:33:21 -  1.18
+++ finger/finger.c 5 Jun 2011 09:14:35 -
@@ -59,6 +59,7 @@
 #include sys/param.h
 #include sys/file.h
 #include sys/stat.h
+#include locale.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -84,6 +85,8 @@ main(int argc, char *argv[])
struct stat sb;
 
oflag = 1;  /* default to old office behavior */
+
+   setlocale(LC_CTYPE, );
 
while ((ch = getopt(argc, argv, lmMpsho)) != 

Re: MSI for bnx(4)

2011-06-19 Thread Stuart Henderson
On 2011/06/19 02:50, Brad wrote:
 Unfortunately I don't have any systems at the moment that are supported
 for MSI (with the -current code) although they loook to be MSI capable.
 So if you have a bnx(4) adapter(s) please take this for a spin. I don't see
 any indication from the FreeBSD/Linux drivers that any of these adapters
 need any special handling.

works on an R310.

OpenBSD 4.9-current (GENERIC.MP) #1: Sun Jun 19 13:10:59 BST 2011
sthen@mh3-pl7:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4284059648 (4085MB)
avail mem = 4155891712 (3963MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xbf79c000 (66 entries)
bios0: vendor Dell Inc. version 1.5.2 date 10/15/2010
bios0: Dell Inc. PowerEdge R310
acpi0 at bios0: rev 2
acpi0: sleep states S0 S4 S5
acpi0: tables DSDT FACP APIC SPCR HPET DM__ MCFG WD__ SLIC ERST HEST BERT EINJ 
TCPA SSDT
acpi0: wakeup devices PCI0(S5) USBA(S0) USBB(S0)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Xeon(R) CPU X3430 @ 2.40GHz, 1197.19 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,NXE,LONG
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: apic clock running at 132MHz
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Xeon(R) CPU X3430 @ 2.40GHz, 1196.99 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,NXE,LONG
cpu1: 256KB 64b/line 8-way L2 cache
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Xeon(R) CPU X3430 @ 2.40GHz, 1196.99 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,NXE,LONG
cpu2: 256KB 64b/line 8-way L2 cache
cpu3 at mainbus0: apid 6 (application processor)
cpu3: Intel(R) Xeon(R) CPU X3430 @ 2.40GHz, 1196.99 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,NXE,LONG
cpu3: 256KB 64b/line 8-way L2 cache
ioapic0 at mainbus0: apid 0 pa 0xfec0, version 20, 24 pins
acpihpet0 at acpi0: 14318179 Hz
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 4 (LYD0)
acpiprt2 at acpi0: bus 5 (LYD2)
acpiprt3 at acpi0: bus -1 (HVD0)
acpiprt4 at acpi0: bus -1 (HVD2)
acpiprt5 at acpi0: bus 3 (PEX0)
acpiprt6 at acpi0: bus -1 (PEX2)
acpiprt7 at acpi0: bus -1 (PEX3)
acpiprt8 at acpi0: bus 2 (PEX4)
acpiprt9 at acpi0: bus 1 (COMP)
acpicpu0 at acpi0: C3, C1
acpicpu1 at acpi0: C3, C1
acpicpu2 at acpi0: C3, C1
acpicpu3 at acpi0: C3, C1
ipmi at mainbus0 not configured
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel Core DMI rev 0x11
ppb0 at pci0 dev 3 function 0 Intel Core PCIE rev 0x11: apic 0 int 16
pci1 at ppb0 bus 4
ppb1 at pci0 dev 5 function 0 Intel Core PCIE rev 0x11: apic 0 int 16
pci2 at ppb1 bus 5
mpii0 at pci2 dev 0 function 0 Symbios Logic SAS2008 rev 0x03: msi
scsibus0 at mpii0: 42 targets
sd0 at scsibus0 targ 1 lun 0: Dell, Virtual Disk, 1028 SCSI4 0/direct fixed 
naa.600508e013201cfbcb2f1f04
sd0: 476416MB, 512 bytes/sec, 975699968 sec total
ses0 at scsibus0 targ 10 lun 0: DP, BACKPLANE, 1.07 SCSI3 13/enclosure 
services fixed t10.DP_BACKPLANE00
Intel Core Management rev 0x11 at pci0 dev 8 function 0 not configured
Intel Core Scratch rev 0x11 at pci0 dev 8 function 1 not configured
Intel Core Control rev 0x11 at pci0 dev 8 function 2 not configured
Intel Core Misc rev 0x11 at pci0 dev 8 function 3 not configured
Intel Core QPI Link rev 0x11 at pci0 dev 16 function 0 not configured
Intel Core QPI Routing rev 0x11 at pci0 dev 16 function 1 not configured
ehci0 at pci0 dev 26 function 0 Intel 3400 USB rev 0x05: apic 0 int 22
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb2 at pci0 dev 28 function 0 Intel 3400 PCIE rev 0x05
pci3 at ppb2 bus 3
ppb3 at pci0 dev 28 function 4 Intel 3400 PCIE rev 0x05
pci4 at ppb3 bus 2
bnx0 at pci4 dev 0 function 0 Broadcom BCM5716 rev 0x20: msi
bnx1 at pci4 dev 0 function 1 Broadcom BCM5716 rev 0x20: msi
ehci1 at pci0 dev 29 function 0 Intel 3400 USB rev 0x05: apic 0 int 22
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 Intel 82801BA Hub-to-PCI rev 0xa5
pci5 at ppb4 bus 1
vga1 at pci5 dev 3 function 0 Matrox MGA G200eW rev 0x0a
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcib0 at pci0 dev 31 function 0 Intel 3420 LPC rev 0x05
pciide0 

Re: use unique MIIDEVS strings

2011-06-19 Thread Mark Kettenis
 Date: Sun, 19 Jun 2011 12:52:43 +0100
 From: Stuart Henderson s...@spacehopper.org
 
 some different versions of MII devices print identical strings
 when they attach, this diff makes them unique.  ok?

I think this is ugly.  Unless there is a pressing need to distinguish
these in dmesg, I'd urge you not to do this.

 Index: miidevs
 ===
 RCS file: /cvs/src/sys/dev/mii/miidevs,v
 retrieving revision 1.116
 diff -u -p -r1.116 miidevs
 --- miidevs   21 Jan 2011 09:46:13 -  1.116
 +++ miidevs   19 Jun 2011 11:48:47 -
 @@ -118,9 +118,9 @@ model AMD 79C873phy   0x0036  Am79C873 int
  model AGERE ET1011   0x0004  ET1011 10/100/1000baseT PHY
  
  /* Atheros PHYs */
 -model ATHEROS F1 0x0001  F1 10/100/1000 PHY
 +model ATHEROS F1 0x0001  F1 1 10/100/1000 PHY
  model ATHEROS F2 0x0002  F2 10/100 PHY
 -model ATHEROS F1_7   0x0007  F1 10/100/1000 PHY
 +model ATHEROS F1_7   0x0007  F1 2 10/100/1000 PHY
  
  /* Altima PHYs */
  model xxALTIMA AC_UNKNOWN0x0001  AC_UNKNOWN 10/100 PHY
 @@ -177,8 +177,8 @@ model xxCICADA CS8201B0x0021  CS8201 10
  model CICADA CS8201  0x0001  CS8201 10/100/1000TX PHY
  model CICADA CS8204  0x0004  CS8204 10/100/1000TX PHY
  model CICADA VSC8211 0x000b  VSC8211 10/100/1000 PHY
 -model CICADA CS8201A 0x0020  CS8201 10/100/1000TX PHY
 -model CICADA CS8201B 0x0021  CS8201 10/100/1000TX PHY
 +model CICADA CS8201A 0x0020  CS8201A 10/100/1000TX PHY
 +model CICADA CS8201B 0x0021  CS8201B 10/100/1000TX PHY
  model CICADA CS8244  0x002c  CS8244 10/100/1000TX PHY
  
  /* Davicom PHYs */
 @@ -299,8 +299,8 @@ model TDK 78Q2120 0x0014  78Q2120 10/100
  model TDK 78Q21210x0015  78Q2121 100baseTX PHY
  
  /* VIA Networking PHYs */
 -model VIA VT6103 0x0032  VT6103 10/100 PHY
 -model VIA VT6103_2   0x0034  VT6103 10/100 PHY
 +model VIA VT6103 0x0032  VT6103 1 10/100 PHY
 +model VIA VT6103_2   0x0034  VT6103 2 10/100 PHY
  
  /* Vitesse PHYs */
  model VITESSE VSC86010x0002  VSC8601 10/100/1000 PHY



Re: use unique MIIDEVS strings

2011-06-19 Thread Stuart Henderson
On 2011/06/19 14:46, Mark Kettenis wrote:
  Date: Sun, 19 Jun 2011 12:52:43 +0100
  From: Stuart Henderson s...@spacehopper.org
  
  some different versions of MII devices print identical strings
  when they attach, this diff makes them unique.  ok?
 
 I think this is ugly.  Unless there is a pressing need to distinguish
 these in dmesg, I'd urge you not to do this.

I was particularly interested in F1 to see if Brad's recent change
that was meant to fix negotiation on gig ports in atphy(4) was being
triggered on my Eee (it's done for F1 and not F1_7) and noticed that
it was already done like this for Marvell 88E1000.

I thought it may be useful in some other cases but there's no real
pressing need.



Re: use unique MIIDEVS strings

2011-06-19 Thread Theo de Raadt
  some different versions of MII devices print identical strings
  when they attach, this diff makes them unique.  ok?
 
 I think this is ugly.  Unless there is a pressing need to distinguish
 these in dmesg, I'd urge you not to do this.

I kind of see it the other way.

If it is a different device, with different behaviours and different
code in the tree to handle it, then I think it is really nice if we
can identify it in dmesg.



sail(6) unsigned char bugfix

2011-06-19 Thread Miod Vallat
Trivial diff to avoid storing the result of getc() into a `char'
variable, and comparing the variable to EOF later on, since on platforms
where `char' is unsigned by default (such as arm and powerpc), EOF can't
fit a `char'.

While there avoid writing past a local buffer.

Index: sync.c
===
RCS file: /cvs/src/games/sail/sync.c,v
retrieving revision 1.9
diff -u -p -r1.9 sync.c
--- sync.c  27 Oct 2009 23:59:27 -  1.9
+++ sync.c  19 Jun 2011 15:16:52 -
@@ -253,16 +253,18 @@ Sync()
if (isstr != 0  isstr != 1)
goto bad;
if (isstr) {
+   int ch;
char *p;
+
for (p = buf;;) {
-   switch (*p++ = getc(sync_fp)) {
+   ch = getc(sync_fp);
+   switch (ch) {
case '\n':
-   p--;
case EOF:
break;
default:
-   if (p = buf + sizeof buf)
-   p--;
+   if (p  buf + sizeof buf)
+   *p++ = ch;
continue;
}
break;



Re: X configuration changes for synaptics - please test

2011-06-19 Thread Dawe
On Jun 18, 2011 01:40, Alexandr Shadchin wrote:
 On Wed, Jun 15, 2011 at 09:11:43AM +0200, Matthieu Herrb wrote:
  Hi,
  
  here are a set of patches being worked on to add native synaptics
  touch pad support to OpenBSD and Xenocara.
  
  The xf86-input-synaptics driver itself is already committed and built
  in Xenocara.
  
  http://xenocara.org/wscons_config.2.diff is a diff that uses the X
  hot-plug mechanism to configure you input drivers. It will setup
  the xf86-input-synaptics driver for you if you have one, together with
  a regular mouse driver that will handle any external PS/2 or USB mouse
  attached in addition. Touchscreens will also be auto-configured this
  way if one is detected.
  
  This new code also takes care of the configuration of the keyboard
  layout from the wscons layout. Thus a second diff:
  http://xenocara.org/xf86-input-keyboard.diff removes that code from
  the keyboard driver.
  
  To apply those patches:
  
  cd /usr/xenocara/xserver
  patch -p0 -E  /path/to/wscons_config.2.diff
  make -f Makefile.bsd-wrapper obj
  make -f Makefile.bsd-wrapper build
  cd /usr/xenocara/driver/xf86-input-keyboard
  patch -p0 -E  /path/to/xf86-input-keyboard.diff
  make -f Makefile.bsd-wrapper obj
  make -f Makefile.bsd-wrapper build
  
  Once X is ready, apply the kernel patch, and build a new kernel with
  the synaptics support in pms(4):
  http://xenocara.org/sys-synaptics.diff
  
  cd /sys
  patch -p0 -E  /path/to/sys-synaptics.diff
  
  the new kernel will detect your synaptics touch pad if any, and  X
  will be configured with the xf86-input-synaptics. Read the
  synaptics(4) manual page to discover all its features.
  
  You can check how the input drivers were configured by running the
  command:
  
 xinput list
  
  If you are configuring input devices manually in xorg,conf you need to
  add this to the ServerFlags section (but may be you should give a try
  at auto-configuration and remove your InputDevice sections all together):
  
  Section ServerFlags
  Option AutoAddDevices false
  EndSection
  
  Please test, comment and report failures. Make sure to include
  /var/log/Xorg.0.log and dmesg outputs in your reports.
  
  Thanks to Alexandr Shadchin (shadchin@) for his work on this driver and
  to all people who already tested these patches and suggested
  enhancements.
  
  -- 
  Matthieu Herrb
  
 
 New sys-synaptics.diff (http://koba.devio.us/distfiles/synaptics.v2.diff)
 * fix wrong detect clickpad
 * fix ignore buttons if no fingers on touchpad
 * if open directly /dev/wsmouseX, then remove this device from mux
   (close device - get back in mux)
 
 Thanks all for your feedback.
 
 -- 
 Alexandr Shadchin
 
This breaks tapping for me on my T410i running amd64.
The more advanced features like scrolling also don't work.
Hitting the real buttons still works.

xinput list   
b! Virtual core pointerid=2[master pointer  (3)]
b   b3 Virtual core XTEST pointerid=4[slave  pointer
(2)]
b   b3 /dev/wsmouse0 id=7[slave  pointer
(2)]
b   b3 /dev/wsmouse  id=8[slave  pointer
(2)]
b# Virtual core keyboard   id=3[master keyboard (2)]
b3 Virtual core XTEST keyboard id=5[slave  keyboard
(3)]
b3 /dev/wskbd  id=6[slave  keyboard
(3)]


OpenBSD 4.9-current (GENERIC.MP) #7: Sun Jun 19 19:32:32 CEST 2011
d...@padtree.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 1998045184 (1905MB)
avail mem = 1930715136 (1841MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xe0010 (78 entries)
bios0: vendor LENOVO version 6IET68WW (1.28 ) date 07/12/2010
bios0: LENOVO 25184QG
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET ASF! SLIC BOOT SSDT TCPA SSDT
SSDT SSDT
acpi0: wakeup devices LID_(S3) SLPB(S3) UART(S3) IGBE(S4) EXP1(S4) EXP2(S4)
EXP3(S4) EXP4(S4) EXP5(S4) EHC1(S3) EHC2(S3) HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz, 2261.41 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,NXE,LONG
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: apic clock running at 132MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz, 2261.00 MHz
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,POPCNT,NXE,LONG
cpu1: 256KB 64b/line 8-way L2 cache
cpu2 at mainbus0: apid 4 

Re: ksh completion

2011-06-19 Thread LEVAI Daniel
On sze, maj 11, 2011 at 16:13:45 +0200, LEVAI Daniel wrote:
 On Tue, May 10, 2011 at 15:23:52 +0400, Alexander Polakov wrote:
  * LEVAI Daniel l...@ecentrum.hu [110510 14:33]:
   On Tue, May 10, 2011 at 12:28:06 +0200, LEVAI Daniel wrote:
[...]
   Apperantly, adding ':' to ESCAPEDCHARS solves the problem. Do you think
   there is any sideeffect to this?
  
  No, I don't think so. Let's just add it and find out in practice.
 
 So far so good. I really like this patch. Thanks for it :)
 Is it acceptable in the tree?

Is this really going down the sewers?


Daniel

-- 
LIVAI Daniel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D  650C C69B BE4C 83B6 3A8F



Re: X configuration changes for synaptics - please test

2011-06-19 Thread Alexandr Shadchin
On Sun, Jun 19, 2011 at 08:16:12PM +0200, Dawe wrote:
 On Jun 18, 2011 01:40, Alexandr Shadchin wrote:
  On Wed, Jun 15, 2011 at 09:11:43AM +0200, Matthieu Herrb wrote:
   Hi,
   
   here are a set of patches being worked on to add native synaptics
   touch pad support to OpenBSD and Xenocara.
   
   The xf86-input-synaptics driver itself is already committed and built
   in Xenocara.
   
   http://xenocara.org/wscons_config.2.diff is a diff that uses the X
   hot-plug mechanism to configure you input drivers. It will setup
   the xf86-input-synaptics driver for you if you have one, together with
   a regular mouse driver that will handle any external PS/2 or USB mouse
   attached in addition. Touchscreens will also be auto-configured this
   way if one is detected.
   
   This new code also takes care of the configuration of the keyboard
   layout from the wscons layout. Thus a second diff:
   http://xenocara.org/xf86-input-keyboard.diff removes that code from
   the keyboard driver.
   
   To apply those patches:
   
   cd /usr/xenocara/xserver
   patch -p0 -E  /path/to/wscons_config.2.diff
   make -f Makefile.bsd-wrapper obj
   make -f Makefile.bsd-wrapper build
   cd /usr/xenocara/driver/xf86-input-keyboard
   patch -p0 -E  /path/to/xf86-input-keyboard.diff
   make -f Makefile.bsd-wrapper obj
   make -f Makefile.bsd-wrapper build
   
   Once X is ready, apply the kernel patch, and build a new kernel with
   the synaptics support in pms(4):
   http://xenocara.org/sys-synaptics.diff
   
   cd /sys
   patch -p0 -E  /path/to/sys-synaptics.diff
   
   the new kernel will detect your synaptics touch pad if any, and  X
   will be configured with the xf86-input-synaptics. Read the
   synaptics(4) manual page to discover all its features.
   
   You can check how the input drivers were configured by running the
   command:
   
  xinput list
   
   If you are configuring input devices manually in xorg,conf you need to
   add this to the ServerFlags section (but may be you should give a try
   at auto-configuration and remove your InputDevice sections all together):
   
   Section ServerFlags
 Option AutoAddDevices false
   EndSection
   
   Please test, comment and report failures. Make sure to include
   /var/log/Xorg.0.log and dmesg outputs in your reports.
   
   Thanks to Alexandr Shadchin (shadchin@) for his work on this driver and
   to all people who already tested these patches and suggested
   enhancements.
   
   -- 
   Matthieu Herrb
   
  
  New sys-synaptics.diff (http://koba.devio.us/distfiles/synaptics.v2.diff)
  * fix wrong detect clickpad
  * fix ignore buttons if no fingers on touchpad
  * if open directly /dev/wsmouseX, then remove this device from mux
(close device - get back in mux)
  
  Thanks all for your feedback.
  
  -- 
  Alexandr Shadchin
  
 This breaks tapping for me on my T410i running amd64.
 The more advanced features like scrolling also don't work.
 Hitting the real buttons still works.
 

Defaults tap and scrolling disabled.

Add in /etc/X11/xorg.conf:

Section InputClass
Identifier  Touchpad defaults
MatchIsTouchpad on
Option  VertEdgeScroll true
Option  HorizEdgeScroll true
Option  TapButton1 1
EndSection

-- 
Alexandr Shadchin



Re: ksh completion

2011-06-19 Thread STeve Andre'

On 06/19/11 14:38, LEVAI Daniel wrote:

On sze, maj 11, 2011 at 16:13:45 +0200, LEVAI Daniel wrote:

On Tue, May 10, 2011 at 15:23:52 +0400, Alexander Polakov wrote:

* LEVAI Daniell...@ecentrum.hu  [110510 14:33]:

On Tue, May 10, 2011 at 12:28:06 +0200, LEVAI Daniel wrote:

[...]

Apperantly, adding ':' to ESCAPEDCHARS solves the problem. Do you think
there is any sideeffect to this?

No, I don't think so. Let's just add it and find out in practice.

So far so good. I really like this patch. Thanks for it :)
Is it acceptable in the tree?

Is this really going down the sewers?


Daniel


I hope not.  I've seen this as well.  I want to test this, seeing as how 
I just

bumped into this.  Can you post the last patch for this?

--STeve Andre'



Re: X configuration changes for synaptics - please test

2011-06-19 Thread Dawe
On Jun 20, 2011 00:48, Alexandr Shadchin wrote:
 On Sun, Jun 19, 2011 at 08:16:12PM +0200, Dawe wrote:
  On Jun 18, 2011 01:40, Alexandr Shadchin wrote:
   On Wed, Jun 15, 2011 at 09:11:43AM +0200, Matthieu Herrb wrote:
Hi,

here are a set of patches being worked on to add native synaptics
touch pad support to OpenBSD and Xenocara.

The xf86-input-synaptics driver itself is already committed and built
in Xenocara.

http://xenocara.org/wscons_config.2.diff is a diff that uses the X
hot-plug mechanism to configure you input drivers. It will setup
the xf86-input-synaptics driver for you if you have one, together with
a regular mouse driver that will handle any external PS/2 or USB mouse
attached in addition. Touchscreens will also be auto-configured this
way if one is detected.

This new code also takes care of the configuration of the keyboard
layout from the wscons layout. Thus a second diff:
http://xenocara.org/xf86-input-keyboard.diff removes that code from
the keyboard driver.

To apply those patches:

cd /usr/xenocara/xserver
patch -p0 -E  /path/to/wscons_config.2.diff
make -f Makefile.bsd-wrapper obj
make -f Makefile.bsd-wrapper build
cd /usr/xenocara/driver/xf86-input-keyboard
patch -p0 -E  /path/to/xf86-input-keyboard.diff
make -f Makefile.bsd-wrapper obj
make -f Makefile.bsd-wrapper build

Once X is ready, apply the kernel patch, and build a new kernel with
the synaptics support in pms(4):
http://xenocara.org/sys-synaptics.diff

cd /sys
patch -p0 -E  /path/to/sys-synaptics.diff

the new kernel will detect your synaptics touch pad if any, and  X
will be configured with the xf86-input-synaptics. Read the
synaptics(4) manual page to discover all its features.

You can check how the input drivers were configured by running the
command:

   xinput list

If you are configuring input devices manually in xorg,conf you need to
add this to the ServerFlags section (but may be you should give a try
at auto-configuration and remove your InputDevice sections all 
together):

Section ServerFlags
Option AutoAddDevices false
EndSection

Please test, comment and report failures. Make sure to include
/var/log/Xorg.0.log and dmesg outputs in your reports.

Thanks to Alexandr Shadchin (shadchin@) for his work on this driver and
to all people who already tested these patches and suggested
enhancements.

-- 
Matthieu Herrb

   
   New sys-synaptics.diff (http://koba.devio.us/distfiles/synaptics.v2.diff)
   * fix wrong detect clickpad
   * fix ignore buttons if no fingers on touchpad
   * if open directly /dev/wsmouseX, then remove this device from mux
 (close device - get back in mux)
   
   Thanks all for your feedback.
   
   -- 
   Alexandr Shadchin
   
  This breaks tapping for me on my T410i running amd64.
  The more advanced features like scrolling also don't work.
  Hitting the real buttons still works.
  
 
 Defaults tap and scrolling disabled.
 
 Add in /etc/X11/xorg.conf:
 
 Section InputClass
 Identifier  Touchpad defaults
 MatchIsTouchpad on
 Option  VertEdgeScroll true
 Option  HorizEdgeScroll true
 Option  TapButton1 1
 EndSection
 
 -- 
 Alexandr Shadchin
 

Oh sorry, I thought there was no need for an xorg.conf.
Now tapping and scrolling work just fine.



Re: wol for xl(4)

2011-06-19 Thread Thomas Gerlach
Richard Toohey richardtoohey at paradise.net.nz writes:

 
 On 17/06/2011, at 8:40 PM, Thomas Gerlach wrote:
 
  hello,
 
  i just confirmed wol is working with freebsd 8.2 standard installation on
 my
  box. So it must be the openbsd xl driver, which isn't working properly.
  i will try to fix it starting next week. :)
 
 
  cheers,
 
  thomas
 
 Hi, Thomas.
 
 This is the same point I reached with Stefan.
 
 http://marc.info/?l=openbsd-techm=130337513320970w=2
 
 I didn't have the coding smarts to progress any further ...
 
 Thanks.
 
 

hey guys,

i just had a look into the driver again, and i was able to get wol working now.
:)

basically, the missing point was to enable RX again. it is disabled in the
xl_stop routine (xl.c).
right now it's just a quick hack, and i will provide you with the patches, so
you can test it on your box.

i will attach them asap.


cheers,

thomas



Re: wol for xl(4)

2011-06-19 Thread Stefan Sperling
On Sun, Jun 19, 2011 at 08:14:11PM +, Thomas Gerlach wrote:
 hey guys,
 
 i just had a look into the driver again, and i was able to get wol working 
 now.
 :)
 
 basically, the missing point was to enable RX again. it is disabled in the
 xl_stop routine (xl.c).
 right now it's just a quick hack, and i will provide you with the patches, so
 you can test it on your box.
 
 i will attach them asap.
 
 
 cheers,
 
 thomas

Didn't you see this patch I mailed you yesterday for testing? :)

Index: ic/xl.c
===
RCS file: /cvs/src/sys/dev/ic/xl.c,v
retrieving revision 1.101
diff -u -p -r1.101 xl.c
--- ic/xl.c 17 Apr 2011 20:52:43 -  1.101
+++ ic/xl.c 17 Jun 2011 21:38:21 -
@@ -2373,9 +2373,13 @@ xl_stop(struct xl_softc *sc)
xl_freetxrx(sc);
 
 #ifndef SMALL_KERNEL
-   /* Call upper layer WOL power routine if WOL is enabled. */
-   if ((sc-xl_flags  XL_FLAG_WOL)  sc-wol_power)
+   /* Re-enable RX and call upper layer WOL power routine
+* if WOL is enabled. */
+   if ((sc-xl_flags  XL_FLAG_WOL)  sc-wol_power) {
+   CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_ENABLE);
+   xl_wait(sc);
sc-wol_power(sc-wol_power_arg);
+   }
 #endif
 }
 
@@ -2694,6 +2698,10 @@ xl_wol(struct ifnet *ifp, int enable)
struct xl_softc *sc = ifp-if_softc;
 
XL_SEL_WIN(7);
+
+   /* Clear any pending PME events. */
+   CSR_READ_2(sc, XL_W7_BM_PME);
+
if (enable) {
CSR_WRITE_2(sc, XL_W7_BM_PME, XL_BM_PME_MAGIC);
sc-xl_flags |= XL_FLAG_WOL;
Index: pci/if_xl_pci.c
===
RCS file: /cvs/src/sys/dev/pci/if_xl_pci.c,v
retrieving revision 1.36
diff -u -p -r1.36 if_xl_pci.c
--- pci/if_xl_pci.c 17 Apr 2011 20:52:43 -  1.36
+++ pci/if_xl_pci.c 17 Jun 2011 21:33:35 -
@@ -266,18 +266,6 @@ xl_pci_attach(struct device *parent, str
pci_conf_write(pc, pa-pa_tag, XL_PCI_LOMEM, mem);
pci_conf_write(pc, pa-pa_tag, XL_PCI_INTLINE, irq);
}
-
-#ifndef SMALL_KERNEL
-   /* The card is WOL-capable if it supports PME# assertion
-* from D3hot power state. Install a callback to configure
-* PCI power state for WOL. It will be invoked when the
-* interface stops and WOL was enabled. */
-   command = pci_conf_read(pc, pa-pa_tag, XL_PCI_PWRMGMTCAP);
-   if (command  XL_PME_CAP_D3_HOT) {
-   sc-wol_power = xl_pci_wol_power;
-   sc-wol_power_arg = psc; 
-   }
-#endif
}
 
/*
@@ -335,6 +323,16 @@ xl_pci_attach(struct device *parent, str
printf(: %s, intrstr);
 
xl_attach(sc);
+
+#ifndef SMALL_KERNEL
+   /* If the card is WOL-capable install a callback to configure
+* PCI power state for WOL. It will be invoked when the
+* interface stops and WOL was enabled. */
+   if (sc-xl_caps  XL_CAPS_PWRMGMT) {
+   sc-wol_power = xl_pci_wol_power;
+   sc-wol_power_arg = psc; 
+   }
+#endif
 }
 
 int



Re: wol for xl(4)

2011-06-19 Thread Thomas Gerlach
Stefan Sperling stsp at stsp.name writes:

hi stefan,

oh, sorry, no. i just got back from the german southside festival this evening.
should explain why i missed it... ;)

seems you came to the same conclusion. fine. :) so i will test it then...



Re: wol for xl(4)

2011-06-19 Thread Stefan Sperling
On Sun, Jun 19, 2011 at 08:55:17PM +, Thomas Gerlach wrote:
 Stefan Sperling stsp at stsp.name writes:
 
 hi stefan,
 
 oh, sorry, no. i just got back from the german southside festival this 
 evening.
 should explain why i missed it... ;)
 
 seems you came to the same conclusion. fine. :) so i will test it then...

It would be interesting to know if just the first hunk, which
re-enables RX, is enough.

I don't have working xl wol hardware, so what I did was compare
our driver to the FreeBSD driver taking blind guesses as to what
could be wrong.

So the diff I sent may be larger than needed.
If you could help trim down the diff to the absolute minimum needed
based on testing with hardware that would be great. Cheers!



Re: wol for xl(4)

2011-06-19 Thread Thomas Gerlach
Stefan Sperling stsp at stsp.name writes:

 It would be interesting to know if just the first hunk, which
 re-enables RX, is enough.
 
 I don't have working xl wol hardware, so what I did was compare
 our driver to the FreeBSD driver taking blind guesses as to what
 could be wrong.
 
 So the diff I sent may be larger than needed.
 If you could help trim down the diff to the absolute minimum needed
 based on testing with hardware that would be great. Cheers!
 
 

I did exactly the same, I compared it to the FreeBSD driver. And I also
cleared the PME events by using CSR_READ_2. I think we're on the safe side if
we keep it.

Maybe we can omit the xl_wait(sc) calls, at least I don't see it in the
FreeBSD driver.


Regards...



Re: X configuration changes for synaptics - please test

2011-06-19 Thread Dawe
On Jun 19, 2011 22:01, Dawe wrote:
 On Jun 20, 2011 00:48, Alexandr Shadchin wrote:
  On Sun, Jun 19, 2011 at 08:16:12PM +0200, Dawe wrote:
   On Jun 18, 2011 01:40, Alexandr Shadchin wrote:
On Wed, Jun 15, 2011 at 09:11:43AM +0200, Matthieu Herrb wrote:
 Hi,
 
 here are a set of patches being worked on to add native synaptics
 touch pad support to OpenBSD and Xenocara.
 
 The xf86-input-synaptics driver itself is already committed and built
 in Xenocara.
 
 http://xenocara.org/wscons_config.2.diff is a diff that uses the X
 hot-plug mechanism to configure you input drivers. It will setup
 the xf86-input-synaptics driver for you if you have one, together with
 a regular mouse driver that will handle any external PS/2 or USB mouse
 attached in addition. Touchscreens will also be auto-configured this
 way if one is detected.
 
 This new code also takes care of the configuration of the keyboard
 layout from the wscons layout. Thus a second diff:
 http://xenocara.org/xf86-input-keyboard.diff removes that code from
 the keyboard driver.
 
 To apply those patches:
 
 cd /usr/xenocara/xserver
 patch -p0 -E  /path/to/wscons_config.2.diff
 make -f Makefile.bsd-wrapper obj
 make -f Makefile.bsd-wrapper build
 cd /usr/xenocara/driver/xf86-input-keyboard
 patch -p0 -E  /path/to/xf86-input-keyboard.diff
 make -f Makefile.bsd-wrapper obj
 make -f Makefile.bsd-wrapper build
 
 Once X is ready, apply the kernel patch, and build a new kernel with
 the synaptics support in pms(4):
 http://xenocara.org/sys-synaptics.diff
 
 cd /sys
 patch -p0 -E  /path/to/sys-synaptics.diff
 
 the new kernel will detect your synaptics touch pad if any, and  X
 will be configured with the xf86-input-synaptics. Read the
 synaptics(4) manual page to discover all its features.
 
 You can check how the input drivers were configured by running the
 command:
 
xinput list
 
 If you are configuring input devices manually in xorg,conf you need to
 add this to the ServerFlags section (but may be you should give a try
 at auto-configuration and remove your InputDevice sections all 
 together):
 
 Section ServerFlags
   Option AutoAddDevices false
 EndSection
 
 Please test, comment and report failures. Make sure to include
 /var/log/Xorg.0.log and dmesg outputs in your reports.
 
 Thanks to Alexandr Shadchin (shadchin@) for his work on this driver 
 and
 to all people who already tested these patches and suggested
 enhancements.
 
 -- 
 Matthieu Herrb
 

New sys-synaptics.diff 
(http://koba.devio.us/distfiles/synaptics.v2.diff)
* fix wrong detect clickpad
* fix ignore buttons if no fingers on touchpad
* if open directly /dev/wsmouseX, then remove this device from mux
  (close device - get back in mux)

Thanks all for your feedback.

-- 
Alexandr Shadchin

   This breaks tapping for me on my T410i running amd64.
   The more advanced features like scrolling also don't work.
   Hitting the real buttons still works.
   
  
  Defaults tap and scrolling disabled.
  
  Add in /etc/X11/xorg.conf:
  
  Section InputClass
  Identifier  Touchpad defaults
  MatchIsTouchpad on
  Option  VertEdgeScroll true
  Option  HorizEdgeScroll true
  Option  TapButton1 1
  EndSection
  
  -- 
  Alexandr Shadchin
  
 
 Oh sorry, I thought there was no need for an xorg.conf.
 Now tapping and scrolling work just fine.
 
Well, after some time I'm experiencing the same behaviour like Aaron.
No dmesg output and nothing in the Xorg.0.log after the touchpad stops working.



Re: X configuration changes for synaptics - please test

2011-06-19 Thread Landry Breuil
On Sat, Jun 18, 2011 at 08:25:19AM -0600, Aaron Bieber wrote:
 Hi,
 
 I applied these patches to -current on my lenovo t410.  
 
 The trackpad works as expected for for a few minutes, and then seems to
 lock up ( not allowing me to move the pointer, or click the two
 buttons under it ).

I've experienced it twice on my msi wind u100, with the very latest
synaptics.v2.diff.. vt switching 'fixes it'.
Alas, nothing special in Xorg.0.log nor dmesg.

Landry



Re: X configuration changes for synaptics - please test

2011-06-19 Thread Dawe
On Jun 19, 2011 23:51, Landry Breuil wrote:
 On Sat, Jun 18, 2011 at 08:25:19AM -0600, Aaron Bieber wrote:
  Hi,
  
  I applied these patches to -current on my lenovo t410.  
  
  The trackpad works as expected for for a few minutes, and then seems to
  lock up ( not allowing me to move the pointer, or click the two
  buttons under it ).
 
 I've experienced it twice on my msi wind u100, with the very latest
 synaptics.v2.diff.. vt switching 'fixes it'.
 Alas, nothing special in Xorg.0.log nor dmesg.
 
 Landry
 
For me, it just came back to life all on its own, without vt switching or any
other special interaction.



pf flag PFDESC_IP_REAS

2011-06-19 Thread Alexander Bluhm
Hi,

We accept more TCP reset packets in pf, if fragment reassembly is
turned off.  That does not make sense to me.  It came into the tree
here:

revision 1.443
date: 2004/04/27 18:28:07;  author: frantzen;  state: Exp;  lines: +9 -6
validate the sequence numbers on TCP resets are an exact match.  check is only
enabled when we're doing full frag reassembly and thus have full seq info
ok markus@

Nowadays we have full fragment reassembly on by default, the fragment
cache has gone.  When the user turns it off, he has to cope with
the consequences.  Fragmented TCP reset packets too short for the
sequence number are likely to be evil.

ok to remove PFDESC_IP_REAS?

bluhm


Index: net/pf.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pf.c,v
retrieving revision 1.747
diff -u -p -r1.747 pf.c
--- net/pf.c2 Jun 2011 22:08:40 -   1.747
+++ net/pf.c17 Jun 2011 23:59:35 -
@@ -3617,8 +3617,7 @@ pf_tcp_track_full(struct pf_state_peer *
(ackskew = (MAXACKWINDOW  sws)) 
/* Acking not more than one window forward */
((th-th_flags  TH_RST) == 0 || orig_seq == src-seqlo ||
-   (orig_seq == src-seqlo + 1) || (orig_seq + 1 == src-seqlo) ||
-   (pd-flags  PFDESC_IP_REAS) == 0)) {
+   (orig_seq == src-seqlo + 1) || (orig_seq + 1 == src-seqlo))) {
/* Require an exact/+1 sequence match on resets when possible */
 
if (dst-scrub || src-scrub) {
@@ -5810,7 +5809,7 @@ pf_test(int dir, struct ifnet *ifp, stru
h = mtod(m, struct ip *);
if (pf_status.reass 
(h-ip_off  htons(IP_MF | IP_OFFMASK)) 
-   pf_normalize_ip(m0, dir, kif, reason, pd) != PF_PASS) {
+   pf_normalize_ip(m0, dir, kif, reason) != PF_PASS) {
action = PF_DROP;
goto done;
}
@@ -6090,7 +6089,7 @@ pf_test6(int fwdir, struct ifnet *ifp, s
 
/* packet reassembly */
if (pf_status.reass 
-   pf_normalize_ip6(m0, fwdir, kif, reason, pd) != PF_PASS) {
+   pf_normalize_ip6(m0, fwdir, kif, reason) != PF_PASS) {
action = PF_DROP;
goto done;
}
Index: net/pf_norm.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pf_norm.c,v
retrieving revision 1.133
diff -u -p -r1.133 pf_norm.c
--- net/pf_norm.c   24 May 2011 14:01:52 -  1.133
+++ net/pf_norm.c   17 Jun 2011 23:58:35 -
@@ -740,7 +740,7 @@ pf_refragment6(struct mbuf **m0, struct 
 
 int
 pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif,
-u_short *reason, struct pf_pdesc *pd)
+u_short *reason)
 {
struct mbuf *m = *m0;
struct ip   *h = mtod(m, struct ip *);
@@ -787,7 +787,6 @@ pf_normalize_ip(struct mbuf **m0, int di
if (h-ip_off  ~htons(IP_DF))
h-ip_off = htons(IP_DF);
 
-   pd-flags |= PFDESC_IP_REAS;
return (PF_PASS);
 
  drop:
@@ -798,7 +797,7 @@ pf_normalize_ip(struct mbuf **m0, int di
 #ifdef INET6
 int
 pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif,
-u_short *reason, struct pf_pdesc *pd)
+u_short *reason)
 {
struct mbuf *m = *m0;
struct ip6_hdr  *h = mtod(m, struct ip6_hdr *);
@@ -924,7 +923,6 @@ pf_normalize_ip6(struct mbuf **m0, int d
if (m == NULL)
return (PF_PASS);
 
-   pd-flags |= PFDESC_IP_REAS;
return (PF_PASS);
 
  shortpkt:
Index: net/pfvar.h
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfvar.h,v
retrieving revision 1.332
diff -u -p -r1.332 pfvar.h
--- net/pfvar.h 24 May 2011 14:01:52 -  1.332
+++ net/pfvar.h 17 Jun 2011 23:58:57 -
@@ -1221,8 +1221,6 @@ struct pf_pdesc {
u_int16_t   *proto_sum;
 
u_int16_trdomain;   /* original routing domain */
-   u_int16_tflags;
-#define PFDESC_IP_REAS 0x0002  /* IP frags would've been reassembled */
sa_family_t  af;
u_int8_t proto;
u_int8_t tos;
@@ -1777,10 +1775,8 @@ int  pf_match_gid(u_int8_t, gid_t, gid_t,
 
 intpf_refragment6(struct mbuf **, struct m_tag *mtag, int);
 void   pf_normalize_init(void);
-intpf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,
-   struct pf_pdesc *);
-intpf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *,
-   struct pf_pdesc *);
+intpf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *);
+intpf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *);
 intpf_normalize_tcp(int, struct pfi_kif *, struct mbuf *, int, int, void *,
struct pf_pdesc *);
 void   pf_normalize_tcp_cleanup(struct pf_state *);



Make rd(4) a 'real' device

2011-06-19 Thread Matthew Dempsky
The diff below makes rd(4) into a real device; i.e., it attaches to
the device tree like any other device, rather than attaching as a
pseudo-device.  This avoids the trickery that rdattach() (in
dev/ramdisk.c) currently has to do to initialize and fake up its
struct device.

This also removes a lot of useless features from ramdisk.c (e.g.,
RD_KMEM_ALLOCATED and RD_UMEM_SERVER), and generally behaves better as
a disk driver (e.g., multiple partitions should work now, should
someone want to try that for something).

The new driver is almost entirely disk driver boiler plate code from
other drivers (mostly sd.c).  I'm not sure what to do (if anything)
with the copyright; the only original rd.c/ramdisk.c code left are the
rd_root_size and rd_root_image variables.

Anyway, feedback and testing welcome.  I've tested with amd64's
ramdisk_cd image, and it seems to work fine.


Index: conf/files
===
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/conf/files,v
retrieving revision 1.512
diff -u -p -r1.512 files
--- conf/files  7 Apr 2011 13:42:53 -   1.512
+++ conf/files  9 Jun 2011 23:27:17 -
@@ -488,12 +488,14 @@ file  dev/softraid_raid6.csoftraid
 device spdmem
 file   dev/spdmem.cspdmem
 
+device rd: disk
+attach rd at root
+file   dev/rd.crd needs-flag
+
 # legitimate pseudo-devices
 pseudo-device vnd: disk
 pseudo-device ccd: disk
 pseudo-device raid: disk
-pseudo-device rd: disk
-file   dev/ramdisk.c   rd needs-flag
 
 pseudo-device pty: tty
 pseudo-device nmea: tty
@@ -1015,7 +1017,6 @@ file uvm/uvm_swap_encrypt.c   uvm_swap_en
 file uvm/uvm_unix.c
 file uvm/uvm_user.c
 file uvm/uvm_vnode.c
-file dev/rd.c  ramdisk_hooks
 
 # IPv6
 file net/if_faith.cfaith   needs-count
Index: sys/conf.h
===
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/sys/conf.h,v
retrieving revision 1.110
diff -u -p -r1.110 conf.h
--- sys/conf.h  25 Jan 2011 20:03:35 -  1.110
+++ sys/conf.h  9 Jun 2011 23:20:11 -
@@ -607,6 +607,9 @@ bdev_decl(sw);
 bdev_decl(vnd);
 cdev_decl(vnd);
 
+bdev_decl(rd);
+cdev_decl(rd);
+
 bdev_decl(ccd);
 cdev_decl(ccd);
 
Index: kern/init_main.c
===
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/kern/init_main.c,v
retrieving revision 1.177
diff -u -p -r1.177 init_main.c
--- kern/init_main.c18 Apr 2011 21:44:56 -  1.177
+++ kern/init_main.c19 Jun 2011 06:46:03 -
@@ -100,6 +100,7 @@
 extern void nfs_init(void);
 #endif
 
+#include rd.h
 #include mpath.h
 #include vscsi.h
 #include softraid.h
@@ -457,6 +458,9 @@ main(void *framep)
 
dostartuphooks();
 
+#if NRD  0
+   config_rootfound(rd, NULL);
+#endif
 #if NMPATH  0
config_rootfound(mpath, NULL);
 #endif
Index: dev/rd.c
===
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/rd.c,v
retrieving revision 1.2
diff -u -p -r1.2 rd.c
--- dev/rd.c22 Aug 2008 03:12:37 -  1.2
+++ dev/rd.c20 Jun 2011 02:05:53 -
@@ -29,11 +29,19 @@
 
 #include sys/param.h
 #include sys/systm.h
-#include sys/reboot.h
-
-#include dev/ramdisk.h
-
-extern int boothowto;
+#include sys/proc.h
+#include sys/errno.h
+#include sys/buf.h
+#include sys/malloc.h
+#include sys/ioctl.h
+#include sys/disklabel.h
+#include sys/device.h
+#include sys/disk.h
+#include sys/stat.h
+#include sys/file.h
+#include sys/uio.h
+#include sys/conf.h
+#include sys/dkio.h
 
 #ifndef MINIROOTSIZE
 #define MINIROOTSIZE 512
@@ -48,25 +56,297 @@ extern int boothowto;
 u_int32_t rd_root_size = ROOTBYTES;
 char rd_root_image[ROOTBYTES] = |This is the root ramdisk!\n;
 
-/*
- * This is called during autoconfig.
- */
+intrd_match(struct device *, void *, void *);
+void   rd_attach(struct device *, struct device *, void *);
+
+struct rd_softc {
+   struct device   sc_dev;
+   struct disk sc_dk;
+};
+
+struct cfattach rd_ca = {
+   sizeof(struct rd_softc),
+   rd_match,
+   rd_attach
+};
+
+struct cfdriver rd_cd = {
+   NULL,
+   rd,
+   DV_DISK
+};
+
+#define rdlookup(unit) ((struct rd_softc *)disk_lookup(rd_cd, (unit)))
+
+intrdgetdisklabel(dev_t, struct rd_softc *, struct disklabel *, int);
+
+int
+rd_match(struct device *parent, void *match, void *aux)
+{
+   struct cfdata *cf = match;
+
+   /* There's only one rd_root_image, so only match rd0. */
+   return (cf-cf_unit == 0);
+}
+
 void
-rd_attach_hook(int unit, struct rd_conf *rd)
+rd_attach(struct device *parent, struct device *self, void *aux)
+{
+   struct rd_softc *sc = (struct rd_softc *)self;
+
+   printf(\n);
+
+   /* Attach disk. */
+   sc-sc_dk.dk_name = sc-sc_dev.dv_xname;
+   disk_attach(sc-sc_dev, sc-sc_dk);
+}
+