Re: Giving love to ospf6d

2015-12-20 Thread Denis Fondras
Hello,

Here is the second iteration of the patch. It fixes a crash and it is a
refactoring.

Denis

Index: area.c
===
RCS file: /cvs/src/usr.sbin/ospf6d/area.c,v
retrieving revision 1.4
diff -u -p -r1.4 area.c
--- area.c  28 Dec 2008 20:08:31 -  1.4
+++ area.c  20 Dec 2015 20:38:00 -
@@ -57,7 +57,6 @@ area_del(struct area *area)
/* clean lists */
while ((iface = LIST_FIRST(&area->iface_list)) != NULL) {
LIST_REMOVE(iface, entry);
-   if_del(iface);
}
 
while ((n = LIST_FIRST(&area->nbr_list)) != NULL)
Index: interface.c
===
RCS file: /cvs/src/usr.sbin/ospf6d/interface.c,v
retrieving revision 1.22
diff -u -p -r1.22 interface.c
--- interface.c 27 Sep 2015 17:31:50 -  1.22
+++ interface.c 20 Dec 2015 20:38:00 -
@@ -170,8 +170,7 @@ int
 if_init(void)
 {
TAILQ_INIT(&iflist);
-
-   return (fetchifs(0));
+   return (0);
 }
 
 /* XXX using a linked list should be OK for now */
