[PATCH] loongson.html

2016-01-27 Thread Frederic Cambus
Hi tech@,

All links are currently dead on this page. This diff fixes them all.

PMON pages aren't hosted on their own server anymore but only on Opsycon
site now.

Lemote recently updated their site, there is no English version anymore
but thankfully they kept the old one on a subdomain. 

Link to the Gdium Liberty doesn't exist anywhere anymore, the Internet
Archive has a copy though.

Index: loongson.html
===
RCS file: /cvs/www/loongson.html,v
retrieving revision 1.50
diff -u -p -u -p -r1.50 loongson.html
--- loongson.html   23 Dec 2015 20:07:18 -  1.50
+++ loongson.html   27 Jan 2016 22:13:57 -
@@ -25,7 +25,7 @@ align="right">
 OpenBSD/loongson is a port intended to run on systems based upon the
 Loongson (also known as Godson) 2E and 2F MIPS-compatible processors,
 using the
-http://www.pmon2000.com/;>PMON firmware and boot loader.
+http://www.opsycon.se/PMON2000/Main;>PMON firmware and boot 
loader.
 
 Table of contents
 
@@ -72,21 +72,21 @@ Specific hardware support is then writte
 
 At the moment, the following machines are supported:
 
-http://www.lemote.com/en/products/mini-computer/2010/0310/111.html;>Lemote
 Fuloong 2F
+http://zkml.lemote.com/en/products/mini-computer/2010/0310/111.html;>Lemote
 Fuloong 2F
 mini-PC
 
 All on-board devices are supported, but the framebuffer is currently limited
 to the 640x400x8 video mode set up by the firmware.
-http://www.lemote.com/en/products/all-in-one/2010/0311/122.html;>Lemote 
Lynloong all-in-one-PC
+http://zkml.lemote.com/en/products/all-in-one/2010/0311/122.html;>Lemote 
Lynloong all-in-one-PC
 
 All on-board devices are supported, but the framebuffer is currently limited
 to the 1360x768x16 video mode set up by the firmware.
-http://www.lemote.com/en/products/Notebook/2010/0310/112.html;>Lemote 
Yeeloong
+http://zkml.lemote.com/en/products/Notebook/2010/0310/112.html;>Lemote 
Yeeloong
 netbook
 
 Both the 8.9" and 10.1" models are supported.
 All on-board devices are supported.
-http://www.gdium.com/en/product/liberty1000;>EMTEC Gdium Liberty 
1000 netbook
+https://web.archive.org/web/20130401064451/http://www.gdium.com/en/product/liberty1000;>EMTEC
 Gdium Liberty 1000 netbook
 
 All on-board devices but the audio controller are supported.
 



Headers cleanup + use getprogname() for test(1)

2016-05-14 Thread Frederic Cambus
Hi tech@,

Headers cleanup + use getprogname() for test(1)

