svn commit: r364396 - head/usr.sbin/freebsd-update

2020-08-19 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Wed Aug 19 15:11:27 2020
New Revision: 364396
URL: https://svnweb.freebsd.org/changeset/base/364396

Log:
  Unbreak `freebsd-update updatesready'.
  
  The command would only work if PWD happened to be WORKDIR.
  Also, exit 1 in case WORKDIR exists, but isn't accessible
  by the current user.
  
  PR:   242709
  Reported by:  Max Fiedler
  MFC after:1 week

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Wed Aug 19 15:08:14 
2020(r364395)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Wed Aug 19 15:11:27 
2020(r364396)
@@ -3341,8 +3341,18 @@ cmd_upgrade () {
upgrade_run || exit 1
 }
 
-# Check if there are fetched updates ready to install
+# Check if there are fetched updates ready to install.
+# Chdir into the working directory.
 cmd_updatesready () {
+   # Check if working directory exists (if not, no updates pending)
+   if ! [ -e "${WORKDIR}" ]; then
+   echo "No updates are available to install."
+   exit 2
+   fi
+   
+   # Change into working directory (fail if no permission/directory etc.)
+   cd ${WORKDIR} || exit 1
+
# Construct a unique name from ${BASEDIR}
BDHASH=`echo ${BASEDIR} | sha256 -q`
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362727 - head/share/man/man4

2020-06-28 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sun Jun 28 17:28:11 2020
New Revision: 362727
URL: https://svnweb.freebsd.org/changeset/base/362727

Log:
  Adapt documentation of kern.tty_info_kstacks.
  
  s/stack/kernel stack/, as this feature only shows kernel stacks.
  
  Reported by:  jhb
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D25488

Modified:
  head/share/man/man4/termios.4

Modified: head/share/man/man4/termios.4
==
--- head/share/man/man4/termios.4   Sun Jun 28 15:03:07 2020
(r362726)
+++ head/share/man/man4/termios.4   Sun Jun 28 17:28:11 2020
(r362727)
@@ -28,7 +28,7 @@
 .\"@(#)termios.4   8.4 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd June 27, 2020
+.Dd June 28, 2020
 .Dt TERMIOS 4
 .Os
 .Sh NAME
@@ -766,7 +766,7 @@ In case the
 .Xr sysctl 8
 variable
 .Va kern.tty_info_kstacks
-is set to a non-zero value, the running thread's stack is
+is set to a non-zero value, the running thread's kernel stack is
 written to the terminal (e.g., for debugging purposes).
 .El
 .Pp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362700 - head/share/man/man4

2020-06-27 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Jun 27 16:31:04 2020
New Revision: 362700
URL: https://svnweb.freebsd.org/changeset/base/362700

Log:
  Document new kern.tty_info_kstacks tunable.
  
  Reviewed by:  manpages (imp), 0mp
  Differential Revision:https://reviews.freebsd.org/D25488

Modified:
  head/share/man/man4/termios.4

Modified: head/share/man/man4/termios.4
==
--- head/share/man/man4/termios.4   Sat Jun 27 15:50:35 2020
(r362699)
+++ head/share/man/man4/termios.4   Sat Jun 27 16:31:04 2020
(r362700)
@@ -28,7 +28,7 @@
 .\"@(#)termios.4   8.4 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd December 26, 2009
+.Dd June 27, 2020
 .Dt TERMIOS 4
 .Os
 .Sh NAME
@@ -761,6 +761,13 @@ command in the foreground, its process ID, the symboli
 wait channel, the number of user and system seconds used,
 the percentage of cpu the process is getting, and the resident
 set size of the process.
+.Pp
+In case the
+.Xr sysctl 8
+variable
+.Va kern.tty_info_kstacks
+is set to a non-zero value, the running thread's stack is
+written to the terminal (e.g., for debugging purposes).
 .El
 .Pp
 The
@@ -1586,4 +1593,5 @@ the values in the header
 .Xr tcsendbreak 3 ,
 .Xr tcsetattr 3 ,
 .Xr tcsetsid 3 ,
-.Xr tty 4
+.Xr tty 4 ,
+.Xr stack 9
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r352662 - head/usr.sbin/freebsd-update

2019-09-24 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Tue Sep 24 20:49:33 2019
New Revision: 352662
URL: https://svnweb.freebsd.org/changeset/base/352662

Log:
  freebsd-update: Add `updatesready' and `showconfig' commands
  
  `freebsd-update updatesready' can be used to check if there are any pending
  fetched updates that can be installed.
  
  `freebsd-update showconfig' writes freebsd-update's configuration to
  stdout.
  
  This also changes the exit code of `freebsd-update install' to 2 in case
  there are no updates pending to be installed and there wasn't a fetch phase
  in the same invocation. This allows scripts to tell apart these error
  conditions without breaking existing jail managers.
  
  See freebsd-update(8) for details.
  
  PR:   240757, 240177, 229346
  Reviewed by:  manpages (bcr), sectam (emaste), yuripv
  Differential Revision:https://reviews.freebsd.org/D21473

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.8
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.8
==
--- head/usr.sbin/freebsd-update/freebsd-update.8   Tue Sep 24 20:36:43 
2019(r352661)
+++ head/usr.sbin/freebsd-update/freebsd-update.8   Tue Sep 24 20:49:33 
2019(r352662)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2017
+.Dd September 24, 2019
 .Dt FREEBSD-UPDATE 8
 .Os
 .Sh NAME
@@ -155,13 +155,24 @@ Note that this command may require up to 500 MB of spa
 depending on which components of the
 .Fx
 base system are installed.
+.It Cm updatesready
+Check if there are fetched updates ready to install.
+Returns exit code 2 if there are no updates to install.
 .It Cm install
 Install the most recently fetched updates or upgrade.
+Returns exit code 2 if there are no updates to install
+and the
+.Cm fetch
+command wasn't passed as an earlier argument in the same
+invocation.
 .It Cm rollback
 Uninstall the most recently installed updates.
 .It Cm IDS
 Compare the system against a "known good" index of the
 installed release.
+.It Cm showconfig
+Show configuration options after parsing conffile and command
+line options.
 .El
 .Sh TIPS
 .Bl -bullet

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Tue Sep 24 20:36:43 
2019(r352661)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Tue Sep 24 20:49:33 
2019(r352662)
@@ -62,9 +62,11 @@ Commands:
   cron -- Sleep rand(3600) seconds, fetch updates, and send an
   email if updates were found
   upgrade  -- Fetch upgrades to FreeBSD version specified via -r option
+  updatesready -- Check if there are fetched updates ready to install
   install  -- Install downloaded updates or upgrades
   rollback -- Uninstall most recently installed updates
   IDS  -- Compare the system against an index of "known good" files
+  showconfig   -- Show configuration
 EOF
exit 0
 }
@@ -503,7 +505,8 @@ parse_cmdline () {
;;
 
# Commands
-   cron | fetch | upgrade | install | rollback | IDS)
+   cron | fetch | upgrade | updatesready | install | rollback |\
+   IDS | showconfig)
COMMANDS="${COMMANDS} $1"
;;
 
@@ -827,7 +830,7 @@ install_check_params () {
echo "No updates are available to install."
if [ $ISFETCHED -eq 0 ]; then
echo "Run '$0 fetch' first."
-   exit 1
+   exit 2
fi
exit 0
fi
@@ -,6 +3336,21 @@ cmd_upgrade () {
upgrade_run || exit 1
 }
 
+# Check if there are fetched updates ready to install
+cmd_updatesready () {
+   # Construct a unique name from ${BASEDIR}
+   BDHASH=`echo ${BASEDIR} | sha256 -q`
+
+   # Check that we have updates ready to install
+   if ! [ -L ${BDHASH}-install ]; then
+   echo "No updates are available to install."
+   exit 2
+   fi
+
+   echo "There are updates available to install."
+   echo "Run '$0 install' to proceed."
+}
+
 # Install downloaded updates.
 cmd_install () {
install_check_params
@@ -3349,6 +3367,13 @@ cmd_rollback () {
 cmd_IDS () {
IDS_check_params
IDS_run || exit 1
+}
+
+# Output configuration.
+cmd_showconfig () {
+   for X in ${CONFIGOPTIONS}; do
+   echo $X=$(eval echo \$${X})
+   done
 }
 
  Entry point
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r352542 - head/usr.sbin/freebsd-update

2019-09-19 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Thu Sep 19 21:13:51 2019
New Revision: 352542
URL: https://svnweb.freebsd.org/changeset/base/352542

Log:
  Fix src component detection
  
  Reviewed by:  emaste
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D21579

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Thu Sep 19 20:45:23 
2019(r352541)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Thu Sep 19 21:13:51 
2019(r352542)
@@ -221,6 +221,14 @@ config_KeepModifiedMetadata () {
 # Add to the list of components which should be kept updated.
 config_Components () {
for C in $@; do
+   COMPONENTS="${COMPONENTS} ${C}"
+   done
+}
+
+# Remove src component from list if it isn't installed
+finalize_components_config () {
+   COMPONENTS=""
+   for C in $@; do
if [ "$C" = "src" ]; then
if [ -e "${BASEDIR}/usr/src/COPYRIGHT" ]; then
COMPONENTS="${COMPONENTS} ${C}"
@@ -3284,6 +3292,7 @@ get_params () {
parse_cmdline $@
parse_conffile
default_params
+   finalize_components_config ${COMPONENTS}
 }
 
 # Fetch command.  Make sure that we're being called
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345512 - head/usr.sbin/daemon

2019-03-25 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Mon Mar 25 21:14:51 2019
New Revision: 345512
URL: https://svnweb.freebsd.org/changeset/base/345512

Log:
  Correct contradictory information on default syslog logging priority.
  
  MFC after:1 week

Modified:
  head/usr.sbin/daemon/daemon.8

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Mon Mar 25 18:19:37 2019
(r345511)
+++ head/usr.sbin/daemon/daemon.8   Mon Mar 25 21:14:51 2019
(r345512)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 9, 2018
+.Dd March 25, 2019
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -129,7 +129,7 @@ Requires adequate superuser privileges.
 .It Fl s Ar syslog_priority
 These priorities are accepted: emerg, alert, crit, err, warning,
 notice, info, and debug.
-The default is info.
+The default is notice.
 .It Fl l Ar syslog_facility
 These facilities are accepted: auth, authpriv, console, cron, daemon,
 ftp, kern, lpr, mail, news, ntp, security, syslog, user, uucp, and
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r322253 - head/sys/dev/cyapa

2017-08-08 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Tue Aug  8 13:27:32 2017
New Revision: 322253
URL: https://svnweb.freebsd.org/changeset/base/322253

Log:
  Fix typo in cyapa out of bounds check.
  
  PR:   217783
  Submitted by: razmys...@viva64.com
  MFC after:1 week

Modified:
  head/sys/dev/cyapa/cyapa.c

Modified: head/sys/dev/cyapa/cyapa.c
==
--- head/sys/dev/cyapa/cyapa.c  Tue Aug  8 12:18:11 2017(r322252)
+++ head/sys/dev/cyapa/cyapa.c  Tue Aug  8 13:27:32 2017(r322253)
@@ -1455,7 +1455,7 @@ cyapa_raw_input(struct cyapa_softc *sc, struct cyapa_r
sc->delta_x = sc->cap_resx;
if (sc->delta_x < -sc->cap_resx)
sc->delta_x = -sc->cap_resx;
-   if (sc->delta_y > sc->cap_resx)
+   if (sc->delta_y > sc->cap_resy)
sc->delta_y = sc->cap_resy;
if (sc->delta_y < -sc->cap_resy)
sc->delta_y = -sc->cap_resy;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316117 - head/sys/cam/ata

2017-03-28 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Tue Mar 28 23:02:41 2017
New Revision: 316117
URL: https://svnweb.freebsd.org/changeset/base/316117

Log:
  In r289137 the legacy_aliases compatibility shims for ata were removed,
  also remove a leftover define used for implementing them.
  
  Reviewed by:  mav
  Differential Revision:https://reviews.freebsd.org/D6726

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Mar 28 22:40:51 2017(r316116)
+++ head/sys/cam/ata/ata_da.c   Tue Mar 28 23:02:41 2017(r316117)
@@ -774,10 +774,6 @@ static voidadashutdown(void *arg, int 
 static voidadasuspend(void *arg);
 static voidadaresume(void *arg);
 
-#ifndefADA_DEFAULT_LEGACY_ALIASES
-#defineADA_DEFAULT_LEGACY_ALIASES  1
-#endif
-
 #ifndef ADA_DEFAULT_TIMEOUT
 #define ADA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r300990 - head/sys/dev/ichiic

2016-05-30 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Mon May 30 09:05:24 2016
New Revision: 300990
URL: https://svnweb.freebsd.org/changeset/base/300990

Log:
  Fix ig4 operation for certain machines
  
  Some machine BIOSes use the I2C bus and leave it in a state that causes
  interrupts to not work properly due to a pending interrupt having been
  latched.
  
  Refactor the code a bit to clear pending interrupts when I2C is enabled.
  This fixes the primary problem.
  
  Also fix a possible race condition in the interrupt handler where the
  interrupt was being cleared after reading the status instead of before.
  
  Reported by:  pfg
  Reviewed by:  jhb
  Approved by:  jhb
  Obtained from:DragonFly BSD
  Differential Revision:https://reviews.freebsd.org/D6586

Modified:
  head/sys/dev/ichiic/ig4_iic.c

Modified: head/sys/dev/ichiic/ig4_iic.c
==
--- head/sys/dev/ichiic/ig4_iic.c   Mon May 30 08:50:33 2016
(r300989)
+++ head/sys/dev/ichiic/ig4_iic.c   Mon May 30 09:05:24 2016
(r300990)
@@ -108,6 +108,17 @@ set_controller(ig4iic_softc_t *sc, uint3
int error;
uint32_t v;
 
+   /*
+* When the controller is enabled, interrupt on STOP detect
+* or receive character ready and clear pending interrupts.
+*/
+   if (ctl & IG4_I2C_ENABLE) {
+   reg_write(sc, IG4_REG_INTR_MASK, IG4_INTR_STOP_DET |
+IG4_INTR_RX_FULL);
+   reg_read(sc, IG4_REG_CLR_INTR);
+   } else
+   reg_write(sc, IG4_REG_INTR_MASK, 0);
+
reg_write(sc, IG4_REG_I2C_EN, ctl);
error = SMB_ETIMEOUT;
 
@@ -553,11 +564,6 @@ ig4iic_attach(ig4iic_softc_t *sc)
reg_write(sc, IG4_REG_RESETS, IG4_RESETS_DEASSERT);
 #endif
 
-   /*
-* Interrupt on STOP detect or receive character ready
-*/
-   reg_write(sc, IG4_REG_INTR_MASK, IG4_INTR_STOP_DET |
-IG4_INTR_RX_FULL);
mtx_lock(>io_lock);
if (set_controller(sc, 0))
device_printf(sc->dev, "controller error during attach-1\n");
@@ -574,7 +580,8 @@ ig4iic_attach(ig4iic_softc_t *sc)
sc->enum_hook.ich_func = ig4iic_start;
sc->enum_hook.ich_arg = sc->dev;
 
-   /* We have to wait until interrupts are enabled. I2C read and write
+   /*
+* We have to wait until interrupts are enabled. I2C read and write
 * only works if the interrupts are available.
 */
if (config_intrhook_establish(>enum_hook) != 0)
@@ -628,7 +635,6 @@ ig4iic_detach(ig4iic_softc_t *sc)
sc->smb = NULL;
sc->intr_handle = NULL;
reg_write(sc, IG4_REG_INTR_MASK, 0);
-   reg_read(sc, IG4_REG_CLR_INTR);
set_controller(sc, 0);
 
mtx_unlock(>io_lock);
@@ -917,6 +923,7 @@ ig4iic_intr(void *cookie)
 
mtx_lock(>io_lock);
 /* reg_write(sc, IG4_REG_INTR_MASK, IG4_INTR_STOP_DET);*/
+   reg_read(sc, IG4_REG_CLR_INTR);
status = reg_read(sc, IG4_REG_I2C_STA);
while (status & IG4_STATUS_RX_NOTEMPTY) {
sc->rbuf[sc->rnext & IG4_RBUFMASK] =
@@ -924,7 +931,6 @@ ig4iic_intr(void *cookie)
++sc->rnext;
status = reg_read(sc, IG4_REG_I2C_STA);
}
-   reg_read(sc, IG4_REG_CLR_INTR);
wakeup(sc);
mtx_unlock(>io_lock);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297052 - in head: lib/libfetch usr.bin/fetch

2016-03-19 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Mar 19 11:55:21 2016
New Revision: 297052
URL: https://svnweb.freebsd.org/changeset/base/297052

Log:
  Update fetch.1 and fetch.3 to reflect libfetch's actual use of CA bundles
  
  Reviewed by:  wblock
  Approved by:  wblock
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D5558

Modified:
  head/lib/libfetch/fetch.3
  head/usr.bin/fetch/fetch.1

Modified: head/lib/libfetch/fetch.3
==
--- head/lib/libfetch/fetch.3   Sat Mar 19 11:48:06 2016(r297051)
+++ head/lib/libfetch/fetch.3   Sat Mar 19 11:55:21 2016(r297052)
@@ -1,6 +1,6 @@
 .\"-
 .\" Copyright (c) 1998-2013 Dag-Erling Smørgrav
-.\" Copyright (c) 2013 Michael Gmelin <free...@grem.de>
+.\" Copyright (c) 2013-2016 Michael Gmelin <free...@grem.de>
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 29, 2015
+.Dd March 18, 2016
 .Dt FETCH 3
 .Os
 .Sh NAME
@@ -396,8 +396,15 @@ is currently unimplemented.
 .Sh HTTPS SCHEME
 Based on HTTP SCHEME.
 By default the peer is verified using the CA bundle located in
-.Pa /etc/ssl/cert.pem .
-The file may contain multiple CA certificates.
+.Pa /usr/local/etc/ssl/cert.pem .
+If this file does not exist,
+.Pa /etc/ssl/cert.pem
+is used instead.
+If neither file exists, and
+.Ev SSL_CA_CERT_PATH
+has not been set,
+OpenSSL's default CA cert and path settings apply.
+The certificate bundle can contain multiple CA certificates.
 A common source of a current CA bundle is
 .Pa \%security/ca_root_nss .
 .Pp
@@ -428,10 +435,11 @@ Client certificate based authentication 
 The environment variable
 .Ev SSL_CLIENT_CERT_FILE
 should be set to point to a file containing key and client certificate
-to be used in PEM format. In case the key is stored in a separate
-file, the environment variable
+to be used in PEM format.
+When a PEM-format key is in a separate file from the client certificate,
+the environment variable
 .Ev SSL_CLIENT_KEY_FILE
-can be set to point to the key in PEM format.
+can be set to point to the key file.
 In case the key uses a password, the user will be prompted on standard
 input (see
 .Xr PEM 3 ) .
@@ -531,7 +539,7 @@ Invalid URL
 .El
 .Pp
 The accompanying error message includes a protocol-specific error code
-and message, e.g.\& "File is not available (404 Not Found)"
+and message, like "File is not available (404 Not Found)"
 .Sh ENVIRONMENT
 .Bl -tag -width ".Ev FETCH_BIND_ADDRESS"
 .It Ev FETCH_BIND_ADDRESS
@@ -648,8 +656,7 @@ for compatibility.
 Allow SSL version 3 when negotiating the connection (not recommended).
 .It Ev SSL_CA_CERT_FILE
 CA certificate bundle containing trusted CA certificates.
-Default value:
-.Pa /etc/ssl/cert.pem .
+Default value: See HTTPS SCHEME above.
 .It Ev SSL_CA_CERT_PATH
 Path containing trusted CA hashes.
 .It Ev SSL_CLIENT_CERT_FILE

Modified: head/usr.bin/fetch/fetch.1
==
--- head/usr.bin/fetch/fetch.1  Sat Mar 19 11:48:06 2016(r297051)
+++ head/usr.bin/fetch/fetch.1  Sat Mar 19 11:55:21 2016(r297052)
@@ -1,6 +1,6 @@
 .\"-
 .\" Copyright (c) 2000-2014 Dag-Erling Smørgrav
-.\" Copyright (c) 2013 Michael Gmelin <free...@grem.de>
+.\" Copyright (c) 2013-2016 Michael Gmelin <free...@grem.de>
 .\" All rights reserved.
 .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
 .\" by permission.
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 25, 2015
+.Dd March 18, 2016
 .Dt FETCH 1
 .Os
 .Sh NAME
@@ -134,11 +134,17 @@ only.
 [SSL]
 Path to certificate bundle containing trusted CA certificates.
 If not specified,
-.Pa /etc/ssl/cert.pem
+.Pa /usr/local/etc/ssl/cert.pem
 is used.
-The file may contain multiple CA certificates. The port
+If this file does not exist,
+.Pa /etc/ssl/cert.pem
+is used instead.
+If neither file exists and no CA path has been configured,
+OpenSSL's default CA cert and path settings apply.
+The certificate bundle can contain multiple CA certificates.
+The
 .Pa security/ca_root_nss
-is a common source of a current CA bundle.
+port is a common source of a current CA bundle.
 .It Fl -ca-path= Ns Ar dir
 [SSL]
 The directory
@@ -218,10 +224,16 @@ altogether, or a comma- or whitespace-se
 which proxies should not be used.
 .It Fl -no-sslv3
 [SSL]
-Don't allow SSL version 3 when negotiating the connection.
+Do not allow SSL version 3 when negotiating the connection.
+This option is deprecated and is provided for backward compatibility
+only.
+SSLv3 is disabled by default.
+Set
+.Ev SSL_ALLOW_SSL3
+to change this behavior.
 .It Fl -no-tlsv1
 [SSL]
-Don't allow TLS version 1 when negotiating the co

svn commit: r288217 - head/lib/libfetch

2015-09-25 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Fri Sep 25 14:24:23 2015
New Revision: 288217
URL: https://svnweb.freebsd.org/changeset/base/288217

Log:
  Fix non-POSIX-compliant use of getaddrinfo in libfetch
  
  Submitted by: Boris Kolpackov 
  Reviewed by:  bapt
  Approved by:  bapt
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D3724

Modified:
  head/lib/libfetch/common.c

Modified: head/lib/libfetch/common.c
==
--- head/lib/libfetch/common.c  Fri Sep 25 13:03:57 2015(r288216)
+++ head/lib/libfetch/common.c  Fri Sep 25 14:24:23 2015(r288217)
@@ -495,7 +495,8 @@ fetch_ssl_get_numeric_addrinfo(const cha
hints.ai_protocol = 0;
hints.ai_flags = AI_NUMERICHOST;
/* port is not relevant for this purpose */
-   getaddrinfo(host, "443", , );
+   if (getaddrinfo(host, "443", , ) != 0)
+   res = NULL;
free(host);
return res;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r286918 - in head/sys: conf dev/cyapa dev/ichiic dev/isl

2015-08-19 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Wed Aug 19 09:49:29 2015
New Revision: 286918
URL: https://svnweb.freebsd.org/changeset/base/286918

Log:
  Allow building a kernel with baked in ig4, isl and cyapa drivers.
  
  Also addresses jhb's remarks on D2811 and D3068.
  
  PR:   202059
  Differential Revision:https://reviews.freebsd.org/D3351
  Reviewed by:  jhb
  Approved by:  jhb

Modified:
  head/sys/conf/files
  head/sys/dev/cyapa/cyapa.c
  head/sys/dev/ichiic/ig4_iic.c
  head/sys/dev/isl/isl.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Aug 19 06:08:11 2015(r286917)
+++ head/sys/conf/files Wed Aug 19 09:49:29 2015(r286918)
@@ -1236,6 +1236,7 @@ t5fw.fw   optional cxgbe  
\
 dev/cy/cy.coptional cy
 dev/cy/cy_isa.coptional cy isa
 dev/cy/cy_pci.coptional cy pci
+dev/cyapa/cyapa.c  optional cyapa smbus
 dev/dc/if_dc.c optional dc pci
 dev/dc/dcphy.c optional dc pci
 dev/dc/pnphy.c optional dc pci
@@ -1461,8 +1462,8 @@ dev/hptiop/hptiop.c   optional hptiop scb
 dev/hwpmc/hwpmc_logging.c  optional hwpmc
 dev/hwpmc/hwpmc_mod.c  optional hwpmc
 dev/hwpmc/hwpmc_soft.c optional hwpmc
-dev/ichiic/ig4_iic.c   optional ichiic
-dev/ichiic/ig4_pci.c   optional ichiic pci
+dev/ichiic/ig4_iic.c   optional ig4 smbus
+dev/ichiic/ig4_pci.c   optional ig4 pci smbus
 dev/ichsmb/ichsmb.coptional ichsmb
 dev/ichsmb/ichsmb_pci.coptional ichsmb pci
 dev/ida/ida.c  optional ida
@@ -1557,6 +1558,7 @@ dev/iscsi_initiator/isc_soc.c optional i
 dev/iscsi_initiator/isc_sm.c   optional iscsi_initiator scbus
 dev/iscsi_initiator/isc_subr.c optional iscsi_initiator scbus
 dev/ismt/ismt.coptional ismt
+dev/isl/isl.c  optional isl smbus
 dev/isp/isp.c  optional isp
 dev/isp/isp_freebsd.c  optional isp
 dev/isp/isp_library.c  optional isp

Modified: head/sys/dev/cyapa/cyapa.c
==
--- head/sys/dev/cyapa/cyapa.c  Wed Aug 19 06:08:11 2015(r286917)
+++ head/sys/dev/cyapa/cyapa.c  Wed Aug 19 09:49:29 2015(r286918)
@@ -149,7 +149,6 @@ struct cyapa_fifo {
 struct cyapa_softc {
device_t dev;
int count;  /* 0 if device opened */
-   int unit;
int addr;
struct cdev *devnode;
struct selinfo selinfo;
@@ -450,7 +449,6 @@ static int
 cyapa_probe(device_t dev)
 {
struct cyapa_cap cap;
-   int unit;
int addr;
int error;
 
@@ -463,8 +461,6 @@ cyapa_probe(device_t dev)
if (addr != 0x67)
return (ENXIO);
 
-   unit = device_get_unit(dev);
-
error = init_device(dev, cap, addr, 1);
if (error != 0)
return (ENXIO);
@@ -486,7 +482,7 @@ cyapa_attach(device_t dev)
sc-reporting_mode = 1;
 
unit = device_get_unit(dev);
-   addr = *((unsigned char*) device_get_ivars(dev));
+   addr = smbus_get_addr(dev);
 
if (init_device(dev, cap, addr, 0))
return (ENXIO);
@@ -494,7 +490,6 @@ cyapa_attach(device_t dev)
mtx_init(sc-mutex, cyapa, NULL, MTX_DEF);
 
sc-dev = dev;
-   sc-unit = unit;
sc-addr = addr;
 
knlist_init_mtx(sc-selinfo.si_note, sc-mutex);

Modified: head/sys/dev/ichiic/ig4_iic.c
==
--- head/sys/dev/ichiic/ig4_iic.c   Wed Aug 19 06:08:11 2015
(r286917)
+++ head/sys/dev/ichiic/ig4_iic.c   Wed Aug 19 09:49:29 2015
(r286918)
@@ -74,8 +74,8 @@ static void ig4iic_intr(void *cookie);
 static void ig4iic_dump(ig4iic_softc_t *sc);
 
 static int ig4_dump;
-SYSCTL_INT(_debug, OID_AUTO, ig4_dump, CTLTYPE_INT | CTLFLAG_RW,
-  ig4_dump, 0, );
+SYSCTL_INT(_debug, OID_AUTO, ig4_dump, CTLFLAG_RW,
+  ig4_dump, 0, Dump controller registers);
 
 /*
  * Low-level inline support functions

Modified: head/sys/dev/isl/isl.c
==
--- head/sys/dev/isl/isl.c  Wed Aug 19 06:08:11 2015(r286917)
+++ head/sys/dev/isl/isl.c  Wed Aug 19 09:49:29 2015(r286918)
@@ -71,12 +71,9 @@ __FBSDID($FreeBSD$);
 
 struct isl_softc {
device_tdev;
-   int unit;
int addr;
 
struct sx   isl_sx;
-   struct sysctl_ctx_list *sysctl_ctx;
-   struct sysctl_oid *sysctl_tree;
 };
 
 /* Returns  0 on problem. */
@@ -85,8 +82,7 @@ static int isl_read_sensor(device_t dev,
 /*
  * Initialize the device
  */
-static
-int
+static int
 

svn commit: r285876 - in head: share/man/man4 sys/dev/cyapa sys/modules/i2c sys/modules/i2c/cyapa

2015-07-25 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Jul 25 18:14:35 2015
New Revision: 285876
URL: https://svnweb.freebsd.org/changeset/base/285876

Log:
  cyapa(4), driver for the Cypress APA I2C trackpad
  
  Differential Revision:https://reviews.freebsd.org/D3068
  Reviewed by:  kib, wblock
  Approved by:  kib
  Relnotes: yes

Added:
  head/share/man/man4/cyapa.4   (contents, props changed)
  head/sys/dev/cyapa/
  head/sys/dev/cyapa/cyapa.c   (contents, props changed)
  head/sys/dev/cyapa/cyapa.h   (contents, props changed)
  head/sys/modules/i2c/cyapa/
  head/sys/modules/i2c/cyapa/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/modules/i2c/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSat Jul 25 16:20:04 2015
(r285875)
+++ head/share/man/man4/MakefileSat Jul 25 18:14:35 2015
(r285876)
@@ -107,6 +107,7 @@ MAN=aac.4 \
cxgb.4 \
cxgbe.4 \
cy.4 \
+   cyapa.4 \
da.4 \
dc.4 \
dcons.4 \

Added: head/share/man/man4/cyapa.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/cyapa.4 Sat Jul 25 18:14:35 2015(r285876)
@@ -0,0 +1,200 @@
+.\ Copyright (c) 2015 Michael Gmelin free...@grem.de
+.\ All rights reserved.
+.\
+.\ 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd July 25, 2015
+.Dt CYAPA 4
+.Os
+.Sh NAME
+.Nm cyapa
+.Nd Cypress APA trackpad with I2C interface driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines into
+the kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device cyapa
+.Cd device ig4
+.Cd device smbus
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the 
following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+cyapa_load=YES
+ig4_load=YES
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Cypress APA trackpad.
+It emulates the IntelliMouse PS/2 protocol.
+It supports basic mouse ioctls, so that
+.Xr moused 8
+is supported properly.
+.Ss Trackpad layout
+.Bd -literal
+   2/3   1/3
+  +++
+  ||   Middle   |
+  ||   Button   |
+  |   Left ||
+  |  Button++
+  ||   Right|
+  ||   Button   |
+  ++|
+  | Thumb/Button Area   | 15%
+  +-+
+.Ed
+.Ss Trackpad features
+.Bl -tag -width 8n
+.It Va Two finger scrolling
+Use two fingers for Z axis scrolling.
+.It Va Button down/second finger
+While one finger clicks and holds down the touchpad, the second finger can be
+used to move the mouse cursor.
+This can be useful for drawing or selecting text.
+.It Va Thumb/Button area
+The lower 15% of the trackpad will not affect the mouse cursor position.
+This allows for high precision clicking, by controlling the cursor with the
+index finger and pushing/holding the pad down with the thumb.
+.It Va Trackpad button
+Push physical button.
+The left two thirds of the pad issues a LEFT button event.
+The upper right corner issues a MIDDLE button event.
+The lower right corner issues a RIGHT button.
+Optionally, tap to click can be enabled (see below).
+.El
+.Sh SYSCTL VARIABLES
+These
+.Xr sysctl 8
+variables are available:
+.Bl -tag -width 8n
+.It Va

svn commit: r285883 - in head: share/man/man4 sys/dev/isl sys/modules/i2c sys/modules/i2c/isl

2015-07-25 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Jul 25 20:17:19 2015
New Revision: 285883
URL: https://svnweb.freebsd.org/changeset/base/285883

Log:
  isl(4), driver for Intersil I2C ISL29018 Digital Ambient Light Sensor
  
  Differential Revision:https://reviews.freebsd.org/D2811
  Reviewed by:  adrian, wblock
  Approved by:  adrian, wblock
  Relnotes: yes

Added:
  head/share/man/man4/isl.4   (contents, props changed)
  head/sys/dev/isl/
  head/sys/dev/isl/isl.c   (contents, props changed)
  head/sys/dev/isl/isl.h   (contents, props changed)
  head/sys/modules/i2c/isl/
  head/sys/modules/i2c/isl/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/modules/i2c/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSat Jul 25 20:17:19 2015
(r285882)
+++ head/share/man/man4/MakefileSat Jul 25 20:17:19 2015
(r285883)
@@ -216,6 +216,7 @@ MAN=aac.4 \
ipw.4 \
ipwfw.4 \
isci.4 \
+   isl.4 \
ismt.4 \
isp.4 \
ispfw.4 \

Added: head/share/man/man4/isl.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/isl.4   Sat Jul 25 20:17:19 2015(r285883)
@@ -0,0 +1,104 @@
+.\ Copyright (c) 2015 Michael Gmelin free...@grem.de
+.\ All rights reserved.
+.\
+.\ 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd July 25, 2015
+.Dt ISL 4
+.Os
+.Sh NAME
+.Nm isl
+.Nd Intersil(TM) I2C ISL29018 sensor driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines into
+the kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device isl
+.Cd device ig4
+.Cd device smbus
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the 
following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+isl_load=YES
+ig4_load=YES
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to sensor data provided by the Intersil(TM) I2C
+ISL29018 Digital Ambient Light Sensor and Proximity Sensor with Interrupt
+Function.
+Functionality is basic and provided through the
+.Xr sysctl 8
+interface.
+.Sh SYSCTL VARIABLES
+The following
+.Xr sysctl 8
+variables are available:
+.Bl -tag -width dev.isl.X.resolution
+.It Va dev.isl.X.als
+Current ALS (Ambient Light Sensor) readout.
+.It Va dev.isl.X.ir
+Current IR (InfraRed) sensor readout.
+.It Va dev.isl.X.prox
+Current proximity sensor readout.
+.It Va dev.isl.X.resolution
+Current sensor resolution.
+.It Va dev.isl.X.range
+Current sensor range.
+.El
+.Sh EXAMPLES
+.Ss Ambient light sensor read out
+.Bd -literal
+$ sysctl dev.isl.0.als
+dev.isl.0.als: 64
+.Ed
+.Ss Automatically adjust brightness
+This requires the port
+.Pa graphics/intel-backlight
+and only works with laptops using a supported Intel(R) GPU.
+.Bd -literal
+$ pkg install intel-backlight
+$ sh /usr/local/share/examples/intel-backlight/isl_backlight.sh
+.Ed
+.Sh SEE ALSO
+.Xr ig4 4 ,
+.Xr smbus 4
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Gmelin Aq Mt free...@grem.de .
+.Pp
+This manual page was written by
+.An Michael Gmelin Aq Mt free...@grem.de .
+.Sh BUGS
+The
+.Nm
+driver detects the device based on its I2C address (0x44).
+This might have unforeseen consequences if the initialization sequence
+is sent to an unknown device at that address.

Added: head/sys/dev/isl/isl.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/isl

svn commit: r284803 - head/sys/dev/ichiic

2015-06-25 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Thu Jun 25 07:52:51 2015
New Revision: 284803
URL: https://svnweb.freebsd.org/changeset/base/284803

Log:
  Protect smbus ioctls in ig4 driver using a shared lock.
  Document locking semantics.
  
  Differential Revision:https://reviews.freebsd.org/D2744
  Reviewed by:  jah, kib
  Approved by:  kib

Modified:
  head/sys/dev/ichiic/ig4_iic.c
  head/sys/dev/ichiic/ig4_pci.c
  head/sys/dev/ichiic/ig4_var.h

Modified: head/sys/dev/ichiic/ig4_iic.c
==
--- head/sys/dev/ichiic/ig4_iic.c   Thu Jun 25 07:25:40 2015
(r284802)
+++ head/sys/dev/ichiic/ig4_iic.c   Thu Jun 25 07:52:51 2015
(r284803)
@@ -40,6 +40,7 @@ __FBSDID($FreeBSD$);
  * Intel fourth generation mobile cpus integrated I2C device, smbus driver.
  *
  * See ig4_reg.h for datasheet reference and notes.
+ * See ig4_var.h for locking semantics.
  */
 
 #include sys/param.h
@@ -49,6 +50,7 @@ __FBSDID($FreeBSD$);
 #include sys/errno.h
 #include sys/lock.h
 #include sys/mutex.h
+#include sys/sx.h
 #include sys/syslog.h
 #include sys/bus.h
 #include sys/sysctl.h
@@ -115,7 +117,7 @@ set_controller(ig4iic_softc_t *sc, uint3
error = 0;
break;
}
-   mtx_sleep(sc, sc-mutex, 0, i2cslv, 1);
+   mtx_sleep(sc, sc-io_lock, 0, i2cslv, 1);
}
return (error);
 }
@@ -179,7 +181,7 @@ wait_status(ig4iic_softc_t *sc, uint32_t
 * work, otherwise poll with the lock held.
 */
if (status  IG4_STATUS_RX_NOTEMPTY) {
-   mtx_sleep(sc, sc-mutex, PZERO, i2cwait,
+   mtx_sleep(sc, sc-io_lock, 0, i2cwait,
  (hz + 99) / 100); /* sleep up to 10ms */
count_us += 1;
} else {
@@ -522,6 +524,8 @@ ig4iic_attach(ig4iic_softc_t *sc)
 * Use a threshold of 1 so we get interrupted on each character,
 * allowing us to use mtx_sleep() in our poll code.  Not perfect
 * but this is better than using DELAY() for receiving data.
+*
+* See ig4_var.h for details on interrupt handler synchronization.
 */
reg_write(sc, IG4_REG_RX_TL, 1);
 
@@ -551,12 +555,12 @@ ig4iic_attach(ig4iic_softc_t *sc)
 */
reg_write(sc, IG4_REG_INTR_MASK, IG4_INTR_STOP_DET |
 IG4_INTR_RX_FULL);
-   mtx_lock(sc-mutex);
+   mtx_lock(sc-io_lock);
if (set_controller(sc, 0))
device_printf(sc-dev, controller error during attach-1\n);
if (set_controller(sc, IG4_I2C_ENABLE))
device_printf(sc-dev, controller error during attach-2\n);
-   mtx_unlock(sc-mutex);
+   mtx_unlock(sc-io_lock);
error = bus_setup_intr(sc-dev, sc-intr_res, INTR_TYPE_MISC | 
INTR_MPSAFE,
   NULL, ig4iic_intr, sc, sc-intr_handle);
if (error) {
@@ -615,7 +619,8 @@ ig4iic_detach(ig4iic_softc_t *sc)
if (sc-intr_handle)
bus_teardown_intr(sc-dev, sc-intr_res, sc-intr_handle);
 
-   mtx_lock(sc-mutex);
+   sx_xlock(sc-call_lock);
+   mtx_lock(sc-io_lock);
 
sc-smb = NULL;
sc-intr_handle = NULL;
@@ -623,18 +628,16 @@ ig4iic_detach(ig4iic_softc_t *sc)
reg_read(sc, IG4_REG_CLR_INTR);
set_controller(sc, 0);
 
-   mtx_unlock(sc-mutex);
+   mtx_unlock(sc-io_lock);
+   sx_xunlock(sc-call_lock);
return (0);
 }
 
 int
 ig4iic_smb_callback(device_t dev, int index, void *data)
 {
-   ig4iic_softc_t *sc = device_get_softc(dev);
int error;
 
-   mtx_lock(sc-mutex);
-
switch (index) {
case SMB_REQUEST_BUS:
error = 0;
@@ -647,8 +650,6 @@ ig4iic_smb_callback(device_t dev, int in
break;
}
 
-   mtx_unlock(sc-mutex);
-
return (error);
 }
 
@@ -660,25 +661,8 @@ ig4iic_smb_callback(device_t dev, int in
 int
 ig4iic_smb_quick(device_t dev, u_char slave, int how)
 {
-   ig4iic_softc_t *sc = device_get_softc(dev);
-   int error;
-
-   mtx_lock(sc-mutex);
 
-   switch (how) {
-   case SMB_QREAD:
-   error = SMB_ENOTSUPP;
-   break;
-   case SMB_QWRITE:
-   error = SMB_ENOTSUPP;
-   break;
-   default:
-   error = SMB_ENOTSUPP;
-   break;
-   }
-   mtx_unlock(sc-mutex);
-
-   return (error);
+   return (SMB_ENOTSUPP);
 }
 
 /*
@@ -695,7 +679,8 @@ ig4iic_smb_sendb(device_t dev, u_char sl
uint32_t cmd;
int error;
 
-   mtx_lock(sc-mutex);
+   sx_xlock(sc-call_lock);
+   mtx_lock(sc-io_lock);
 
set_slave_addr(sc, slave, 0);
cmd = byte;
@@ -706,7 +691,8 @@ ig4iic_smb_sendb(device_t dev, u_char sl
error = SMB_ETIMEOUT;
}
 
-   

Re: svn commit: r281985 - in head: share/man/man4 sys/dev/smbus usr.sbin/smbmsg

2015-05-01 Thread Michael Gmelin
On Tue, 28 Apr 2015 13:28:49 +
Antoine Brodin anto...@freebsd.org wrote:

 On Sat, Apr 25, 2015 at 4:15 PM, Michael Gmelin gre...@freebsd.org
 wrote:
  Author: grembo (ports committer)
  Date: Sat Apr 25 16:15:01 2015
  New Revision: 281985
  URL: https://svnweb.freebsd.org/changeset/base/281985
 
  Log:
Expand SMBUS API to add smbus_trans() function.
 
Differential Revision:https://reviews.freebsd.org/D1955
Reviewed by:  adrian, jhb, wblock
Approved by:  adrian, jhb
 
 Hi,
 
 Some ports used the previous API,  see error logs at:
 http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p384806_s282042/logs/errors/bsdhwmon-20120702.log
 http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p384806_s282042/logs/errors/consolehm-1.31_1.log
 http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p384806_s282042/logs/errors/gkrellm2-2.3.5_6.log
 http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p384806_s282042/logs/errors/healthd-0.7.9_2.log
 http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p384806_s282042/logs/errors/lmmon-0.65_1.log
 http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p384806_s282042/logs/errors/xmbmon-205_14.log
 
 Normally you should request an exp-run before doing a change like
 this.
 
 Cheers,
 
 Antoine (with hat: portmgr)

Bumped __FreeBSD_version and fixed all affected ports I'm aware of
(bsdhwmon and gkrellm2 were already done by others).

Cheers,
Michael

-- 
Michael Gmelin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r282256 - head/sys/sys

2015-04-29 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Wed Apr 29 22:50:41 2015
New Revision: 282256
URL: https://svnweb.freebsd.org/changeset/base/282256

Log:
  Bump __FreeBSD_version for smb(4) changes in r281985
  
  Differential Revision:https://reviews.freebsd.org/D2398
  Reviewed by:  bapt, flo
  Approved by:  bapt, flo

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hWed Apr 29 22:46:30 2015(r282255)
+++ head/sys/sys/param.hWed Apr 29 22:50:41 2015(r282256)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1100070  /* Master, propagated to newvers */
+#define __FreeBSD_version 1100071  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r282020 - head/share/man/man4

2015-04-26 Thread Michael Gmelin
-through and with 10-bit addresses.
+This function can be utilized to roll up all of the above functions.
+It first sends the byte from
 .Fa cmd
-field to the device, followed by
+to the device, followed by
 .Fa wcount
 bytes of data that are taken from the buffer pointed to by
 .Fa wbuf ,
 then reads
 .Fa rcount
 bytes of data that from the device.
-These data will be returned in the buffer pointed to by
+This data is returned in the buffer pointed to by
 .Fa rbuf .
 .Pp
 The following flags are allowed in
@@ -239,5 +225,4 @@ This
 manual page was written by
 .An Nicolas Souchu
 and extended by
-.An Michael Gmelin Aq free...@grem.de
-.
+.An Michael Gmelin Aq free...@grem.de .
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r281985 - in head: share/man/man4 sys/dev/smbus usr.sbin/smbmsg

2015-04-25 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Apr 25 16:15:01 2015
New Revision: 281985
URL: https://svnweb.freebsd.org/changeset/base/281985

Log:
  Expand SMBUS API to add smbus_trans() function.
  
  Differential Revision:https://reviews.freebsd.org/D1955
  Reviewed by:  adrian, jhb, wblock
  Approved by:  adrian, jhb

Modified:
  head/share/man/man4/smb.4
  head/sys/dev/smbus/smb.c
  head/sys/dev/smbus/smb.h
  head/sys/dev/smbus/smbconf.h
  head/sys/dev/smbus/smbus.c
  head/sys/dev/smbus/smbus.h
  head/sys/dev/smbus/smbus_if.m
  head/usr.sbin/smbmsg/smbmsg.c

Modified: head/share/man/man4/smb.4
==
--- head/share/man/man4/smb.4   Sat Apr 25 16:12:06 2015(r281984)
+++ head/share/man/man4/smb.4   Sat Apr 25 16:15:01 2015(r281985)
@@ -1,5 +1,6 @@
 .\ Copyright (c) 1998, Nicolas Souchu
 .\ Copyright (c) 2004, Joerg Wunsch
+.\ Copyright (c) 2015, Michael Gmelin free...@grem.de
 .\ All rights reserved.
 .\
 .\ Redistribution and use in source and binary forms, with or without
@@ -25,7 +26,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 6, 2009
+.Dd April 25, 2015
 .Dt SMB 4
 .Os
 .Sh NAME
@@ -49,21 +50,24 @@ as its argument.
 #include sys/types.h
 
 struct smbcmd {
-   char cmd;
-   int count;
-   u_char slave;
+   u_char cmd;
+   u_char reserved;
+   u_short op;
union {
-   char byte;
-   short word;
-
-   char *byte_ptr;
-   short *word_ptr;
-
-   struct {
-   short sdata;
-   short *rdata;
-   } process;
-   } data;
+   charbyte;
+   charbuf[2];
+   short   word;
+   } wdata;
+   union {
+   charbyte;
+   charbuf[2];
+   short   word;
+   } rdata;
+   int  slave;
+   char *wbuf; /* use wdata if NULL */
+   int  wcount;
+   char *rbuf; /* use rdata if NULL */
+   int  rcount;
 };
 .Ed
 .Pp
@@ -107,14 +111,14 @@ The
 command first sends the byte from the
 .Fa cmd
 field to the device, followed by the byte given in
-.Fa data.byte .
+.Fa wdata.byte .
 .It Dv SMB_WRITEW Ta
 The
 .Em WriteWord
 command first sends the byte from the
 .Fa cmd
 field to the device, followed by the word given in
-.Fa data.word .
+.Fa wdata.word .
 Note that the SMBus byte-order is little-endian by definition.
 .It Dv SMB_READB Ta
 The
@@ -123,8 +127,8 @@ command first sends the byte from the
 .Fa cmd
 field to the device, and then reads one byte of data from
 the device.
-The returned data will be stored in the location pointed to by
-.Fa data.byte_ptr .
+The returned data will be stored in
+.Fa rdata.byte .
 .It Dv SMB_READW Ta
 The
 .Em ReadWord
@@ -132,29 +136,33 @@ command first sends the byte from the
 .Fa cmd
 field to the device, and then reads one word of data from
 the device.
-The returned data will be stored in the location pointed to by
-.Fa data.word_ptr .
+The returned data will be stored in
+.Fa rdata.word .
 .It Dv SMB_PCALL Ta
 The
 .Em ProcedureCall
 command first sends the byte from the
 .Fa cmd
 field to the device, followed by the word provided in
-.Fa data.process.sdata .
+.Fa wdata.word .
 It then reads one word of data from the device, and returns it
-in the location pointed to by
-.Fa data.process.rdata .
+in
+.Fa rdata.word .
 .It Dv SMB_BWRITE Ta
 The
 .Em BlockWrite
 command first sends the byte from the
 .Fa cmd
 field to the device, followed by
-.Fa count
+.Fa wcount
 bytes of data that are taken from the buffer pointed to by
-.Fa data.byte_ptr .
+.Fa wbuf .
 The SMBus specification mandates that no more than 32 bytes of
-data can be transferred in a single block read or write command.
+data can be transferred in a single block read or write command,
+but since
+.Xr smbus 4
+is also used to access I2C devices, the limit has been increased
+to 1024.
 This value is available in the constant
 .Dv SMB_MAXBLOCKSIZE .
 .It Dv SMB_BREAD Ta
@@ -163,10 +171,38 @@ The
 command first sends the byte from the
 .Fa cmd
 field to the device, and then reads
-.Fa count
+.Fa rcount
 bytes of data that from the device.
 These data will be returned in the buffer pointed to by
-.Fa data.byte_ptr .
+.Fa rbuf .
+.It Dv SMB_TRANS Ta
+The
+.Em Trans
+command sends an SMB roll-up transaction with flags that also allow it to
+be used for (mostly) I2C pass-through and with with 10-bit addresses.
+This function can be used to roll up all of the above functions.
+It first sends the byte from the
+.Fa cmd
+field to the device, followed by
+.Fa wcount
+bytes of data that are taken from the buffer pointed to by
+.Fa wbuf ,
+then reads
+.Fa rcount
+bytes of data that from the device.
+These data will be returned in the buffer pointed to by
+.Fa rbuf .
+.Pp
+The following flags are allowed in
+.Fa op :
+.Pp
+.Bd -literal -compact
+SMB_TRANS_NOSTOP  Do not send STOP at end

svn commit: r279222 - head/sys/boot/i386/libi386

2015-02-23 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Mon Feb 23 22:58:51 2015
New Revision: 279222
URL: https://svnweb.freebsd.org/changeset/base/279222

Log:
  Improve memory detection in biosmem.c
  
  - Add a quirk to allow ignoring e820 extended memory detection.
  - Improve memory detection through e801.
  - Add bootloader command biosmem.
  
  See differential revision for more details.
  
  Reviewed by:  jhb, adrian
  Approved by:  adrian
  Differential Revision:  https://reviews.freebsd.org/D1741

Modified:
  head/sys/boot/i386/libi386/biosmem.c

Modified: head/sys/boot/i386/libi386/biosmem.c
==
--- head/sys/boot/i386/libi386/biosmem.cMon Feb 23 22:50:43 2015
(r279221)
+++ head/sys/boot/i386/libi386/biosmem.cMon Feb 23 22:58:51 2015
(r279222)
@@ -32,19 +32,63 @@ __FBSDID($FreeBSD$);
  */
 #include stand.h
 #include machine/pc/bios.h
+#include bootstrap.h
 #include libi386.h
 #include btxv86.h
 
 vm_offset_tmemtop, memtop_copyin, high_heap_base;
 uint32_t   bios_basemem, bios_extmem, high_heap_size;
 
-static struct bios_smap smap;
+static struct bios_smap_xattr smap;
+
+/*
+ * Used to track which method was used to set BIOS memory
+ * regions.
+ */
+static uint8_t b_bios_probed;
+#defineB_BASEMEM_E820  0x1
+#defineB_BASEMEM_120x2
+#defineB_EXTMEM_E820   0x4
+#defineB_EXTMEM_E801   0x8
+#defineB_EXTMEM_8800   0x10
 
 /*
  * The minimum amount of memory to reserve in bios_extmem for the heap.
  */
 #defineHEAP_MIN(3 * 1024 * 1024)
 
+/*
+ * Products in this list need quirks to detect
+ * memory correctly. You need both maker and product as
+ * reported by smbios.
+ */
+#define BQ_DISTRUST_E820_EXTMEM0x1 /* e820 might not return useful
+  extended memory */
+struct bios_getmem_quirks {
+const char* bios_vendor;
+const char*maker;
+const char*product;
+intquirk;
+};
+
+static struct bios_getmem_quirks quirks[] = {
+{coreboot, Acer, Peppy, BQ_DISTRUST_E820_EXTMEM},
+{NULL, NULL, NULL, 0}
+};
+
+static int
+bios_getquirks(void)
+{
+int i;
+
+for (i=0; quirks[i].quirk != 0; ++i)
+   if (smbios_match(quirks[i].bios_vendor, quirks[i].maker,
+   quirks[i].product))
+   return (quirks[i].quirk);
+
+return (0);
+}
+
 void
 bios_getmem(void)
 {
@@ -56,7 +100,7 @@ bios_getmem(void)
v86.ctl = V86_FLAGS;
v86.addr = 0x15;/* int 0x15 function 0xe820*/
v86.eax = 0xe820;
-   v86.ecx = sizeof(struct bios_smap);
+   v86.ecx = sizeof(struct bios_smap_xattr);
v86.edx = SMAP_SIG;
v86.es = VTOPSEG(smap);
v86.edi = VTOPOFF(smap);
@@ -65,11 +109,16 @@ bios_getmem(void)
break;
/* look for a low-memory segment that's large enough */
if ((smap.type == SMAP_TYPE_MEMORY)  (smap.base == 0) 
-   (smap.length = (512 * 1024)))
+   (smap.length = (512 * 1024))) {
bios_basemem = smap.length;
+   b_bios_probed |= B_BASEMEM_E820;
+   }
+
/* look for the first segment in 'extended' memory */
-   if ((smap.type == SMAP_TYPE_MEMORY)  (smap.base == 0x10)) {
+   if ((smap.type == SMAP_TYPE_MEMORY)  (smap.base == 0x10) 
+   !(bios_getquirks()  BQ_DISTRUST_E820_EXTMEM)) {
bios_extmem = smap.length;
+   b_bios_probed |= B_EXTMEM_E820;
}
 
/*
@@ -100,6 +149,7 @@ bios_getmem(void)
v86int();

bios_basemem = (v86.eax  0x) * 1024;
+   b_bios_probed |= B_BASEMEM_12;
 }
 
 /* Fall back through several compatibility functions for extended memory */
@@ -109,7 +159,30 @@ bios_getmem(void)
v86.eax = 0xe801;
v86int();
if (!(V86_CY(v86.efl))) {
-   bios_extmem = ((v86.ecx  0x) + ((v86.edx  0x) * 64)) * 
1024;
+   /*
+* Clear high_heap; it may end up overlapping
+* with the segment we're determining here.
+* Let the default steal stuff from top of
+* bios_extmem code below pick up on it.
+*/
+   high_heap_size = 0;
+   high_heap_base = 0;
+
+   /*
+* %cx is the number of 1KiB blocks between 1..16MiB.
+* It can only be up to 0x3c00; if it's smaller then
+* there's a PC AT memory hole so we can't treat
+* it as contiguous.
+*/
+   bios_extmem = (v86.ecx  0x) * 1024;
+   if (bios_extmem == (1024 * 0x3c00))
+   bios_extmem += (v86.edx  0x) * 64 * 1024;
+
+   /* truncate bios_extmem */
+   if (bios_extmem  0x3ff0)
+   bios_extmem = 0x3ff0;
+
+   b_bios_probed |= B_EXTMEM_E801;
}
 }
 if (bios_extmem == 0) {
@@ -118,6 +191,7 @@ 

svn commit: r278787 - head/sys/dev/atkbdc

2015-02-14 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Feb 14 22:12:17 2015
New Revision: 278787
URL: https://svnweb.freebsd.org/changeset/base/278787

Log:
  Quirk based support of Chromebook keyboard found in Acer C720
  
  This probably supports other devices based on SeaBIOS, which need
  to be added to the smbios based quirks table.
  
  The functionality has been ported from DragonFlyBSD and adapted
  to FreeBSD's more general purpose environment.
  
  Devices not covered by a quirk shouldn't be affected at all. Thanks
  to jhb and kostikbel for reviewing the code.
  
  Reviewed by:  kostikbel, jhb
  Approved by:  jhb, kostikbel
  Differential Revision: https://reviews.freebsd.org/D1802

Modified:
  head/sys/dev/atkbdc/atkbd.c
  head/sys/dev/atkbdc/atkbdc.c
  head/sys/dev/atkbdc/atkbdcreg.h
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/atkbd.c
==
--- head/sys/dev/atkbdc/atkbd.c Sat Feb 14 21:16:19 2015(r278786)
+++ head/sys/dev/atkbdc/atkbd.c Sat Feb 14 22:12:17 2015(r278787)
@@ -77,6 +77,10 @@ typedef struct atkbd_state {
 
 static voidatkbd_timeout(void *arg);
 static voidatkbd_shutdown_final(void *v);
+static int atkbd_reset(KBDC kbdc, int flags, int c);
+
+#define HAS_QUIRK(p, q)(((atkbdc_softc_t *)(p))-quirks  q)
+#define ALLOW_DISABLE_KBD(kbdc)!HAS_QUIRK(kbdc, 
KBDC_QUIRK_KEEP_ACTIVATED)
 
 int
 atkbd_probe_unit(device_t dev, int irq, int flags)
@@ -1095,6 +1099,39 @@ atkbd_shutdown_final(void *v)
 #endif
 }
 
+static int
+atkbd_reset(KBDC kbdc, int flags, int c)
+{
+   /* reset keyboard hardware */
+   if (!(flags  KB_CONF_NO_RESET)  !reset_kbd(kbdc)) {
+   /*
+* KEYBOARD ERROR
+* Keyboard reset may fail either because the keyboard
+* doen't exist, or because the keyboard doesn't pass
+* the self-test, or the keyboard controller on the
+* motherboard and the keyboard somehow fail to shake hands.
+* It is just possible, particularly in the last case,
+* that the keyboard controller may be left in a hung state.
+* test_controller() and test_kbd_port() appear to bring
+* the keyboard controller back (I don't know why and how,
+* though.)
+*/
+   empty_both_buffers(kbdc, 10);
+   test_controller(kbdc);
+   test_kbd_port(kbdc);
+   /*
+* We could disable the keyboard port and interrupt... but, 
+* the keyboard may still exist (see above). 
+*/
+   set_controller_command_byte(kbdc,
+   ALLOW_DISABLE_KBD(kbdc) ? 0xff : KBD_KBD_CONTROL_BITS, c);
+   if (bootverbose)
+   printf(atkbd: failed to reset the keyboard.\n);
+   return (EIO);
+   }
+   return (0);
+}
+
 /* local functions */
 
 static int
@@ -1250,13 +1287,14 @@ probe_keyboard(KBDC kbdc, int flags)
kbdc_set_device_mask(kbdc, m | KBD_KBD_CONTROL_BITS);
} else {
/* try to restore the command byte as before */
-   set_controller_command_byte(kbdc, 0xff, c);
+   set_controller_command_byte(kbdc,
+   ALLOW_DISABLE_KBD(kbdc) ? 0xff : KBD_KBD_CONTROL_BITS, c);
kbdc_set_device_mask(kbdc, m);
}
 #endif
 
kbdc_lock(kbdc, FALSE);
-   return err;
+   return (HAS_QUIRK(kbdc, KBDC_QUIRK_IGNORE_PROBE_RESULT) ? 0 : err);
 }
 
 static int
@@ -1299,6 +1337,12 @@ init_keyboard(KBDC kbdc, int *type, int 
return EIO;
}
 
+   if (HAS_QUIRK(kbdc, KBDC_QUIRK_RESET_AFTER_PROBE) 
+   atkbd_reset(kbdc, flags, c)) {
+   kbdc_lock(kbdc, FALSE);
+   return EIO;
+   }
+
/* 
 * Check if we have an XT keyboard before we attempt to reset it. 
 * The procedure assumes that the keyboard and the controller have 
@@ -1343,31 +1387,9 @@ init_keyboard(KBDC kbdc, int *type, int 
if (bootverbose)
printf(atkbd: keyboard ID 0x%x (%d)\n, id, *type);
 
-   /* reset keyboard hardware */
-   if (!(flags  KB_CONF_NO_RESET)  !reset_kbd(kbdc)) {
-   /*
-* KEYBOARD ERROR
-* Keyboard reset may fail either because the keyboard
-* doen't exist, or because the keyboard doesn't pass
-* the self-test, or the keyboard controller on the
-* motherboard and the keyboard somehow fail to shake hands.
-* It is just possible, particularly in the last case,
-* that the keyboard controller may be left in a hung state.
-* test_controller() and test_kbd_port() appear to bring
-* the keyboard controller back 

svn commit: r278541 - head/usr.bin/w

2015-02-10 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Tue Feb 10 22:23:52 2015
New Revision: 278541
URL: https://svnweb.freebsd.org/changeset/base/278541

Log:
  Add xo_finish() to w.c in case it's invoked as uptime
  
  Reviewed by:  marcel
  Approved by:  marcel
  Differential Revision: https://reviews.freebsd.org/D1821

Modified:
  head/usr.bin/w/w.c

Modified: head/usr.bin/w/w.c
==
--- head/usr.bin/w/w.c  Tue Feb 10 22:05:57 2015(r278540)
+++ head/usr.bin/w/w.c  Tue Feb 10 22:23:52 2015(r278541)
@@ -264,7 +264,9 @@ main(int argc, char *argv[])
if (header || wcmd == 0) {
pr_header(now, nusers);
if (wcmd == 0) {
-   xo_close_container(uptime-information);
+   xo_close_container(uptime-information);
+   xo_finish();
+
(void)kvm_close(kd);
exit(0);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277949 - head/sys/boot/i386/libi386

2015-01-30 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Fri Jan 30 19:47:25 2015
New Revision: 277949
URL: https://svnweb.freebsd.org/changeset/base/277949

Log:
  New function smbios_match to detect BIOS versions during boot
  
  Motivation is to introduce BIOS specific quirks early in the boot
  process. smbios_match can be called before malloc is avaible, that's
  why parts of smbios_detect have been moved into a separate function
  smbios_probe that will be called by smbios_detect as well as
  smbios_match.
  
  Reviewed by:  jhb
  Approved by:  jhb
  Differential Revision:https://reviews.freebsd.org/D1679

Modified:
  head/sys/boot/i386/libi386/libi386.h
  head/sys/boot/i386/libi386/smbios.c

Modified: head/sys/boot/i386/libi386/libi386.h
==
--- head/sys/boot/i386/libi386/libi386.hFri Jan 30 19:19:03 2015
(r277948)
+++ head/sys/boot/i386/libi386/libi386.hFri Jan 30 19:47:25 2015
(r277949)
@@ -114,6 +114,8 @@ uint32_t biospci_locator(int8_t bus, uin
 void   biosacpi_detect(void);
 
 void   smbios_detect(void);
+intsmbios_match(const char* bios_vendor, const char* maker,
+   const char* product);
 
 inti386_autoload(void);
 

Modified: head/sys/boot/i386/libi386/smbios.c
==
--- head/sys/boot/i386/libi386/smbios.c Fri Jan 30 19:19:03 2015
(r277948)
+++ head/sys/boot/i386/libi386/smbios.c Fri Jan 30 19:47:25 2015
(r277949)
@@ -64,10 +64,24 @@ __FBSDID($FreeBSD$);
 #defineSMBIOS_GETLEN(base) SMBIOS_GET8(base, 0x01)
 #defineSMBIOS_GETSTR(base) ((base) + SMBIOS_GETLEN(base))
 
-static uint32_tsmbios_enabled_memory = 0;
-static uint32_tsmbios_old_enabled_memory = 0;
-static uint8_t smbios_enabled_sockets = 0;
-static uint8_t smbios_populated_sockets = 0;
+struct smbios_attr {
+   int probed;
+   caddr_t addr;
+   size_t  length;
+   size_t  count;
+   int major;
+   int minor;
+   int ver;
+   const char* bios_vendor;
+   const char* maker;
+   const char* product;
+   uint32_tenabled_memory;
+   uint32_told_enabled_memory;
+   uint8_t enabled_sockets;
+   uint8_t populated_sockets;
+};
+
+static struct smbios_attr smbios;
 
 static uint8_t
 smbios_checksum(const caddr_t addr, const uint8_t len)
@@ -95,8 +109,8 @@ smbios_sigsearch(const caddr_t addr, con
return (NULL);
 }
 
-static void
-smbios_setenv(const char *name, caddr_t addr, const int offset)
+static const char*
+smbios_getstring(caddr_t addr, const int offset)
 {
caddr_t cp;
int i, idx;
@@ -106,8 +120,19 @@ smbios_setenv(const char *name, caddr_t 
cp = SMBIOS_GETSTR(addr);
for (i = 1; i  idx; i++)
cp += strlen(cp) + 1;
-   setenv(name, cp, 1);
+   return cp;
}
+   return (NULL);
+}
+
+static void
+smbios_setenv(const char *name, caddr_t addr, const int offset)
+{
+   const char* val;
+
+   val = smbios_getstring(addr, offset);
+   if (val != NULL)
+   setenv(name, val, 1);
 }
 
 #ifdef SMBIOS_SERIAL_NUMBERS
@@ -187,7 +212,7 @@ smbios_setuuid(const char *name, const c
 #endif
 
 static caddr_t
-smbios_parse_table(const caddr_t addr, const int ver)
+smbios_parse_table(const caddr_t addr)
 {
caddr_t cp;
int proc, size, osize, type;
@@ -206,7 +231,7 @@ smbios_parse_table(const caddr_t addr, c
smbios_setenv(smbios.system.version, addr, 0x06);
 #ifdef SMBIOS_SERIAL_NUMBERS
smbios_setenv(smbios.system.serial, addr, 0x07);
-   smbios_setuuid(smbios.system.uuid, addr + 0x08, ver);
+   smbios_setuuid(smbios.system.uuid, addr + 0x08, smbios.ver);
 #endif
break;
 
@@ -248,9 +273,9 @@ smbios_parse_table(const caddr_t addr, c
 */
proc = SMBIOS_GET8(addr, 0x18);
if ((proc  0x07) == 1)
-   smbios_enabled_sockets++;
+   smbios.enabled_sockets++;
if ((proc  0x40) != 0)
-   smbios_populated_sockets++;
+   smbios.populated_sockets++;
break;
 
case 6: /* 3.3.7 Memory Module Information (Type 6, Obsolete) */
@@ -268,7 +293,7 @@ smbios_parse_table(const caddr_t addr, c
 */
osize = SMBIOS_GET8(addr, 0x0a)  0x7f;
if (osize  0  osize  22)
-   smbios_old_enabled_memory += 1  (osize + 10);
+   smbios.old_enabled_memory += 1  (osize + 10);
break;
 
case 17:/* 3.3.18 Memory Device (Type 17) */
@@ -282,7 +307,7 

svn commit: r277957 - head/sys/boot/i386/libi386

2015-01-30 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Jan 31 00:06:05 2015
New Revision: 277957
URL: https://svnweb.freebsd.org/changeset/base/277957

Log:
  Fix order of functions in smbios.c (corrects r277949), since this corrects
  a build error I committed this directly, sorry.

Modified:
  head/sys/boot/i386/libi386/smbios.c

Modified: head/sys/boot/i386/libi386/smbios.c
==
--- head/sys/boot/i386/libi386/smbios.c Fri Jan 30 23:57:39 2015
(r277956)
+++ head/sys/boot/i386/libi386/smbios.c Sat Jan 31 00:06:05 2015
(r277957)
@@ -323,6 +323,29 @@ smbios_parse_table(const caddr_t addr)
return (cp + 2);
 }
 
+static caddr_t
+smbios_find_struct(int type)
+{
+   caddr_t dmi;
+   int i;
+
+   if (smbios.addr == NULL)
+   return (NULL);
+
+   for (dmi = smbios.addr, i = 0;
+dmi  smbios.addr + smbios.length  i  smbios.count; i++) {
+   if (SMBIOS_GET8(dmi, 0) == type)
+   return dmi;
+   /* Find structure terminator. */
+   dmi = SMBIOS_GETSTR(dmi);
+   while (SMBIOS_GET16(dmi, 0) != 0)
+   dmi++;
+   dmi += 2;
+   }
+
+   return (NULL);
+}
+
 static void
 smbios_probe(void)
 {
@@ -368,29 +391,6 @@ smbios_probe(void)
}
 }
 
-static caddr_t
-smbios_find_struct(int type)
-{
-   caddr_t dmi;
-   int i;
-
-   if (smbios.addr == NULL)
-   return (NULL);
-
-   for (dmi = smbios.addr, i = 0;
-dmi  smbios.addr + smbios.length  i  smbios.count; i++) {
-   if (SMBIOS_GET8(dmi, 0) == type)
-   return dmi;
-   /* Find structure terminator. */
-   dmi = SMBIOS_GETSTR(dmi);
-   while (SMBIOS_GET16(dmi, 0) != 0)
-   dmi++;
-   dmi += 2;
-   }
-
-   return (NULL);
-}
-
 void
 smbios_detect(void)
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r260983 - head/share/misc

2014-01-21 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Tue Jan 21 13:23:18 2014
New Revision: 260983
URL: http://svnweb.freebsd.org/changeset/base/260983

Log:
  Add grembo as a ports committer
  
  Approved by:  flo (mentor)

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotTue Jan 21 09:22:00 2014
(r260982)
+++ head/share/misc/committers-ports.dotTue Jan 21 13:23:18 2014
(r260983)
@@ -105,6 +105,7 @@ gerald [label=Gerald Pfeifer\ngerald@Fr
 gjb [label=Glen Barber\n...@freebsd.org\n2012/06/19]
 glarkin [label=Greg Larkin\nglar...@freebsd.org\n2008/07/17]
 glewis [label=Greg Lewis\ngle...@freebsd.org\n2002/04/08]
+grembo [label=Michael Gmelin\ngre...@freebsd.org\n2014/01/21]
 gnn [label=George Neville-Neil\n...@freebsd.org\n2013/09/04]
 hq [label=Herve Quiroz\n...@freebsd.org\n2004/08/05]
 ijliao [label=Ying-Chieh Liao\nijl...@freebsd.org\n2001/01/20]
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org