Index: ospf6d.c
===
RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.c,v
retrieving revision 1.29
diff -u -p -r1.29 ospf6d.c
--- ospf6d.c5 Dec 2015 13:12:41 -   1.29
+++ ospf6d.c20 Dec 2015 20:38:01 -
@@ -597,6 +597,7 @@ ospf_reload(void)
 {
struct area *area;
struct ospfd_conf   *xconf;
+   struct iface*iface;
 
if ((xconf = parse_config(conffile, ospfd_conf->opts)) == NULL)
return (-1);
@@ -605,10 +606,16 @@ ospf_reload(void)
if (ospf_sendboth(IMSG_RECONF_CONF, xconf, sizeof(*xconf)) == -1)
return (-1);
 
-   /* send areas, interfaces happen out of band */
+   /* send areas & interfaces */
LIST_FOREACH(area, &xconf->area_list, entry) {
if (ospf_sendboth(IMSG_RECONF_AREA, area, sizeof(*area)) == -1)
return (-1);
+
+   LIST_FOREACH(iface, &area->iface_list, entry) {
+   if (ospf_sendboth(IMSG_RECONF_IFACE, iface,
+   sizeof(*iface)) == -1)
+   return (-1);
+   }
}
 
if (ospf_sendboth(IMSG_RECONF_END, NULL, 0) == -1)
Index: ospf6d.h
===
RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.h,v
retrieving revision 1.29
diff -u -p -r1.29 ospf6d.h
--- ospf6d.h27 Sep 2015 17:31:50 -  1.29
+++ ospf6d.h20 Dec 2015 20:38:01 -
@@ -121,6 +121,7 @@ enum imsg_type {
IMSG_ABR_DOWN,
IMSG_RECONF_CONF,
IMSG_RECONF_AREA,
+   IMSG_RECONF_IFACE,
IMSG_RECONF_END,
IMSG_DEMOTE
 };
Index: ospfe.c
===
RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.c,v
retrieving revision 1.47
diff -u -p -r1.47 ospfe.c
--- ospfe.c 5 Dec 2015 13:12:41 -   1.47
+++ ospfe.c 20 Dec 2015 20:38:02 -
@@ -250,6 +250,7 @@ ospfe_dispatch_main(int fd, short event,
static struct area  *narea;
struct area *area;
struct iface*iface, *ifp;
+   struct iface*niface;
struct ifaddrchange *ifc;
struct iface_addr   *ia, *nia;
struct imsg  imsg;
@@ -388,6 +389,19 @@ ospfe_dispatch_main(int fd, short event,
RB_INIT(&narea->lsa_tree);
 
LIST_INSERT_HEAD(&nconf->area_list, narea, entry);
+   break;
+   case IMSG_RECONF_IFACE:
+   if ((niface = malloc(sizeof(struct iface))) == NULL)
+   fatal(NULL);
+
+   memcpy(niface, imsg.data, sizeof(struct iface));
+
+   LIST_INIT(&niface->nbr_list);
+   TAILQ_INIT(&niface->ls_ack_list);
+   RB_INIT(&niface->lsa_tree);
+
+   narea = area_find(nconf, niface->area_id);
+   LIST_INSERT_HEAD(&narea->iface_list, niface, entry);
break;
case IMSG_RECONF_END:
if ((oeconf->flags & OSPFD_FLAG_STUB_ROUTER) !=
Index: parse.y
===
RCS file: /cvs/src/usr.sbin/ospf6d/parse.y,v
retrieving revision 1.27
diff -u -p -r1.27 parse.y
--- parse.y 20 Nov 2014 05:51:20 -  1.27
+++ parse.y 20 Dec 2015 20:38:02 -
@@ -924,6 +924,7 @@ parse_config(char *filename, int opts)
LIST_INIT(&conf->area_list);
LIST_INIT(&conf->cand_list);
SIMPLEQ_INIT(&conf->redist_list);
+   fetchifs(0);
 
yyparse();
errors = file->errors;
Index: rde.c
===
RCS fi

Re: initial 11n support for iwn (n, not m)

2015-12-20 Thread Frank Groeneveld

On 12/19/15 13:08, Stefan Sperling wrote:

On Fri, Dec 18, 2015 at 05:40:39PM -0500, David Hill wrote:
Here's an updated iwn diff with a better approach for Stuart's fix.

Thanks for helping, Stuart, and to everyone who sent beacons which
allowed us to narrow this problem down to protection settings being
set up the wrong way in iwn_run().


Assuming this fix was in yesterdays snapshot, it fixes my previously 
reported association problems. Thank you!


Frank



Re: initial 11n support for iwn (n, not m)

2015-12-20 Thread Stefan Sperling
On Sat, Dec 19, 2015 at 01:08:26PM +0100, Stefan Sperling wrote:
> On Fri, Dec 18, 2015 at 05:40:39PM -0500, David Hill wrote:
> > With sthen@'s patch I can associate, dhcp, and use net.
> 
> Here's an updated iwn diff with a better approach for Stuart's fix.
> 
> Thanks for helping, Stuart, and to everyone who sent beacons which
> allowed us to narrow this problem down to protection settings being
> set up the wrong way in iwn_run().

And another update (hopefully) fixing some reported issues, with some
uncommitted net80211 changes included.

I haven't put these diffs in yet because I'm still hearing about regressions
in some form or another. Sometimes it's unclear what people are running,
so I hope this version will linger for a bit and get tested.
Thanks for all the help so far from more people than I expected!

Index: dev/pci/if_iwn.c
===
RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
retrieving revision 1.148
diff -u -p -r1.148 if_iwn.c
--- dev/pci/if_iwn.c25 Nov 2015 03:09:59 -  1.148
+++ dev/pci/if_iwn.c20 Dec 2015 11:18:52 -
@@ -148,7 +148,7 @@ int iwn_newstate(struct ieee80211com *,
 void   iwn_iter_func(void *, struct ieee80211_node *);
 void   iwn_calib_timeout(void *);
 intiwn_ccmp_decap(struct iwn_softc *, struct mbuf *,
-   struct ieee80211_key *);
+   struct ieee80211_node *);
 void   iwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
 void   iwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
@@ -189,7 +189,7 @@ int iwn5000_add_node(struct iwn_softc *
int);
 intiwn_set_link_quality(struct iwn_softc *,
struct ieee80211_node *);
-intiwn_add_broadcast_node(struct iwn_softc *, int);
+intiwn_add_broadcast_node(struct iwn_softc *, int, int);
 void   iwn_updateedca(struct ieee80211com *);
 void   iwn_set_led(struct iwn_softc *, uint8_t, uint8_t, uint8_t);
 intiwn_set_critical_temp(struct iwn_softc *);
@@ -280,7 +280,7 @@ voidiwn_stop(struct ifnet *, int);
 #ifdef IWN_DEBUG
 #define DPRINTF(x) do { if (iwn_debug > 0) printf x; } while (0)
 #define DPRINTFN(n, x) do { if (iwn_debug >= (n)) printf x; } while (0)
-int iwn_debug = 0;
+int iwn_debug = 1;
 #else
 #define DPRINTF(x)
 #define DPRINTFN(n, x)
@@ -458,6 +458,15 @@ iwn_attach(struct device *parent, struct
IEEE80211_C_PMGT;   /* power saving supported */
 
 #ifndef IEEE80211_NO_HT
+   /* No optional HT features supported for now, */
+   ic->ic_htcaps = 0;
+   ic->ic_htxcaps = 0;
+   ic->ic_txbfcaps = 0;
+   ic->ic_aselcaps = 0;
+#endif
+
+#ifdef notyet
+#ifndef IEEE80211_NO_HT
if (sc->sc_flags & IWN_FLAG_HAS_11N) {
/* Set HT capabilities. */
ic->ic_htcaps =
@@ -475,6 +484,7 @@ iwn_attach(struct device *parent, struct
ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DIS;
}
 #endif /* !IEEE80211_NO_HT */
+#endif /* notyet */
 
/* Set supported legacy rates. */
ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_std_rateset_11b;
@@ -487,10 +497,12 @@ iwn_attach(struct device *parent, struct
if (sc->sc_flags & IWN_FLAG_HAS_11N) {
/* Set supported HT rates. */
ic->ic_sup_mcs[0] = 0xff;   /* MCS 0-7 */
+#ifdef notyet
if (sc->nrxchains > 1)
-   ic->ic_sup_mcs[1] = 0xff;   /* MCS 7-15 */
+   ic->ic_sup_mcs[1] = 0xff;   /* MCS 8-15 */
if (sc->nrxchains > 2)
ic->ic_sup_mcs[2] = 0xff;   /* MCS 16-23 */
+#endif
}
 #endif
 
@@ -515,9 +527,11 @@ iwn_attach(struct device *parent, struct
 #ifndef IEEE80211_NO_HT
ic->ic_ampdu_rx_start = iwn_ampdu_rx_start;
ic->ic_ampdu_rx_stop = iwn_ampdu_rx_stop;
+#ifdef notyet
ic->ic_ampdu_tx_start = iwn_ampdu_tx_start;
ic->ic_ampdu_tx_stop = iwn_ampdu_tx_stop;
 #endif
+#endif
 
/* Override 802.11 state transition machine. */
sc->sc_newstate = ic->ic_newstate;
@@ -1635,6 +1649,11 @@ iwn_read_eeprom_channels(struct iwn_soft
/* Save maximum allowed TX power for this channel. */
sc->maxpwr[chan] = channels[i].maxpwr;
 
+#ifndef IEEE80211_NO_HT
+   if (sc->sc_flags & IWN_FLAG_HAS_11N)
+   ic->ic_channels[chan].ic_flags |= IEEE80211_CHAN_HT;
+#endif
+
DPRINTF(("adding chan %d flags=0x%x maxpwr=%d\n",
chan, channels[i].flags, sc->maxpwr[chan]));
}
@@ -1693,13 +1712,18 @@ iwn_newassoc(struct ieee80211com *ic, st
ieee80211_amrr_node_init(&sc->amrr, &wn->amn);
/* Start at lowest available bit-rate, AMRR will raise. */
ni->ni_txrate = 0;
+#ifndef 

Re: Thinkpad display brightness control

2015-12-20 Thread Marcus MERIGHI
I am somewhat confused; there were two recent changes that might cause
the improvement:

- tedu@ 2015-12-16 acpi/dsdt.c
- kettenis@ 2015-12-17 acpi/acpithinkpad.c

since tedu@s commit was inspired by kettenis@ I reply to this thread.

mark.kette...@xs4all.nl (Mark Kettenis), 2015.12.16 (Wed) 19:48 (CET):
> Most, if not all, somewhat recent Thinkpads have some subtle issues
> with display brightness control.  For example,if you change the
> display brightness using wsconsctl(8) or cbacklight(1), and later use
> the brightness control buttons on the keyboard, you're likely to see a
> big jump in brightness.  or if you plug or unplug the power, the
> display brightness will suddenly change.  The problem here is that on

hw.version=ThinkPad X200s

plug/unplug brightness jumps are gone, thank you!

But:
- I cannot reach 100% with Fn+PgUp. 
- Fn+PgUp/PgDown does not care about what I've set via software
  (wsconsctl display.brightness=XYZ). It always changes based on the
  value set by the last Fn+PgUp/PgDown, regardless of display.brightness
  settings.

Thanks, Marcus

OpenBSD 5.8-current (GENERIC.MP) #1757: Sat Dec 19 08:17:18 MST 2015
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4166717440 (3973MB)
avail mem = 4036304896 (3849MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0010 (68 entries)
bios0: vendor LENOVO version "6DET72WW (3.22 )" date 10/25/2012
bios0: LENOVO 7470W1W
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET SLIC BOOT ASF! SSDT TCPA DMAR 
SSDT SSDT SSDT
acpi0: wakeup devices LID_(S3) SLPB(S3) IGBE(S4) EXP0(S4) EXP1(S4) EXP2(S4) 
EXP3(S4) USB0(S3) USB3(S3) USB5(S3) EHC0(S3) EHC1(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)2 Duo CPU L9400 @ 1.86GHz, 1862.25 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,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE,NXE,LONG,LAHF,PERF,SENSOR
cpu0: 6MB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 7 var ranges, 88 fixed ranges
cpu0: apic clock running at 265MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2.1.3, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU L9400 @ 1.86GHz, 1862.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,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE,NXE,LONG,LAHF,PERF,SENSOR
cpu1: 6MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 2, remapped to apid 1
acpimcfg0 at acpi0 addr 0xe000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (AGP_)
acpiprt2 at acpi0: bus 2 (EXP0)
acpiprt3 at acpi0: bus 3 (EXP1)
acpiprt4 at acpi0: bus -1 (EXP2)
acpiprt5 at acpi0: bus 5 (EXP3)
acpicpu0 at acpi0: !C3(100@57 mwait.3@0x30), !C2(500@1 mwait.1@0x10), C1(1000@1 
mwait.1), PSS
acpicpu1 at acpi0: !C3(100@57 mwait.3@0x30), !C2(500@1 mwait.1@0x10), C1(1000@1 
mwait.1), PSS
acpipwrres0 at acpi0: PUBS, resource for USB0, USB3, USB5, EHC0, EHC1
acpitz0 at acpi0: critical temperature is 127 degC
acpitz1 at acpi0: critical temperature is 104 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "93P5030" serial   165 type LION oem "SANYO"
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
acpidock0 at acpi0: GDCK not docked (0)
cpu0: Enhanced SpeedStep 1862 MHz: speeds: 1867, 1866, 1600, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel GM45 Host" rev 0x07
inteldrm0 at pci0 dev 2 function 0 "Intel GM45 Video" rev 0x07
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0xd000, size 0x1000
inteldrm0: msi
inteldrm0: 1280x800
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel GM45 Video" rev 0x07 at pci0 dev 2 function 1 not configured
"Intel GM45 HECI" rev 0x07 at pci0 dev 3 function 0 not configured
em0 at pci0 dev 25 function 0 "Intel ICH9 IGP M AMT" rev 0x03: msi, address 
00:1f:16:32:df:5c
uhci0 at pci0 dev 26 function 0 "Intel 82801I USB" rev 0x03: apic 1 int 20
uhci1 at pci0 dev 26 function 1 "Intel 82801I USB" rev 0x03: apic 1 int 21
uhci2 at pci0 dev 26 function 2 "Intel 82801I USB" rev 0x03: apic 1 int 22
ehci0 at pci0 dev 26 function 7 "Intel 82801I USB" rev 0x03: apic 1 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 82801I HD Audio" rev 0x03

Add --brief and --dereference to file(1)

2015-12-20 Thread Ralf Horstmann
Hi,

xdg-open uses "xdg-mime query filetype" to find out the mime type of a given
file. Depending on the desktop environment, xdg-mime uses different backends.
In my case (i3 wm) it falls back to the generic code path, which uses

file --brief --dereference --mime-type

Since --brief and --dereference are not recognized, xdg-mime returns an empty
mime type and causes xdg-open to open the given file with a browser instead of
using the preferred application.

The following patch adds --brief and --dereference to file(1) to address this.

Regards,
Ralf

Index: usr.bin/file/file.1
===
RCS file: /usr/cvs/openbsd/src/usr.bin/file/file.1,v
retrieving revision 1.43
diff -u -u -r1.43 file.1
--- usr.bin/file/file.1 30 Jul 2015 11:13:24 -  1.43
+++ usr.bin/file/file.1 20 Dec 2015 11:13:37 -
@@ -83,7 +83,7 @@
 .Pp
 The options are as follows:
 .Bl -tag -width indent
-.It Fl b
+.It Fl b , -brief
 Does not prepend filenames to output lines.
 .It Fl c
 Prints a summary of the parsed magic file; usually used for debugging.
@@ -97,7 +97,7 @@
 .Dq text/plain
 rather than
 .Dq ASCII text .
-.It Fl L
+.It Fl L , -dereference
 Causes symlinks to be followed.
 .It Fl s
 Attempts to read block and character device files, not just regular files.
Index: usr.bin/file/file.c
===
RCS file: /usr/cvs/openbsd/src/usr.bin/file/file.c,v
retrieving revision 1.56
diff -u -u -r1.56 file.c
--- usr.bin/file/file.c 5 Dec 2015 13:18:09 -   1.56
+++ usr.bin/file/file.c 20 Dec 2015 10:50:21 -
@@ -102,9 +102,11 @@
 static FILE*magicfp;
 
 static struct option longopts[] = {
-   { "mime",  no_argument, NULL, 'i' },
-   { "mime-type", no_argument, NULL, 'i' },
-   { NULL,0,   NULL, 0   }
+   { "brief",   no_argument, NULL, 'b' },
+   { "dereference", no_argument, NULL, 'L' },
+   { "mime",no_argument, NULL, 'i' },
+   { "mime-type",   no_argument, NULL, 'i' },
+   { NULL,  0,   NULL, 0   }
 };
 
 __dead void



Re: Mesa has broken r300/r600 (gallium) dri DSO

2015-12-20 Thread Martin Pieuchot
On 20/12/15(Sun) 14:06, Jonathan Gray wrote:
> On Sat, Dec 19, 2015 at 04:36:53PM +0100, Martin Pieuchot wrote:
> > On 20/12/15(Sun) 00:05, Jonathan Gray wrote:
> > > On Sat, Dec 19, 2015 at 01:06:28PM +0100, Martin Pieuchot wrote:
> > > > When I start glxgears(1) (on macppc) I see:
> > > > 
> > > >   glxgears:/usr/X11R6/lib/modules/dri/r300_dri.so: undefined symbol 
> > > > 'drisw_create_screen'
> > > >   libGL error: unable to load driver: r300_dri.so
> > > >   libGL error: driver pointer missing
> > > >   libGL error: failed to load driver: r300
> > > > 
> > > > 
> > > > I don't have a Radeon card on !macppc machine but on my amd64 I also
> > > > see:
> > > > 
> > > >   $ nm /usr/X11R6/lib/modules/dri/r300_dri.so |grep drisw_create_screen
> > > >  U drisw_create_screen
> > > > 
> > > > Sin the r300 and the r600 dri DSO are the same, I wonder if anybody is
> > > > able to load them?
> > > > 
> > > >   $ ls -li r[36]00_dri.so
> > > >   26355 -rw-r--r--  2 root  wheel  18913848 Dec 12 06:14 r300_dri.so
> > > >   26355 -rw-r--r--  2 root  wheel  18913848 Dec 12 06:14 r600_dri.so
> > > > 
> > > > Diff below works for me.  It clearly seems to be a workaround.
> > > 
> > > I wonder if this is another powerpc binutils bug.
> > 
> > Are you saying that it works for you on amd64/i386?  Which shared object
> > provides the 'drisw_create_screen' symbol then because I cannot find it 
> > on my amd64 system under /usr/X11R6:
> > 
> > $ find . -name "*.so*" |xargs nm |grep drisw_create_screen
> > U drisw_create_screen
> > U drisw_create_screen
> > 
> 
> I can't easily test r300/r600 at the moment but the update was tested
> by at least r600 users on amd64.  I tested at least one of the 11.0
> releases on r300/r600 with amd64 at some point but I don't recall if that
> was with autoconf build or an update to the custom makefiles that
> wasn't committed.
> 
> The code in question seems to have been removed sometime after Mesa 11.0
> was branched.  So how about we build softpipe everywhere for now
> (not just dri archs as your diff had) and revisit this later if needed.

Works for me, ok mpi@

> Building this way means the gallium software rasteriser will be used
> instead of the dri one even though both are built.
> 
> The intel dri drivers use floating point textures regardless of configure
> options but others don't.  I think we should enable that everywhere
> as well.  It may make Mesa advertise OpenGL 3.x for r600 instead of 2.1.

I don't have r600 to test but it makes sense.

> Index: Makefile.bsd-wrapper
> ===
> RCS file: /cvs/xenocara/lib/mesa/Makefile.bsd-wrapper,v
> retrieving revision 1.2
> diff -u -p -r1.2 Makefile.bsd-wrapper
> --- Makefile.bsd-wrapper  26 Nov 2015 19:05:49 -  1.2
> +++ Makefile.bsd-wrapper  20 Dec 2015 02:48:55 -
> @@ -6,16 +6,16 @@ SHARED_LIBS=EGL 1.0 gbm 0.0 glapi 0.1 G
>   OSMesa 9.0
>  
>  DRI_DRIVERS= swrast
> -GALLIUM_DRIVERS=
> +GALLIUM_DRIVERS= swrast
>  
>  .if ${MACHINE} == i386 || ${MACHINE} == amd64
>  DRI_DRIVERS=swrast,radeon,r200,i915,i965
> -GALLIUM_DRIVERS=r300,r600
> +GALLIUM_DRIVERS=swrast,r300,r600
>  .endif
>  
>  .if ${MACHINE} == macppc || ${MACHINE} == sparc64
>  DRI_DRIVERS=swrast,radeon,r200
> -GALLIUM_DRIVERS=r300,r600
> +GALLIUM_DRIVERS=swrast,r300,r600
>  .endif
>  
>  CONFIGURE_ARGS=  --with-dri-drivers=${DRI_DRIVERS} \
> @@ -27,6 +27,7 @@ CONFIGURE_ARGS= --with-dri-drivers=${DR
>   --enable-shared-glapi \
>   --enable-osmesa \
>   --enable-gbm \
> + --enable-texture-float \
>   --with-egl-platforms="x11,drm" \
>   --prefix=${X11BASE} \
>   --with-dri-driverdir=${X11BASE}/lib/modules/dri \
> 



Update V4L2 API (sys/videoio.h)

2015-12-20 Thread Ingo Feinerer
Hi,

I would like to update our V4L2 (Video for Linux Two) API.

The plan is to sync sys/videoio.h with a recent version of
linux/videodev2.h (which has a BSD license statement in it) from the
Linux kernel sources. However, videodev2.h now includes two additional
headers:

1) linux/v4l2-common.h: GPL2 licensed
2) linux/v4l2-controls.h: has the same BSD license statement as
   videodev2.h as it was split off from it.

The proposed diff completely ignores v4l2-common.h. That should work out
as it is not designed to be included directly, contains only new
#defines and structs (compared to what we have now in videoio.h), and is
very short. As a consequence I had to comment out two lines in videoio.h
which are not present in our current version anyway.

As there is now just v4l2-controls.h left I propose to merge this file
directly back into videoio.h. The alternative would be to have it as a
separate file sys/v4l2-controls.h. In Linux it is not designed to be
included on its own (but just by videodev2.h).

This proposal is a revised version of
https://marc.info/?l=openbsd-cvs&m=145019666410552&w=2 (which was
reverted because of GPL2 considerations) which worked out in a ports
bulk build by ajacoutot@. I am pretty confident that skipping
v4l2-common.h does not hurt us, so no new bulk build should be strictly
necessary.

The original version had two OKs but I would like to restart the process
because of the restructuring. So I am looking for feedback and OKs.

(After that I'd like to address whitespace and formatting in videoio.h
to ease further syncs. Moreover, the man page video.4 will be updated as
well.)

Best regards,
Ingo

Index: videoio.h
===
RCS file: /cvs/src/sys/sys/videoio.h,v
retrieving revision 1.11
diff -u -p -r1.11 videoio.h
--- videoio.h   15 Dec 2015 17:01:44 -  1.11
+++ videoio.h   20 Dec 2015 08:20:01 -
@@ -2,7 +2,7 @@
 /*
  *  Video for Linux Two header file
  *
- *  Copyright (C) 1999-2007 the contributors
+ *  Copyright (C) 1999-2012 the contributors
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -59,6 +59,926 @@
 #define _SYS_VIDEOIO_H_
 #include 
 #include 
+/* Ignore #include  as it is GPL2.
+ * Inline #include 
+ * (v4l2-controls.h was split off from videodev2.h and has the same BSD 
license.)
+ *
+ * Begin of v4l2-controls.h
+ */
+/* Control classes */
+#define V4L2_CTRL_CLASS_USER   0x0098  /* Old-style 'user' 
controls */
+#define V4L2_CTRL_CLASS_MPEG   0x0099  /* MPEG-compression 
controls */
+#define V4L2_CTRL_CLASS_CAMERA 0x009a  /* Camera class 
controls */
+#define V4L2_CTRL_CLASS_FM_TX  0x009b  /* FM Modulator 
controls */
+#define V4L2_CTRL_CLASS_FLASH  0x009c  /* Camera flash 
controls */
+#define V4L2_CTRL_CLASS_JPEG   0x009d  /* JPEG-compression 
controls */
+#define V4L2_CTRL_CLASS_IMAGE_SOURCE   0x009e  /* Image source 
controls */
+#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f  /* Image processing 
controls */
+#define V4L2_CTRL_CLASS_DV 0x00a0  /* Digital Video 
controls */
+#define V4L2_CTRL_CLASS_FM_RX  0x00a1  /* FM Receiver controls 
*/
+#define V4L2_CTRL_CLASS_RF_TUNER   0x00a2  /* RF tuner controls */
+#define V4L2_CTRL_CLASS_DETECT 0x00a3  /* Detection controls */
+
+/* User-class control IDs */
+
+#define V4L2_CID_BASE  (V4L2_CTRL_CLASS_USER | 0x900)
+#define V4L2_CID_USER_BASE V4L2_CID_BASE
+#define V4L2_CID_USER_CLASS(V4L2_CTRL_CLASS_USER | 1)
+#define V4L2_CID_BRIGHTNESS(V4L2_CID_BASE+0)
+#define V4L2_CID_CONTRAST  (V4L2_CID_BASE+1)
+#define V4L2_CID_SATURATION(V4L2_CID_BASE+2)
+#define V4L2_CID_HUE   (V4L2_CID_BASE+3)
+#define V4L2_CID_AUDIO_VOLUME  (V4L2_CID_BASE+5)
+#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
+#define V4L2_CID_AUDIO_BASS(V4L2_CID_BASE+7)
+#define V4L2_CID_AUDIO_TREBLE  (V4L2_CID_BASE+8)
+#define V4L2_CID_AUDIO_MUTE(V4L2_CID_BASE+9)
+#define V4L2_CID_AUDIO_LOUDNESS(V4L2_CID_BASE+10)
+#define V4L2_CID_BLACK_LEVEL   (V4L2_CID_BASE+11) /* Deprecated */
+#define V4L2_CID_AUTO_WHITE_BALANCE(V4L2_CID_BASE+12)
+#define V4L2_CID_DO_WHITE_BALANCE  (V4L2_CID_BASE+13)
+#define V4L2_CID_RED_BALANCE   (V4L2_CID_BASE+14)
+#define V4L2_CID_BLUE_BALANCE  (V4L2_CID_BASE+15)
+#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
+#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
+#define V4L2_CID_EXPOSURE  (V4L2_CID_BASE+17)
+#define V4L2_CID_AUTOGAIN  (V4L2_CID_BASE+18)
+#define V4L2_CID_GAIN  (V4L2_CID_BASE+19)
+#define V4L2_CID_HFLIP  

Re: ipmi(4) - Support ipmitool IOCTL etc.

2015-12-20 Thread Masao Uebayashi
Update: merged 3 changes from Jonathan Matthew.  Other things remain.  See
[1] for details.

- Don't check threashold in this driver; fix false positive warnings.
- Handle disabled sensors, but allow them to supply readings if they want.
- Make command taskq MP-safe.

Masao

[1] https://github.com/uebayasi/openbsd-ipmi

Index: sys/arch/amd64/amd64/conf.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/conf.c,v
retrieving revision 1.52
diff -u -p -r1.52 conf.c
--- sys/arch/amd64/amd64/conf.c 13 Nov 2015 07:52:20 -  1.52
+++ sys/arch/amd64/amd64/conf.c 18 Dec 2015 12:07:54 -
@@ -182,6 +182,7 @@ cdev_decl(pci);
 #include "vscsi.h"
 #include "pppx.h"
 #include "fuse.h"
+#include "ipmi.h"
 
 struct cdevsw  cdevsw[] =
 {
@@ -291,6 +292,7 @@ struct cdevsw   cdevsw[] =
cdev_pppx_init(NPPPX,pppx), /* 91: pppx */
cdev_fuse_init(NFUSE,fuse), /* 92: fuse */
cdev_tun_init(NTUN,tap),/* 93: Ethernet network tunnel */
+   cdev_ipmi_init(NIPMI,ipmi), /* 94: ipmi */
 };
 intnchrdev = nitems(cdevsw);
 
Index: sys/dev/ipmi.c
===
RCS file: /cvs/src/sys/dev/ipmi.c,v
retrieving revision 1.77
diff -u -p -r1.77 ipmi.c
--- sys/dev/ipmi.c  8 Sep 2015 11:58:58 -   1.77
+++ sys/dev/ipmi.c  18 Dec 2015 12:07:54 -
@@ -31,20 +31,21 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
 #include 
+#include 
 
 struct ipmi_sensor {
u_int8_t*i_sdr;
@@ -55,8 +56,12 @@ struct ipmi_sensor {
SLIST_ENTRY(ipmi_sensor) list;
 };
 
-intipmi_nintr;
-intipmi_poll = 1;
+struct ipmi_stats {
+   int ncmds;
+   int ntickles;
+   int nioctls;
+} ipmi_stats;
+
 intipmi_enabled = 0;
 
 #define SENSOR_REFRESH_RATE (5 * hz)
@@ -112,6 +117,7 @@ int ipmi_enabled = 0;
 #define IPMI_ENTITY_PWRSUPPLY  0x0A
 
 #define IPMI_INVALID_SENSOR(1L << 5)
+#define IPMI_DISABLED_SENSOR   (1L << 6)
 
 #define IPMI_SDR_TYPEFULL  1
 #define IPMI_SDR_TYPECOMPACT   2
@@ -139,8 +145,6 @@ SLIST_HEAD(ipmi_sensors_head, ipmi_senso
 struct ipmi_sensors_head ipmi_sensor_list =
 SLIST_HEAD_INITIALIZER(ipmi_sensor_list);
 
-struct timeout ipmi_timeout;
-
 void   dumpb(const char *, int, const u_int8_t *);
 
 intread_sensor(struct ipmi_softc *, struct ipmi_sensor *);
@@ -149,16 +153,25 @@ int   get_sdr_partial(struct ipmi_softc *,
u_int8_t, u_int8_t, void *, u_int16_t *);
 intget_sdr(struct ipmi_softc *, u_int16_t, u_int16_t *);
 
-intipmi_sendcmd(struct ipmi_softc *, int, int, int, int, int, const void*);
-intipmi_recvcmd(struct ipmi_softc *, int, int *, void *);
-void   ipmi_delay(struct ipmi_softc *, int);
+intipmi_sendcmd(struct ipmi_cmd *);
+intipmi_recvcmd(struct ipmi_cmd *);
+void   ipmi_cmd(struct ipmi_cmd *);
+void   ipmi_cmd_poll(struct ipmi_cmd *);
+void   ipmi_cmd_wait(struct ipmi_cmd *);
+void   ipmi_cmd_wait_cb(void *);
 
 intipmi_watchdog(void *, int);
+void   ipmi_watchdog_tickle(void *);
+void   ipmi_watchdog_set(void *);
 
-intipmi_intr(void *);
 intipmi_match(struct device *, void *, void *);
 void   ipmi_attach(struct device *, struct device *, void *);
 intipmi_activate(struct device *, int);
+struct ipmi_softc *ipmilookup(dev_t dev);
+
+intipmiopen(dev_t, int, int, struct proc *);
+intipmiclose(dev_t, int, int, struct proc *);
+intipmiioctl(dev_t, u_long, caddr_t, int, struct proc *);
 
 long   ipow(long, int);
 long   ipmi_convert(u_int8_t, struct sdrtype1 *, long);
@@ -167,13 +180,10 @@ void  ipmi_sensor_name(char *, int, u_int
 /* BMC Helper Functions */
 u_int8_t bmc_read(struct ipmi_softc *, int);
 void   bmc_write(struct ipmi_softc *, int, u_int8_t);
-intbmc_io_wait(struct ipmi_softc *, int, u_int8_t, u_int8_t, const char *);
-intbmc_io_wait_cold(struct ipmi_softc *, int, u_int8_t, u_int8_t,
-const char *);
-void   _bmc_io_wait(void *);
+intbmc_io_wait(struct ipmi_softc *);
 
-void   *bt_buildmsg(struct ipmi_softc *, int, int, int, const void *, int *);
-void   *cmn_buildmsg(struct ipmi_softc *, int, int, int, const void *, int *);
+void   bt_buildmsg(struct ipmi_cmd *);
+void   cmn_buildmsg(struct ipmi_cmd *);
 
 intgetbits(u_int8_t *, int, int);
 intipmi_sensor_type(int, int, int);
@@ -185,7 +195,6 @@ voidipmi_unmap_regs(struct ipmi_softc *
 
 void   *scan_sig(long, long, int, int, const void *);
 
-intipmi_test_threshold(u_int8_t, u_int8_t, u_int8_t, u_int8_t, int);
 intipmi_sensor_status(struct ipmi_softc *, struct ipmi_sensor *,
 u_int8_t *);
 
@@ -200,6 +209,8 @@ struct ipmi_if kcs_if = {
kcs_recvmsg,
kcs_reset,
kcs_probe,
+   IPMI_MSG_DATASND,
+   IPMI_MSG_DATARCV,
 };
 
 struct ipmi_i