Index: bin/test/test.c
===
RCS file: /cvs/src/bin/test/test.c,v
retrieving revision 1.16
diff -u -p -r1.16 test.c
--- bin/test/test.c 13 Jan 2016 13:13:04 -  1.16
+++ bin/test/test.c 14 May 2016 09:06:33 -
@@ -11,7 +11,7 @@
  * This program is in the Public Domain.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -155,13 +155,12 @@ static void syntax(const char *op, char 
 int
 main(int argc, char *argv[])
 {
-   extern char *__progname;
int res;
 
if (pledge("stdio rpath", NULL) == -1)
err(2, "pledge");
 
-   if (strcmp(__progname, "[") == 0) {
+   if (strcmp(getprogname(), "[") == 0) {
if (strcmp(argv[--argc], "]"))
errx(2, "missing ]");
argv[argc] = NULL;



Use proper bool types in /usr/games

2016-05-14 Thread Frederic Cambus
Hi tech@,

Proper bool types for fortune(6) and monop(6).

Index: games/fortune/fortune/fortune.c
===
RCS file: /cvs/src/games/fortune/fortune/fortune.c,v
retrieving revision 1.55
diff -u -p -r1.55 fortune.c
--- games/fortune/fortune/fortune.c 7 Mar 2016 22:49:45 -   1.55
+++ games/fortune/fortune/fortune.c 14 May 2016 10:19:21 -
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -49,8 +50,6 @@
 
 #include "pathnames.h"
 #include "strfile.h"
-
-#defineboolshort
 
 #defineMINW6   /* minimum wait if desired */
 #defineCPERS   20  /* # of chars for each sec */
Index: games/monop/deck.h
===
RCS file: /cvs/src/games/monop/deck.h,v
retrieving revision 1.6
diff -u -p -r1.6 deck.h
--- games/monop/deck.h  8 Jan 2016 18:19:47 -   1.6
+++ games/monop/deck.h  14 May 2016 10:19:21 -
@@ -32,7 +32,7 @@
  * @(#)deck.h  8.1 (Berkeley) 5/31/93
  */
 
-#defineboolint8_t
+#include 
 
 #defineCC_Ddeck[0]
 #defineCH_Ddeck[1]
Index: games/monop/initdeck.c
===
RCS file: /cvs/src/games/monop/initdeck.c,v
retrieving revision 1.17
diff -u -p -r1.17 initdeck.c
--- games/monop/initdeck.c  8 Jan 2016 18:20:33 -   1.17
+++ games/monop/initdeck.c  14 May 2016 10:19:21 -
@@ -51,8 +51,6 @@
 #defineTRUE1
 #defineFALSE   0
 
-#defineboolint8_t
-
 char   *infile = "cards.inp",  /* input file   */
*outfile= "cards.pck";  /* "packed" file*/
 
Index: games/monop/monop.h
===
RCS file: /cvs/src/games/monop/monop.h,v
retrieving revision 1.8
diff -u -p -r1.8 monop.h
--- games/monop/monop.h 8 Jan 2016 18:19:47 -   1.8
+++ games/monop/monop.h 14 May 2016 10:19:21 -
@@ -37,7 +37,6 @@
 #else
 #defineshrtchar
 #endif
-#defineboolint8_t
 
 #defineTRUE(1)
 #defineFALSE   (0)



Some cleanups and tweaks for wc.1

2016-05-08 Thread Frederic Cambus
Hi tech@,

Some cleanups and tweaks for wc.1:

- Removed unnecessary string.h include
- Changed 'format_and_print' argument type to int64_t and casting
  inside the function
- Declaring 'print_counts', 'format_and_print', and 'cnt' as static
- Remove unnecessary cast for NULL, and (void) casts from printfs,
  'mbtowc' and 'format_and_print' calls
- In 'cnt', change bufsz type from ssize_t to size_t to avoid
  converting between pointers to integer types with different sign
  when calling getline (catched when compiling with Clang)
- Use return instead of exit in main

Index: wc.c
===
RCS file: /cvs/src/usr.bin/wc/wc.c,v
retrieving revision 1.20
diff -u -p -u -p -r1.20 wc.c
--- wc.c8 Dec 2015 01:00:45 -   1.20
+++ wc.c8 May 2016 21:51:28 -
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,12 +44,12 @@
 
 int64_ttlinect, twordct, tcharct;
 intdoline, doword, dochar, humanchar, multibyte;
-intrval;
+intrval;
 extern char *__progname;
 
-void   print_counts(int64_t, int64_t, int64_t, char *);
-void   format_and_print(long long);
-void   cnt(char *);
+static void print_counts(int64_t, int64_t, int64_t, char *);
+static void format_and_print(int64_t);
+static void cnt(char *);
 
 int
 main(int argc, char *argv[])
@@ -82,10 +81,10 @@ main(int argc, char *argv[])
break;
case '?':
default:
-   (void)fprintf(stderr,
+   fprintf(stderr,
"usage: %s [-c | -m] [-hlw] [file ...]\n",
__progname);
-   exit(1);
+   return 1;
}
argv += optind;
argc -= optind;
@@ -99,7 +98,7 @@ main(int argc, char *argv[])
doline = doword = dochar = 1;
 
if (!*argv) {
-   cnt((char *)NULL);
+   cnt(NULL);
} else {
int dototal = (argc > 1);
 
@@ -111,14 +110,14 @@ main(int argc, char *argv[])
print_counts(tlinect, twordct, tcharct, "total");
}
 
-   exit(rval);
+   return rval;
 }
 
-void
+static void
 cnt(char *file)
 {
static char *buf;
-   static ssize_t bufsz;
+   static size_t bufsz;
 
FILE *stream;
char *C;
@@ -213,7 +212,7 @@ cnt(char *file)
++charct;
len = mbtowc(, C, MB_CUR_MAX);
if (len == -1) {
-   (void)mbtowc(NULL, NULL,
+   mbtowc(NULL, NULL,
MB_CUR_MAX);
len = 1;
wc = L' ';
@@ -263,31 +262,31 @@ cnt(char *file)
}
 }
 
-void 
-format_and_print(long long v)
+static void
+format_and_print(int64_t v)
 {
if (humanchar) {
char result[FMT_SCALED_STRSIZE];
 
-   (void)fmt_scaled(v, result);
-   (void)printf("%7s", result);
+   fmt_scaled((long long)v, result);
+   printf("%7s", result);
} else {
-   (void)printf(" %7lld", v);
+   printf(" %7lld", v);
}
 }
 
-void
+static void
 print_counts(int64_t lines, int64_t words, int64_t chars, char *name)
 {
if (doline)
-   format_and_print((long long)lines);
+   format_and_print(lines);
if (doword)
-   format_and_print((long long)words);
+   format_and_print(words);
if (dochar)
-   format_and_print((long long)chars);
+   format_and_print(chars);
 
if (name)
-   (void)printf(" %s\n", name);
+   printf(" %s\n", name);
else
-   (void)printf("\n");
+   printf("\n");
 }



Enable building wsfontload on Loongson

2017-01-18 Thread Frederic Cambus
Hi tech@,

Here is a diff to enable building wsfontload on Loongson.

Builds and works correctly, allowing loading and using custom fonts.

Comments? OK?

Index: distrib/sets/lists/base/md.loongson
===
RCS file: /cvs/src/distrib/sets/lists/base/md.loongson,v
retrieving revision 1.433
diff -u -p -r1.433 md.loongson
--- distrib/sets/lists/base/md.loongson 9 Nov 2016 16:24:17 -   1.433
+++ distrib/sets/lists/base/md.loongson 18 Jan 2017 11:55:56 -
@@ -452,4 +452,5 @@
 ./usr/sbin/hotplugd
 ./usr/sbin/pcidump
 ./usr/sbin/wsconscfg
+./usr/sbin/wsfontload
 ./usr/sbin/zzz
Index: usr.sbin/wsfontload/Makefile
===
RCS file: /cvs/src/usr.sbin/wsfontload/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- usr.sbin/wsfontload/Makefile3 Sep 2016 13:37:46 -   1.15
+++ usr.sbin/wsfontload/Makefile18 Jan 2017 11:55:57 -
@@ -1,7 +1,8 @@
 #  $OpenBSD: Makefile,v 1.15 2016/09/03 13:37:46 guenther Exp $
 
 .if ${MACHINE} == "i386" || ${MACHINE} == "amd64" || \
-${MACHINE} == "alpha" || ${MACHINE} == "hppa"
+${MACHINE} == "alpha" || ${MACHINE} == "hppa" || \
+${MACHINE} == "loongson"
 
 PROG=  wsfontload
 SRCS=  wsfontload.c



Document the RI_CLEARMARGINS flag in rasops.9

2017-01-17 Thread Frederic Cambus
Hi tech@,

The RI_CLEARMARGINS flag is used on sparc64 but isn't documented in the
rasops man page.

Comments? OK?

Index: share/man/man9/rasops.9
===
RCS file: /cvs/src/share/man/man9/rasops.9,v
retrieving revision 1.16
diff -u -p -r1.16 rasops.9
--- share/man/man9/rasops.9 7 Sep 2015 18:43:54 -   1.16
+++ share/man/man9/rasops.9 17 Jan 2017 22:28:09 -
@@ -130,7 +130,7 @@ The value of the
 .Em ri_flg
 member is formed by OR'ing the following values:
 .Pp
-.Bl -tag -offset indent -width RI_CURSORCLIP -compact
+.Bl -tag -offset indent -width RI_CLEARMARGINS -compact
 .It RI_FULLCLEAR
 Force eraserows() to clear the whole screen instead of only text lines,
 when invoked with an
@@ -144,6 +144,8 @@ Specifies that the frame buffer endianne
 Set when the text cursor is enabled.
 .It RI_CLEAR
 Clear the display upon initialization.
+.It RI_CLEARMARGINS
+Clear display margins upon initialization.
 .It RI_CENTER
 Center the text area.
 .\" Only honoured if option RASOPS_CLIPPING which we don't use.



Re: wsfont.c: remove sony8x16 and sony12x24?

2017-01-17 Thread Frederic Cambus
On Thu, Jan 12, 2017 at 01:39:47PM +0100, Frederic Cambus wrote:

> Most fonts in wsfont are not compiled in by default, and while some are
> worth keeping and using, I would like to propose deleting some of them
> in order to make space for larger sized fonts.
> 
> The Sony fonts are Serif, which doesn't work very well for monospaced
> bitmap fonts intended for console use, are not very readable, and have
> no slashed or dotted zeros. Delete them?
> 
> For obvious reasons, I didn't run cvs rm on sony8x16.h and sony12x24.h
> before generating the diff.
> 
> Comments? OK?

It's been five days and so far nobody objected. Got one OK privately,
however I would prefer having more feedback before committing this.

If there are no objections I'm going to commit in the following days.

Any more OKs? Any objections?



Re: Fix broken example link in packages.7

2017-03-01 Thread Frederic Cambus
On Tue, Feb 28, 2017 at 09:14:49PM +, Stuart Henderson wrote:
> On 2017/02/28 20:28, Frederic Cambus wrote:
> > Hi tech@,
> > 
> > In packages.7, PKG_PATH points to a broken link. This diff fixes it.
> 
> https is going to be horrible for pkg_add -u...

Following tj@ and sthen@ suggestions, use %c and %a instead of
hardcoding strings, and switch to http instead of https.

Index: share/man/man7/packages.7
===
RCS file: /cvs/src/share/man/man7/packages.7,v
retrieving revision 1.40
diff -u -p -r1.40 packages.7
--- share/man/man7/packages.7   24 Oct 2015 08:44:49 -  1.40
+++ share/man/man7/packages.7   1 Mar 2017 14:28:07 -
@@ -240,7 +240,7 @@ are supported: pointing
 .Ev PKG_PATH
 to a distant package repository, e.g.,
 .Bd -literal -offset 1n
-# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
+# export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/%c/packages/%a/
 .Ed
 .Pp
 will let



Some cleanups and tweaks for wc(1)

2016-09-03 Thread Frederic Cambus
Hi tech@,

Some cleanups and tweaks for wc(1):

- Removed unnecessary string.h include
- Changed 'format_and_print' argument type to int64_t and casting
  inside the function
- Declaring 'print_counts', 'format_and_print', and 'cnt' as static
- Remove unnecessary cast for NULL, and (void) casts from printfs,
  'mbtowc' and 'format_and_print' calls
- In 'cnt', change bufsz type from ssize_t to size_t to avoid
  converting between pointers to integer types with different sign
  when calling getline (catched when compiling with Clang)
- Use return instead of exit in main

Index: wc.c
===
RCS file: /cvs/src/usr.bin/wc/wc.c,v
retrieving revision 1.20
diff -u -p -u -p -r1.20 wc.c
--- wc.c8 Dec 2015 01:00:45 -   1.20
+++ wc.c8 May 2016 21:51:28 -
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,12 +44,12 @@
 
 int64_ttlinect, twordct, tcharct;
 intdoline, doword, dochar, humanchar, multibyte;
-intrval;
+intrval;
 extern char *__progname;
 
-void   print_counts(int64_t, int64_t, int64_t, char *);
-void   format_and_print(long long);
-void   cnt(char *);
+static void print_counts(int64_t, int64_t, int64_t, char *);
+static void format_and_print(int64_t);
+static void cnt(char *);
 
 int
 main(int argc, char *argv[])
@@ -82,10 +81,10 @@ main(int argc, char *argv[])
break;
case '?':
default:
-   (void)fprintf(stderr,
+   fprintf(stderr,
"usage: %s [-c | -m] [-hlw] [file ...]\n",
__progname);
-   exit(1);
+   return 1;
}
argv += optind;
argc -= optind;
@@ -99,7 +98,7 @@ main(int argc, char *argv[])
doline = doword = dochar = 1;
 
if (!*argv) {
-   cnt((char *)NULL);
+   cnt(NULL);
} else {
int dototal = (argc > 1);
 
@@ -111,14 +110,14 @@ main(int argc, char *argv[])
print_counts(tlinect, twordct, tcharct, "total");
}
 
-   exit(rval);
+   return rval;
 }
 
-void
+static void
 cnt(char *file)
 {
static char *buf;
-   static ssize_t bufsz;
+   static size_t bufsz;
 
FILE *stream;
char *C;
@@ -213,7 +212,7 @@ cnt(char *file)
++charct;
len = mbtowc(, C, MB_CUR_MAX);
if (len == -1) {
-   (void)mbtowc(NULL, NULL,
+   mbtowc(NULL, NULL,
MB_CUR_MAX);
len = 1;
wc = L' ';
@@ -263,31 +262,31 @@ cnt(char *file)
}
 }
 
-void 
-format_and_print(long long v)
+static void
+format_and_print(int64_t v)
 {
if (humanchar) {
char result[FMT_SCALED_STRSIZE];
 
-   (void)fmt_scaled(v, result);
-   (void)printf("%7s", result);
+   fmt_scaled((long long)v, result);
+   printf("%7s", result);
} else {
-   (void)printf(" %7lld", v);
+   printf(" %7lld", v);
}
 }
 
-void
+static void
 print_counts(int64_t lines, int64_t words, int64_t chars, char *name)
 {
if (doline)
-   format_and_print((long long)lines);
+   format_and_print(lines);
if (doword)
-   format_and_print((long long)words);
+   format_and_print(words);
if (dochar)
-   format_and_print((long long)chars);
+   format_and_print(chars);
 
if (name)
-   (void)printf(" %s\n", name);
+   printf(" %s\n", name);
else
-   (void)printf("\n");
+   printf("\n");
 }



cdce(4): Move include within the #if NBPFILTER directive

2016-09-25 Thread Frederic Cambus
Hi tech@,

Move the net/bpf.h include within the #if NBPFILTER directive.

Index: sys/dev/usb/if_cdce.c
===
RCS file: /cvs/src/sys/dev/usb/if_cdce.c,v
retrieving revision 1.70
diff -u -p -r1.70 if_cdce.c
--- sys/dev/usb/if_cdce.c   13 Apr 2016 11:03:37 -  1.70
+++ sys/dev/usb/if_cdce.c   25 Sep 2016 19:46:43 -
@@ -52,8 +52,8 @@
 
 #include 
 
-#include 
 #if NBPFILTER > 0
+#include 
 #endif
 
 #include 



wsfont.c: remove reference to non existing font

2016-10-05 Thread Frederic Cambus
Hi tech@,

Include file with font data (courier11x18.h) was removed from NetBSD
due to licensing concerns [1] before wsfont was imported into OpenBSD.

I renumbered the cookie values for consistency, and verified that no
code in tree used hardcoded cookie values.

Comments? OK?

[1] http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/wsfont/Attic/courier11x18.h

Index: sys/dev/wsfont/wsfont.c
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.c,v
retrieving revision 1.44
diff -u -p -r1.44 wsfont.c
--- sys/dev/wsfont/wsfont.c 14 Sep 2016 03:25:51 -  1.44
+++ sys/dev/wsfont/wsfont.c 4 Oct 2016 21:56:23 -
@@ -139,32 +139,29 @@ static struct font builtin_fonts[] = {
 #ifdef FONT_BOLD8x16_ISO1
BUILTIN_FONT(bold8x16_iso1, 2),
 #endif
-#ifdef FONT_COURIER11x18
-   BUILTIN_FONT(courier11x18, 3),
-#endif
 #ifdef FONT_GALLANT12x22
-   BUILTIN_FONT(gallant12x22, 4),
+   BUILTIN_FONT(gallant12x22, 3),
 #endif
 #ifdef FONT_LUCIDA16x29
-   BUILTIN_FONT(lucida16x29, 5),
+   BUILTIN_FONT(lucida16x29, 4),
 #endif
 #ifdef FONT_QVSS8x15
-   BUILTIN_FONT(qvss8x15, 6),
+   BUILTIN_FONT(qvss8x15, 5),
 #endif
 #ifdef FONT_VT220L8x8
-   BUILTIN_FONT(vt220l8x8, 7),
+   BUILTIN_FONT(vt220l8x8, 6),
 #endif
 #ifdef FONT_VT220L8x10
-   BUILTIN_FONT(vt220l8x10, 8),
+   BUILTIN_FONT(vt220l8x10, 7),
 #endif
 #ifdef FONT_SONY8x16
-   BUILTIN_FONT(sony8x16, 9),
+   BUILTIN_FONT(sony8x16, 8),
 #endif
 #ifdef FONT_SONY12x24
-   BUILTIN_FONT(sony12x24, 10),
+   BUILTIN_FONT(sony12x24, 9),
 #endif
 #ifdef FONT_OMRON12x20
-   BUILTIN_FONT(omron12x20, 11),
+   BUILTIN_FONT(omron12x20, 10),
 #endif
 #undef BUILTIN_FONT
 };



cdce(4): Remove zaurus specific code

2016-10-07 Thread Frederic Cambus
Hi tech@,

It seems there are still some leftovers from the zaurus port removal.

Comments? OK?

Index: sys/dev/usb/if_cdce.c
===
RCS file: /cvs/src/sys/dev/usb/if_cdce.c,v
retrieving revision 1.71
diff -u -p -r1.71 if_cdce.c
--- sys/dev/usb/if_cdce.c   26 Sep 2016 07:09:32 -  1.71
+++ sys/dev/usb/if_cdce.c   7 Oct 2016 13:38:43 -
@@ -88,7 +88,6 @@ void   cdce_init(void *);
 voidcdce_watchdog(struct ifnet *);
 voidcdce_stop(struct cdce_softc *);
 voidcdce_intr(struct usbd_xfer *, void *, usbd_status);
-static uint32_t cdce_crc32(const void *, size_t);
 
 const struct cdce_type cdce_devs[] = {
 {{ USB_VENDOR_ACERLABS, USB_PRODUCT_ACERLABS_M5632 }, 0 },
@@ -404,23 +403,14 @@ cdce_encap(struct cdce_softc *sc, struct
 {
struct cdce_chain   *c;
usbd_status  err;
-   int  extra = 0;
 
c = >cdce_cdata.cdce_tx_chain[idx];
 
m_copydata(m, 0, m->m_pkthdr.len, c->cdce_buf);
-   if (sc->cdce_flags & CDCE_ZAURUS) {
-   /* Zaurus wants a 32-bit CRC appended to every frame */
-   u_int32_t crc;
-
-   crc = cdce_crc32(c->cdce_buf, m->m_pkthdr.len);
-   bcopy(, c->cdce_buf + m->m_pkthdr.len, 4);
-   extra = 4;
-   }
c->cdce_mbuf = m;
 
usbd_setup_xfer(c->cdce_xfer, sc->cdce_bulkout_pipe, c, c->cdce_buf,
-   m->m_pkthdr.len + extra, USBD_FORCE_SHORT_XFER | USBD_NO_COPY,
+   m->m_pkthdr.len, USBD_FORCE_SHORT_XFER | USBD_NO_COPY,
1, cdce_txeof);
err = usbd_transfer(c->cdce_xfer);
if (err != USBD_IN_PROGRESS) {
@@ -741,8 +731,6 @@ cdce_rxeof(struct usbd_xfer *xfer, void 
sc->cdce_rxeof_errors = 0;
 
usbd_get_xfer_status(xfer, NULL, NULL, _len, NULL);
-   if (sc->cdce_flags & CDCE_ZAURUS)
-   total_len -= 4; /* Strip off CRC added by Zaurus */
if (total_len <= 1)
goto done;
 
@@ -869,68 +857,3 @@ cdce_intr(struct usbd_xfer *xfer, void *
 #endif
 }
 
-
-/*  COPYRIGHT (C) 1986 Gary S. Brown.  You may use this program, or
- *  code or tables extracted from it, as desired without restriction.
- */
-
-static uint32_t cdce_crc32_tab[] = {
-   0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
-   0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
-   0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
-   0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-   0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
-   0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
-   0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
-   0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-   0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
-   0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-   0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
-   0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-   0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
-   0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
-   0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
-   0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-   0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
-   0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
-   0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
-   0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-   0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
-   0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
-   0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
-   0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-   0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
-   0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
-   0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
-   0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-   0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
-   0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
-   0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
-   0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-   0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
-   0x72076785, 0x05005713, 0x95bf4a82, 

Remove reference to zaurus

2016-09-21 Thread Frederic Cambus
Hi tech@,

This seems to be a leftover from the zaurus port removal.

OK?

Index: sbin/disklabel/Makefile
===
RCS file: /cvs/src/sbin/disklabel/Makefile,v
retrieving revision 1.63
diff -u -p -r1.63 Makefile
--- sbin/disklabel/Makefile 1 Sep 2016 09:46:42 -   1.63
+++ sbin/disklabel/Makefile 21 Sep 2016 14:51:08 -
@@ -49,10 +49,6 @@ CFLAGS+= -DSEEALSO="\"fdisk(8), pdisk(8)
 CFLAGS+= -DSEEALSO="\"installboot(8)\"" -DSUN_CYLCHECK -DSUN_AAT0
 .endif
 
-.if (${MACHINE} == "zaurus")
-CFLAGS+= -DSEEALSO="\"fdisk(8)\""
-.endif
-
 .ifdef NOPIC
 CFLAGS+= -DSTATICLINKING
 .endif



Remove duplicated includes in stdlib.h and termios.h

2016-09-19 Thread Frederic Cambus
Hi tech@,

This diff removes duplicated includes in stdlib.h and termios.h

Comments? OK?

Index: include/stdlib.h
===
RCS file: /cvs/src/include/stdlib.h,v
retrieving revision 1.66
diff -u -p -r1.66 stdlib.h
--- include/stdlib.h9 Sep 2016 18:12:37 -   1.66
+++ include/stdlib.h16 Sep 2016 22:23:11 -
@@ -85,8 +85,6 @@ typedef struct {
 extern size_t  __mb_cur_max;
 #defineMB_CUR_MAX  __mb_cur_max
 
-#include 
-
 /*
  * Some header files may define an abs macro.
  * If defined, undef it to prevent a syntax error and issue a warning.
Index: sys/sys/termios.h
===
RCS file: /cvs/src/sys/sys/termios.h,v
retrieving revision 1.12
diff -u -p -r1.12 termios.h
--- sys/sys/termios.h   17 Dec 2013 22:12:07 -  1.12
+++ sys/sys/termios.h   16 Sep 2016 22:23:12 -
@@ -247,7 +247,6 @@ struct termios {
 #define TCIOFF 3
 #define TCION  4
 
-#include 
 #include 
 
 #if __XPG_VISIBLE >= 420 || __POSIX_VISIBLE >= 200809



Remove empty #ifdef and #ifndef blocks

2016-09-27 Thread Frederic Cambus
Hi tech@,

It seems some #ifdef and #ifndef blocks are no longer necessary.

Comments? OK?

Index: sys/netinet/ip_spd.c
===
RCS file: /cvs/src/sys/netinet/ip_spd.c,v
retrieving revision 1.90
diff -u -p -r1.90 ip_spd.c
--- sys/netinet/ip_spd.c15 Sep 2016 02:00:18 -  1.90
+++ sys/netinet/ip_spd.c27 Sep 2016 09:25:39 -
@@ -38,10 +38,6 @@
 #include 
 #include 
 #include 
-
-#ifdef INET6
-#endif /* INET6 */
-
 #include 
 #include 
 
Index: usr.bin/ftp/extern.h
===
RCS file: /cvs/src/usr.bin/ftp/extern.h,v
retrieving revision 1.44
diff -u -p -r1.44 extern.h
--- usr.bin/ftp/extern.h20 Aug 2016 20:18:42 -  1.44
+++ usr.bin/ftp/extern.h27 Sep 2016 09:25:39 -
@@ -101,8 +101,6 @@ voidptransfer(int);
 void   recvrequest(const char *, const char *, const char *,
const char *, int, int);
 char   *remglob(char **, int, char **);
-#ifndef SMALL
-#endif /* !SMALL */
 off_t  remotesize(const char *, int);
 time_t remotemodtime(const char *, int);
 void   reset(int, char **);



rasops.c: avoid calculating offset several times

2016-09-26 Thread Frederic Cambus
Hi tech@,

Here is a diff to avoid calculating offset several times in rasops.c.
This was done for a few functions already, but not all of them.

Comments? OK?

Index: sys/dev/rasops/rasops.c
===
RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
retrieving revision 1.42
diff -u -p -r1.42 rasops.c
--- sys/dev/rasops/rasops.c 7 Sep 2015 18:00:58 -   1.42
+++ sys/dev/rasops/rasops.c 21 Sep 2016 14:44:58 -
@@ -1577,8 +1577,10 @@ rasops_vcons_erasecols(void *cookie, int
int i;
 
for (i = 0; i < num; i++) {
-   scr->rs_bs[row * cols + col + i].uc = ' ';
-   scr->rs_bs[row * cols + col + i].attr = attr;
+   int off = row * cols + col + i;
+
+   scr->rs_bs[off].uc = ' ';
+   scr->rs_bs[off].attr = attr;
}
 
if (!scr->rs_visible)
@@ -1626,8 +1628,10 @@ rasops_vcons_eraserows(void *cookie, int
int i;
 
for (i = 0; i < num * cols; i++) {
-   scr->rs_bs[row * cols + i].uc = ' ';
-   scr->rs_bs[row * cols + i].attr = attr;
+   int off = row * cols + i;
+
+   scr->rs_bs[off].uc = ' ';
+   scr->rs_bs[off].attr = attr;
}
 
if (!scr->rs_visible)
@@ -1695,8 +1699,10 @@ rasops_wronly_erasecols(void *cookie, in
int i;
 
for (i = 0; i < num; i++) {
-   ri->ri_bs[row * cols + col + i].uc = ' ';
-   ri->ri_bs[row * cols + col + i].attr = attr;
+   int off = row * cols + col + i;
+
+   ri->ri_bs[off].uc = ' ';
+   ri->ri_bs[off].attr = attr;
}
 
return ri->ri_erasecols(ri, row, col, num, attr);
@@ -1734,8 +1740,10 @@ rasops_wronly_eraserows(void *cookie, in
int i;
 
for (i = 0; i < num * cols; i++) {
-   ri->ri_bs[row * cols + i].uc = ' ';
-   ri->ri_bs[row * cols + i].attr = attr;
+   int off = row * cols + i;
+
+   ri->ri_bs[off].uc = ' ';
+   ri->ri_bs[off].attr = attr;
}
 
return ri->ri_eraserows(ri, row, num, attr);



Re: Remove more duplicated includes

2016-09-25 Thread Frederic Cambus
On Fri, Sep 23, 2016 at 08:02:03PM +0200, Jeremie Courreges-Anglas wrote:
> >
> > A few remaining duplicated includes to remove.
> >
> > Comments? OK?
> 
> ok except for ixgbe.h
> 
> Better remove the unguarded #include, I think.  Even if a kernel
> configured without BPFILTER will not build...

That makes sense, here is an updated diff. OK?

Index: sys/arch/sparc64/include/asm.h
===
RCS file: /cvs/src/sys/arch/sparc64/include/asm.h,v
retrieving revision 1.10
diff -u -p -r1.10 asm.h
--- sys/arch/sparc64/include/asm.h  27 May 2016 16:32:39 -  1.10
+++ sys/arch/sparc64/include/asm.h  25 Sep 2016 13:46:14 -
@@ -41,11 +41,6 @@
 #ifndef _MACHINE_ASM_H_
 #define _MACHINE_ASM_H_
 
-#ifndef _LOCORE
-#define _LOCORE
-#endif
-#include 
-
 /* Pull in CCFSZ, CC64FSZ, and BIAS from frame.h */
 #ifndef _LOCORE
 #define _LOCORE
Index: sys/dev/pci/ixgbe.h
===
RCS file: /cvs/src/sys/dev/pci/ixgbe.h,v
retrieving revision 1.22
diff -u -p -r1.22 ixgbe.h
--- sys/dev/pci/ixgbe.h 15 Mar 2016 16:45:52 -  1.22
+++ sys/dev/pci/ixgbe.h 25 Sep 2016 13:46:15 -
@@ -55,7 +55,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include 
Index: usr.sbin/snmpd/snmpd.h
===
RCS file: /cvs/src/usr.sbin/snmpd/snmpd.h,v
retrieving revision 1.67
diff -u -p -r1.67 snmpd.h
--- usr.sbin/snmpd/snmpd.h  16 Aug 2016 18:41:57 -  1.67
+++ usr.sbin/snmpd/snmpd.h  25 Sep 2016 13:46:17 -
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



share/misc: Complete 'airport' and 'inter.phone' for Poland

2016-10-01 Thread Frederic Cambus
Hi tech@,

This diff adds missing airports and area codes for Poland, and fixes
some erroneous entries.

OK?

Index: share/misc/airport
===
RCS file: /cvs/src/share/misc/airport,v
retrieving revision 1.56
diff -u -p -r1.56 airport
--- share/misc/airport  10 Jul 2016 13:52:27 -  1.56
+++ share/misc/airport  1 Oct 2016 20:37:42 -
@@ -273,6 +273,7 @@ BXU:Butuan, Butuan, Philippines
 BYO:Bonito, Brazil
 BYU:Bindlacher Berg, Bayreuth, Germany
 BZE:Philip S. W. Goldson International, Belize City, Belize
+BZG:Szwederowo, Bydgoszcz, Poland
 BZN:Gallatin Field, Bozeman, Montana, USA
 CAE:Columbia Metropolitan, South Carolina, USA
 CAG:Elmas, Cagliari, Sardinia, Italy
@@ -726,6 +727,7 @@ IAS:Iasi, Romania
 IBZ:Ibiza, Spain
 ICT:Wichita Mid-Continent, Kansas, USA
 IDA:Idaho Falls, Idaho, USA
+IEG:Babimost, Zielona Gora, Poland
 IEV:Kyiv Zhulyany International, Kyiv, Ukraine
 IFO:Ivano-Frankivs'k International, Ivano-Frankivs'k, Ukraine
 IFP:Bullhead City, Arizona, USA
@@ -936,6 +938,7 @@ LCA:Larnaca International, Cyprus
 LCE:La Ceiba International, Honduras
 LCG:La Coruna, Spain
 LCH:Lake Charles, Louisiana, USA
+LCJ:Lublinek, Lodz, Poland
 LCY:London City, England, United Kingdom
 LDB:Londrina, Parana, Brazil
 LDE:Tarbes International, Lourdes/Tarbes, France
@@ -1009,6 +1012,7 @@ LUD:Luderitz, Namibia
 LUG:Agno, Lugano, Switzerland
 LUN:Lusaka, Zambia
 LUX:Findel, Luxembourg
+LUZ:Swidnik, Lublin, Poland
 LVI:Livingstone, Zambia
 LVK:Livermore, California, USA
 LWB:Greenbrier Valley, West Virginia, USA
@@ -1345,7 +1349,7 @@ POP:La Union, Puerto Plata, Dominican Re
 POR:Pori, Finland
 POS:Port Of Spain, Trinidad
 POU:Dutchess County, Poughkeepsie, New York, USA
-POZ:Lawica, Poznan, Poland
+POZ:Poznan, Poland
 PPG:Pago Pago International, American Samoa
 PPS:Puerto Princesa, Philippines
 PPT:Pape'ete, Tahiti, French Polynesia
@@ -1406,6 +1410,7 @@ RCB:Richards Bay, South Africa
 RCE:Roche Harbor, Washington, USA
 RDD:Redding, California, USA
 RDG:Reading Municipal / Spaatz Field, Pennsylvania, USA
+RDO:Sadkow, Radom, Poland
 RDU:Raleigh-Durham, North Carolina, USA
 REC:Guararapes International, Recife, Pernambuco, Brazil
 REG:Tito Menniti, Reggio Calabria, Italy
@@ -1457,6 +1462,7 @@ RUN:Roland Garros Airport, Reunion Islan
 RUT:Rutland, Vermont, USA
 RWI:Wilson, Rocky Mount, North Carolina, USA
 RWN:Rivne International, Rivne, Ukraine
+RZE:Jasionka, Rzeszow, Poland
 SAB:Saba Island, Netherlands Antilles
 SAF:Santa Fe, New Mexico, USA
 SAH:Sanaa International, Yemen
@@ -1620,6 +1626,7 @@ SZG:Salzburg, Austria
 SZR:Stara Zagora, Bulgaria
 SZS:Ryan's Creek, Stewart Island, New Zealand
 SZX:Shenzhen, China
+SZY:Szymany, Olsztyn, Poland
 SZZ:Goleniow, Szczecin, Poland
 TAB:Crown Point, Tobago, Trinidad And Tobago
 TAC:Dz Romualdez, Tacloban, Philippines
@@ -1815,6 +1822,7 @@ WIL:Wilson, Nairobi, Kenya
 WIN:Winton, Queensland, Australia
 WLG:Wellington International, New Zealand
 WMH:Mountain Home, Arkansas, USA
+WMI:Modlin, Warsaw, Poland
 WNA:Napakiak, Alaska, USA
 WRL:Worland, Wyoming, USA
 WRO:Strachowice, Wroclaw, Poland
Index: share/misc/inter.phone
===
RCS file: /cvs/src/share/misc/inter.phone,v
retrieving revision 1.42
diff -u -p -r1.42 inter.phone
--- share/misc/inter.phone  9 Jul 2016 23:32:51 -   1.42
+++ share/misc/inter.phone  1 Oct 2016 20:37:42 -
@@ -1711,10 +1711,55 @@
 47:2:Oslo:Norway
 47:5:Bergen:Norway
 47:7:Trondheim:Norway
-48:12:Crakow:Poland
+48:12:Krakow:Poland
+48:13:Krosno:Poland
+48:14:Tarnow:Poland
+48:15:Tarnobrzeg:Poland
+48:16:Przemysl:Poland
+48:17:Rzeszow:Poland
+48:18:Nowy Sacz:Poland
 48:22:Warsaw:Poland
+48:23:Ciechanow:Poland
+48:24:Plock:Poland
+48:25:Siedlce:Poland
+48:29:Ostroleka:Poland
+48:32:Katowice:Poland
+48:33:Bielsko-Biala:Poland
+48:34:Czestochowa:Poland
+48:41:Kielce:Poland
 48:42:Lodz:Poland
+48:43:Sieradz:Poland
+48:44:Piotrkow Trybunalski:Poland
+48:46:Skierniewice:Poland
+48:48:Radom:Poland
+48:52:Bydgoszcz:Poland
+48:54:Wloclawek:Poland
+48:55:Elblag:Poland
+48:56:Torun:Poland
 48:58:Gdansk:Poland
+48:59:Slupsk:Poland
+48:61:Poznan:Poland
+48:62:Kalisz:Poland
+48:63:Konin:Poland
+48:65:Leszno:Poland
+48:67:Pila:Poland
+48:68:Zielona Gora:Poland
+48:71:Wroclaw:Poland
+48:74:Walbrzych:Poland
+48:75:Jelenia Gora:Poland
+48:76:Legnica:Poland
+48:77:Opole:Poland
+48:81:Lublin:Poland
+48:82:Chelm:Poland
+48:83:Biala Podlaska:Poland
+48:84:Zamosc:Poland
+48:85:Bialystok:Poland
+48:86:Lomza:Poland
+48:87:Suwalki:Poland
+48:89:Olsztyn:Poland
+48:91:Szczecin:Poland
+48:94:Koszalin:Poland
+48:95:Gorzow Wielkopolski:Poland
 49:201:Essen:Germany
 49:202:Wuppertal:Germany
 49:203:Duisburg:Germany



Re: opencvs - fix update -r and -A

2016-10-14 Thread Frederic Cambus
On Fri, Oct 14, 2016 at 09:24:03AM -0600, Todd C. Miller wrote:
> On Fri, 14 Oct 2016 16:17:45 +0200, Joris Vink wrote:
> 
> > In certain cases update -r and update -A would not properly set or reset
> > the sticky tag for file(s). This patch fixes that problem.
> 
> After reading through the applicable parts of update.c I'm fairly
> certain this is correct.  OK millert@

Commited, thanks!



ykbec(4): Add support for lid state detection

2016-11-12 Thread Frederic Cambus
Hi tech@,

This is an attempt at adding lid state detection in ykbec(4). Tested on
a Lemote Yeeloong 8101B.

Comments? OK?

Index: share/man/man4/man4.loongson/ykbec.4
===
RCS file: /cvs/src/share/man/man4/man4.loongson/ykbec.4,v
retrieving revision 1.3
diff -u -p -r1.3 ykbec.4
--- share/man/man4/man4.loongson/ykbec.425 Feb 2010 10:07:11 -  
1.3
+++ share/man/man4/man4.loongson/ykbec.412 Nov 2016 15:10:03 -
@@ -40,9 +40,11 @@ Battery control
 Button events
 .It
 Power management
+.It
+Lid state
 .El
 .Pp
-Fan and battery information is made available via the
+Fan, battery, and lid information is made available via the
 .Xr sysctl 3
 hardware sensor interface.
 Not all the device interfaces are supported under
Index: sys/arch/loongson/dev/kb3310.c
===
RCS file: /cvs/src/sys/arch/loongson/dev/kb3310.c,v
retrieving revision 1.20
diff -u -p -r1.20 kb3310.c
--- sys/arch/loongson/dev/kb3310.c  8 Jan 2016 15:54:13 -   1.20
+++ sys/arch/loongson/dev/kb3310.c  12 Nov 2016 15:10:05 -
@@ -76,8 +76,10 @@ static const struct {
 #define YKBEC_CHARGING 7
{ "Battery charging",   SENSOR_INDICATOR },
 #define YKBEC_AC   8
-   { "AC-Power",   SENSOR_INDICATOR }
-#define YKBEC_NSENSORS 9
+   { "AC-Power",   SENSOR_INDICATOR },
+#define YKBEC_LID  9
+   { "Lid open",   SENSOR_INDICATOR }
+#define YKBEC_NSENSORS 10
 };
 
 struct ykbec_softc {
@@ -310,6 +312,10 @@ ykbec_read16(struct ykbec_softc *mcsc, u
 #defineREG_FAN_ON  1
 #define REG_FAN_OFF0
 
+#define REG_LID_STATE  0xf4bd
+#define LID_OPEN   1
+#define LID_CLOSED 0
+
 #define YKBEC_SCI_IRQ  0xa
 
 #ifdef DEBUG
@@ -337,7 +343,7 @@ ykbec_refresh(void *arg)
 {
struct ykbec_softc *sc = (struct ykbec_softc *)arg;
u_int val, bat_charge, bat_status, charge_status, bat_state, power_flag;
-   u_int cap_pct, fullcap;
+   u_int lid_state, cap_pct, fullcap;
int current;
 #if NAPM > 0
struct apm_power_info old;
@@ -376,11 +382,14 @@ ykbec_refresh(void *arg)
charge_status = ykbec_read(sc, REG_CHARGE_STATUS);
bat_state = ykbec_read(sc, REG_BAT_STATE);
power_flag = ykbec_read(sc, REG_POWER_FLAG);
+   lid_state = ykbec_read(sc, REG_LID_STATE);
 
sc->sc_sensor[YKBEC_CHARGING].value = !!ISSET(bat_state,
BAT_STATE_CHARGING);
sc->sc_sensor[YKBEC_AC].value = !!ISSET(power_flag,
POWER_FLAG_ADAPTER_IN);
+
+   sc->sc_sensor[YKBEC_LID].value = !!ISSET(lid_state, LID_OPEN);
 
sc->sc_sensor[YKBEC_CAP].status = ISSET(bat_status, BAT_STATUS_BAT_LOW) 
?
SENSOR_S_CRIT : SENSOR_S_OK;



Re: cdce(4): Remove zaurus specific code

2016-10-11 Thread Frederic Cambus
On Fri, Oct 07, 2016 at 06:02:35PM +0200, Mark Kettenis wrote:

> > It seems there are still some leftovers from the zaurus port removal.
> > 
> > Comments? OK?
> 
> Not ok.  This is support for the zaurus as a usb device attached to an

My mistake, thanks for the clarification.

> OpenBSD machine.  Perhaps the option should be renamed (to CDCE_CRC32
> for example) to make this clear.

That would make sense, what about the following diff?

Index: sys/dev/usb/if_cdce.c
===
RCS file: /cvs/src/sys/dev/usb/if_cdce.c,v
retrieving revision 1.71
diff -u -p -r1.71 if_cdce.c
--- sys/dev/usb/if_cdce.c   26 Sep 2016 07:09:32 -  1.71
+++ sys/dev/usb/if_cdce.c   11 Oct 2016 10:37:53 -
@@ -93,13 +93,13 @@ static uint32_t  cdce_crc32(const void *
 const struct cdce_type cdce_devs[] = {
 {{ USB_VENDOR_ACERLABS, USB_PRODUCT_ACERLABS_M5632 }, 0 },
 {{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2501 }, 0 },
-{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5500 }, CDCE_ZAURUS },
-{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_A300 }, CDCE_ZAURUS },
-{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5600 }, CDCE_ZAURUS },
-{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_C700 }, CDCE_ZAURUS },
-{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_C750 }, CDCE_ZAURUS },
-{{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN }, CDCE_ZAURUS },
-{{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2 }, CDCE_ZAURUS },
+{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5500 }, CDCE_CRC32 },
+{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_A300 }, CDCE_CRC32 },
+{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5600 }, CDCE_CRC32 },
+{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_C700 }, CDCE_CRC32 },
+{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_C750 }, CDCE_CRC32 },
+{{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN }, CDCE_CRC32 },
+{{ USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_USBLAN2 }, CDCE_CRC32 },
 {{ USB_VENDOR_GMATE, USB_PRODUCT_GMATE_YP3X00 }, 0 },
 {{ USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_ETHERNETGADGET }, 0 },
 {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX }, 0 },
@@ -409,8 +409,8 @@ cdce_encap(struct cdce_softc *sc, struct
c = >cdce_cdata.cdce_tx_chain[idx];
 
m_copydata(m, 0, m->m_pkthdr.len, c->cdce_buf);
-   if (sc->cdce_flags & CDCE_ZAURUS) {
-   /* Zaurus wants a 32-bit CRC appended to every frame */
+   if (sc->cdce_flags & CDCE_CRC32) {
+   /* Some devices want a 32-bit CRC appended to every frame */
u_int32_t crc;
 
crc = cdce_crc32(c->cdce_buf, m->m_pkthdr.len);
@@ -741,8 +741,8 @@ cdce_rxeof(struct usbd_xfer *xfer, void 
sc->cdce_rxeof_errors = 0;
 
usbd_get_xfer_status(xfer, NULL, NULL, _len, NULL);
-   if (sc->cdce_flags & CDCE_ZAURUS)
-   total_len -= 4; /* Strip off CRC added by Zaurus */
+   if (sc->cdce_flags & CDCE_CRC32)
+   total_len -= 4; /* Strip off added CRC */
if (total_len <= 1)
goto done;
 
Index: sys/dev/usb/if_cdcereg.h
===
RCS file: /cvs/src/sys/dev/usb/if_cdcereg.h,v
retrieving revision 1.6
diff -u -p -r1.6 if_cdcereg.h
--- sys/dev/usb/if_cdcereg.h4 Dec 2013 00:52:52 -   1.6
+++ sys/dev/usb/if_cdcereg.h11 Oct 2016 10:37:53 -
@@ -41,7 +41,7 @@
 struct cdce_type {
struct usb_devno cdce_dev;
u_int16_tcdce_flags;
-#define CDCE_ZAURUS1
+#define CDCE_CRC32 1
 #define CDCE_SWAPUNION 2
 };
 



Re: opencvs - use correct size when creating h_table

2016-10-12 Thread Frederic Cambus
On Wed, Jun 22, 2016 at 12:23:38PM +0200, Joris Vink wrote:

> Don't allocate the length of a pointer but rather the
> entire size of the struct hash_head data structure
> when creating the h_table array.

> RCS file: /cvs/src/usr.bin/cvs/hash.c,v
>
> - htable->h_table = xcalloc(hsize, sizeof(struct hash_head *));
> + htable->h_table = xcalloc(hsize, sizeof(struct hash_head));

Looks good to me.

OK fcambus@ if anyone wants to commit.



Re: [patch] opencvs rcsnum_free()

2016-10-13 Thread Frederic Cambus
On Fri, Jun 24, 2016 at 11:22:06AM +0200, Joris Vink wrote:
> On Fri, Jun 24, 2016 at 01:58:20PM +0800, Michael W. Bombardieri wrote:

> > If people are interested in opencvs diffs again, sharing a 
> > rcsnum_free()->free()
> > clean-up item. Note that rcs(1) also has a version of rcsnum_free() which 
> > does more
> > than simply call free().
> 
> This is good. Eventually the rcs(1) rcsnum code should get the same
> simplification as opencvs got regarding how it deals with rn_id as well.

Looks good to me, with a caveat though: there is a missing include on
stdlib.h in getlog.c, which breaks compilation.

With the missing include this is OK fcambus@ if anyone wants to commit.



Provide the "machdep.lidsuspend" sysctl on Loongson

2016-12-14 Thread Frederic Cambus
Hi tech@,

Here is a diff to add the "machdep.lidsuspend" sysctl on Loongson.

This is another required step to activate suspend on lid close on the
Lemote Yeeloong.

Comments? OK?

Index: etc/etc.loongson/sysctl.conf
===
RCS file: /cvs/src/etc/etc.loongson/sysctl.conf,v
retrieving revision 1.2
diff -u -p -r1.2 sysctl.conf
--- etc/etc.loongson/sysctl.conf24 Jun 2011 19:47:48 -  1.2
+++ etc/etc.loongson/sysctl.conf14 Dec 2016 14:05:36 -
@@ -0,0 +1 @@
+#machdep.lidsuspend=0  # do not suspend laptop upon lid closing
Index: sys/arch/loongson/loongson/machdep.c
===
RCS file: /cvs/src/sys/arch/loongson/loongson/machdep.c,v
retrieving revision 1.69
diff -u -p -r1.69 machdep.c
--- sys/arch/loongson/loongson/machdep.c11 Dec 2016 07:57:14 -  
1.69
+++ sys/arch/loongson/loongson/machdep.c14 Dec 2016 14:06:28 -
@@ -116,6 +116,7 @@ int physmem;/* Max supported memory, c
 intncpu = 1;   /* At least one CPU in the system. */
 intnnodes = 1; /* Number of NUMA nodes, only on 3A. */
 struct user *proc0paddr;
+intlid_suspend = 1;
 
 const struct platform *sys_platform;
 struct cpu_hwinfo bootcpu_hwinfo;
@@ -1016,9 +1017,12 @@ cpu_sysctl(name, namelen, oldp, oldlenp,
return ENOTDIR; /* Overloaded */
 
switch (name[0]) {
+   case CPU_LIDSUSPEND:
+   return (sysctl_int(oldp, oldlenp, newp, newlen, _suspend));
default:
-   return EOPNOTSUPP;
+   return (EOPNOTSUPP);
}
+   /* NOTREACHED */
 }
 
 intwaittime = -1;
Index: sys/arch/mips64/include/cpu.h
===
RCS file: /cvs/src/sys/arch/mips64/include/cpu.h,v
retrieving revision 1.111
diff -u -p -r1.111 cpu.h
--- sys/arch/mips64/include/cpu.h   14 Aug 2016 08:23:52 -  1.111
+++ sys/arch/mips64/include/cpu.h   14 Dec 2016 14:06:28 -
@@ -361,12 +361,14 @@ void  cp0_calibrate(struct cpu_info *);
  */
 #defineCPU_ALLOWAPERTURE   1   /* allow mmap of /dev/xf86 */
/*  2  formerly: keyboard reset */
-#defineCPU_MAXID   3   /* number of valid machdep ids 
*/
+#defineCPU_LIDSUSPEND  3   /* lid close causes a suspend */
+#defineCPU_MAXID   4   /* number of valid machdep ids 
*/
 
 #defineCTL_MACHDEP_NAMES { \
{ 0, 0 },   \
{ "allowaperture", CTLTYPE_INT },   \
{ 0, 0 },   \
+   { "lidsuspend", CTLTYPE_INT },  \
 }
 
 /*



rasops(9): Remove rasops2 functions?

2016-12-11 Thread Frederic Cambus
Hi tech@,

Unless I overlooked something, nothing seems to use the rasops2 (2-bit
color depth) functions.

It seems unlikely that any future new platform will ever need them.

Should we remove them?

Comments? OK?

Index: sys/conf/files
===
RCS file: /cvs/src/sys/conf/files,v
retrieving revision 1.635
diff -u -p -r1.635 files
--- sys/conf/files  30 Nov 2016 14:26:12 -  1.635
+++ sys/conf/files  11 Dec 2016 22:51:49 -
@@ -41,7 +41,6 @@ attachmidi at midibus
 
 # raster operations attributes
 define rasops1
-define rasops2
 define rasops4
 define rasops8
 define rasops15
Index: sys/dev/rasops/files.rasops
===
RCS file: /cvs/src/sys/dev/rasops/files.rasops,v
retrieving revision 1.6
diff -u -p -r1.6 files.rasops
--- sys/dev/rasops/files.rasops 2 Dec 2006 15:55:18 -   1.6
+++ sys/dev/rasops/files.rasops 11 Dec 2016 22:51:49 -
@@ -3,14 +3,13 @@
 
 # Note: `rasops_glue' is only here to force the header file's name
 #  hence it must be mentioned first (shudder...)
-file   dev/rasops/rasops.c ((rasops_glue | rasops1 | rasops2 | rasops4 |
- rasops8 | rasops15 | rasops16 | rasops24 |
- rasops32 | rasops_bswap | rasops_rotation) &
+file   dev/rasops/rasops.c ((rasops_glue | rasops1 | rasops4 | rasops8 |
+ rasops15 | rasops16 | rasops24 | rasops32 |
+ rasops_bswap | rasops_rotation) &
 wsdisplay) needs-flag
 
-file   dev/rasops/rasops_masks.c  wsdisplay & (rasops1 | rasops2 | rasops4)
+file   dev/rasops/rasops_masks.c  wsdisplay & (rasops1 | rasops4)
 file   dev/rasops/rasops1.cwsdisplay & rasops1
-file   dev/rasops/rasops2.cwsdisplay & rasops2
 file   dev/rasops/rasops4.cwsdisplay & rasops4
 file   dev/rasops/rasops8.cwsdisplay & rasops8
 file   dev/rasops/rasops15.c   wsdisplay & (rasops15 | rasops16)
Index: sys/dev/rasops/rasops.c
===
RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
retrieving revision 1.43
diff -u -p -r1.43 rasops.c
--- sys/dev/rasops/rasops.c 26 Sep 2016 20:41:08 -  1.43
+++ sys/dev/rasops/rasops.c 11 Dec 2016 22:51:49 -
@@ -427,11 +427,6 @@ rasops_reconfig(struct rasops_info *ri, 
rasops1_init(ri);
break;
 #endif
-#if NRASOPS2 > 0
-   case 2:
-   rasops2_init(ri);
-   break;
-#endif
 #if NRASOPS4 > 0
case 4:
rasops4_init(ri);
@@ -802,16 +797,6 @@ rasops_init_devcmap(struct rasops_info *
}
 
switch (ri->ri_depth) {
-#if NRASOPS2 > 0
-   case 2:
-   for (i = 1; i < 15; i++)
-   ri->ri_devcmap[i] = 0x;
-
-   ri->ri_devcmap[0] = 0;
-   ri->ri_devcmap[8] = 0x;
-   ri->ri_devcmap[15] = 0x;
-   return;
-#endif
 #if NRASOPS4 > 0
case 4:
for (i = 0; i < 16; i++) {
Index: sys/dev/rasops/rasops.h
===
RCS file: /cvs/src/sys/dev/rasops/rasops.h,v
retrieving revision 1.17
diff -u -p -r1.17 rasops.h
--- sys/dev/rasops/rasops.h 7 Sep 2015 18:00:58 -   1.17
+++ sys/dev/rasops/rasops.h 11 Dec 2016 22:51:49 -
@@ -158,7 +158,6 @@ struct rasops_info {
  * the rasops code.
  */
 void   rasops1_init(struct rasops_info *);
-void   rasops2_init(struct rasops_info *);
 void   rasops4_init(struct rasops_info *);
 void   rasops8_init(struct rasops_info *);
 void   rasops15_init(struct rasops_info *);
Index: sys/dev/rasops/rasops2.c
===
RCS file: sys/dev/rasops/rasops2.c
diff -N sys/dev/rasops/rasops2.c
--- sys/dev/rasops/rasops2.c19 Dec 2014 22:44:59 -  1.11
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,461 +0,0 @@
-/* $OpenBSD: rasops2.c,v 1.11 2014/12/19 22:44:59 guenther Exp $   */
-/* $NetBSD: rasops2.c,v 1.5 2000/04/12 14:22:29 pk Exp $   */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Andrew Doran.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, 

Harmonize frame buffer drivers information display

2017-01-14 Thread Frederic Cambus
Hi tech@,

Harmonize the way frame buffer drivers display resolution and color
depth when attaching.

Comments? OK?

Index: sys/arch/alpha/tc/cfb.c
===
RCS file: /cvs/src/sys/arch/alpha/tc/cfb.c,v
retrieving revision 1.23
diff -u -p -r1.23 cfb.c
--- sys/arch/alpha/tc/cfb.c 20 Oct 2013 20:07:22 -  1.23
+++ sys/arch/alpha/tc/cfb.c 12 Jan 2017 15:26:42 -
@@ -215,7 +215,7 @@ cfbattach(parent, self, aux)
printf(": can't map mem space\n");
return;
}
-   printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
+   printf(": %dx%d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
sc->sc_dc->dc_depth);
 
/* Establish an interrupt handler, and clear any pending interrupts */
Index: sys/arch/alpha/tc/sfb.c
===
RCS file: /cvs/src/sys/arch/alpha/tc/sfb.c,v
retrieving revision 1.21
diff -u -p -r1.21 sfb.c
--- sys/arch/alpha/tc/sfb.c 20 Oct 2013 20:07:22 -  1.21
+++ sys/arch/alpha/tc/sfb.c 12 Jan 2017 15:26:42 -
@@ -255,7 +255,7 @@ sfbattach(parent, self, aux)
printf(": can't map mem space\n");
return;
}
-   printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
+   printf(": %dx%d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
sc->sc_dc->dc_depth);
 
 #if 0
Index: sys/arch/loongson/dev/radeonfb.c
===
RCS file: /cvs/src/sys/arch/loongson/dev/radeonfb.c,v
retrieving revision 1.1
diff -u -p -r1.1 radeonfb.c
--- sys/arch/loongson/dev/radeonfb.c7 Oct 2016 04:08:30 -   1.1
+++ sys/arch/loongson/dev/radeonfb.c12 Jan 2017 15:26:42 -
@@ -229,7 +229,7 @@ radeonfb_attach(struct device *parent, s
}
}
 
-   printf(": %dx%dx%d frame buffer\n",
+   printf(": %dx%d, %dbpp\n",
fb->ri.ri_width, fb->ri.ri_height, fb->ri.ri_depth);
 
sc->sc_scrlist[0] = >wsd;
Index: sys/arch/loongson/dev/sisfb.c
===
RCS file: /cvs/src/sys/arch/loongson/dev/sisfb.c,v
retrieving revision 1.4
diff -u -p -r1.4 sisfb.c
--- sys/arch/loongson/dev/sisfb.c   21 Oct 2013 10:36:14 -  1.4
+++ sys/arch/loongson/dev/sisfb.c   12 Jan 2017 15:26:42 -
@@ -240,7 +240,7 @@ sisfb_attach(struct device *parent, stru
}
}
 
-   printf(": %dx%dx%d frame buffer\n",
+   printf(": %dx%d, %dbpp\n",
fb->ri.ri_width, fb->ri.ri_height, fb->ri.ri_depth);
 
sc->sc_scrlist[0] = >wsd;
Index: sys/arch/luna88k/dev/lunafb.c
===
RCS file: /cvs/src/sys/arch/luna88k/dev/lunafb.c,v
retrieving revision 1.22
diff -u -p -r1.22 lunafb.c
--- sys/arch/luna88k/dev/lunafb.c   22 Jul 2014 13:39:16 -  1.22
+++ sys/arch/luna88k/dev/lunafb.c   12 Jan 2017 15:26:42 -
@@ -200,7 +200,7 @@ omfbattach(struct device *parent, struct
M_WAITOK | M_ZERO);
omfb_getdevconfig(OMFB_FB_WADDR, sc->sc_dc);
}
-   printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
+   printf(": %dx%d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
hwplanebits);
 
waa.console = omfb_console;
Index: sys/arch/sgi/gio/grtwo.c
===
RCS file: /cvs/src/sys/arch/sgi/gio/grtwo.c,v
retrieving revision 1.12
diff -u -p -r1.12 grtwo.c
--- sys/arch/sgi/gio/grtwo.c8 Sep 2015 10:21:50 -   1.12
+++ sys/arch/sgi/gio/grtwo.c12 Jan 2017 15:26:42 -
@@ -424,7 +424,7 @@ grtwo_attach(struct device *parent, stru
dc->dc_sc = sc;
 
printf(", revision %d, monitor sense %d\n", dc->boardrev, dc->monitor);
-   printf("%s: %dx%d %d-bit frame buffer\n",
+   printf("%s: %dx%d, %dbpp\n",
self->dv_xname, GRTWO_WIDTH, GRTWO_HEIGHT, dc->depth);
 
sc->sc_scrlist[0] = >dc_wsd;
Index: sys/arch/sgi/gio/light.c
===
RCS file: /cvs/src/sys/arch/sgi/gio/light.c,v
retrieving revision 1.7
diff -u -p -r1.7 light.c
--- sys/arch/sgi/gio/light.c7 Dec 2014 17:15:56 -   1.7
+++ sys/arch/sgi/gio/light.c12 Jan 2017 15:26:42 -
@@ -417,7 +417,7 @@ light_attach(struct device *parent, stru
printf(": LG%dMC\n",
LIGHT_IS_LG1(sc->sc_dc->dc_boardrev) ? 1 : 2);
printf(", revision %d\n", dc->dc_boardrev);
-   printf("%s: %dx%d %d-bit frame buffer\n", self->dv_xname,
+   printf("%s: %dx%d, %dbpp\n", self->dv_xname,
dc->dc_ri.ri_width, dc->dc_ri.ri_height, dc->dc_ri.ri_depth);
 
sc->sc_scrlist[0] = >dc_wsd;
Index: sys/arch/sgi/gio/newport.c

Ansify cpu_sysctl() on alpha, arm, arm64, luna88k and sparc64

2017-01-12 Thread Frederic Cambus
Hi tech@,

Here is a diff to ansify cpu_sysctl() where not previously done.

Comments? OK?

Index: sys/arch/alpha/alpha/machdep.c
===
RCS file: /cvs/src/sys/arch/alpha/alpha/machdep.c,v
retrieving revision 1.176
diff -u -p -r1.176 machdep.c
--- sys/arch/alpha/alpha/machdep.c  9 Oct 2016 11:25:39 -   1.176
+++ sys/arch/alpha/alpha/machdep.c  12 Jan 2017 10:48:51 -
@@ -1553,14 +1553,8 @@ sys_sigreturn(struct proc *p, void *v, r
  * machine dependent system variables.
  */
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
dev_t consdev;
 #if NIOASIC > 0
Index: sys/arch/arm/arm/arm32_machdep.c
===
RCS file: /cvs/src/sys/arch/arm/arm/arm32_machdep.c,v
retrieving revision 1.52
diff -u -p -r1.52 arm32_machdep.c
--- sys/arch/arm/arm/arm32_machdep.c23 Sep 2016 11:38:21 -  1.52
+++ sys/arch/arm/arm/arm32_machdep.c12 Jan 2017 10:48:51 -
@@ -300,14 +300,8 @@ cpu_startup()
  */
 
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
 #if NAPM > 0
extern int cpu_apmwarn;
Index: sys/arch/arm64/arm64/machdep.c
===
RCS file: /cvs/src/sys/arch/arm64/arm64/machdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 machdep.c
--- sys/arch/arm64/arm64/machdep.c  19 Dec 2016 07:44:54 -  1.2
+++ sys/arch/arm64/arm64/machdep.c  12 Jan 2017 10:48:51 -
@@ -293,14 +293,8 @@ cpu_startup()
  */
 
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
/* all sysctl names at this level are terminal */
if (namelen != 1)
Index: sys/arch/luna88k/luna88k/machdep.c
===
RCS file: /cvs/src/sys/arch/luna88k/luna88k/machdep.c,v
retrieving revision 1.121
diff -u -p -r1.121 machdep.c
--- sys/arch/luna88k/luna88k/machdep.c  9 Oct 2016 11:25:40 -   1.121
+++ sys/arch/luna88k/luna88k/machdep.c  12 Jan 2017 10:48:51 -
@@ -916,14 +916,8 @@ sys_sysarch(p, v, retval)
  */
 
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
dev_t consdev;
 
Index: sys/arch/sparc64/sparc64/machdep.c
===
RCS file: /cvs/src/sys/arch/sparc64/sparc64/machdep.c,v
retrieving revision 1.181
diff -u -p -r1.181 machdep.c
--- sys/arch/sparc64/sparc64/machdep.c  9 Oct 2016 11:25:40 -   1.181
+++ sys/arch/sparc64/sparc64/machdep.c  12 Jan 2017 10:48:52 -
@@ -367,14 +367,8 @@ struct sigframe {
  * machine dependent system variables.
  */
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
int oldval, ret;
 



wsfont.c: remove sony8x16 and sony12x24?

2017-01-12 Thread Frederic Cambus
Hi tech@,

Most fonts in wsfont are not compiled in by default, and while some are
worth keeping and using, I would like to propose deleting some of them
in order to make space for larger sized fonts.

The Sony fonts are Serif, which doesn't work very well for monospaced
bitmap fonts intended for console use, are not very readable, and have
no slashed or dotted zeros. Delete them?

For obvious reasons, I didn't run cvs rm on sony8x16.h and sony12x24.h
before generating the diff.

Comments? OK?

Index: distrib/sets/lists/comp/mi
===
RCS file: /cvs/src/distrib/sets/lists/comp/mi,v
retrieving revision 1.1322
diff -u -p -r1.1322 mi
--- distrib/sets/lists/comp/mi  7 Jan 2017 16:04:13 -   1.1322
+++ distrib/sets/lists/comp/mi  11 Jan 2017 21:45:55 -
@@ -813,8 +813,6 @@
 ./usr/include/dev/wsfont/lucida16x29.h
 ./usr/include/dev/wsfont/omron12x20.h
 ./usr/include/dev/wsfont/qvss8x15.h
-./usr/include/dev/wsfont/sony12x24.h
-./usr/include/dev/wsfont/sony8x16.h
 ./usr/include/dev/wsfont/vt220l8x10.h
 ./usr/include/dev/wsfont/vt220l8x8.h
 ./usr/include/dev/wsfont/wsfont.h
Index: sys/dev/wsfont/wsfont.c
===
RCS file: /cvs/src/sys/dev/wsfont/wsfont.c,v
retrieving revision 1.45
diff -u -p -r1.45 wsfont.c
--- sys/dev/wsfont/wsfont.c 6 Oct 2016 07:30:19 -   1.45
+++ sys/dev/wsfont/wsfont.c 11 Jan 2017 21:45:55 -
@@ -64,16 +64,6 @@
 #include 
 #endif
 
-#ifdef FONT_SONY8x16
-#define HAVE_FONT 1
-#include 
-#endif
-
-#ifdef FONT_SONY12x24
-#define HAVE_FONT 1
-#include 
-#endif
-
 #ifdef FONT_OMRON12x20
 #define HAVE_FONT 1
 #include 
@@ -154,14 +144,8 @@ static struct font builtin_fonts[] = {
 #ifdef FONT_VT220L8x10
BUILTIN_FONT(vt220l8x10, 7),
 #endif
-#ifdef FONT_SONY8x16
-   BUILTIN_FONT(sony8x16, 8),
-#endif
-#ifdef FONT_SONY12x24
-   BUILTIN_FONT(sony12x24, 9),
-#endif
 #ifdef FONT_OMRON12x20
-   BUILTIN_FONT(omron12x20, 10),
+   BUILTIN_FONT(omron12x20, 8),
 #endif
 #undef BUILTIN_FONT
 };



Harmonize battery state thresholds accross platforms

2016-12-01 Thread Frederic Cambus
Hi tech@,

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

Comments? OK?

Index: sys/arch/loongson/dev/kb3310.c
===
RCS file: /cvs/src/sys/arch/loongson/dev/kb3310.c,v
retrieving revision 1.21
diff -u -p -r1.21 kb3310.c
--- sys/arch/loongson/dev/kb3310.c  15 Nov 2016 13:53:35 -  1.21
+++ sys/arch/loongson/dev/kb3310.c  27 Nov 2016 22:22:31 -
@@ -408,8 +408,7 @@ ykbec_refresh(void *arg)
ykbec_apmdata.battery_state = APM_BATT_CHARGING;
else if (ISSET(bat_status, BAT_STATUS_BAT_LOW))
ykbec_apmdata.battery_state = APM_BATT_CRITICAL;
-   /* XXX arbitrary */
-   else if (cap_pct > 60)
+   else if (cap_pct > 50)
ykbec_apmdata.battery_state = APM_BATT_HIGH;
else
ykbec_apmdata.battery_state = APM_BATT_LOW;
Index: sys/arch/loongson/dev/stsec.c
===
RCS file: /cvs/src/sys/arch/loongson/dev/stsec.c,v
retrieving revision 1.4
diff -u -p -r1.4 stsec.c
--- sys/arch/loongson/dev/stsec.c   8 Mar 2010 20:56:20 -   1.4
+++ sys/arch/loongson/dev/stsec.c   27 Nov 2016 22:22:31 -
@@ -323,13 +323,12 @@ stsec_sensors_update(void *vsc)
} else {
if (ISSET(control, STC_CHARGE_ENABLE))
stsec_apmdata.battery_state = APM_BATT_CHARGING;
-   /* XXX arbitrary */
-   else if (cap_pct < 10)
-   stsec_apmdata.battery_state = APM_BATT_CRITICAL;
-   else if (cap_pct > 60)
+   else if (cap_pct > 50)
stsec_apmdata.battery_state = APM_BATT_HIGH;
-   else
+   else if (cap_pct > 25)
stsec_apmdata.battery_state = APM_BATT_LOW;
+   else
+   stsec_apmdata.battery_state = APM_BATT_CRITICAL;
 
stsec_apmdata.minutes_left = -1; /* unknown */
}
Index: sys/arch/macppc/dev/apm.c
===
RCS file: /cvs/src/sys/arch/macppc/dev/apm.c,v
retrieving revision 1.18
diff -u -p -r1.18 apm.c
--- sys/arch/macppc/dev/apm.c   8 Oct 2016 05:49:08 -   1.18
+++ sys/arch/macppc/dev/apm.c   27 Nov 2016 22:22:31 -
@@ -273,13 +273,12 @@ apmioctl(dev_t dev, u_long cmd, caddr_t 
power->minutes_left =
((batt.cur_charge * 3600) / (-batt.draw)) / 60;
 
-   /* XXX - Arbitrary */
-   if (power->battery_life > 60)
+   if (power->battery_life > 50)
power->battery_state = APM_BATT_HIGH;
-   else if (power->battery_life < 10)
-   power->battery_state = APM_BATT_CRITICAL;
-   else
+   else if (power->battery_life > 25)
power->battery_state = APM_BATT_LOW;
+   else
+   power->battery_state = APM_BATT_CRITICAL;
}
break;
case APM_IOC_STANDBY_REQ:



Remove useless #ifndef in atc(6) and pom(6)

2016-12-01 Thread Frederic Cambus
Hi tech@,

M_PI is always defined, so we can drop those directives.

Index: games/atc/def.h
===
RCS file: /cvs/src/games/atc/def.h,v
retrieving revision 1.5
diff -u -p -r1.5 def.h
--- games/atc/def.h 3 Jun 2003 03:01:38 -   1.5
+++ games/atc/def.h 1 Dec 2016 13:39:53 -
@@ -46,10 +46,6 @@
 
 #define AUTHOR_STR "ATC - by Ed James"
 
-#ifndef M_PI
-#define M_PI   3.14159265358979323846
-#endif
-
 #define LOWFUEL15
 
 #define REALLOC10
Index: games/pom/pom.c
===
RCS file: /cvs/src/games/pom/pom.c,v
retrieving revision 1.24
diff -u -p -r1.24 pom.c
--- games/pom/pom.c 11 Sep 2016 14:21:18 -  1.24
+++ games/pom/pom.c 1 Dec 2016 13:39:54 -
@@ -54,10 +54,6 @@
 #include 
 #include 
 
-#ifndef M_PI
-#defineM_PI  3.14159265358979323846
-#endif
-
 #defineEPOCH 90
 #defineEPSILONg  279.403303/* solar ecliptic long at EPOCH */
 #defineRHOg  282.768422/* solar ecliptic long of perigee at 
EPOCH */



Display color depth when attaching inteldrm and radeondrm

2017-01-06 Thread Frederic Cambus
Hi tech@,

Here's a diff to display color depth alongside resolution when attaching
inteldrm and radeondrm, using the same scheme as efifb(4). This is the
first step in trying to have all frame buffer drivers display resolution
and depth the same way.

Tested only with inteldrm.

On this machine, it now displays: inteldrm0: 1600x900, 32bpp

Comments? OK?

Index: sys/dev/pci/drm/i915/i915_drv.c
===
RCS file: /cvs/src/sys/dev/pci/drm/i915/i915_drv.c,v
retrieving revision 1.100
diff -u -p -r1.100 i915_drv.c
--- sys/dev/pci/drm/i915/i915_drv.c 8 Apr 2016 08:27:53 -   1.100
+++ sys/dev/pci/drm/i915/i915_drv.c 5 Jan 2017 21:45:13 -
@@ -1508,8 +1508,8 @@ inteldrm_attach(struct device *parent, s
efifb_cndetach();
 #endif
 
-   printf("%s: %dx%d\n", dev_priv->sc_dev.dv_xname,
-   ri->ri_width, ri->ri_height);
+   printf("%s: %dx%d, %dbpp\n", dev_priv->sc_dev.dv_xname,
+   ri->ri_width, ri->ri_height, ri->ri_depth);
 
intel_fbdev_restore_mode(dev);
 
Index: sys/dev/pci/drm/radeon/radeon_kms.c
===
RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon_kms.c,v
retrieving revision 1.48
diff -u -p -r1.48 radeon_kms.c
--- sys/dev/pci/drm/radeon/radeon_kms.c 8 Apr 2016 08:27:53 -   1.48
+++ sys/dev/pci/drm/radeon/radeon_kms.c 5 Jan 2017 21:45:13 -
@@ -769,7 +769,8 @@ radeondrm_attachhook(struct device *self
radeon_vga_set_state(rdev, false);
pci_disable_legacy_vga(>dev);
 
-   printf("%s: %dx%d\n", rdev->dev.dv_xname, ri->ri_width, ri->ri_height);
+   printf("%s: %dx%d, %dbpp\n", rdev->dev.dv_xname,
+   ri->ri_width, ri->ri_height, ri->ri_depth);
 
config_found_sm(>dev, , wsemuldisplaydevprint,
wsemuldisplaydevsubmatch);



Ansify cpu_sysctl() on mips64 platforms

2017-01-05 Thread Frederic Cambus
Hi tech@,

Here is a diff to ansify cpu_sysctl() on mips64 platforms.

Comments? OK?

Index: sys/arch/loongson/loongson/machdep.c
===
RCS file: /cvs/src/sys/arch/loongson/loongson/machdep.c,v
retrieving revision 1.70
diff -u -p -r1.70 machdep.c
--- sys/arch/loongson/loongson/machdep.c16 Dec 2016 12:01:19 -  
1.70
+++ sys/arch/loongson/loongson/machdep.c5 Jan 2017 22:27:45 -
@@ -1003,14 +1003,8 @@ cpu_startup()
  * Machine dependent system variables.
  */
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
/* All sysctl names at this level are terminal. */
if (namelen != 1)
Index: sys/arch/octeon/octeon/machdep.c
===
RCS file: /cvs/src/sys/arch/octeon/octeon/machdep.c,v
retrieving revision 1.81
diff -u -p -r1.81 machdep.c
--- sys/arch/octeon/octeon/machdep.c17 Dec 2016 14:14:09 -  1.81
+++ sys/arch/octeon/octeon/machdep.c5 Jan 2017 22:27:45 -
@@ -669,14 +669,8 @@ process_bootargs(void)
  * Machine dependent system variables.
  */
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
/* All sysctl names at this level are terminal. */
if (namelen != 1)
Index: sys/arch/sgi/sgi/machdep.c
===
RCS file: /cvs/src/sys/arch/sgi/sgi/machdep.c,v
retrieving revision 1.153
diff -u -p -r1.153 machdep.c
--- sys/arch/sgi/sgi/machdep.c  9 Oct 2016 11:25:40 -   1.153
+++ sys/arch/sgi/sgi/machdep.c  5 Jan 2017 22:27:45 -
@@ -795,14 +795,8 @@ cpu_startup()
  * Machine dependent system variables.
  */
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
-   int *name;
-   u_int namelen;
-   void *oldp;
-   size_t *oldlenp;
-   void *newp;
-   size_t newlen;
-   struct proc *p;
+cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
+size_t newlen, struct proc *p)
 {
/* All sysctl names at this level are terminal. */
if (namelen != 1)



Re: Some tweaks for smfb(4)

2017-01-09 Thread Frederic Cambus
On Tue, Dec 27, 2016 at 11:39:26PM +0100, Frederic Cambus wrote:
> 
> > > Here is a diff with some tweaks for smfb(4):
> > > 
> > > - Display resolution and color depth when attaching
> > 
> > We should try to do so in a uniform way though.  None of our drivers
> > print the words "frame buffer".  Most of them only print the
> > resolution, but I can see the additional value of printing the depth
> > as well.  Perhaps we should do that for the other framebuffers as well.
> 
> All other frame buffer drivers on Loongson (radeonfb and sisfb) print
> it this way, that's why I used the same scheme here. It seems sgi
> drivers also do it this way.
> 
> I'm all for trying to do things in an uniform way though, and find the
> formatting used by efifb(4) possibly better: ": %dx%d, %dbpp\n". Any
> thoughts on this?

Following up on this, here is a revised version of the diff, which only
keeps the part adding resolution and color depth display when attaching.

The output has been updated to follow the efifb(4) scheme.

Comments? OK?

Index: sys/arch/loongson/dev/smfb.c
===
RCS file: /cvs/src/sys/arch/loongson/dev/smfb.c,v
retrieving revision 1.16
diff -u -p -r1.16 smfb.c
--- sys/arch/loongson/dev/smfb.c21 Oct 2013 10:36:14 -  1.16
+++ sys/arch/loongson/dev/smfb.c9 Jan 2017 15:29:54 -
@@ -202,6 +202,7 @@ void
 smfb_attach_common(struct smfb_softc *sc, int is5xx, bus_space_tag_t memt,
 bus_space_handle_t memh, bus_space_tag_t mmiot, bus_space_handle_t mmioh)
 {
+   struct smfb *fb;
struct wsemuldisplaydev_attach_args waa;
int console;
 
@@ -219,8 +220,9 @@ smfb_attach_common(struct smfb_softc *sc
}
}
 
-   /* XXX print resolution */
-   printf("\n");
+   fb = sc->sc_fb;
+   printf(": %dx%d, %dbpp\n",
+   fb->ri.ri_width, fb->ri.ri_height, fb->ri.ri_depth);
 
sc->sc_scrlist[0] = >sc_fb->wsd;
sc->sc_wsl.nscreens = 1;



Use explicit_bzero() to wipe copybuffer at console logout

2017-01-10 Thread Frederic Cambus
Hi tech@,

Use explicit_bzero() to wipe copybuffer when logging out of the console.

Comments? OK?

Index: sys/dev/wscons/wsdisplay.c
===
RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.125
diff -u -p -r1.125 wsdisplay.c
--- sys/dev/wscons/wsdisplay.c  7 Nov 2016 00:26:33 -   1.125
+++ sys/dev/wscons/wsdisplay.c  10 Jan 2017 09:34:11 -
@@ -935,7 +935,7 @@ wsdisplayclose(dev_t dev, int flag, int 
 #ifdef HAVE_WSMOUSED_SUPPORT
/* remove the selection at logout */
if (sc->sc_copybuffer != NULL)
-   bzero(sc->sc_copybuffer, sc->sc_copybuffer_size);
+   explicit_bzero(sc->sc_copybuffer, sc->sc_copybuffer_size);
CLR(sc->sc_flags, SC_PASTE_AVAIL);
 #endif
 



Some tweaks for smfb(4)

2016-12-19 Thread Frederic Cambus
Hi tech@,

Here is a diff with some tweaks for smfb(4):

- Display resolution and color depth when attaching
- Do not hardcode 'wantrows' and 'wantcols' when calling rasops_init

Comments? OK?

Index: sys/arch/loongson/dev/smfb.c
===
RCS file: /cvs/src/sys/arch/loongson/dev/smfb.c,v
retrieving revision 1.16
diff -u -p -r1.16 smfb.c
--- sys/arch/loongson/dev/smfb.c21 Oct 2013 10:36:14 -  1.16
+++ sys/arch/loongson/dev/smfb.c18 Dec 2016 22:51:52 -
@@ -202,6 +202,7 @@ void
 smfb_attach_common(struct smfb_softc *sc, int is5xx, bus_space_tag_t memt,
 bus_space_handle_t memh, bus_space_tag_t mmiot, bus_space_handle_t mmioh)
 {
+   struct smfb *fb;
struct wsemuldisplaydev_attach_args waa;
int console;
 
@@ -219,8 +220,9 @@ smfb_attach_common(struct smfb_softc *sc
}
}
 
-   /* XXX print resolution */
-   printf("\n");
+   fb = sc->sc_fb;
+   printf(": %dx%dx%d frame buffer\n",
+   fb->ri.ri_width, fb->ri.ri_height, fb->ri.ri_depth);
 
sc->sc_scrlist[0] = >sc_fb->wsd;
sc->sc_wsl.nscreens = 1;
@@ -413,7 +415,7 @@ smfb_setup(struct smfb *fb, bus_space_ta
ri->ri_bpos = 0;
 #endif
 
-   rasops_init(ri, 160, 160);
+   rasops_init(ri, ri->ri_height / 8, ri->ri_width / 8);
 
strlcpy(fb->wsd.name, "std", sizeof(fb->wsd.name));
fb->wsd.ncols = ri->ri_cols;



Re: Some tweaks for smfb(4)

2016-12-27 Thread Frederic Cambus
On Mon, Dec 19, 2016 at 12:21:54PM +0100, Mark Kettenis wrote:

> > Here is a diff with some tweaks for smfb(4):
> > 
> > - Display resolution and color depth when attaching
> 
> We should try to do so in a uniform way though.  None of our drivers
> print the words "frame buffer".  Most of them only print the
> resolution, but I can see the additional value of printing the depth
> as well.  Perhaps we should do that for the other framebuffers as well.

All other frame buffer drivers on Loongson (radeonfb and sisfb) print
it this way, that's why I used the same scheme here. It seems sgi
drivers also do it this way.

I'm all for trying to do things in an uniform way though, and find the
formatting used by efifb(4) possibly better: ": %dx%d, %dbpp\n". Any
thoughts on this?

> > - Do not hardcode 'wantrows' and 'wantcols' when calling rasops_init
> 
> That is undesirable.  The whole idea here is to put some fixed limits
> on the number of rows and colums such that the lines don't get
> insanely long and scrolling doesn't get too slow because the number of
> rows is ridiculously large.
> 
> If you are concerned about the framebuffer console only using a
> limited part of the screen, see my reply to reyk@ from last week.

In this case, the opposite: smfb assumes a fixed 1024x600 or 800x480
resolution so the hardcoded values are too large. On sgi, some drivers
divide screen width and height by the size of the smallest possible
usable font (8x8), so that was the idea.

> Basically, we need to add a bigger console font.

That makes sense, and this is something I'm interested in working on.
I recently imported psftools in ports to be able to start converting
some fonts and started experimenting.



Re: Fix broken example link in packages.7

2017-03-27 Thread Frederic Cambus
On Wed, Mar 01, 2017 at 11:16:57PM +, Stuart Henderson wrote:

> > -# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
> > +# export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/%c/packages/%a/
> 
> Hmm - if you're going to trust autodetection of snapshots vs release
> anyway (as you do with %c), you could simply "export 
> PKG_PATH=ftp.openbsd.org" ...
> 
> Not sure which is better though.

Sounds good to me, espie@ likes it as well, and this also addresses the
concern pointed by Raf Czlonka. So here is a new diff.

Comments? OK?

Index: share/man/man7/packages.7
===
RCS file: /cvs/src/share/man/man7/packages.7,v
retrieving revision 1.40
diff -u -p -r1.40 packages.7
--- share/man/man7/packages.7   24 Oct 2015 08:44:49 -  1.40
+++ share/man/man7/packages.7   27 Mar 2017 19:14:12 -
@@ -240,7 +240,7 @@ are supported: pointing
 .Ev PKG_PATH
 to a distant package repository, e.g.,
 .Bd -literal -offset 1n
-# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
+# export PKG_PATH=ftp.openbsd.org
 .Ed
 .Pp
 will let



fsck_ffs(8): remove always false comparison

2017-04-09 Thread Frederic Cambus
Hi tech@,

Remove always false comparison: inosused type is ino_t, which is
unsigned.

While there, fix a whitespace issue.

Comments? OK?

Index: sbin/fsck_ffs/pass1.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass1.c,v
retrieving revision 1.43
diff -u -p -r1.43 pass1.c
--- sbin/fsck_ffs/pass1.c   22 Aug 2015 06:00:27 -  1.43
+++ sbin/fsck_ffs/pass1.c   9 Apr 2017 15:59:55 -
@@ -126,11 +126,9 @@ pass1(void)
}
break;
}
-   if (inosused < 0)
-   inosused = 0;
}
/*
-* Allocate inoinfo structures for the allocated inodes.
+* Allocate inoinfo structures for the allocated inodes.
 */
inostathead[c].il_numalloced = inosused;
if (inosused == 0) {



adventure(6): clean up disabled declaration

2017-04-10 Thread Frederic Cambus
Hi tech@,

Clean up disabled declaration in the text struct.

Comments? OK?

Index: games/adventure/hdr.h
===
RCS file: /cvs/src/games/adventure/hdr.h,v
retrieving revision 1.15
diff -u -p -r1.15 hdr.h
--- games/adventure/hdr.h   8 Mar 2016 10:48:39 -   1.15
+++ games/adventure/hdr.h   10 Apr 2017 09:24:28 -
@@ -85,9 +85,6 @@ struct hashtab{   /* hash table for voca
 } voc[HTSIZE];
 
 struct text {
-#ifdef OLDSTUFF
-   int seekadr;/* DATFILE must be < 2**16  */
-#endif /* OLDSTUFF */
char *seekadr;  /* Msg start in virtual disk*/
int txtlen; /* length of msg starting here  */
 };



Re: relayd(8): convert explicit_bzero() + free() to freezero()

2017-04-11 Thread Frederic Cambus
On Mon, Apr 10, 2017 at 05:43:33PM +0200, Claudio Jeker wrote:

> > --- usr.sbin/relayd/relayd.c24 Jan 2017 10:49:14 -  1.165
> > +++ usr.sbin/relayd/relayd.c10 Apr 2017 15:06:38 -
> > @@ -550,8 +550,7 @@ purge_key(char **ptr, off_t len)
> > if (key == NULL || len == 0)
> > return;
> 
> I think this can also be dropped because freezero(NULL, 0) is save.

Indeed, saw the thread regarding imsg, that makes sense.

Revised diff below.

OK?

Index: usr.sbin/relayd/relayd.c
===
RCS file: /cvs/src/usr.sbin/relayd/relayd.c,v
retrieving revision 1.165
diff -u -p -r1.165 relayd.c
--- usr.sbin/relayd/relayd.c24 Jan 2017 10:49:14 -  1.165
+++ usr.sbin/relayd/relayd.c11 Apr 2017 06:57:26 -
@@ -547,11 +547,7 @@ purge_key(char **ptr, off_t len)
 {
char*key = *ptr;
 
-   if (key == NULL || len == 0)
-   return;
-
-   explicit_bzero(key, len);
-   free(key);
+   freezero(key, len);
 
*ptr = NULL;
 }



relayd(8): convert explicit_bzero() + free() to freezero()

2017-04-10 Thread Frederic Cambus
Hi tech@,

Convert explicit_bzero() + free() to freezero().

Comments? OK?

Index: usr.sbin/relayd/relayd.c
===
RCS file: /cvs/src/usr.sbin/relayd/relayd.c,v
retrieving revision 1.165
diff -u -p -r1.165 relayd.c
--- usr.sbin/relayd/relayd.c24 Jan 2017 10:49:14 -  1.165
+++ usr.sbin/relayd/relayd.c10 Apr 2017 15:06:38 -
@@ -550,8 +550,7 @@ purge_key(char **ptr, off_t len)
if (key == NULL || len == 0)
return;
 
-   explicit_bzero(key, len);
-   free(key);
+   freezero(key, len);
 
*ptr = NULL;
 }



Mention maximum number of allowed fonts in wsfontload.8

2017-03-07 Thread Frederic Cambus
Hi tech@,

WSDISPLAY_MAXFONTCOUNT macro was introduced in sys/dev/wscons/wsconsio.h
(revision 1.75) to limit the number of fonts that can be loaded.

Reflect that in the man page as well.

Comments? OK?

Index: usr.sbin/wsfontload/wsfontload.8
===
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.8,v
retrieving revision 1.19
diff -u -p -r1.19 wsfontload.8
--- usr.sbin/wsfontload/wsfontload.820 Oct 2013 13:22:44 -  1.19
+++ usr.sbin/wsfontload/wsfontload.87 Mar 2017 11:25:57 -
@@ -112,6 +112,8 @@ and 12 for raster displays.
 No font files are provided with the wscons framework.
 The fonts installed by PCVT can be used instead, as can raw font files from
 other operating system distributions.
+.Pp
+A maximum of 8 fonts can be loaded.
 .Sh FILES
 .Bl -tag -width "/usr/share/misc/pcvtfonts/XX" -compact
 .\" .It Pa /etc/wscons.conf



Fix style.9 offenders in includes

2017-03-07 Thread Frederic Cambus
Hi tech@,

Here is a diff to fix style.9 offenders in includes.

Prototypes should not have variable names associated with the types.

Comments? OK?

Index: bsd_auth.h
===
RCS file: /cvs/src/include/bsd_auth.h,v
retrieving revision 1.10
diff -u -p -r1.10 bsd_auth.h
--- bsd_auth.h  21 Apr 2014 11:27:34 -  1.10
+++ bsd_auth.h  26 Feb 2017 23:08:15 -
@@ -85,7 +85,7 @@ intauth_call(auth_session_t *, char *,
 
 int auth_setdata(auth_session_t *, void *, size_t);
 int auth_setoption(auth_session_t *, char *, char *);
-int auth_setpwd(auth_session_t *, struct passwd *pwd);
+int auth_setpwd(auth_session_t *, struct passwd *);
 voidauth_set_va_list(auth_session_t *, __va_list);
 
 struct passwd *auth_getpwd(auth_session_t *);
Index: icdb.h
===
RCS file: /cvs/src/include/icdb.h,v
retrieving revision 1.4
diff -u -p -r1.4 icdb.h
--- icdb.h  4 Sep 2016 14:51:39 -   1.4
+++ icdb.h  26 Feb 2017 23:08:15 -
@@ -24,20 +24,19 @@ __BEGIN_DECLS
 
 struct icdb;
 
-struct icdb *icdb_new(uint32_t version, uint32_t nentries, uint32_t entrysize,
-uint32_t nkeys, const uint32_t *keysizes, const uint32_t *keyoffsets);
+struct icdb *icdb_new(uint32_t, uint32_t, uint32_t, uint32_t,
+const uint32_t *, const uint32_t *);
 
-struct icdb *icdb_open(const char *name, int flags, uint32_t version);
-int icdb_get(struct icdb *db, void *entry, uint32_t idx);
-int icdb_lookup(struct icdb *db, int keynum, const void *key, void *entry,
-uint32_t *idxp);
-int icdb_nentries(struct icdb *db);
-const void *icdb_entries(struct icdb *db);
-int icdb_update(struct icdb *db, const void *entry, int offset);
-int icdb_add(struct icdb *db, const void *entry);
-int icdb_rehash(struct icdb *db);
-int icdb_save(struct icdb *db, int fd);
-int icdb_close(struct icdb *db);
+struct icdb *icdb_open(const char *, int, uint32_t);
+int icdb_get(struct icdb *, void *, uint32_t);
+int icdb_lookup(struct icdb *, int, const void *, void *, uint32_t *);
+int icdb_nentries(struct icdb *);
+const void *icdb_entries(struct icdb *);
+int icdb_update(struct icdb *, const void *, int);
+int icdb_add(struct icdb *, const void *);
+int icdb_rehash(struct icdb *);
+int icdb_save(struct icdb *, int);
+int icdb_close(struct icdb *);
 
 __END_DECLS
 
Index: pwd.h
===
RCS file: /cvs/src/include/pwd.h,v
retrieving revision 1.24
diff -u -p -r1.24 pwd.h
--- pwd.h   18 Nov 2015 16:44:46 -  1.24
+++ pwd.h   26 Feb 2017 23:08:15 -
@@ -96,9 +96,9 @@ struct passwd *getpwnam(const char *);
 struct passwd  *getpwuid_shadow(uid_t);
 struct passwd  *getpwnam_shadow(const char *);
 intgetpwnam_r(const char *, struct passwd *, char *, size_t,
-   struct passwd **result);
-intgetpwuid_r(uid_t uid, struct passwd *, char *buf, size_t buflen,
-   struct passwd **result);
+   struct passwd **);
+intgetpwuid_r(uid_t, struct passwd *, char *, size_t,
+   struct passwd **);
 #if __BSD_VISIBLE || __XPG_VISIBLE
 struct passwd  *getpwent(void);
 voidsetpwent(void);
Index: signal.h
===
RCS file: /cvs/src/include/signal.h,v
retrieving revision 1.25
diff -u -p -r1.25 signal.h
--- signal.h9 May 2016 23:55:52 -   1.25
+++ signal.h26 Feb 2017 23:08:15 -
@@ -124,7 +124,7 @@ int sigaltstack(const struct sigaltstack
 intsigblock(int);
 intsigsetmask(int);
 intsigvec(int, struct sigvec *, struct sigvec *);
-intthrkill(pid_t _tid, int _signum, void *_tcb);
+intthrkill(pid_t, int, void *);
 #endif
 #endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
 #if __BSD_VISIBLE ||  __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500
Index: unistd.h
===
RCS file: /cvs/src/include/unistd.h,v
retrieving revision 1.103
diff -u -p -r1.103 unistd.h
--- unistd.h12 Sep 2016 19:36:26 -  1.103
+++ unistd.h26 Feb 2017 23:08:15 -
@@ -519,10 +519,10 @@ intsetresgid(gid_t, gid_t, gid_t);
 int setresuid(uid_t, uid_t, uid_t);
 voidsetusershell(void);
 int strtofflags(char **, u_int32_t *, u_int32_t *);
-int swapctl(int cmd, const void *arg, int misc);
+int swapctl(int, const void *, int);
 int syscall(int, ...);
 int getentropy(void *, size_t);
-int pledge(const char *, const char **paths);
+int pledge(const char *, const char **);
 pid_t   __tfork_thread(const struct __tfork *, size_t, void (*)(void *),
void *);
 #endif /* __BSD_VISIBLE */



Fix broken example link in packages.7

2017-02-28 Thread Frederic Cambus
Hi tech@,

In packages.7, PKG_PATH points to a broken link. This diff fixes it.

Comments? OK?

Index: share/man/man7/packages.7
===
RCS file: /cvs/src/share/man/man7/packages.7,v
retrieving revision 1.40
diff -u -p -r1.40 packages.7
--- share/man/man7/packages.7   24 Oct 2015 08:44:49 -  1.40
+++ share/man/man7/packages.7   28 Feb 2017 19:20:43 -
@@ -240,7 +240,7 @@ are supported: pointing
 .Ev PKG_PATH
 to a distant package repository, e.g.,
 .Bd -literal -offset 1n
-# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/5.2/packages/i386/
+# export PKG_PATH=https://ftp.openbsd.org/pub/OpenBSD/6.0/packages/i386/
 .Ed
 .Pp
 will let



shutdown(8): warn format string should be literal

2017-04-03 Thread Frederic Cambus
Hi tech@,

warn format string should be literal.

Comments? OK?

Index: sbin/shutdown/shutdown.c
===
RCS file: /cvs/src/sbin/shutdown/shutdown.c,v
retrieving revision 1.45
diff -u -p -r1.45 shutdown.c
--- sbin/shutdown/shutdown.c1 Sep 2016 09:50:38 -   1.45
+++ sbin/shutdown/shutdown.c3 Apr 2017 20:16:45 -
@@ -397,7 +397,7 @@ die_you_gravy_sucking_pig_dog(void)
*arg++ = NULL;
execve(path, args, NULL);
syslog(LOG_ERR, "shutdown: can't exec %s: %m.", path);
-   warn(path);
+   warn("%s", path);
}
if (access(_PATH_RC, R_OK) != -1) {
pid_t pid;



Remove duplicated commented out include in files.i386

2017-08-02 Thread Frederic Cambus
Hi tech@,

Remove duplicated commented out "dev/rasops/files.rasops" include.

Comments? OK?

Index: sys/arch/i386/conf/files.i386
===
RCS file: /cvs/src/sys/arch/i386/conf/files.i386,v
retrieving revision 1.233
diff -u -p -r1.233 files.i386
--- sys/arch/i386/conf/files.i386   31 May 2017 19:18:18 -  1.233
+++ sys/arch/i386/conf/files.i386   2 Aug 2017 19:30:30 -
@@ -411,8 +411,6 @@ device  esm
 attach esm at mainbus
 file   arch/i386/i386/esm.cesm needs-flag
 
-#include "dev/rasops/files.rasops"
-
 # quad support is necessary for 32 bit architectures
 file lib/libkern/adddi3.c
 file lib/libkern/anddi3.c



wscons(4): set WS_KERNEL_COLATTR to WSATTR_HILIT in vt100 emulation

2017-08-12 Thread Frederic Cambus
Hi tech@,

Currently, output originating from the kernel is displayed using
WSCOL_WHITE on WSCOL_BLUE, which translates to NORMAL_WHITE on
NORMAL_BLUE.

When booting in BIOS mode, NORMAL_WHITE is 0xaa in text mode
(which is very hard to read on a blue backgroud), and when framebuffer
attaches, NORMAL_WHITE becomes 0xc7c7c7.

The proposed change makes text display using HILITE_WHITE, which
is 0xff in both text mode and framebuffer console.

I've been running with this diff for a while now and find kernel
messages easier to read this way, especially in text mode.

Comments? OK?

Index: sys/dev/wscons/wsemul_vt100.c
===
RCS file: /cvs/src/sys/dev/wscons/wsemul_vt100.c,v
retrieving revision 1.36
diff -u -p -r1.36 wsemul_vt100.c
--- sys/dev/wscons/wsemul_vt100.c   10 Aug 2017 09:12:32 -  1.36
+++ sys/dev/wscons/wsemul_vt100.c   12 Aug 2017 14:42:28 -
@@ -171,7 +171,7 @@ wsemul_vt100_cnattach(const struct wsscr
 #define WS_KERNEL_BG WSCOL_BLUE
 #endif
 #ifndef WS_KERNEL_COLATTR
-#define WS_KERNEL_COLATTR 0
+#define WS_KERNEL_COLATTR WSATTR_HILIT
 #endif
 #ifndef WS_KERNEL_MONOATTR
 #define WS_KERNEL_MONOATTR 0



backgammon(6): remove compiled out user count checks

2017-07-11 Thread Frederic Cambus
Hi tech@,

The user count checks have been compiled out since 1998, let's get rid
of them.

Comments? OK?

Index: games/backgammon/backgammon/main.c
===
RCS file: /cvs/src/games/backgammon/backgammon/main.c,v
retrieving revision 1.23
diff -u -p -r1.23 main.c
--- games/backgammon/backgammon/main.c  3 Jan 2016 14:38:16 -   1.23
+++ games/backgammon/backgammon/main.c  10 Jul 2017 17:48:06 -
@@ -35,7 +35,6 @@
 #include "backlocal.h"
 
 #define MVPAUSE5   /* time to sleep when stuck */
-/* #define MAXUSERS 35 */  /* maximum number of users */
 
 extern const char   *const instruct[]; /* text of instructions */
 
@@ -91,14 +90,6 @@ main (int argc, char **argv)
 
signal(SIGINT, getout); /* trap interrupts */
 
-/* check user count */
-#if 0
-   if (ucount() > MAXUSERS)  {
-   printw("%s%d%s", user1a, MAXUSERS, user1b);
-   getout(0);
-   }
-#endif
-
/* use whole screen for text */
begscr = 0;
 
@@ -394,15 +385,6 @@ main (int argc, char **argv)
 
/* write score */
wrscore();
-
-/* check user count */
-#if 0
-   if (ucount() > MAXUSERS)  {
-   printw("%s%d%s", user2a, MAXUSERS, user2b);
-   rfl = 1;
-   break;
-   }
-#endif
 
/* see if he wants another game */
addstr(again);



telnet(1): remove unnecessary #ifdefs

2017-07-05 Thread Frederic Cambus
Hi tech@,

Remove unnecessary #ifdefs in telnet. No binary change.

Comments? OK?

Index: usr.bin/telnet/externs.h
===
RCS file: /cvs/src/usr.bin/telnet/externs.h,v
retrieving revision 1.30
diff -u -p -r1.30 externs.h
--- usr.bin/telnet/externs.h24 Nov 2015 05:06:24 -  1.30
+++ usr.bin/telnet/externs.h5 Jul 2017 09:18:09 -
@@ -277,55 +277,15 @@ extern struct termios new_tc;
 # define termKillChar  new_tc.c_cc[VKILL]
 # define termQuitChar  new_tc.c_cc[VQUIT]
 # define termSuspChar  new_tc.c_cc[VSUSP]
-
-# if   defined(VFLUSHO) && !defined(VDISCARD)
-#  define VDISCARD VFLUSHO
-# endif
-# ifndef   VDISCARD
-extern cc_t termFlushChar;
-# else
-#  define termFlushCharnew_tc.c_cc[VDISCARD]
-# endif
-# ifndef VWERASE
-extern cc_t termWerasChar;
-# else
-#  define termWerasCharnew_tc.c_cc[VWERASE]
-# endif
-# ifndef   VREPRINT
-extern cc_t termRprntChar;
-# else
-#  define termRprntCharnew_tc.c_cc[VREPRINT]
-# endif
-# ifndef   VLNEXT
-extern cc_t termLiteralNextChar;
-# else
-#  define termLiteralNextChar  new_tc.c_cc[VLNEXT]
-# endif
-# ifndef   VSTART
-extern cc_t termStartChar;
-# else
-#  define termStartCharnew_tc.c_cc[VSTART]
-# endif
-# ifndef   VSTOP
-extern cc_t termStopChar;
-# else
-#  define termStopChar new_tc.c_cc[VSTOP]
-# endif
-# ifndef   VEOL
-extern cc_t termForw1Char;
-# else
-#  define termForw1Charnew_tc.c_cc[VEOL]
-# endif
-# ifndef   VEOL2
-extern cc_t termForw2Char;
-# else
-#  define termForw2Charnew_tc.c_cc[VEOL]
-# endif
-# ifndef   VSTATUS
-extern cc_t termAytChar;
-#else
-#  define termAytChar  new_tc.c_cc[VSTATUS]
-#endif
+# define termFlushChar new_tc.c_cc[VDISCARD]
+# define termWerasChar new_tc.c_cc[VWERASE]
+# define termRprntChar new_tc.c_cc[VREPRINT]
+# define termLiteralNextChar   new_tc.c_cc[VLNEXT]
+# define termStartChar new_tc.c_cc[VSTART]
+# define termStopChar  new_tc.c_cc[VSTOP]
+# define termForw1Char new_tc.c_cc[VEOL]
+# define termForw2Char new_tc.c_cc[VEOL]
+# define termAytChar   new_tc.c_cc[VSTATUS]
 
 /* Ring buffer structures which are shared */
 
Index: usr.bin/telnet/sys_bsd.c
===
RCS file: /cvs/src/usr.bin/telnet/sys_bsd.c,v
retrieving revision 1.32
diff -u -p -r1.32 sys_bsd.c
--- usr.bin/telnet/sys_bsd.c16 Mar 2016 15:41:11 -  1.32
+++ usr.bin/telnet/sys_bsd.c5 Jul 2017 09:18:09 -
@@ -123,28 +123,6 @@ TerminalSaveState(void)
 tcgetattr(0, _tc);
 
 new_tc = old_tc;
-
-#ifndefVDISCARD
-termFlushChar = CONTROL('O');
-#endif
-#ifndefVWERASE
-termWerasChar = CONTROL('W');
-#endif
-#ifndefVREPRINT
-termRprntChar = CONTROL('R');
-#endif
-#ifndefVLNEXT
-termLiteralNextChar = CONTROL('V');
-#endif
-#ifndefVSTART
-termStartChar = CONTROL('Q');
-#endif
-#ifndefVSTOP
-termStopChar = CONTROL('S');
-#endif
-#ifndefVSTATUS
-termAytChar = CONTROL('T');
-#endif
 }
 
 cc_t *
@@ -161,22 +139,11 @@ tcval(int func)
 case SLC_FORW1:return();
 case SLC_FORW2:return();
 case SLC_SUSP: return();
-# ifdefVDISCARD
 case SLC_AO:   return();
-# endif
-# ifdefVWERASE
 case SLC_EW:   return();
-# endif
-# ifdefVREPRINT
 case SLC_RP:   return();
-# endif
-# ifdefVLNEXT
 case SLC_LNEXT:return();
-# endif
-# ifdefVSTATUS
 case SLC_AYT:  return();
-# endif
-
 case SLC_SYNCH:
 case SLC_BRK:
 case SLC_EOR:
@@ -189,27 +156,6 @@ void
 TerminalDefaultChars(void)
 {
 memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));
-# ifndef   VDISCARD
-termFlushChar = CONTROL('O');
-# endif
-# ifndef   VWERASE
-termWerasChar = CONTROL('W');
-# endif
-# ifndef   VREPRINT
-termRprntChar = CONTROL('R');
-# endif
-# ifndef   VLNEXT
-termLiteralNextChar = CONTROL('V');
-# endif
-# ifndef   VSTART
-termStartChar = CONTROL('Q');
-# endif
-# ifndef   VSTOP
-termStopChar = CONTROL('S');
-# endif
-# ifndef   VSTATUS
-termAytChar = CONTROL('T');
-# endif
 }
 
 /*
Index: usr.bin/telnet/terminal.c
===
RCS file: /cvs/src/usr.bin/telnet/terminal.c,v
retrieving revision 1.13
diff -u -p -r1.13 terminal.c
--- usr.bin/telnet/terminal.c   22 Jul 2014 07:30:24 -  1.13
+++ usr.bin/telnet/terminal.c   5 Jul 2017 09:18:09 -
@@ -41,34 +41,6 @@ unsigned charttyobuf[2*BUFSIZ], ttyibuf
 
 int termdata;  /* Debugging flag */
 
-# ifndef VDISCARD
-cc_t termFlushChar;
-# endif
-# ifndef VLNEXT
-cc_t termLiteralNextChar;
-# endif
-# ifndef VWERASE
-cc_t termWerasChar;
-# endif

lpt.4: make configuration lines match GENERIC files

2017-07-05 Thread Frederic Cambus
Hi tech@,

Make configuration lines match GENERIC files. This adds amd64 and splits
up alpha and i386.

Comments? OK?

Index: share/man/man4/lpt.4
===
RCS file: /cvs/src/share/man/man4/lpt.4,v
retrieving revision 1.7
diff -u -p -r1.7 lpt.4
--- share/man/man4/lpt.420 Jun 2007 17:44:07 -  1.7
+++ share/man/man4/lpt.45 Jul 2017 22:16:28 -
@@ -35,10 +35,18 @@
 .Nm lpt
 .Nd parallel port driver
 .Sh SYNOPSIS
-.Cd "# alpha/i386"
+.Cd "# alpha"
+.Cd "lpt* at isa? port 0x3bc irq 7"
+.Pp
+.Cd "# amd64"
+.Cd "lpt0 at isa? port 0x378 irq 7"
+.Cd "lpt* at puc?"
+.Pp
+.Cd "# i386"
 .Cd "lpt0 at isa? port 0x378 irq 7"
 .Cd "lpt1 at isa? port 0x278"
 .Cd "lpt2 at isa? port 0x3bc"
+.Cd "lpt* at puc?"
 .Pp
 .Cd "# hppa"
 .Cd "lpt0 at gsc? irq 7"



Update inaccurate comment in rasops(9)

2017-08-04 Thread Frederic Cambus
Hi tech@,

Update inaccurate comment: rasops_copycols() doesn't use bcopy()
anymore, but either memmove() or slow_bcopy().

Comments? OK?

Index: sys/dev/rasops/rasops.c
===
RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
retrieving revision 1.45
diff -u -p -r1.45 rasops.c
--- sys/dev/rasops/rasops.c 16 May 2017 02:22:51 -  1.45
+++ sys/dev/rasops/rasops.c 1 Aug 2017 21:32:14 -
@@ -660,8 +660,8 @@ rasops_copyrows(void *cookie, int src, i
 /*
  * Copy columns. This is slow, and hard to optimize due to alignment,
  * and the fact that we have to copy both left->right and right->left.
- * We simply cop-out here and use bcopy(), since it handles all of
- * these cases anyway.
+ * We simply cop-out here and use either memmove() or slow_bcopy(),
+ * since they handle all of these cases anyway.
  */
 int
 rasops_copycols(void *cookie, int row, int src, int dst, int num)



amd(8): plog format string should be literal

2017-07-28 Thread Frederic Cambus
Hi tech@,

plog format string should be literal.

Comments? OK?

Index: usr.sbin/amd/amd/ifs_ops.c
===
RCS file: /cvs/src/usr.sbin/amd/amd/ifs_ops.c,v
retrieving revision 1.5
diff -u -p -r1.5 ifs_ops.c
--- usr.sbin/amd/amd/ifs_ops.c  26 Oct 2014 02:43:50 -  1.5
+++ usr.sbin/amd/amd/ifs_ops.c  28 Jul 2017 19:22:56 -
@@ -63,7 +63,7 @@ ifs_init(mntfs *mf)
 {
mntfs *mf_link = (mntfs *) mf->mf_private;
if (mf_link == 0) {
-   plog(XLOG_FATAL, not_a_filesystem);
+   plog(XLOG_FATAL, "%s", not_a_filesystem);
return EINVAL;
}
 #ifdef notdef
@@ -89,7 +89,7 @@ ifs_inherit(mntfs *mf)
 */
mntfs *mf_link = (mntfs *) mf->mf_private;
if (mf_link == 0) {
-   plog(XLOG_FATAL, not_a_filesystem);
+   plog(XLOG_FATAL, "%s", not_a_filesystem);
return 0;   /*XXX*/
}
 



fsdb(8): remove erroneous h length modifier

2017-07-29 Thread Frederic Cambus
Hi tech@,

Remove erroneous h length modifier, the argument has type 'int'.

Comments? OK?

Index: sbin/fsdb/fsdbutil.c
===
RCS file: /cvs/src/sbin/fsdb/fsdbutil.c,v
retrieving revision 1.17
diff -u -p -r1.17 fsdbutil.c
--- sbin/fsdb/fsdbutil.c20 Jan 2015 18:22:21 -  1.17
+++ sbin/fsdb/fsdbutil.c28 Jul 2017 17:34:32 -
@@ -148,7 +148,7 @@ printstat(const char *cp, ino_t inum, un
else
printf("GID=%u ", DIP(dp, di_gid));
 
-   printf("LINKCNT=%hd FLAGS=%#x BLKCNT=%x GEN=%x\n", DIP(dp, di_nlink),
+   printf("LINKCNT=%d FLAGS=%#x BLKCNT=%x GEN=%x\n", DIP(dp, di_nlink),
DIP(dp, di_flags), (unsigned)DIP(dp, di_blocks), DIP(dp, di_gen));
 }
 



wscons(4): remove compiled out case statements

2017-08-09 Thread Frederic Cambus
Hi tech@,

Remove some case statements which have been compiled out since 2000.

Comments? OK?

Index: sys/dev/wscons/wsemul_vt100.c
===
RCS file: /cvs/src/sys/dev/wscons/wsemul_vt100.c,v
retrieving revision 1.35
diff -u -p -r1.35 wsemul_vt100.c
--- sys/dev/wscons/wsemul_vt100.c   11 Apr 2017 14:43:49 -  1.35
+++ sys/dev/wscons/wsemul_vt100.c   9 Aug 2017 19:47:42 -
@@ -472,25 +472,6 @@ wsemul_vt100_output_c0c1(struct wsemul_v
/* cancel current escape sequence */
edp->state = VT100_EMUL_STATE_NORMAL;
break;
-#if 0
-   case CSI: /* 8-bit */
-   /* XXX cancel current escape sequence */
-   edp->nargs = 0;
-   memset(edp->args, 0, sizeof (edp->args));
-   edp->modif1 = edp->modif2 = '\0';
-   edp->state = VT100_EMUL_STATE_CSI;
-   break;
-   case DCS: /* 8-bit */
-   /* XXX cancel current escape sequence */
-   edp->nargs = 0;
-   memset(edp->args, 0, sizeof (edp->args));
-   edp->state = VT100_EMUL_STATE_DCS;
-   break;
-   case ST: /* string end 8-bit */
-   /* XXX only in VT100_EMUL_STATE_STRING */
-   wsemul_vt100_handle_dcs(edp);
-   return (VT100_EMUL_STATE_NORMAL);
-#endif
case ASCII_LF:
case ASCII_VT:
case ASCII_FF:



Re: monop(6): drop the conditional shrt macro definitions

2017-06-22 Thread Frederic Cambus
On Sat, Jun 10, 2017 at 05:11:31PM -0700, Philip Guenther wrote:

> >> Drop the conditional shrt macro definitions and use short everywhere.
> >
> > Why not use uint8_t then?
> 
> Isn't the point of the code to *not* use an unsigned type?

Yes, those changes [1] were commited with the following commit message:
"Changes from NetBSD to compile games without warnings due to short
being unsigned on some archs, PowerPC, ROMP.".

[1] 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/games/monop/monop.h.diff?r1=1.2=1.3



adventure(6): remove unused functions

2017-06-23 Thread Frederic Cambus
Hi tech@,

Remove unused confirm() and datime() functions.

Those functions are unused and have been compiled out since 1998,
it's time to let them go.

Comments? OK?

Index: games/adventure/io.c
===
RCS file: /cvs/src/games/adventure/io.c,v
retrieving revision 1.22
diff -u -p -r1.22 io.c
--- games/adventure/io.c21 Dec 2016 18:28:19 -  1.22
+++ games/adventure/io.c23 Jun 2017 08:58:19 -
@@ -89,27 +89,6 @@ getin(char *wrd1, size_t siz1, char *wrd
}
 }
 
-
-#if 0  /* Not used */
-int
-confirm(char *mesg)/* confirm irreversible action  */
-{
-   int result;
-   int ch;
-
-   printf("%s", mesg); /* tell him what he did */
-   if ((ch = getchar()) == 'y')/* was his first letter a 'y'?  */
-   result = 1;
-   else if (ch == EOF) {
-   printf("user closed input stream, quitting...\n");
-   exit(0);
-   } else
-   result = 0;
-   FLUSHLINE;
-   return (result);
-}
-#endif
-
 int
 yes(int x, int y, int z)   /* confirm with rspeak  */
 {
Index: games/adventure/wizard.c
===
RCS file: /cvs/src/games/adventure/wizard.c,v
retrieving revision 1.19
diff -u -p -r1.19 wizard.c
--- games/adventure/wizard.c8 Mar 2016 10:48:39 -   1.19
+++ games/adventure/wizard.c23 Jun 2017 08:58:19 -
@@ -45,24 +45,6 @@
 #include "extern.h"
 #include "hdr.h"
 
-#if 0
-void
-datime(int *d, int *t)
-{
-   time_t  tvec;
-   struct tm *tptr;
-
-   time();
-   tptr = localtime();
-   /* day since 1977  (mod leap)   */
-   *d = tptr->tm_yday + 365 * (tptr->tm_year - 77);
-   /* bug: this will overflow in the year 2066 AD  */
-   /* it will be attributed to Wm the C's millenial celebration*/
-   /* and minutes since midnite */
-   *t = tptr->tm_hour * 60 + tptr->tm_min;
-}  /* pretty painless  */
-#endif
-
 charmagic[6];
 
 void



wsconsctl.8: mention the display.font variable in EXAMPLES

2017-05-26 Thread Frederic Cambus
Hi tech@,

As mentioned by miod@ here [1], wsconsctl(8) has a currently
undocumented 'display.font' variable allowing to change the
current font on framebuffer consoles.

[1] http://undeadly.org/cgi?action=article=20131023125815

Comments? OK?

Index: sbin/wsconsctl/wsconsctl.8
===
RCS file: /cvs/src/sbin/wsconsctl/wsconsctl.8,v
retrieving revision 1.24
diff -u -p -r1.24 wsconsctl.8
--- sbin/wsconsctl/wsconsctl.8  6 Apr 2017 17:33:39 -   1.24
+++ sbin/wsconsctl/wsconsctl.8  26 May 2017 14:22:23 -
@@ -184,6 +184,10 @@ Set the bell pitch to be 1200:
 Add 200 to the current pitch of the bell:
 .Pp
 .Dl # wsconsctl keyboard.bell.pitch+=200
+.Pp
+Set the display font by name:
+.Pp
+.Dl # wsconsctl display.font=name
 .Sh SEE ALSO
 .Xr pckbd 4 ,
 .Xr wscons 4 ,



Re: wsconsctl.8: mention the display.font variable in EXAMPLES

2017-05-27 Thread Frederic Cambus
On Fri, May 26, 2017 at 05:37:25PM +0100, Jason McIntyre wrote:

> the examples are expected to be typed as shown. so i think "name" should
> be changed to an actual font name, and the description adjusted to show that.
> 
> otherwise it may be neccessary to document it more fully if it's not so
> simple.

Makes sense, here is a revised diff:

Comments? OK?

Index: sbin/wsconsctl/wsconsctl.8
===
RCS file: /cvs/src/sbin/wsconsctl/wsconsctl.8,v
retrieving revision 1.24
diff -u -p -r1.24 wsconsctl.8
--- sbin/wsconsctl/wsconsctl.8  6 Apr 2017 17:33:39 -   1.24
+++ sbin/wsconsctl/wsconsctl.8  27 May 2017 09:49:07 -
@@ -184,6 +184,10 @@ Set the bell pitch to be 1200:
 Add 200 to the current pitch of the bell:
 .Pp
 .Dl # wsconsctl keyboard.bell.pitch+=200
+.Pp
+Set the display font to Gallant:
+.Pp
+.Dl # wsconsctl display.font=Gallant
 .Sh SEE ALSO
 .Xr pckbd 4 ,
 .Xr wscons 4 ,



wscons: add missing comments in ascii.h

2017-05-27 Thread Frederic Cambus
Hi tech@,

Add missing comments for CAN and SUB, for consistency.

Comments? OK?

Index: sys/dev/wscons/ascii.h
===
RCS file: /cvs/src/sys/dev/wscons/ascii.h,v
retrieving revision 1.5
diff -u -p -r1.5 ascii.h
--- sys/dev/wscons/ascii.h  12 Jan 2009 20:43:53 -  1.5
+++ sys/dev/wscons/ascii.h  26 May 2017 19:18:58 -
@@ -11,6 +11,6 @@
 #define ASCII_CR   0x0d/* carriage return */
 #define ASCII_SO   0x0e/* shift out */
 #define ASCII_SI   0x0f/* shift in */
-#defineASCII_CAN   0x18
-#defineASCII_SUB   0x1a
+#defineASCII_CAN   0x18/* cancel */
+#defineASCII_SUB   0x1a/* substitute */
 #define ASCII_ESC  0x1b/* escape */



wsfont: remove lucida16x29.h and omron12x20?

2017-05-29 Thread Frederic Cambus
Hi,

Those fonts are not compiled in by default, and I see no reason
to keep them:

lucida16x29 is a bad conversion from a truetype font, it is too bold
which makes it unreadable and unusable.

omron12x20 is a serif font, and is very difficult to read due to
inconsistencies in character spacing, alignement, and width.

Moreover, both fonts only have 96 glyphs.

Comments? OK to remove them?



Re: Remove unused function from compress(1)

2017-05-29 Thread Frederic Cambus
On Tue, May 23, 2017 at 12:12:11PM -0400, Brian Callahan wrote:

> clang says zclose is an unused function. Seems to check out.

Commited, thanks!



fortune(6): use proper bool types

2017-05-29 Thread Frederic Cambus
Hi tech@,

Here is a diff to use proper bool types for fortune(6).

Comments? OK?

Index: games/fortune/fortune/fortune.c
===
RCS file: /cvs/src/games/fortune/fortune/fortune.c,v
retrieving revision 1.55
diff -u -p -r1.55 fortune.c
--- games/fortune/fortune/fortune.c 7 Mar 2016 22:49:45 -   1.55
+++ games/fortune/fortune/fortune.c 29 May 2017 21:40:40 -
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -49,8 +50,6 @@
 
 #include "pathnames.h"
 #include "strfile.h"
-
-#defineboolshort
 
 #defineMINW6   /* minimum wait if desired */
 #defineCPERS   20  /* # of chars for each sec */
Index: games/fortune/strfile/strfile.c
===
RCS file: /cvs/src/games/fortune/strfile/strfile.c,v
retrieving revision 1.28
diff -u -p -r1.28 strfile.c
--- games/fortune/strfile/strfile.c 7 Mar 2016 12:07:56 -   1.28
+++ games/fortune/strfile/strfile.c 29 May 2017 21:40:40 -
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,9 +67,6 @@
  * Added ordering options.
  */
 
-#defineTRUE1
-#defineFALSE   0
-
 #defineSTORING_PTRS(Oflag || Rflag)
 #defineCHUNKSIZE   512
 
@@ -92,11 +90,11 @@ char*Infile = NULL, /* input file 
nam
Outfile[PATH_MAX] = "", /* output file name */
Delimch = '%';  /* delimiting character */
 
-intSflag   = FALSE;/* silent run flag */
-intOflag   = FALSE;/* ordering flag */
-intIflag   = FALSE;/* ignore case flag */
-intRflag   = FALSE;/* randomize order flag */
-intXflag   = FALSE;/* set rotated bit */
+intSflag   = false;/* silent run flag */
+intOflag   = false;/* ordering flag */
+intIflag   = false;/* ignore case flag */
+intRflag   = false;/* randomize order flag */
+intXflag   = false;/* set rotated bit */
 long   Num_pts = 0;/* number of pointers/strings */
 
 int32_t*Seekpts;
@@ -189,7 +187,7 @@ main(int ac, char *av[])
else
fp->first = *nsp;
fp->pos = Seekpts[Num_pts - 1];
-   first = FALSE;
+   first = false;
}
} while (sp != NULL);
 
@@ -394,8 +392,8 @@ cmp_str(const void *p1, const void *p2)
(void) fseek(Sort_1, ((STR *)p1)->pos, SEEK_SET);
(void) fseek(Sort_2, ((STR *)p2)->pos, SEEK_SET);
 
-   n1 = FALSE;
-   n2 = FALSE;
+   n1 = false;
+   n2 = false;
while (!isalnum(c1 = getc(Sort_1)) && c1 != '\0')
SET_N(n1, c1);
while (!isalnum(c2 = getc(Sort_2)) && c2 != '\0')



pcdisplay(4): remove unused pcdisplay_mapchar_simple function

2017-05-29 Thread Frederic Cambus
Hi tech@,

Here is a diff to remove the unused pcdisplay_mapchar_simple function
in pcdisplay(4).

It has been unused since this code was imported from NetBSD.

Comments? OK?

Index: sys/dev/ic/pcdisplay_subr.c
===
RCS file: /cvs/src/sys/dev/ic/pcdisplay_subr.c,v
retrieving revision 1.11
diff -u -p -r1.11 pcdisplay_subr.c
--- sys/dev/ic/pcdisplay_subr.c 11 Apr 2011 19:11:01 -  1.11
+++ sys/dev/ic/pcdisplay_subr.c 29 May 2017 20:56:31 -
@@ -144,17 +144,6 @@ done:
 #endif /* PCDISPLAY_SOFTCURSOR */
 }
 
-#if 0
-unsigned int
-pcdisplay_mapchar_simple(void *id, int uni)
-{
-   if (uni < 128)
-   return (uni);
-
-   return (1); /* XXX ??? smiley */
-}
-#endif
-
 int
 pcdisplay_putchar(void *id, int row, int col, u_int c, long attr)
 {
Index: sys/dev/ic/pcdisplayvar.h
===
RCS file: /cvs/src/sys/dev/ic/pcdisplayvar.h,v
retrieving revision 1.11
diff -u -p -r1.11 pcdisplayvar.h
--- sys/dev/ic/pcdisplayvar.h   28 Aug 2010 12:48:14 -  1.11
+++ sys/dev/ic/pcdisplayvar.h   29 May 2017 20:56:31 -
@@ -76,9 +76,6 @@ _pcdisplay_6845_write(struct pcdisplay_h
 void   pcdisplay_cursor_init(struct pcdisplayscreen *, int);
 void   pcdisplay_cursor_reset(struct pcdisplayscreen *);
 intpcdisplay_cursor(void *, int, int, int);
-#if 0
-unsigned int pcdisplay_mapchar_simple(void *, int);
-#endif
 intpcdisplay_mapchar(void *, int, unsigned int *);
 intpcdisplay_putchar(void *, int, int, u_int, long);
 struct wsdisplay_charcell;



pcdisplay(4): properly disable hardware cursor

2017-05-30 Thread Frederic Cambus
Hi tech@,

Use the CD bit (Cursor Disable) in the cursor start register to properly
disable hardware cursor.

>From NetBSD. See commit message [1] and diff [2] for more information.

Comments? OK?

[1] 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/pcdisplay_subr.c?rev=1.35=text/x-cvsweb-markup
[2] 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/pcdisplay_subr.c.diff?r1=1.34=1.35_with_tag=MAIN

Index: pcdisplay_subr.c
===
RCS file: /cvs/src/sys/dev/ic/pcdisplay_subr.c,v
retrieving revision 1.12
diff -u -p -r1.12 pcdisplay_subr.c
--- pcdisplay_subr.c30 May 2017 08:24:56 -  1.12
+++ pcdisplay_subr.c30 May 2017 09:03:18 -
@@ -44,8 +44,8 @@ void
 pcdisplay_cursor_reset(struct pcdisplayscreen *scr)
 {
 #ifdef PCDISPLAY_SOFTCURSOR
-   pcdisplay_6845_write(scr->hdl, curstart, 0x10);
-   pcdisplay_6845_write(scr->hdl, curend, 0x10);
+   pcdisplay_6845_write(scr->hdl, curstart, 0x20);
+   pcdisplay_6845_write(scr->hdl, curend, 0x00);
 #endif
 }
 



wsfont: remove qvss8x15, vt220l8x8, and vt220l8x10?

2017-05-30 Thread Frederic Cambus
Hi,

This would be the last round of console fonts removal.

Those fonts are not compiled in by default, and are smaller than the
smallest font (bold8x16_iso1) we currently include.

Comments? OK to remove them?



fortune(6): fix an infinite loop

2017-06-02 Thread Frederic Cambus
Hi tech@,

When invoking fortune with the -l option (to get long dictums only),
the program gets stuck in an infinite loop because fortlen() doesn't
return the fortune length correctly.

Comments? OK?

Index: games/fortune/fortune/fortune.c
===
RCS file: /cvs/src/games/fortune/fortune/fortune.c,v
retrieving revision 1.55
diff -u -p -r1.55 fortune.c
--- games/fortune/fortune/fortune.c 7 Mar 2016 22:49:45 -   1.55
+++ games/fortune/fortune/fortune.c 2 Jun 2017 14:00:16 -
@@ -218,7 +218,7 @@ fortlen(void)
charline[BUFSIZ];
 
if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
-   nchar = (Seekpts[1] - Seekpts[0] <= SLEN);
+   nchar = Seekpts[1] - Seekpts[0];
else {
open_fp(Fortfile);
(void) fseek(Fortfile->inf, (long)Seekpts[0], SEEK_SET);



monop(6): correct number of players in the man page

2017-06-08 Thread Frederic Cambus
Hi tech@,

The man page says monop monitors a game between 1 to 9 users, but the
program enforces a range from 2 to 9.

Comments? OK?

Index: games/monop/monop.6
===
RCS file: /cvs/src/games/monop/monop.6,v
retrieving revision 1.15
diff -u -p -r1.15 monop.6
--- games/monop/monop.6 13 Mar 2015 19:58:40 -  1.15
+++ games/monop/monop.6 8 Jun 2017 21:15:46 -
@@ -29,7 +29,7 @@
 .\"
 .\"@(#)monop.6 6.5 (Berkeley) 3/25/93
 .\"
-.Dd $Mdocdate: March 13 2015 $
+.Dd $Mdocdate: June 8 2017 $
 .Dt MONOP 6
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .Sh DESCRIPTION
 .Nm
 is reminiscent of the Parker Brother's game Monopoly, and
-monitors a game between 1 to 9 users.
+monitors a game between 2 to 9 users.
 It is assumed that the rules of Monopoly are known.
 The game follows the standard rules, with the exception that,
 if a property goes up for auction and there are only two solvent players,



wsfont: remove iso7/pcvt encoding macros and entries

2017-06-13 Thread Frederic Cambus
Hi tech@,

We do not support iso7 nor pcvt encoding, so remove macro definitions
and commented entries.

Comments? OK?

Index: sys/dev/wscons/wsconsio.h
===
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.82
diff -u -p -r1.82 wsconsio.h
--- sys/dev/wscons/wsconsio.h   13 Jun 2017 08:00:24 -  1.82
+++ sys/dev/wscons/wsconsio.h   13 Jun 2017 08:41:20 -
@@ -506,8 +506,6 @@ struct wsdisplay_font {
int encoding;
 #define WSDISPLAY_FONTENC_ISO 0
 #define WSDISPLAY_FONTENC_IBM 1
-#define WSDISPLAY_FONTENC_PCVT 2
-#define WSDISPLAY_FONTENC_ISO7 3 /* greek */
u_int fontwidth, fontheight, stride;
 #define WSDISPLAY_MAXFONTSZ(512*1024)
int bitorder, byteorder;
Index: usr.sbin/wsfontload/wsfontload.c
===
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
retrieving revision 1.16
diff -u -p -r1.16 wsfontload.c
--- usr.sbin/wsfontload/wsfontload.c6 Sep 2015 20:07:46 -   1.16
+++ usr.sbin/wsfontload/wsfontload.c13 Jun 2017 08:41:21 -
@@ -75,10 +75,6 @@ static const struct {
 } encodings[] = {
{"iso",  WSDISPLAY_FONTENC_ISO},
{"ibm",  WSDISPLAY_FONTENC_IBM},
-#if 0
-   {"pcvt", WSDISPLAY_FONTENC_PCVT},
-   {"iso7", WSDISPLAY_FONTENC_ISO7},
-#endif
 };
 
 int



Re: wsfont: remove iso7/pcvt encoding macros and entries

2017-06-15 Thread Frederic Cambus
On Tue, Jun 13, 2017 at 11:29:59AM +, Miod Vallat wrote:
> 
> > Hi tech@,
> >
> > We do not support iso7 nor pcvt encoding, so remove macro definitions
> > and commented entries.
> 
> If you do that, then you can probably optimize away
> vga_valid_primary_font() in sys/dev/ic/vga.c as well.

Makes sense to me as well, thanks for pointing that out. Diff below.

Comments? OK?

Index: sys/dev/ic/vga.c
===
RCS file: /cvs/src/sys/dev/ic/vga.c,v
retrieving revision 1.68
diff -u -p -r1.68 vga.c
--- sys/dev/ic/vga.c9 Sep 2015 18:23:39 -   1.68
+++ sys/dev/ic/vga.c15 Jun 2017 10:47:09 -
@@ -344,10 +344,6 @@ bad:
  * We want at least ASCII 32..127 be present in the
  * first font slot.
  */
-#define vga_valid_primary_font(f) \
-   (f->encoding == WSDISPLAY_FONTENC_IBM || \
-   f->encoding == WSDISPLAY_FONTENC_ISO)
-
 int
 vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1,
 const char *name2) /* NULL: take first found */
@@ -363,7 +359,8 @@ vga_selectfont(struct vga_config *vc, st
if (!f || f->height != type->fontheight)
continue;
if (!f1 &&
-   vga_valid_primary_font(f) &&
+   (f->encoding == WSDISPLAY_FONTENC_IBM ||
+f->encoding == WSDISPLAY_FONTENC_ISO) &&
(!name1 || !*name1 ||
 !strncmp(name1, f->name, WSFONT_NAME_SIZE))) {
f1 = f;



Re: wsfont: remove iso7/pcvt encoding macros and entries

2017-06-16 Thread Frederic Cambus
On Thu, Jun 15, 2017 at 01:52:07PM +0200, Frederic Cambus wrote:
> On Tue, Jun 13, 2017 at 11:29:59AM +, Miod Vallat wrote:
> > 
> > > Hi tech@,
> > >
> > > We do not support iso7 nor pcvt encoding, so remove macro definitions
> > > and commented entries.
> > 
> > If you do that, then you can probably optimize away
> > vga_valid_primary_font() in sys/dev/ic/vga.c as well.
> 
> Makes sense to me as well, thanks for pointing that out. Diff below.

Please discard the last diff, what did I have in mind?

The fonts we are looping through in vga_selectfont() are the builtin
font which is using the IBM encoding, and some potentially loaded fonts
which are either IBM or ISO encoded.

Therefore the condition checked by vga_valid_font() is always true, and
we can remove it.

Comments? OK?

Index: sys/dev/ic/vga.c
===
RCS file: /cvs/src/sys/dev/ic/vga.c,v
retrieving revision 1.68
diff -u -p -r1.68 vga.c
--- sys/dev/ic/vga.c9 Sep 2015 18:23:39 -   1.68
+++ sys/dev/ic/vga.c16 Jun 2017 20:50:42 -
@@ -344,10 +344,6 @@ bad:
  * We want at least ASCII 32..127 be present in the
  * first font slot.
  */
-#define vga_valid_primary_font(f) \
-   (f->encoding == WSDISPLAY_FONTENC_IBM || \
-   f->encoding == WSDISPLAY_FONTENC_ISO)
-
 int
 vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1,
 const char *name2) /* NULL: take first found */
@@ -362,9 +358,7 @@ vga_selectfont(struct vga_config *vc, st
struct vgafont *f = vc->vc_fonts[i];
if (!f || f->height != type->fontheight)
continue;
-   if (!f1 &&
-   vga_valid_primary_font(f) &&
-   (!name1 || !*name1 ||
+   if (!f1 && (!name1 || !*name1 ||
 !strncmp(name1, f->name, WSFONT_NAME_SIZE))) {
f1 = f;
continue;



wsfontload(8): account for the WSFONT_NAME_SIZE change

2017-06-17 Thread Frederic Cambus
Hi tech@,

Since WSFONT_NAME_SIZE was switched from 16 to 32, account for the
change in wsfontload as well: tweak spacing and printf format string.

Comments? OK?

Index: usr.sbin/wsfontload/wsfontload.c
===
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
retrieving revision 1.17
diff -u -p -r1.17 wsfontload.c
--- usr.sbin/wsfontload/wsfontload.c15 Jun 2017 11:48:49 -  1.17
+++ usr.sbin/wsfontload/wsfontload.c17 Jun 2017 08:20:20 -
@@ -147,7 +147,7 @@ main(int argc, char *argv[])
 
if (list) {
i = 0;
-   p = " # Name Encoding  W  H";
+   p = " # Name Encoding  W  H";
do {
f.index = i;
res = ioctl(wsfd, WSDISPLAYIO_LSFONT, );
@@ -157,7 +157,7 @@ main(int argc, char *argv[])
puts(p);
p = NULL;
}
-   printf("%2d %-16s %8s %2d %2d\n",
+   printf("%2d %-32s %8s %2d %2d\n",
f.index, f.name,
encodings[f.encoding].name,
f.fontwidth, f.fontheight);



inteldrm: add a handler for the WSDISPLAYIO_GINFO ioctl

2017-06-17 Thread Frederic Cambus
Hi tech@,

Add a handler for the WSDISPLAYIO_GINFO ioctl in inteldrm, allowing
to retrieve basic information about a framebuffer display.

When running wsconsctl on a machine with inteldrm support, this now
returns those additional fields:

display.width=1600
display.height=900
display.depth=32

Comments? OK?

Index: sys/dev/pci/drm/i915/i915_drv.c
===
RCS file: /cvs/src/sys/dev/pci/drm/i915/i915_drv.c,v
retrieving revision 1.101
diff -u -p -r1.101 i915_drv.c
--- sys/dev/pci/drm/i915/i915_drv.c 8 Jan 2017 12:11:54 -   1.101
+++ sys/dev/pci/drm/i915/i915_drv.c 17 Jun 2017 19:15:04 -
@@ -1037,11 +1037,20 @@ inteldrm_wsioctl(void *v, u_long cmd, ca
 {
struct inteldrm_softc *dev_priv = v;
struct drm_device *dev = dev_priv->dev;
+   struct rasops_info *ri = _priv->ro;
+   struct wsdisplay_fbinfo *wdf;
struct wsdisplay_param *dp = (struct wsdisplay_param *)data;
 
switch (cmd) {
case WSDISPLAYIO_GTYPE:
*(int *)data = WSDISPLAY_TYPE_INTELDRM;
+   return 0;
+   case WSDISPLAYIO_GINFO:
+   wdf = (struct wsdisplay_fbinfo *)data;
+   wdf->width = ri->ri_width;
+   wdf->height = ri->ri_height;
+   wdf->depth = ri->ri_depth;
+   wdf->cmsize = 0;
return 0;
case WSDISPLAYIO_GETPARAM:
if (ws_get_param && ws_get_param(dp) == 0)



monop(6): drop the conditional shrt macro definitions

2017-06-10 Thread Frederic Cambus
Hi tech@,

Drop the conditional shrt macro definitions and use short everywhere.

Comments? OK?

Index: games/monop/houses.c
===
RCS file: /cvs/src/games/monop/houses.c,v
retrieving revision 1.10
diff -u -p -r1.10 houses.c
--- games/monop/houses.c8 Jan 2016 18:20:33 -   1.10
+++ games/monop/houses.c10 Jun 2017 21:22:54 -
@@ -110,7 +110,7 @@ buy_h(MON *mnp)
int i;
MON *mp;
int price;
-   shrtinput[3],temp[3];
+   short   input[3],temp[3];
int tot, tot2;
PROP*pp;
int nhous, nhot;
@@ -245,7 +245,7 @@ sell_h(MON *mnp)
int i;
MON *mp;
int price;
-   shrtinput[3],temp[3];
+   short   input[3],temp[3];
int tot;
PROP*pp;
 
Index: games/monop/monop.h
===
RCS file: /cvs/src/games/monop/monop.h,v
retrieving revision 1.8
diff -u -p -r1.8 monop.h
--- games/monop/monop.h 8 Jan 2016 18:19:47 -   1.8
+++ games/monop/monop.h 10 Jun 2017 21:22:54 -
@@ -32,11 +32,6 @@
  * @(#)monop.h 8.1 (Berkeley) 5/31/93
  */
 
-#ifdef __CHAR_UNSIGNED__
-#defineshrtshort
-#else
-#defineshrtchar
-#endif
 #defineboolint8_t
 
 #defineTRUE(1)
@@ -72,8 +67,8 @@
 
 struct sqr_st {/* structure for square 
*/
char*name;  /* place name   */
-   shrtowner;  /* owner number */
-   shrttype;   /* place type   */
+   short   owner;  /* owner number */
+   short   type;   /* place type   */
struct prp_st   *desc;  /* description struct   */
int cost;   /* cost */
 };
@@ -82,10 +77,10 @@ typedef struct sqr_st   SQUARE;
 
 struct mon_st {/* monopoly description structure   
*/
char*name;  /* monop. name (color)  */
-   shrtowner;  /* owner of monopoly*/
-   shrtnum_in; /* # in monopoly*/
-   shrtnum_own;/* # owned (-1: not poss. monop)*/
-   shrth_cost; /* price of houses  */
+   short   owner;  /* owner of monopoly*/
+   short   num_in; /* # in monopoly*/
+   short   num_own;/* # owned (-1: not poss. monop)*/
+   short   h_cost; /* price of houses  */
char*not_m; /* name if not monopoly */
char*mon_n; /* name if a monopoly   */
charsqnums[3];  /* Square numbers (used to init)*/
@@ -101,8 +96,8 @@ typedef struct mon_stMON;
 struct prp_st {/* property description structure   
*/
boolmorg;   /* set if mortgaged */
boolmonop;  /* set if monopoly  */
-   shrtsquare; /* square description   */
-   shrthouses; /* number of houses */
+   short   square; /* square description   */
+   short   houses; /* number of houses */
MON *mon_desc;  /* name of color*/
int rent[6];/* rents*/
 };
@@ -116,11 +111,11 @@ typedef struct own_st OWN;
 
 struct plr_st {/* player description structure 
*/
char*name;  /* owner name   */
-   shrtnum_gojf;   /* # of get-out-of-jail-free's  */
-   shrtnum_rr; /* # of railroads owned */
-   shrtnum_util;   /* # of water works/elec. co.   */
-   shrtloc;/* location on board*/
-   shrtin_jail;/* count of turns in jail   */
+   short   num_gojf;   /* # of get-out-of-jail-free's  */
+   short   num_rr; /* # of railroads owned */
+   short   num_util;   /* # of water works/elec. co.   */
+   short   loc;/* location on board*/
+   short   in_jail;/* count of turns in jail   */
int money;  /* amount of money  */
OWN *own_list;  /* start of property list   */
 };
@@ -183,7 +178,7 @@ voidprinthold(int);
 /* prop.c */
 

radeondrm: add a handler for the WSDISPLAYIO_GINFO ioctl

2017-06-18 Thread Frederic Cambus
Hi tech@,

Add a handler for the WSDISPLAYIO_GINFO ioctl in radeondrm, allowing
to retrieve basic information about a framebuffer display.

Same rationale as the diff I sent for inteldrm, and it can also be
tested with wsconsctl which will return new display values for width,
height and depth.

Comments? OK?

Index: sys/dev/pci/drm/radeon/radeon_kms.c
===
RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon_kms.c,v
retrieving revision 1.49
diff -u -p -r1.49 radeon_kms.c
--- sys/dev/pci/drm/radeon/radeon_kms.c 8 Jan 2017 12:11:54 -   1.49
+++ sys/dev/pci/drm/radeon/radeon_kms.c 18 Jun 2017 11:09:53 -
@@ -354,9 +354,19 @@ struct wsdisplay_accessops radeondrm_acc
 int
 radeondrm_wsioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
+   struct rasops_info *ri = v;
+   struct wsdisplay_fbinfo *wdf;
+
switch (cmd) {
case WSDISPLAYIO_GTYPE:
*(int *)data = WSDISPLAY_TYPE_RADEONDRM;
+   return 0;
+   case WSDISPLAYIO_GINFO:
+   wdf = (struct wsdisplay_fbinfo *)data;
+   wdf->width = ri->ri_width;
+   wdf->height = ri->ri_height;
+   wdf->depth = ri->ri_depth;
+   wdf->cmsize = 0;
return 0;
default:
return -1;



wsfontload(8): close file descriptors on all exit paths

2017-06-18 Thread Frederic Cambus
Hi tech@,

Close file descriptors on all exit paths in wsfontload(8).

Comments? OK?

Index: usr.sbin/wsfontload/wsfontload.c
===
RCS file: /cvs/src/usr.sbin/wsfontload/wsfontload.c,v
retrieving revision 1.18
diff -u -p -r1.18 wsfontload.c
--- usr.sbin/wsfontload/wsfontload.c17 Jun 2017 19:27:54 -  1.18
+++ usr.sbin/wsfontload/wsfontload.c18 Jun 2017 12:56:22 -
@@ -166,6 +166,7 @@ main(int argc, char *argv[])
i++;
} while(res == 0);
 
+   close(wsfd);
return (0);
}
 
@@ -245,6 +246,8 @@ main(int argc, char *argv[])
if (res < 0)
err(3, "WSDISPLAYIO_LDFONT");
 
+   close(ffd);
+   close(wsfd);
return (0);
 }
 



Re: inteldrm: add a handler for the WSDISPLAYIO_GINFO ioctl

2017-06-18 Thread Frederic Cambus
On Sat, Jun 17, 2017 at 05:27:38PM -0400, Ted Unangst wrote:

> > Add a handler for the WSDISPLAYIO_GINFO ioctl in inteldrm, allowing
> > to retrieve basic information about a framebuffer display.

[...]

> why? what program will use this information?

The reason I would like to add this handler is to be able to get the
frame buffer resolution in wsfontload(8). The default width/height is
currently hardcoded and ought to be computed from the frame buffer
resolution, there is a TODO in the code.

Most framebuffer drivers have handlers already, it's only missing in KMS
drivers.



Remove the no longer true CAVEATS section in rasops.9

2017-08-29 Thread Frederic Cambus
Hi tech@,

Remove the CAVEATS section in rasops.9, which no longer holds truth.

Comments? OK?

Index: share/man/man9/rasops.9
===
RCS file: /cvs/src/share/man/man9/rasops.9,v
retrieving revision 1.18
diff -u -p -r1.18 rasops.9
--- share/man/man9/rasops.9 21 Aug 2017 11:49:50 -  1.18
+++ share/man/man9/rasops.9 29 Aug 2017 22:25:52 -
@@ -235,5 +235,3 @@ subsystem was written by
 .An Andrew Doran Aq Mt a...@netbsd.org .
 Display rotation was written by
 .An Christopher Pascoe Aq Mt pas...@openbsd.org .
-.Sh CAVEATS
-Display rotation only works for 16bpp displays.



Document the RI_ROTATE_CCW flag in rasops.9

2017-08-21 Thread Frederic Cambus
Hi tech@,

Document the newly introduced RI_ROTATE_CCW flag.

Comments? OK?

Index: share/man/man9/rasops.9
===
RCS file: /cvs/src/share/man/man9/rasops.9,v
retrieving revision 1.17
diff -u -p -r1.17 rasops.9
--- share/man/man9/rasops.9 18 Jan 2017 20:07:40 -  1.17
+++ share/man/man9/rasops.9 21 Aug 2017 09:33:00 -
@@ -153,6 +153,8 @@ Center the text area.
 .\" Cursor is currently clipped
 .It RI_ROTATE_CW
 Rotate the text display quarter clockwise.
+.It RI_ROTATE_CCW
+Rotate the text display quarter counter-clockwise.
 .It RI_CFGDONE
 .Fn rasops_reconfig
 completed successfully



Re: Update inaccurate comment in rasops(9)

2017-08-21 Thread Frederic Cambus
On Fri, Aug 04, 2017 at 11:31:00PM +0200, Frederic Cambus wrote:

> Update inaccurate comment: rasops_copycols() doesn't use bcopy()
> anymore, but either memmove() or slow_bcopy().
> 
> Comments? OK?

Ping. Anyone?

> Index: sys/dev/rasops/rasops.c
> ===
> RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
> retrieving revision 1.45
> diff -u -p -r1.45 rasops.c
> --- sys/dev/rasops/rasops.c   16 May 2017 02:22:51 -  1.45
> +++ sys/dev/rasops/rasops.c   1 Aug 2017 21:32:14 -
> @@ -660,8 +660,8 @@ rasops_copyrows(void *cookie, int src, i
>  /*
>   * Copy columns. This is slow, and hard to optimize due to alignment,
>   * and the fact that we have to copy both left->right and right->left.
> - * We simply cop-out here and use bcopy(), since it handles all of
> - * these cases anyway.
> + * We simply cop-out here and use either memmove() or slow_bcopy(),
> + * since they handle all of these cases anyway.
>   */
>  int
>  rasops_copycols(void *cookie, int row, int src, int dst, int num)



Change bcopy to memcpy (i386 VIA PadLock driver)

2017-12-13 Thread Frederic Cambus
Hi tech@,

This diff changes bcopy to memcpy in the i386 version of the VIA PadLock
driver. It was done a while ago in the amd64 version of the driver.

Comments? OK?

Index: sys/arch/i386/i386/via.c
===
RCS file: /cvs/src/sys/arch/i386/i386/via.c,v
retrieving revision 1.37
diff -u -p -r1.37 via.c
--- sys/arch/i386/i386/via.c2 May 2017 11:47:49 -   1.37
+++ sys/arch/i386/i386/via.c10 Dec 2017 14:01:21 -
@@ -161,7 +161,7 @@ viac3_crypto_newsession(u_int32_t *sidp,
M_NOWAIT);
if (ses == NULL)
return (ENOMEM);
-   bcopy(sc->sc_sessions, ses, sesn * sizeof(*ses));
+   memcpy(ses, sc->sc_sessions, sesn * sizeof(*ses));
explicit_bzero(sc->sc_sessions, sesn * sizeof(*ses));
free(sc->sc_sessions, M_DEVBUF, sesn * sizeof(*ses));
sc->sc_sessions = ses;
@@ -370,7 +370,7 @@ viac3_crypto_encdec(struct cryptop *crp,
sc->op_cw[0] = ses->ses_cw0 | C3_CRYPT_CWLO_ENCRYPT;
key = ses->ses_ekey;
if (crd->crd_flags & CRD_F_IV_EXPLICIT)
-   bcopy(crd->crd_iv, sc->op_iv, 16);
+   memcpy(sc->op_iv, crd->crd_iv, 16);
else
arc4random_buf(sc->op_iv, 16);
 
@@ -382,8 +382,8 @@ viac3_crypto_encdec(struct cryptop *crp,
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_inject, 16, sc->op_iv);
else
-   bcopy(sc->op_iv,
-   crp->crp_buf + crd->crd_inject, 16);
+   memcpy(crp->crp_buf + crd->crd_inject,
+   sc->op_iv, 16);
if (err)
return (err);
}
@@ -391,7 +391,7 @@ viac3_crypto_encdec(struct cryptop *crp,
sc->op_cw[0] = ses->ses_cw0 | C3_CRYPT_CWLO_DECRYPT;
key = ses->ses_dkey;
if (crd->crd_flags & CRD_F_IV_EXPLICIT)
-   bcopy(crd->crd_iv, sc->op_iv, 16);
+   memcpy(sc->op_iv, crd->crd_iv, 16);
else {
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copydata((struct mbuf *)crp->crp_buf,
@@ -400,8 +400,8 @@ viac3_crypto_encdec(struct cryptop *crp,
cuio_copydata((struct uio *)crp->crp_buf,
crd->crd_inject, 16, sc->op_iv);
else
-   bcopy(crp->crp_buf + crd->crd_inject,
-   sc->op_iv, 16);
+   memcpy(sc->op_iv,
+   crp->crp_buf + crd->crd_inject, 16);
}
}
 
@@ -412,7 +412,7 @@ viac3_crypto_encdec(struct cryptop *crp,
cuio_copydata((struct uio *)crp->crp_buf,
crd->crd_skip, crd->crd_len, sc->op_buf);
else
-   bcopy(crp->crp_buf + crd->crd_skip, sc->op_buf, crd->crd_len);
+   memcpy(sc->op_buf, crp->crp_buf + crd->crd_skip, crd->crd_len);
 
sc->op_cw[1] = sc->op_cw[2] = sc->op_cw[3] = 0;
viac3_cbc(>op_cw, sc->op_buf, sc->op_buf, key,
@@ -425,7 +425,7 @@ viac3_crypto_encdec(struct cryptop *crp,
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_skip, crd->crd_len, sc->op_buf);
else
-   bcopy(sc->op_buf, crp->crp_buf + crd->crd_skip,
+   memcpy(crp->crp_buf + crd->crd_skip, sc->op_buf,
crd->crd_len);
 
if (sc->op_buf != NULL) {



Add sizes for free() in the VIA PadLock driver

2017-11-12 Thread Frederic Cambus
Hi tech@,

Add sizes for free() in the VIA PadLock driver.

Comments? OK?

Index: sys/arch/amd64/amd64/via.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/via.c,v
retrieving revision 1.24
diff -u -p -r1.24 via.c
--- sys/arch/amd64/amd64/via.c  14 Oct 2017 04:44:43 -  1.24
+++ sys/arch/amd64/amd64/via.c  12 Nov 2017 20:18:37 -
@@ -144,7 +144,7 @@ viac3_crypto_newsession(u_int32_t *sidp,
return (ENOMEM);
memcpy(ses, sc->sc_sessions, sesn * sizeof(*ses));
explicit_bzero(sc->sc_sessions, sesn * sizeof(*ses));
-   free(sc->sc_sessions, M_DEVBUF, 0);
+   free(sc->sc_sessions, M_DEVBUF, sesn * sizeof(*ses));
sc->sc_sessions = ses;
ses = >sc_sessions[sesn];
sc->sc_nsessions++;
@@ -284,13 +284,13 @@ viac3_crypto_freesession(u_int64_t tid)
 
if (swd->sw_ictx) {
explicit_bzero(swd->sw_ictx, axf->ctxsize);
-   free(swd->sw_ictx, M_CRYPTO_DATA, 0);
+   free(swd->sw_ictx, M_CRYPTO_DATA, axf->ctxsize);
}
if (swd->sw_octx) {
explicit_bzero(swd->sw_octx, axf->ctxsize);
-   free(swd->sw_octx, M_CRYPTO_DATA, 0);
+   free(swd->sw_octx, M_CRYPTO_DATA, axf->ctxsize);
}
-   free(swd, M_CRYPTO_DATA, 0);
+   free(swd, M_CRYPTO_DATA, sizeof(*swd));
}
 
explicit_bzero(>sc_sessions[sesn], sizeof(sc->sc_sessions[sesn]));
@@ -411,7 +411,7 @@ viac3_crypto_encdec(struct cryptop *crp,
 
if (sc->op_buf != NULL) {
explicit_bzero(sc->op_buf, crd->crd_len);
-   free(sc->op_buf, M_DEVBUF, 0);
+   free(sc->op_buf, M_DEVBUF, crd->crd_len);
sc->op_buf = NULL;
}
 



Remove unnecessary includes (i386 VIA PadLock driver)

2017-12-08 Thread Frederic Cambus
Hi tech@,

This diff remove unnecessary includes in the i386 version of the
VIA PadLock driver.

Comments? OK?

Index: sys/arch/i386/i386/via.c
===
RCS file: /cvs/src/sys/arch/i386/i386/via.c,v
retrieving revision 1.37
diff -u -p -r1.37 via.c
--- sys/arch/i386/i386/via.c2 May 2017 11:47:49 -   1.37
+++ sys/arch/i386/i386/via.c8 Dec 2017 10:33:39 -
@@ -21,18 +21,9 @@
 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #ifdef CRYPTO
 #include 
@@ -41,17 +32,8 @@
 #include 
 #endif
 
-#include 
-
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
 
 #include 
 



Add sizes for free() in the AMD PowerNow! K8 driver

2017-12-08 Thread Frederic Cambus
Hi tech@,

Add sizes for free() in the AMD PowerNow! K8 driver.

Comments? OK?

Index: sys/arch/amd64/amd64/powernow-k8.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/powernow-k8.c,v
retrieving revision 1.26
diff -u -p -r1.26 powernow-k8.c
--- sys/arch/amd64/amd64/powernow-k8.c  8 Sep 2017 05:36:51 -   1.26
+++ sys/arch/amd64/amd64/powernow-k8.c  8 Dec 2017 17:37:02 -
@@ -380,7 +380,7 @@ k8pnow_acpi_pss_changed(struct acpicpu_p
if (needtran)
k8pnow_transition(nstate, curs);
 
-   free(cstate, M_DEVBUF, 0);
+   free(cstate, M_DEVBUF, sizeof(*cstate));
k8pnow_current_state = nstate;
 }
 
@@ -510,5 +510,5 @@ k8_powernow_init(struct cpu_info *ci)
setperf_prio = 1;
return;
}
-   free(cstate, M_DEVBUF, 0);
+   free(cstate, M_DEVBUF, sizeof(*cstate));
 }



Add sizes for free() in libsa for amd64 and i386

2017-12-10 Thread Frederic Cambus
Hi tech@,

Add sizes for free() in libsa for amd64 and i386.

Comments? OK?

Index: sys/arch/amd64/stand/libsa/diskprobe.c
===
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/diskprobe.c,v
retrieving revision 1.21
diff -u -p -r1.21 diskprobe.c
--- sys/arch/amd64/stand/libsa/diskprobe.c  6 Nov 2017 08:57:34 -   
1.21
+++ sys/arch/amd64/stand/libsa/diskprobe.c  8 Dec 2017 14:35:27 -
@@ -94,7 +94,7 @@ floppyprobe(void)
if (debug)
printf(" ", i);
 #endif
-   free(dip, 0);
+   free(dip, sizeof(*dip));
break;
}
 
@@ -136,7 +136,7 @@ hardprobe(void)
if (debug)
printf(" ", i&0x7f);
 #endif
-   free(dip, 0);
+   free(dip, sizeof(*dip));
break;
}
 
@@ -323,7 +323,7 @@ cdprobe(void)
 #if 0
if (bios_getdiskinfo(cddev, >bios_info)) {
printf(" ");  /* XXX */
-   free(dip, 0);
+   free(dip, sizeof(*dip));
return;
}
 #endif
Index: sys/arch/amd64/stand/libsa/softraid_amd64.c
===
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/softraid_amd64.c,v
retrieving revision 1.4
diff -u -p -r1.4 softraid_amd64.c
--- sys/arch/amd64/stand/libsa/softraid_amd64.c 5 Jan 2017 11:18:54 -   
1.4
+++ sys/arch/amd64/stand/libsa/softraid_amd64.c 8 Dec 2017 14:35:27 -
@@ -305,7 +305,7 @@ srprobe(void)
}
 
explicit_bzero(md, SR_META_SIZE * DEV_BSIZE);
-   free(md, 0);
+   free(md, SR_META_SIZE * DEV_BSIZE);
 }
 
 int
Index: sys/arch/i386/stand/libsa/diskprobe.c
===
RCS file: /cvs/src/sys/arch/i386/stand/libsa/diskprobe.c,v
retrieving revision 1.44
diff -u -p -r1.44 diskprobe.c
--- sys/arch/i386/stand/libsa/diskprobe.c   21 Jul 2017 01:21:42 -  
1.44
+++ sys/arch/i386/stand/libsa/diskprobe.c   8 Dec 2017 14:35:27 -
@@ -94,7 +94,7 @@ floppyprobe(void)
if (debug)
printf(" ", i);
 #endif
-   free(dip, 0);
+   free(dip, sizeof(*dip));
break;
}
 
@@ -136,7 +136,7 @@ hardprobe(void)
if (debug)
printf(" ", i&0x7f);
 #endif
-   free(dip, 0);
+   free(dip, sizeof(*dip));
break;
}
 
@@ -310,7 +310,7 @@ cdprobe(void)
 #if 0
if (bios_getdiskinfo(cddev, >bios_info)) {
printf(" ");  /* XXX */
-   free(dip, 0);
+   free(dip, sizeof(*dip));
return;
}
 #endif
Index: sys/arch/i386/stand/libsa/softraid_i386.c
===
RCS file: /cvs/src/sys/arch/i386/stand/libsa/softraid_i386.c,v
retrieving revision 1.2
diff -u -p -r1.2 softraid_i386.c
--- sys/arch/i386/stand/libsa/softraid_i386.c   11 Sep 2016 17:52:47 -  
1.2
+++ sys/arch/i386/stand/libsa/softraid_i386.c   8 Dec 2017 14:35:27 -
@@ -300,7 +300,7 @@ srprobe(void)
}
 
explicit_bzero(md, SR_META_SIZE * DEV_BSIZE);
-   free(md, 0);
+   free(md, SR_META_SIZE * DEV_BSIZE);
 }
 
 int



Enable bwfm(4) on Loongson for USB devices

2018-05-30 Thread Frederic Cambus
Hi tech@,

Here is a diff to enable bwfm(4) on Loongson for USB devices.

Tested on a Lemote Yeeloong 8101B.

Comments? OK?

Index: sys/arch/loongson/conf/GENERIC
===
RCS file: /cvs/src/sys/arch/loongson/conf/GENERIC,v
retrieving revision 1.57
diff -u -p -r1.57 GENERIC
--- sys/arch/loongson/conf/GENERIC  24 Apr 2018 03:17:36 -  1.57
+++ sys/arch/loongson/conf/GENERIC  30 May 2018 15:45:25 -
@@ -164,6 +164,7 @@ atu*at uhub?# Atmel AT76c50x based 
80
 aue*   at uhub?# ADMtek AN986 Pegasus Ethernet  
 axe*   at uhub?# ASIX Electronics AX88172 USB Ethernet
 axen*  at uhub?# ASIX Electronics AX88179 USB Ethernet
+bwfm*  at uhub?# Broadcom FullMAC
 cdce*  at uhub?# CDC Ethernet
 urndis*at uhub?# Remote NDIS Ethernet
 cue*   at uhub?# CATC USB-EL1201A based Ethernet



Add sizes for free() in cryptosoft.c

2018-05-29 Thread Frederic Cambus
Hi tech@,

Add sizes for free() in cryptosoft.c.

Comments? OK?

Index: sys/crypto/cryptosoft.c
===
RCS file: /cvs/src/sys/crypto/cryptosoft.c,v
retrieving revision 1.83
diff -u -p -r1.83 cryptosoft.c
--- sys/crypto/cryptosoft.c 2 May 2017 11:44:32 -   1.83
+++ sys/crypto/cryptosoft.c 29 May 2018 11:13:13 -
@@ -971,7 +971,8 @@ swcr_freesession(u_int64_t tid)
 
if (swd->sw_kschedule) {
explicit_bzero(swd->sw_kschedule, txf->ctxsize);
-   free(swd->sw_kschedule, M_CRYPTO_DATA, 0);
+   free(swd->sw_kschedule, M_CRYPTO_DATA,
+   txf->ctxsize);
}
break;
 
@@ -985,11 +986,11 @@ swcr_freesession(u_int64_t tid)
 
if (swd->sw_ictx) {
explicit_bzero(swd->sw_ictx, axf->ctxsize);
-   free(swd->sw_ictx, M_CRYPTO_DATA, 0);
+   free(swd->sw_ictx, M_CRYPTO_DATA, axf->ctxsize);
}
if (swd->sw_octx) {
explicit_bzero(swd->sw_octx, axf->ctxsize);
-   free(swd->sw_octx, M_CRYPTO_DATA, 0);
+   free(swd->sw_octx, M_CRYPTO_DATA, axf->ctxsize);
}
break;
 
@@ -1001,12 +1002,12 @@ swcr_freesession(u_int64_t tid)
 
if (swd->sw_ictx) {
explicit_bzero(swd->sw_ictx, axf->ctxsize);
-   free(swd->sw_ictx, M_CRYPTO_DATA, 0);
+   free(swd->sw_ictx, M_CRYPTO_DATA, axf->ctxsize);
}
break;
}
 
-   free(swd, M_CRYPTO_DATA, 0);
+   free(swd, M_CRYPTO_DATA, sizeof(*swd));
}
return 0;
 }



Remove unused C3 values (VIA)

2018-06-02 Thread Frederic Cambus
Hi tech@,

Here is a diff to remove unused C3 values.

Comments? OK?

Index: sys/arch/amd64/include/specialreg.h
===
RCS file: /cvs/src/sys/arch/amd64/include/specialreg.h,v
retrieving revision 1.72
diff -u -p -r1.72 specialreg.h
--- sys/arch/amd64/include/specialreg.h 23 May 2018 05:37:01 -  1.72
+++ sys/arch/amd64/include/specialreg.h 2 Jun 2018 09:14:32 -
@@ -873,14 +873,9 @@
 #define C3_CPUID_DO_PMM0x002000
 
 /* VIA C3 xcrypt-* instruction context control options */
-#defineC3_CRYPT_CWLO_ROUND_M   0x000f
-#defineC3_CRYPT_CWLO_ALG_M 0x0070
 #defineC3_CRYPT_CWLO_ALG_AES   0x
-#defineC3_CRYPT_CWLO_KEYGEN_M  0x0080
-#defineC3_CRYPT_CWLO_KEYGEN_HW 0x
 #defineC3_CRYPT_CWLO_KEYGEN_SW 0x0080
 #defineC3_CRYPT_CWLO_NORMAL0x
-#defineC3_CRYPT_CWLO_INTERMEDIATE  0x0100
 #defineC3_CRYPT_CWLO_ENCRYPT   0x
 #defineC3_CRYPT_CWLO_DECRYPT   0x0200
 #defineC3_CRYPT_CWLO_KEY1280x000a  /* 128bit, 10 
rds */
Index: sys/arch/i386/include/specialreg.h
===
RCS file: /cvs/src/sys/arch/i386/include/specialreg.h,v
retrieving revision 1.66
diff -u -p -r1.66 specialreg.h
--- sys/arch/i386/include/specialreg.h  28 May 2018 20:52:44 -  1.66
+++ sys/arch/i386/include/specialreg.h  2 Jun 2018 09:14:32 -
@@ -724,14 +724,9 @@
 #define C3_CPUID_DO_PMM0x002000
 
 /* VIA C3 xcrypt-* instruction context control options */
-#defineC3_CRYPT_CWLO_ROUND_M   0x000f
-#defineC3_CRYPT_CWLO_ALG_M 0x0070
 #defineC3_CRYPT_CWLO_ALG_AES   0x
-#defineC3_CRYPT_CWLO_KEYGEN_M  0x0080
-#defineC3_CRYPT_CWLO_KEYGEN_HW 0x
 #defineC3_CRYPT_CWLO_KEYGEN_SW 0x0080
 #defineC3_CRYPT_CWLO_NORMAL0x
-#defineC3_CRYPT_CWLO_INTERMEDIATE  0x0100
 #defineC3_CRYPT_CWLO_ENCRYPT   0x
 #defineC3_CRYPT_CWLO_DECRYPT   0x0200
 #defineC3_CRYPT_CWLO_KEY1280x000a  /* 128bit, 10 
rds */



Re: Remove unused C3 values (VIA)

2018-06-02 Thread Frederic Cambus
On Sat, Jun 02, 2018 at 11:30:15AM +, Visa Hankala wrote:
> On Sat, Jun 02, 2018 at 01:00:05PM +0200, Frederic Cambus wrote:
> > Hi tech@,
> > 
> > Here is a diff to remove unused C3 values.
> > 
> > Comments? OK?
> 
> I would keep the definitions because they can at least serve as a weak
> form of documentation about the hardware. For example,
> C3_CRYPT_CWLO_ALG_M indicates what bits specify the algorithm, which
> in turn helps one to understand the value of C3_CRYPT_CWLO_ALG_AES.

Agreed. That makes sense indeed, sorry for the noise.



cpu.4: VIA C7 CPUs support Enhanced SpeedStep (i386)

2018-06-05 Thread Frederic Cambus
Hi tech@,

VIA C7 CPUs support Enhanced SpeedStep, so reflect that in cpu.4.

On the VIA C7 1.5Ghz:

cpu0: VIA Esther processor 1500MHz ("CentaurHauls" 686-class) 1.51 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,APIC,SEP,MTRR,PGE,CMOV,PAT,CFLUSH,ACPI,MMX,FXSR,SSE,SSE2,TM,PBE,NXE,SSE3,EST,TM2
cpu0: Enhanced SpeedStep 1501 MHz: speeds: 1500, 800 MHz

Comments? OK?

Index: share/man/man4/man4.i386/cpu.4
===
RCS file: /cvs/src/share/man/man4/man4.i386/cpu.4,v
retrieving revision 1.18
diff -u -p -r1.18 cpu.4
--- share/man/man4/man4.i386/cpu.4  12 Jan 2018 04:36:44 -  1.18
+++ share/man/man4/man4.i386/cpu.4  5 Jun 2018 08:39:38 -
@@ -53,8 +53,8 @@ positions.
 The processor dynamically adjusts frequency in response to load; the setperf
 value is interpreted as the maximum.
 .It EST
-Enhanced SpeedStep found on Intel Pentium M processors,
-offering frequency scaling with numerous positions.
+Enhanced SpeedStep found on Intel Pentium M and newer processors, as well as
+on VIA C7 processors, offering frequency scaling with numerous positions.
 .It SpeedStep
 Found on some Intel Pentium 3 and newer mobile chips,
 it is capable of adjusting frequency between a low and high value.



Some tweaks for the VIA PadLock driver

2018-05-29 Thread Frederic Cambus
Hi tech@,

Return error values directly where appropriate, instead of using the err
variable.

While there, remove TODO about bitching. We haven't felt the need to bitch
since the driver was commited, and we do not bitch in aesni_setup() either.

Comments? OK?

Index: sys/arch/amd64/amd64/via.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/via.c,v
retrieving revision 1.29
diff -u -p -r1.29 via.c
--- sys/arch/amd64/amd64/via.c  28 Apr 2018 15:44:59 -  1.29
+++ sys/arch/amd64/amd64/via.c  29 May 2018 15:34:03 -
@@ -87,7 +87,7 @@ viac3_crypto_setup(void)
 
vc3_sc = malloc(sizeof(*vc3_sc), M_DEVBUF, M_NOWAIT|M_ZERO);
if (vc3_sc == NULL)
-   return; /* YYY bitch? */
+   return;
 
bzero(algs, sizeof(algs));
algs[CRYPTO_AES_CBC] = CRYPTO_ALG_FLAG_SUPPORTED;
@@ -102,7 +102,7 @@ viac3_crypto_setup(void)
vc3_sc->sc_cid = crypto_get_driverid(0);
if (vc3_sc->sc_cid < 0) {
free(vc3_sc, M_DEVBUF, sizeof(*vc3_sc));
-   return; /* YYY bitch? */
+   return;
}
 
crypto_register(vc3_sc->sc_cid, algs, viac3_crypto_newsession,
@@ -340,16 +340,12 @@ viac3_crypto_encdec(struct cryptop *crp,
u_int32_t *key;
int err = 0;
 
-   if ((crd->crd_len % 16) != 0) {
-   err = EINVAL;
-   return (err);
-   }
+   if ((crd->crd_len % 16) != 0)
+   return (EINVAL);
 
sc->op_buf = malloc(crd->crd_len, M_DEVBUF, M_NOWAIT);
-   if (sc->op_buf == NULL) {
-   err = ENOMEM;
-   return (err);
-   }
+   if (sc->op_buf == NULL)
+   return (ENOMEM);
 
if (crd->crd_flags & CRD_F_ENCRYPT) {
sc->op_cw[0] = ses->ses_cw0 | C3_CRYPT_CWLO_ENCRYPT;
Index: sys/arch/i386/i386/via.c
===
RCS file: /cvs/src/sys/arch/i386/i386/via.c,v
retrieving revision 1.43
diff -u -p -r1.43 via.c
--- sys/arch/i386/i386/via.c28 Apr 2018 15:44:59 -  1.43
+++ sys/arch/i386/i386/via.c29 May 2018 15:34:03 -
@@ -88,7 +88,7 @@ viac3_crypto_setup(void)
 
vc3_sc = malloc(sizeof(*vc3_sc), M_DEVBUF, M_NOWAIT|M_ZERO);
if (vc3_sc == NULL)
-   return; /* YYY bitch? */
+   return;
 
bzero(algs, sizeof(algs));
algs[CRYPTO_AES_CBC] = CRYPTO_ALG_FLAG_SUPPORTED;
@@ -103,7 +103,7 @@ viac3_crypto_setup(void)
vc3_sc->sc_cid = crypto_get_driverid(0);
if (vc3_sc->sc_cid < 0) {
free(vc3_sc, M_DEVBUF, sizeof(*vc3_sc));
-   return; /* YYY bitch? */
+   return;
}
 
crypto_register(vc3_sc->sc_cid, algs, viac3_crypto_newsession,
@@ -341,16 +341,12 @@ viac3_crypto_encdec(struct cryptop *crp,
u_int32_t *key;
int err = 0;
 
-   if ((crd->crd_len % 16) != 0) {
-   err = EINVAL;
-   return (err);
-   }
+   if ((crd->crd_len % 16) != 0)
+   return (EINVAL);
 
sc->op_buf = malloc(crd->crd_len, M_DEVBUF, M_NOWAIT);
-   if (sc->op_buf == NULL) {
-   err = ENOMEM;
-   return (err);
-   }
+   if (sc->op_buf == NULL)
+   return (ENOMEM);
 
if (crd->crd_flags & CRD_F_ENCRYPT) {
sc->op_cw[0] = ses->ses_cw0 | C3_CRYPT_CWLO_ENCRYPT;



Add sizes for free() for octeon

2018-05-29 Thread Frederic Cambus
Hi tech@,

Add sizes for free() for octeon.

Comments? OK?

Index: sys/arch/octeon/dev/amdcf.c
===
RCS file: /cvs/src/sys/arch/octeon/dev/amdcf.c,v
retrieving revision 1.5
diff -u -p -r1.5 amdcf.c
--- sys/arch/octeon/dev/amdcf.c 30 Dec 2017 23:08:29 -  1.5
+++ sys/arch/octeon/dev/amdcf.c 30 Apr 2018 21:40:24 -
@@ -495,7 +495,7 @@ amdcfioctl(dev_t dev, u_long xfer, caddr
lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
amdcfgetdisklabel(dev, sc, lp, 0);
bcopy(lp, sc->sc_dk.dk_label, sizeof(*lp));
-   free(lp, M_TEMP, 0);
+   free(lp, M_TEMP, sizeof(*lp));
goto exit;
 
case DIOCGPDINFO:
Index: sys/arch/octeon/dev/octcf.c
===
RCS file: /cvs/src/sys/arch/octeon/dev/octcf.c,v
retrieving revision 1.31
diff -u -p -r1.31 octcf.c
--- sys/arch/octeon/dev/octcf.c 30 Dec 2017 23:08:29 -  1.31
+++ sys/arch/octeon/dev/octcf.c 30 Apr 2018 21:40:24 -
@@ -563,7 +563,7 @@ octcfioctl(dev_t dev, u_long xfer, caddr
lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
octcfgetdisklabel(dev, wd, lp, 0);
bcopy(lp, wd->sc_dk.dk_label, sizeof(*lp));
-   free(lp, M_TEMP, 0);
+   free(lp, M_TEMP, sizeof(*lp));
goto exit;
 
case DIOCGPDINFO:
@@ -788,7 +788,7 @@ octcf_get_params(struct octcf_softc *wd,
 
if (error != 0) {
printf("%s: identify failed: %d\n", __func__, error);
-   free(tb, M_DEVBUF, 0);
+   free(tb, M_DEVBUF, ATAPARAMS_SIZE);
return CMD_ERR;
} else {
/*
@@ -818,7 +818,7 @@ octcf_get_params(struct octcf_softc *wd,
params->atap_model[1] == 'E') ||
 (params->atap_model[0] == 'F' &&
 params->atap_model[1] == 'X'))) {
-   free(tb, M_DEVBUF, 0);
+   free(tb, M_DEVBUF, ATAPARAMS_SIZE);
return CMD_OK;
}
for (i = 0; i < sizeof(params->atap_model); i += 2) {
@@ -834,7 +834,7 @@ octcf_get_params(struct octcf_softc *wd,
*p = swap16(*p);
}
 
-   free(tb, M_DEVBUF, 0);
+   free(tb, M_DEVBUF, ATAPARAMS_SIZE);
return CMD_OK;
}
 }



Re: cpu.4: VIA C7 CPUs support Enhanced SpeedStep (i386)

2018-07-01 Thread Frederic Cambus
On Tue, Jun 05, 2018 at 10:04:52PM +1000, Jonathan Gray wrote:

> > VIA C7 CPUs support Enhanced SpeedStep, so reflect that in cpu.4.
> > 
> > On the VIA C7 1.5Ghz:
> > 
> > cpu0: VIA Esther processor 1500MHz ("CentaurHauls" 686-class) 1.51 GHz
> > cpu0: 
> > FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,APIC,SEP,MTRR,PGE,CMOV,PAT,CFLUSH,ACPI,MMX,FXSR,SSE,SSE2,TM,PBE,NXE,SSE3,EST,TM2
> > cpu0: Enhanced SpeedStep 1501 MHz: speeds: 1500, 800 MHz
> 
> If you just have the faked high/low table does it really support it
> besides setting the cpuid bit?  No PSS in ACPI?  There is a table
> for a 1.5GHz C7 in i386
> 
> /* 1.50GHz Centaur C7-M 400 MHz FSB */
> static struct est_op C7M_754[] = {
>   ID16(1500, 1004, BUS100),
>   ID16(1400,  988, BUS100),
>   ID16(1000,  940, BUS100),
>   ID16( 800,  844, BUS100),
>   ID16( 600,  844, BUS100),
>   ID16( 400,  844, BUS100),
> };

Sorry for the delay, I wanted to try booting an old VIA C7 motherboard
I have (the dmesg bits from previous mail came from our dmesg archive)
before answering.

I finally was able to find it and do so, and indeed it seems there are
some issues as well:

cpu0: VIA C7 Processor 1000MHz ("CentaurHauls" 686-class) 1 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,CMOV,PAT,CFLUSH,ACPI,MMX,FXSR,SSE,SSE2,TM,PBE,NXE,SSE3,EST,TM2,xTPR

cpu0: unknown Enhanced SpeedStep CPU, msr 0x08100a1308000a13
cpu0: using only highest and lowest power states
cpu0: Enhanced SpeedStep 998 MHz: speeds: 1333, 1067 MHz

I'm not sure it makes sense to spend any time on this, let's forget it.



pcidevs updates for the VIA VX900 chipset

2018-07-01 Thread Frederic Cambus
Hi tech@,

Add device IDs of the VIA VX900 chipset.

Attaching a dmesg from my HP t510 Thin Client.

Comments? OK?

Index: sys/dev/pci/pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1851
diff -u -p -r1.1851 pcidevs
--- sys/dev/pci/pcidevs 16 Jun 2018 21:29:39 -  1.1851
+++ sys/dev/pci/pcidevs 1 Jul 2018 13:53:17 -
@@ -7427,6 +7427,7 @@ product VIATECH VT3351_HB 0x0351  VT3351 
 product VIATECH VX800_00x0353  VX800 Host
 product VIATECH P4M900 0x0364  P4M900 Host
 product VIATECH VT8371_HB  0x0391  VT8371 Host
+product VIATECH VX900_HB   0x0410  VX900 Host
 product VIATECH VT6415 0x0415  VT6415 IDE
 product VIATECH VT8501 0x0501  VT8501
 product VIATECH VT82C505   0x0505  VT82C505
@@ -7464,6 +7465,7 @@ product VIATECH K8M890_1  0x1336  K8M890 H
 product VIATECH VT3351_2   0x1351  VT3351 Host
 product VIATECH VX800_10x1353  VX800 Host
 product VIATECH P4M900_1   0x1364  P4M900 Host
+product VIATECH VX900_ERR  0x1410  VX900 Error Reporting
 product VIATECH VT82C416   0x1571  VT82C416 IDE
 product VIATECH VT82C1595  0x1595  VT82C1595 PCI
 product VIATECH K8M800_2   0x2204  K8M800 Host
@@ -7480,6 +7482,7 @@ product VIATECH K8M890_2  0x2336  K8M890 H
 product VIATECH VT3351_3   0x2351  VT3351 Host
 product VIATECH VX800_20x2353  VX800 Host
 product VIATECH P4M900_2   0x2364  P4M900 Host
+product VIATECH VX900_00x2410  VX900 Host
 product VIATECH VT8251_PCI 0x287a  VT8251 PCI
 product VIATECH VT8251_PCIE_0  0x287b  VT8251 PCIE
 product VIATECH VT8251_PCIE_1  0x287c  VT8251 PCIE
@@ -7553,6 +7556,7 @@ product VIATECH CHROME9_HC0x3371  Chrome
 product VIATECH VT8237S_ISA0x3372  VT8237S ISA
 product VIATECH VT8237A_PPB_1  0x337a  VT8237A
 product VIATECH VT8237A_PPB_2  0x337b  VT8237A
+product VIATECH VX900_DRAM 0x3410  VX900 DRAM
 product VIATECH VL80x_XHCI 0x3432  VL80x xHCI
 productVIATECH VL805_XHCI  0x3483  VL805 xHCI
 product VIATECH K8M800_4   0x4204  K8M800 Host
@@ -7569,6 +7573,7 @@ product VIATECH K8M890_4  0x4336  K8M890 H
 product VIATECH VT3351_5   0x4351  VT3351 Host
 product VIATECH VX800_40x4353  VX800 Host
 product VIATECH P4M900_4   0x4364  P4M900 Host
+product VIATECH VX900_10x4410  VX900 Host
 product VIATECH K8T890_IOAPIC  0x5238  K8T890 IOAPIC
 product VIATECH PT894_IOAPIC   0x5308  PT894 IOAPIC
 product VIATECH CX700_IDE  0x5324  CX700 IDE
@@ -7579,6 +7584,7 @@ product VIATECH VT3351_IOAPIC 0x5351  VT3
 product VIATECH VX800_IOAPIC   0x5353  VX800 IOAPIC
 product VIATECH P4M900_IOAPIC  0x5364  P4M900 IOAPIC
 product VIATECH VT8237S_SATA   0x5372  VT8237S SATA
+product VIATECH VX900_APIC 0x5410  VX900 APIC
 product VIATECH RHINEII0x6100  RhineII
 product VIATECH VT3351_6   0x6238  VT3351 Host
 product VIATECH VT8251_AHCI0x6287  VT8251 AHCI
@@ -7586,6 +7592,8 @@ product VIATECH K8M890_6  0x6290  K8M890 H
 product VIATECH P4M890_6   0x6327  P4M890 Security
 product VIATECH VX800_60x6353  VX800 Host
 product VIATECH P4M900_6   0x6364  P4M900 Security
+product VIATECH VX900_SCRATCH  0x6410  VX900 Scratch
+product VIATECH CHROME9_HD 0x7122  Chrome9 HD
 product VIATECH K8M800_7   0x7204  K8M800 Host
 product VIATECH VT8378_VGA 0x7205  VT8378 VGA
 product VIATECH PT894_50x7308  PT894 Host
@@ -7601,6 +7609,7 @@ product VIATECH K8HTB_7   0x7282  K8HTB Ho
 product VIATECH CN700_70x7314  CN700 Host
 product VIATECH CX700_70x7324  CX700 Host
 product VIATECH VT3351_7   0x7351  VT3351 Host
+product VIATECH VX900_20x7410  VX900 Host
 product VIATECH VT8231_ISA 0x8231  VT8231 ISA
 product VIATECH VT8231_PWR 0x8235  VT8231 PMG
 product VIATECH VT8363_AGP 0x8305  VT8363 AGP
@@ -7608,6 +7617,7 @@ product VIATECH CX700_ISA 0x8324  CX700 I
 product VIATECH VX800_ISA  0x8353  VX800 ISA
 product VIATECH VT8371_PPB 0x8391  VT8371
 product VIATECH VX855_ISA  0x8409  VX855 ISA
+product VIATECH VX900_ISA  0x8410  VX900 ISA
 product VIATECH VT8501_AGP 0x8501  VT8501 AGP
 product VIATECH VT82C597AGP0x8597  VT82C597 AGP
 product VIATECH VT82C598AGP0x8598  VT82C598 AGP
@@ -7617,6 +7627,7 @@ product VIATECH VX900_IDE 0x9001  VX900 I
 product VIATECH VX800_SDMMC0x9530  VX800 SD/MMC
 product VIATECH VX800_SDIO 0x95d0  VX800 SDIO
 product VIATECH K8T890_PPB_A   0xa238  K8T890
+product VIATECH VX900_PCIE_0   0xa410  VX900 PCIE
 product VIATECH P4M890_PPB_1   0xa327  P4M890
 product VIATECH VX800_A0xa353  VX800 Host
 product VIATECH P4M900_PPB_1   0xa364  P4M900
@@ -7629,15 +7640,19 @@ product VIATECH VT8235_AGP  0xb168  VT8235
 product VIATECH K8HTB_AGP  0xb188  K8HTB AGP
 product VIATECH VT8377_AGP 

Add sizes for free() in glxsb(4)

2017-12-24 Thread Frederic Cambus
Hi tech@,

Add sizes for free() for the Geode LX Security Block crypto accelerator.

Comments? OK?

Index: sys/arch/i386/pci/glxsb.c
===
RCS file: /cvs/src/sys/arch/i386/pci/glxsb.c,v
retrieving revision 1.33
diff -u -p -r1.33 glxsb.c
--- sys/arch/i386/pci/glxsb.c   8 Sep 2017 05:36:51 -   1.33
+++ sys/arch/i386/pci/glxsb.c   24 Dec 2017 18:37:54 -
@@ -525,22 +525,22 @@ glxsb_crypto_freesession(uint64_t tid)
 
if (swd->sw_kschedule) {
explicit_bzero(swd->sw_kschedule, txf->ctxsize);
-   free(swd->sw_kschedule, M_CRYPTO_DATA, 0);
+   free(swd->sw_kschedule, M_CRYPTO_DATA, txf->ctxsize);
}
-   free(swd, M_CRYPTO_DATA, 0);
+   free(swd, M_CRYPTO_DATA, sizeof(*swd));
}
if ((swd = sc->sc_sessions[sesn].ses_swd_auth)) {
axf = swd->sw_axf;
 
if (swd->sw_ictx) {
explicit_bzero(swd->sw_ictx, axf->ctxsize);
-   free(swd->sw_ictx, M_CRYPTO_DATA, 0);
+   free(swd->sw_ictx, M_CRYPTO_DATA, axf->ctxsize);
}
if (swd->sw_octx) {
explicit_bzero(swd->sw_octx, axf->ctxsize);
-   free(swd->sw_octx, M_CRYPTO_DATA, 0);
+   free(swd->sw_octx, M_CRYPTO_DATA, axf->ctxsize);
}
-   free(swd, M_CRYPTO_DATA, sizeof *swd);
+   free(swd, M_CRYPTO_DATA, sizeof(*swd));
}
explicit_bzero(>sc_sessions[sesn], sizeof(sc->sc_sessions[sesn]));
return (0);



Add sizes for free() in wscons(4)

2018-01-16 Thread Frederic Cambus
Hi tech@,

Add sizes for free() in wscons(4).

Comments? OK?

Index: sys/dev/wscons/wsdisplay.c
===
RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.129
diff -u -p -r1.129 wsdisplay.c
--- sys/dev/wscons/wsdisplay.c  19 Jul 2017 20:12:54 -  1.129
+++ sys/dev/wscons/wsdisplay.c  15 Jan 2018 09:49:03 -
@@ -3326,7 +3326,7 @@ allocate_copybuffer(struct wsdisplay_sof
}
if (size != sc->sc_copybuffer_size && sc->sc_copybuffer_size != 0) {
bzero(sc->sc_copybuffer, sc->sc_copybuffer_size);
-   free(sc->sc_copybuffer, M_DEVBUF, 0);
+   free(sc->sc_copybuffer, M_DEVBUF, sc->sc_copybuffer_size);
}
if ((sc->sc_copybuffer = (char *)malloc(size, M_DEVBUF, M_NOWAIT)) ==
NULL) {
Index: sys/dev/wscons/wskbd.c
===
RCS file: /cvs/src/sys/dev/wscons/wskbd.c,v
retrieving revision 1.87
diff -u -p -r1.87 wskbd.c
--- sys/dev/wscons/wskbd.c  12 May 2017 09:16:55 -  1.87
+++ sys/dev/wscons/wskbd.c  15 Jan 2018 09:49:03 -
@@ -1126,7 +1126,7 @@ getkeyrepeat:
KB_HANDLEDBYWSKBD);
wskbd_update_layout(sc->id, enc);
}
-   free(buf, M_TEMP, 0);
+   free(buf, M_TEMP, len);
return(error);
 
case WSKBDIO_GETMAP:



rasops(9): Fix underline rotation on CCW rotated screens

2018-01-19 Thread Frederic Cambus
Hi tech@,

Fix underline rotation on CCW (quarter counter-clockwise) rotated
screens.

Currently, the "underline" is actually drawn above text.

Comments? OK?

Index: sys/dev/rasops/rasops.c
===
RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
retrieving revision 1.49
diff -u -p -r1.49 rasops.c
--- sys/dev/rasops/rasops.c 23 Dec 2017 10:30:25 -  1.49
+++ sys/dev/rasops/rasops.c 17 Jan 2018 17:35:49 -
@@ -1247,6 +1247,8 @@ rasops_putchar_rotated(void *cookie, int
 
/* Do rotated underline */
rp = ri->ri_bits + col * ri->ri_yscale + row * ri->ri_xscale;
+   if (ri->ri_flg & RI_ROTATE_CCW)
+   rp += (ri->ri_font->fontwidth - 1) * ri->ri_pelbytes;
height = ri->ri_font->fontheight;
 
/* XXX this assumes 16-bit color depth */



Sizes for free() in the Enhanced SpeedStep driver

2018-02-13 Thread Frederic Cambus
Hi tech@,

Add sizes for free() in the i386 version of the Enhanced SpeedStep driver.

It was already done on amd64, but not on i386. Tested on an Atom N270.

Comments? OK?

Index: sys/arch/i386/i386/est.c
===
RCS file: /cvs/src/sys/arch/i386/i386/est.c,v
retrieving revision 1.48
diff -u -p -r1.48 est.c
--- sys/arch/i386/i386/est.c7 Mar 2016 05:32:46 -   1.48
+++ sys/arch/i386/i386/est.c20 Jan 2018 17:53:44 -
@@ -1036,7 +1036,7 @@ est_acpi_pss_changed(struct acpicpu_pss 
needtran = 0;
}
 
-   free(est_fqlist->table, M_DEVBUF, 0);
+   free(est_fqlist->table, M_DEVBUF, npss * sizeof(struct est_op));
free(est_fqlist, M_DEVBUF, sizeof *est_fqlist);
est_fqlist = acpilist;
 
@@ -1141,7 +1141,7 @@ est_init(struct cpu_info *ci, int vendor
 
if ((fake_table = mallocarray(3, sizeof(struct est_op),
M_DEVBUF, M_NOWAIT)) == NULL) {
-   free(fake_fqlist, M_DEVBUF, 0);
+   free(fake_fqlist, M_DEVBUF, sizeof(struct fqlist));
printf("%s: EST: cannot allocate memory for fake "
"table\n", cpu_device);
return;
@@ -1206,7 +1206,7 @@ nospeedstep:
 * it can't fail in that case and therefore can't reach here.
 */
free(est_fqlist->table, M_DEVBUF, 0);
-   free(est_fqlist, M_DEVBUF, 0);
+   free(est_fqlist, M_DEVBUF, sizeof(*est_fqlist));
 }
 
 void



Re: Remove unnecessary includes (i386 VIA PadLock driver)

2017-12-28 Thread Frederic Cambus
On Fri, Dec 08, 2017 at 12:39:36PM +0100, Frederic Cambus wrote:

> This diff remove unnecessary includes in the i386 version of the
> VIA PadLock driver.
> 
> Comments? OK?

Ping. Anyone?

This is the last step in syncing amd64 and i386 versions of the
VIA PadLock driver.



cpu.4: VIA amd64 compatible CPUs support Enhanced SpeedStep

2017-12-28 Thread Frederic Cambus
Hi tech@,

VIA amd64 compatible CPUs support Enhanced SpeedStep, so reflect that
in cpu.4.

On my VIA Nano U3500:

cpu0: VIA Nano U3500@1000MHz, 997.66 MHz
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
CFLUSH,ACPI,MMX,FXSR,SSE,SSE2,SS,TM,PBE,SSE3,MWAIT,VMX,EST,TM2,SSSE3,
CX16,xTPR,SSE4.1,POPCNT,NXE,LONG,LAHF,PERF
cpu0: Enhanced SpeedStep 997 MHz: speeds: 1000, 800 MHz

On my VIA Eden X2 U4200:

cpu0: VIA Eden X2 U4200 @ 1.0+ GHz, 1000.23 MHz
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,
CFLUSH,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,MWAIT,VMX,EST,TM2,
SSSE3,CX16,xTPR,SSE4.1,POPCNT,NXE,LONG,LAHF,PERF
cpu0: Enhanced SpeedStep 1000 MHz: speeds: 1000, 900, 800 MHz

Comments? OK?

Index: share/man/man4/man4.amd64/cpu.4
===
RCS file: /cvs/src/share/man/man4/man4.amd64/cpu.4,v
retrieving revision 1.4
diff -u -p -r1.4 cpu.4
--- share/man/man4/man4.amd64/cpu.4 13 Jul 2009 15:43:05 -  1.4
+++ share/man/man4/man4.amd64/cpu.4 27 Dec 2017 17:22:10 -
@@ -46,7 +46,7 @@ There are several possible implementatio
 to the user.
 .Bl -tag -width tenletters
 .It EST
-Enhanced SpeedStep found on Intel processors,
+Enhanced SpeedStep found on Intel and VIA processors,
 offers frequency scaling with numerous positions.
 .It PowerNow
 Found on various AMD processors.



rasops(9): Remove dead assignment

2017-12-22 Thread Frederic Cambus
Hi tech@,

Now that we call rasops_putchar_rotated(), we don't need ri anymore.

Comments? OK?

Index: sys/dev/rasops/rasops.c
===
RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
retrieving revision 1.48
diff -u -p -r1.48 rasops.c
--- sys/dev/rasops/rasops.c 22 Aug 2017 12:24:45 -  1.48
+++ sys/dev/rasops/rasops.c 22 Dec 2017 21:08:39 -
@@ -1265,11 +1265,8 @@ rasops_putchar_rotated(void *cookie, int
 int
 rasops_erasecols_rotated(void *cookie, int row, int col, int num, long attr)
 {
-   struct rasops_info *ri;
int i;
int rc;
-
-   ri = (struct rasops_info *)cookie;
 
for (i = col; i < col + num; i++) {
rc = rasops_putchar_rotated(cookie, row, i, ' ', attr);



  1   2   >