svn commit: r344476 - in head/sys: dev/nvdimm modules/nvdimm

2019-02-22 Thread Ben Widawsky
Author: bwidawsk
Date: Fri Feb 22 19:54:28 2019
New Revision: 344476
URL: https://svnweb.freebsd.org/changeset/base/344476

Log:
  nvdimm: Simple namespace support
  
  Add support for simple NVDIMM v1.2 namespaces from the UEFI
  version 2.7 specification. The combination of NVDIMM regions and
  labels can lead to a wide variety of namespace layouts. Here we
  support a simple subset of namespaces where each NVDIMM SPA range
  is composed of a single region per member dimm.
  
  Submitted by: D Scott Phillips 
  Discussed with:   kib
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D18736

Added:
  head/sys/dev/nvdimm/nvdimm_ns.c   (contents, props changed)
Modified:
  head/sys/dev/nvdimm/nvdimm.c
  head/sys/dev/nvdimm/nvdimm_var.h
  head/sys/modules/nvdimm/Makefile

Modified: head/sys/dev/nvdimm/nvdimm.c
==
--- head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:24 2019
(r344475)
+++ head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:28 2019
(r344476)
@@ -462,6 +462,7 @@ nvdimm_root_create_spas(struct nvdimm_root_dev *dev, A
free(spa, M_NVDIMM);
break;
}
+   nvdimm_create_namespaces(spa_mapping, nfitbl);
SLIST_INSERT_HEAD(>spas, spa_mapping, link);
}
free(spas, M_NVDIMM);
@@ -519,6 +520,7 @@ nvdimm_root_detach(device_t dev)
 
root = device_get_softc(dev);
SLIST_FOREACH_SAFE(spa, >spas, link, next) {
+   nvdimm_destroy_namespaces(spa);
nvdimm_spa_fini(spa);
SLIST_REMOVE_HEAD(>spas, link);
free(spa, M_NVDIMM);

Added: head/sys/dev/nvdimm/nvdimm_ns.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/nvdimm/nvdimm_ns.c Fri Feb 22 19:54:28 2019
(r344476)
@@ -0,0 +1,97 @@
+/*-
+ * Copyright (c) 2018 Intel Corporation
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+int
+nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI_TABLE_NFIT *nfitbl)
+{
+   ACPI_NFIT_MEMORY_MAP **regions;
+   struct nvdimm_dev *nv;
+   struct nvdimm_label_entry *e;
+   struct nvdimm_namespace *ns;
+   nfit_handle_t dimm_handle;
+   char *name;
+   int i, error, num_regions;
+
+   acpi_nfit_get_region_mappings_by_spa_range(nfitbl, spa->spa_nfit_idx,
+   , _regions);
+   if (num_regions == 0 || num_regions != regions[0]->InterleaveWays) {
+   free(regions, M_NVDIMM);
+   return (ENXIO);
+   }
+   dimm_handle = regions[0]->DeviceHandle;
+   nv = nvdimm_find_by_handle(dimm_handle);
+   if (nv == NULL) {
+   free(regions, M_NVDIMM);
+   return (ENXIO);
+   }
+   i = 0;
+   error = 0;
+   SLIST_FOREACH(e, >labels, link) {
+   ns = malloc(sizeof(struct nvdimm_namespace), M_NVDIMM,
+   M_WAITOK | M_ZERO);
+   ns->dev.spa_domain = spa->dev.spa_domain;
+   ns->dev.spa_phys_base = spa->dev.spa_phys_base +
+   regions[0]->RegionOffset +
+   num_regions *
+   (e->label.dimm_phys_addr - regions[0]->Address);
+   ns->dev.spa_len = num_regions * e->label.raw_size;
+   ns->dev.spa_efi_mem_flags = spa->dev.spa_efi_mem_flags;
+   

svn commit: r344474 - head/sys/dev/nvdimm

2019-02-22 Thread Ben Widawsky
Author: bwidawsk
Date: Fri Feb 22 19:54:21 2019
New Revision: 344474
URL: https://svnweb.freebsd.org/changeset/base/344474

Log:
  nvdimm: split spa dev into a separate entity
  
  Separate code for exposing a device backed by a system physical
  address range away from the NVDIMM spa code. This will allow a
  future patch to add support for NVDIMM namespaces while using the
  same device code.
  
  Submitted by: D Scott Phillips 
  Reviewed by:  bwidawsk
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D18736

Modified:
  head/sys/dev/nvdimm/nvdimm_spa.c
  head/sys/dev/nvdimm/nvdimm_var.h

Modified: head/sys/dev/nvdimm/nvdimm_spa.c
==
--- head/sys/dev/nvdimm/nvdimm_spa.cFri Feb 22 18:43:27 2019
(r344473)
+++ head/sys/dev/nvdimm/nvdimm_spa.cFri Feb 22 19:54:21 2019
(r344474)
@@ -143,31 +143,31 @@ nvdimm_spa_type_from_uuid(struct uuid *uuid)
 }
 
 static vm_memattr_t
-nvdimm_spa_memattr(struct SPA_mapping *spa)
+nvdimm_spa_memattr(struct nvdimm_spa_dev *dev)
 {
vm_memattr_t mode;
 
-   if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WB) != 0)
+   if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WB) != 0)
mode = VM_MEMATTR_WRITE_BACK;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WT) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WT) != 0)
mode = VM_MEMATTR_WRITE_THROUGH;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WC) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WC) != 0)
mode = VM_MEMATTR_WRITE_COMBINING;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_WP) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_WP) != 0)
mode = VM_MEMATTR_WRITE_PROTECTED;
-   else if ((spa->spa_efi_mem_flags & EFI_MD_ATTR_UC) != 0)
+   else if ((dev->spa_efi_mem_flags & EFI_MD_ATTR_UC) != 0)
mode = VM_MEMATTR_UNCACHEABLE;
else {
if (bootverbose)
-   printf("SPA%d mapping attr unsupported\n",
-   spa->spa_nfit_idx);
+   printf("SPA mapping attr %#lx unsupported\n",
+   dev->spa_efi_mem_flags);
mode = VM_MEMATTR_UNCACHEABLE;
}
return (mode);
 }
 
 static int
-nvdimm_spa_uio(struct SPA_mapping *spa, struct uio *uio)
+nvdimm_spa_uio(struct nvdimm_spa_dev *dev, struct uio *uio)
 {
struct vm_page m, *ma;
off_t off;
@@ -175,14 +175,14 @@ nvdimm_spa_uio(struct SPA_mapping *spa, struct uio *ui
int error, n;
 
error = 0;
-   if (spa->spa_kva == NULL) {
-   mattr = nvdimm_spa_memattr(spa);
+   if (dev->spa_kva == NULL) {
+   mattr = nvdimm_spa_memattr(dev);
vm_page_initfake(, 0, mattr);
ma = 
while (uio->uio_resid > 0) {
-   if (uio->uio_offset >= spa->spa_len)
+   if (uio->uio_offset >= dev->spa_len)
break;
-   off = spa->spa_phys_base + uio->uio_offset;
+   off = dev->spa_phys_base + uio->uio_offset;
vm_page_updatefake(, trunc_page(off), mattr);
n = PAGE_SIZE;
if (n > uio->uio_resid)
@@ -193,14 +193,14 @@ nvdimm_spa_uio(struct SPA_mapping *spa, struct uio *ui
}
} else {
while (uio->uio_resid > 0) {
-   if (uio->uio_offset >= spa->spa_len)
+   if (uio->uio_offset >= dev->spa_len)
break;
n = INT_MAX;
if (n > uio->uio_resid)
n = uio->uio_resid;
-   if (uio->uio_offset + n > spa->spa_len)
-   n = spa->spa_len - uio->uio_offset;
-   error = uiomove((char *)spa->spa_kva + uio->uio_offset,
+   if (uio->uio_offset + n > dev->spa_len)
+   n = dev->spa_len - uio->uio_offset;
+   error = uiomove((char *)dev->spa_kva + uio->uio_offset,
n, uio);
if (error != 0)
break;
@@ -217,20 +217,20 @@ nvdimm_spa_rw(struct cdev *dev, struct uio *uio, int i
 }
 
 static int
-nvdimm_spa_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
+nvdimm_spa_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
 struct thread *td)
 {
-   struct SPA_mapping *spa;
+   struct nvdimm_spa_dev *dev;
int error;
 
-   spa = dev->si_drv1;
+   dev = cdev->si_drv1;
error = 0;
switch (cmd) {
case DIOCGSECTORSIZE:
*(u_int *)data = DEV_BSIZE;
 

svn commit: r344475 - head/sys/dev/nvdimm

2019-02-22 Thread Ben Widawsky
Author: bwidawsk
Date: Fri Feb 22 19:54:24 2019
New Revision: 344475
URL: https://svnweb.freebsd.org/changeset/base/344475

Log:
  nvdimm: Read NVDIMM namespace labels
  
  When attaching to NVDIMM devices, read and verify the namespace
  labels from the special namespace label storage area. A later
  change will expose NVDIMM namespaces derived from this label data.
  
  Submitted by: D Scott Phillips 
  Discussed with:   kib
  MFC after:1 week
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D18735

Modified:
  head/sys/dev/nvdimm/nvdimm.c
  head/sys/dev/nvdimm/nvdimm_var.h

Modified: head/sys/dev/nvdimm/nvdimm.c
==
--- head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:21 2019
(r344474)
+++ head/sys/dev/nvdimm/nvdimm.cFri Feb 22 19:54:24 2019
(r344475)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,10 +52,240 @@ __FBSDID("$FreeBSD$");
 #define _COMPONENT ACPI_OEM
 ACPI_MODULE_NAME("NVDIMM")
 
+static struct uuid intel_nvdimm_dsm_uuid =
+{0x4309AC30,0x0D11,0x11E4,0x91,0x91,{0x08,0x00,0x20,0x0C,0x9A,0x66}};
+#define INTEL_NVDIMM_DSM_REV 1
+#define INTEL_NVDIMM_DSM_GET_LABEL_SIZE 4
+#define INTEL_NVDIMM_DSM_GET_LABEL_DATA 5
+
 static devclass_t nvdimm_devclass;
 static devclass_t nvdimm_root_devclass;
 MALLOC_DEFINE(M_NVDIMM, "nvdimm", "NVDIMM driver memory");
 
+static int
+read_label_area_size(struct nvdimm_dev *nv)
+{
+   ACPI_OBJECT *result_buffer;
+   ACPI_HANDLE handle;
+   ACPI_STATUS status;
+   ACPI_BUFFER result;
+   uint32_t *out;
+   int error;
+
+   handle = nvdimm_root_get_acpi_handle(nv->nv_dev);
+   if (handle == NULL)
+   return (ENODEV);
+   result.Length = ACPI_ALLOCATE_BUFFER;
+   result.Pointer = NULL;
+   status = acpi_EvaluateDSM(handle, (uint8_t *)_nvdimm_dsm_uuid,
+   INTEL_NVDIMM_DSM_REV, INTEL_NVDIMM_DSM_GET_LABEL_SIZE, NULL,
+   );
+   error = ENXIO;
+   if (ACPI_SUCCESS(status) && result.Pointer != NULL &&
+   result.Length >= sizeof(ACPI_OBJECT)) {
+   result_buffer = result.Pointer;
+   if (result_buffer->Type == ACPI_TYPE_BUFFER &&
+   result_buffer->Buffer.Length >= 12) {
+   out = (uint32_t *)result_buffer->Buffer.Pointer;
+   nv->label_area_size = out[1];
+   nv->max_label_xfer = out[2];
+   error = 0;
+   }
+   }
+   if (result.Pointer != NULL)
+   AcpiOsFree(result.Pointer);
+   return (error);
+}
+
+static int
+read_label_area(struct nvdimm_dev *nv, uint8_t *dest, off_t offset,
+off_t length)
+{
+   ACPI_BUFFER result;
+   ACPI_HANDLE handle;
+   ACPI_OBJECT params_pkg, params_buf, *result_buf;
+   ACPI_STATUS status;
+   uint32_t params[2];
+   off_t to_read;
+   int error;
+
+   error = 0;
+   handle = nvdimm_root_get_acpi_handle(nv->nv_dev);
+   if (offset < 0 || length <= 0 ||
+   offset + length > nv->label_area_size ||
+   handle == NULL)
+   return (ENODEV);
+   params_pkg.Type = ACPI_TYPE_PACKAGE;
+   params_pkg.Package.Count = 1;
+   params_pkg.Package.Elements = _buf;
+   params_buf.Type = ACPI_TYPE_BUFFER;
+   params_buf.Buffer.Length = sizeof(params);
+   params_buf.Buffer.Pointer = (UINT8 *)params;
+   while (length > 0) {
+   to_read = MIN(length, nv->max_label_xfer);
+   params[0] = offset;
+   params[1] = to_read;
+   result.Length = ACPI_ALLOCATE_BUFFER;
+   result.Pointer = NULL;
+   status = acpi_EvaluateDSM(handle,
+   (uint8_t *)_nvdimm_dsm_uuid, INTEL_NVDIMM_DSM_REV,
+   INTEL_NVDIMM_DSM_GET_LABEL_DATA, _pkg, );
+   if (ACPI_FAILURE(status) ||
+   result.Length < sizeof(ACPI_OBJECT) ||
+   result.Pointer == NULL) {
+   error = ENXIO;
+   break;
+   }
+   result_buf = (ACPI_OBJECT *)result.Pointer;
+   if (result_buf->Type != ACPI_TYPE_BUFFER ||
+   result_buf->Buffer.Pointer == NULL ||
+   result_buf->Buffer.Length != 4 + to_read ||
+   ((uint16_t *)result_buf->Buffer.Pointer)[0] != 0) {
+   error = ENXIO;
+   break;
+   }
+   bcopy(result_buf->Buffer.Pointer + 4, dest, to_read);
+   dest += to_read;
+   offset += to_read;
+   length -= to_read;
+   if (result.Pointer != NULL) {
+   AcpiOsFree(result.Pointer);
+   result.Pointer = NULL;
+   }
+   }
+ 

svn commit: r344043 - head/share/termcap

2019-02-11 Thread Ben Widawsky
Author: bwidawsk
Date: Tue Feb 12 05:15:36 2019
New Revision: 344043
URL: https://svnweb.freebsd.org/changeset/base/344043

Log:
  termcap: Add an entry for kitty
  
  The project is here:
  https://github.com/kovidgoyal/kitty/
  
  I created a port (which now needs updating):
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233010
  
  If only we could use terminfo :(
  
  MFC after:  5 days
  Approved by:bapt
  Differential Revision:https://reviews.freebsd.org/D19060

Modified:
  head/share/termcap/termcap

Modified: head/share/termcap/termcap
==
--- head/share/termcap/termcap  Tue Feb 12 04:33:05 2019(r344042)
+++ head/share/termcap/termcap  Tue Feb 12 05:15:36 2019(r344043)
@@ -4746,6 +4746,29 @@ st-meta-256color|simpleterm with meta key and 256 colo
:is=\E[4l\E>\E[?1034h:mm=\E[?1034h:mo=\E[?1034l:\
:rs=\E[4l\E>\E[?1034h:tc=st-256color:
 
+
+# From version 0.13.3
+xterm-kitty|KovId's TTY:\
+   :tc=xterm-256color:tc=kitty+common:
+
+kitty+common|KovId's TTY common properties:\
+:am:hs:km:mi:ms:xn:\
+:co#80:it#8:li#24:\
+:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:K1=:K3=:\
+:K4=:K5=:LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\
+:ae=\E(B:al=\E[L:as=\E(0:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:\
+:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=\r:cs=\E[%i%d;%dr:\
+:ct=\E[3g:dc=\E[P:dl=\E[M:do=\n:ds=\E]2;\007:ec=\E[%dX:\
+:ei=\E[4l:fs=^G:ho=\E[H:im=\E[4h:k1=\EOP:k2=\EOQ:k3=\EOR:\
+:k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:\
+:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:\
+:kd=\EOB:ke=\E[?1l:kh=\EOH:kl=\EOD:kr=\EOC:ks=\E[?1h:\
+:ku=\EOA:le=^H:md=\E[1m:me=\E[0m:mh=\E[2m:mr=\E[7m:nd=\E[C:\
+:rc=\E8:sc=\E7:se=\E[27m:sf=\n:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
+:te=\E[?1049l:ti=\E[?1049h:ts=\E]2;:ue=\E[24m:up=\E[A:\
+:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?12l\E[?25h:vi=\E[?25l:\
+:vs=\E[?12;25h:
+
 #
 # END OF TERMCAP
 # 
___
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: r340993 - head/sys/dev/acpica

2018-11-26 Thread Ben Widawsky
Author: bwidawsk
Date: Mon Nov 26 19:41:13 2018
New Revision: 340993
URL: https://svnweb.freebsd.org/changeset/base/340993

Log:
  acpi/ec: Fix regression caused by r340644
  
  After r340644 there were two things wrong in cases where there is both
  an ECDT, and an EC device exposed via acpica. The first is a rather
  trivial situation where the device desc would say ECDT even when it was
  not implicitly created via ECDT (not really sure why the compiler
  doesn't seem to warn about this).
  
  The other more pervasive issue is that the code is designed to
  essentially not do anything for EC probe when its uid was already
  created an EC based on the ECDT's uid. The issue was that probe would
  still return 0 in this case, and so we'd end up with some weird
  duplication. Now to be honest, I'm not actually sure what exactly broke,
  but it was definitely not working as intended. To fix this, all that is
  really needed is to make sure we return ENXIO when we're probing the
  device already added for the ECDT entry. While here though, move the
  check for this earlier to avoid wasted cycles when we know after
  obtaining the uid that it's duplicative.
  
  There remains one questionable bit here which I don't want to touch -
  when doing probe for PNP0C09, if acquiring _UID for the device fails, 0
  is assumed, which is a valid UID used by the implicit ECDT.
  
  Reported by:  Charlie Li, et al.
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D18311

Modified:
  head/sys/dev/acpica/acpi_ec.c

Modified: head/sys/dev/acpica/acpi_ec.c
==
--- head/sys/dev/acpica/acpi_ec.c   Mon Nov 26 19:39:49 2018
(r340992)
+++ head/sys/dev/acpica/acpi_ec.c   Mon Nov 26 19:41:13 2018
(r340993)
@@ -362,7 +362,8 @@ acpi_ec_probe(device_t dev)
ret = 0;
 
goto out;
-}
+} else
+   ecdt = 0;
 
 ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
 if (ret > 0)
@@ -382,6 +383,22 @@ acpi_ec_probe(device_t dev)
 if (ACPI_FAILURE(status))
params->uid = 0;
 
+/*
+ * Check for a duplicate probe. This can happen when a probe via ECDT
+ * succeeded already. If this is a duplicate, disable this device.
+ *
+ * NB: It would seem device_disable would be sufficient to not get
+ * duplicated devices, and ENXIO isn't needed, however, device_probe() only
+ * checks DF_ENABLED at the start and so disabling it here is too late to
+ * prevent device_attach() from being called.
+ */
+peer = devclass_get_device(acpi_ec_devclass, params->uid);
+if (peer != NULL && device_is_alive(peer)) {
+   device_disable(dev);
+   ret = ENXIO;
+   goto out;
+}
+
 status = acpi_GetInteger(h, "_GLK", >glk);
 if (ACPI_FAILURE(status))
params->glk = 0;
@@ -421,16 +438,6 @@ acpi_ec_probe(device_t dev)
 
 /* Store the values we got from the namespace for attach. */
 acpi_set_private(dev, params);
-
-/*
- * Check for a duplicate probe. This can happen when a probe via ECDT
- * succeeded already. If this is a duplicate, disable this device.
- */
-peer = devclass_get_device(acpi_ec_devclass, params->uid);
-if (peer == NULL || !device_is_alive(peer))
-   ret = 0;
-else
-   device_disable(dev);
 
 if (buf.Pointer)
AcpiOsFree(buf.Pointer);
___
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: r340720 - in head/sys: compat/linuxkpi/common/include/linux vm

2018-11-20 Thread Ben Widawsky
Author: bwidawsk
Date: Wed Nov 21 04:34:18 2018
New Revision: 340720
URL: https://svnweb.freebsd.org/changeset/base/340720

Log:
  linuxkpi: Use pageproc instead of vmproc
  
  According to markj@:
  pageproc contains the page daemon and laundry threads, which are
  responsible for managing the LRU page queues and writing back dirty
  pages.  vmproc's main task is to swap out kernel stacks when the system
  is under memory pressure, and swap them back in when necessary.  It's a
  somewhat legacy component of the system and isn't required.  You can
  build a kernel without it by specifying "options NO_SWAPPING" (which is
  a somewhat misleading name), in which vm_swapout_dummy.c is compiled
  instead of vm_swapout.c.
  
  Based on this, we want pageproc to emulate kswapd, not vmproc.
  
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D18061

Modified:
  head/sys/compat/linuxkpi/common/include/linux/swap.h
  head/sys/vm/vm_pageout.h
  head/sys/vm/vm_swapout.c

Modified: head/sys/compat/linuxkpi/common/include/linux/swap.h
==
--- head/sys/compat/linuxkpi/common/include/linux/swap.hWed Nov 21 
03:22:37 2018(r340719)
+++ head/sys/compat/linuxkpi/common/include/linux/swap.hWed Nov 21 
04:34:18 2018(r340720)
@@ -45,7 +45,8 @@ get_nr_swap_pages(void)
 static inline int
 current_is_kswapd(void)
 {
-   return vm_curproc_is_vmproc();
+
+   return (curproc == pageproc);
 }
 
 #endif

Modified: head/sys/vm/vm_pageout.h
==
--- head/sys/vm/vm_pageout.hWed Nov 21 03:22:37 2018(r340719)
+++ head/sys/vm/vm_pageout.hWed Nov 21 04:34:18 2018(r340720)
@@ -107,7 +107,5 @@ void vm_pageout_oom(int shortage);
 void vm_swapout_run(void);
 void vm_swapout_run_idle(void);
 
-bool vm_curproc_is_vmproc(void);
-
 #endif /* _KERNEL */
 #endif /* _VM_VM_PAGEOUT_H_ */

Modified: head/sys/vm/vm_swapout.c
==
--- head/sys/vm/vm_swapout.cWed Nov 21 03:22:37 2018(r340719)
+++ head/sys/vm/vm_swapout.cWed Nov 21 04:34:18 2018(r340720)
@@ -961,10 +961,3 @@ swapout(struct proc *p)
p->p_swtick = ticks;
return (0);
 }
-
-/* Used to determine if the current process is itself the reaper. */
-bool
-vm_curproc_is_vmproc(void)
-{
-   return curproc == vmproc;
-}
___
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"


Re: svn commit: r340709 - in head/sys: compat/linuxkpi/common/include/linux vm

2018-11-20 Thread Ben Widawsky
On 18-11-21 02:00:57, Oliver Pinter wrote:
> 
> 
> On Tuesday, November 20, 2018, Ben Widawsky  wrote:
> 
> Author: bwidawsk
> Date: Tue Nov 20 22:49:19 2018
> New Revision: 340709
> URL: https://svnweb.freebsd.org/changeset/base/340709
> 
> Log:
>   linuxkpi: Add some basic swap functions
> 
>   These are used by kms-drm to determine various heuristics relate
>   memory conditions.
> 
>   The number of free swap pages is just a variable, and it can be
>   much cheaper by either adding a new getter, or simply extern'ing
>   swap_total. However, this patch opts to use the more expensive,
>   existing interface - since this isn't an operation in a high per
>   path.
> 
>   This allows us to remove some more gpl linuxkpi and do the follo
>   kms-drm:
>   git rm linuxkpi/gplv2/include/linux/swap.h
> 
>   Reviewed by:    mmacy, Johannes Lundberg 
>   Approved by:    emaste (mentor)
>   Differential Revision:  https://reviews.freebsd.org/D18052
> 
> Added:
>   head/sys/compat/linuxkpi/common/include/linux/swap.h   (contents, props
> changed)
> Modified:
>   head/sys/vm/vm_pageout.h
>   head/sys/vm/vm_swapout.c
> 
> Added: head/sys/compat/linuxkpi/common/include/linux/swap.h
> 
> ===
> ===
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/sys/compat/linuxkpi/common/include/linux/swap.h        Tue Nov 20
> 22:49:19 2018        (r340709)
> @@ -0,0 +1,102 @@
> +/*-
> + * Copyright (c) 2018 Intel Corporation
> + *
> + * 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$
> + */
> +
> +#ifndef        _LINUX_SWAP_H_
> +#define        _LINUX_SWAP_H_
> +
> +#include 
> +#include 
> +
> +static inline long
> +get_nr_swap_pages(void)
> +{
> +       int i, j;
> +
> +       /* NB: This could be done cheaply by obtaining swap_total directly
> */
> +       swap_pager_status(, );
> +       return i - j;
> +}
> +
> +static inline int
> +current_is_kswapd(void)
> +{
> +       return vm_curproc_is_vmproc();
> +}
> +
> +#endif
> 
> 
> Probably I'm wrong, but this file contains twice the same intended content. 
>  

You are correct, but I have already fixed it. I have some problems with my
workflow still, apparently. :(

> 
> +/*-
> + * Copyright (c) 2018 Intel Corporation
> + *
> + * 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 T

Re: svn commit: r340709 - in head/sys: compat/linuxkpi/common/include/linux vm

2018-11-20 Thread Ben Widawsky
On 18-11-20 19:51:48, Mark Johnston wrote:
> On Tue, Nov 20, 2018 at 04:42:39PM -0800, Ben Widawsky wrote:
> > On 18-11-20 19:35:15, Mark Johnston wrote:
> > > On Tue, Nov 20, 2018 at 10:49:19PM +, Ben Widawsky wrote:
> > > > Author: bwidawsk
> > > > Date: Tue Nov 20 22:49:19 2018
> > > > New Revision: 340709
> > > > URL: https://svnweb.freebsd.org/changeset/base/340709
> > > > 
> > > > Log:
> > > >   linuxkpi: Add some basic swap functions
> > > >   
> > > >   These are used by kms-drm to determine various heuristics relate
> > > >   memory conditions.
> > > >   
> > > >   The number of free swap pages is just a variable, and it can be
> > > >   much cheaper by either adding a new getter, or simply extern'ing
> > > >   swap_total. However, this patch opts to use the more expensive,
> > > >   existing interface - since this isn't an operation in a high per
> > > >   path.
> > > >   
> > > >   This allows us to remove some more gpl linuxkpi and do the follo
> > > >   kms-drm:
> > > >   git rm linuxkpi/gplv2/include/linux/swap.h
> > > >   
> > > >   Reviewed by:mmacy, Johannes Lundberg 
> > > >   Approved by:emaste (mentor)
> > > >   Differential Revision:  https://reviews.freebsd.org/D18052
> > > > 
> > > > Added:
> > > >   head/sys/compat/linuxkpi/common/include/linux/swap.h   (contents, 
> > > > props changed)
> > > > Modified:
> > > >   head/sys/vm/vm_pageout.h
> > > >   head/sys/vm/vm_swapout.c
> > > > 
> > > > [...]
> > > > Modified: head/sys/vm/vm_swapout.c
> > > > ==
> > > > --- head/sys/vm/vm_swapout.cTue Nov 20 22:24:18 2018
> > > > (r340708)
> > > > +++ head/sys/vm/vm_swapout.cTue Nov 20 22:49:19 2018
> > > > (r340709)
> > > > @@ -961,3 +961,10 @@ swapout(struct proc *p)
> > > > p->p_swtick = ticks;
> > > > return (0);
> > > >  }
> > > > +
> > > > +/* Used to determine if the current process is itself the reaper. */
> > > > +bool
> > > > +vm_curproc_is_vmproc(void)
> > > > +{
> > > > +   return curproc == vmproc;
> > > > +}
> > > 
> > > From a look at how this is used, it should probably be pageproc rather
> > > than vmproc.  There are various code paths that just check
> > > curproc == pageproc inline.
> > > 
> > 
> > Could I trouble you for a quick explanation of the difference between the 
> > two?
> 
> pageproc contains the page daemon and laundry threads, which are
> responsible for managing the LRU page queues and writing back dirty
> pages.  vmproc's main task is to swap out kernel stacks when the system
> is under memory pressure, and swap them back in when necessary.  It's a
> somewhat legacy component of the system and isn't required.  You can
> build a kernel without it by specifying "options NO_SWAPPING" (which is
> a somewhat misleading name), in which vm_swapout_dummy.c is compiled
> instead of vm_swapout.c.
> 

Thanks for the explanation. I indeed want the page daemon. I will put up a patch
to do that the correct way. Thanks.
___
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"


Re: svn commit: r340709 - in head/sys: compat/linuxkpi/common/include/linux vm

2018-11-20 Thread Ben Widawsky
On 18-11-20 19:35:15, Mark Johnston wrote:
> On Tue, Nov 20, 2018 at 10:49:19PM +0000, Ben Widawsky wrote:
> > Author: bwidawsk
> > Date: Tue Nov 20 22:49:19 2018
> > New Revision: 340709
> > URL: https://svnweb.freebsd.org/changeset/base/340709
> > 
> > Log:
> >   linuxkpi: Add some basic swap functions
> >   
> >   These are used by kms-drm to determine various heuristics relate
> >   memory conditions.
> >   
> >   The number of free swap pages is just a variable, and it can be
> >   much cheaper by either adding a new getter, or simply extern'ing
> >   swap_total. However, this patch opts to use the more expensive,
> >   existing interface - since this isn't an operation in a high per
> >   path.
> >   
> >   This allows us to remove some more gpl linuxkpi and do the follo
> >   kms-drm:
> >   git rm linuxkpi/gplv2/include/linux/swap.h
> >   
> >   Reviewed by:mmacy, Johannes Lundberg 
> >   Approved by:emaste (mentor)
> >   Differential Revision:  https://reviews.freebsd.org/D18052
> > 
> > Added:
> >   head/sys/compat/linuxkpi/common/include/linux/swap.h   (contents, props 
> > changed)
> > Modified:
> >   head/sys/vm/vm_pageout.h
> >   head/sys/vm/vm_swapout.c
> > 
> > [...]
> > Modified: head/sys/vm/vm_swapout.c
> > ==
> > --- head/sys/vm/vm_swapout.cTue Nov 20 22:24:18 2018
> > (r340708)
> > +++ head/sys/vm/vm_swapout.cTue Nov 20 22:49:19 2018
> > (r340709)
> > @@ -961,3 +961,10 @@ swapout(struct proc *p)
> > p->p_swtick = ticks;
> > return (0);
> >  }
> > +
> > +/* Used to determine if the current process is itself the reaper. */
> > +bool
> > +vm_curproc_is_vmproc(void)
> > +{
> > +   return curproc == vmproc;
> > +}
> 
> From a look at how this is used, it should probably be pageproc rather
> than vmproc.  There are various code paths that just check
> curproc == pageproc inline.
> 

Could I trouble you for a quick explanation of the difference between the two?
___
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: r340716 - head/sys/x86/include

2018-11-20 Thread Ben Widawsky
Author: bwidawsk
Date: Wed Nov 21 00:21:58 2018
New Revision: 340716
URL: https://svnweb.freebsd.org/changeset/base/340716

Log:
  Add definitions for Intel Speed Shift
  
  These definitions will be used by a driver to implement Hardware
  P-States (autonomous control of HWP, via Intel Speed Shift technology).
  
  Reviewed by:  kib
  Approved by:  emaste (mentor)
  Differential Revision:https://reviews.freebsd.org/D18050

Modified:
  head/sys/x86/include/specialreg.h

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Wed Nov 21 00:16:43 2018
(r340715)
+++ head/sys/x86/include/specialreg.h   Wed Nov 21 00:21:58 2018
(r340716)
@@ -189,6 +189,12 @@
 #defineCPUTPM1_SENSOR  0x0001
 #defineCPUTPM1_TURBO   0x0002
 #defineCPUTPM1_ARAT0x0004
+#defineCPUTPM1_HWP 0x0080
+#defineCPUTPM1_HWP_NOTIFICATION0x0100
+#defineCPUTPM1_HWP_ACTIVITY_WINDOW 0x0200
+#defineCPUTPM1_HWP_PERF_PREF   0x0400
+#defineCPUTPM1_HWP_PKG 0x0800
+#defineCPUTPM1_HWP_FLEXIBLE0x0002
 #defineCPUTPM2_EFFREQ  0x0001
 
 /* Intel Processor Trace CPUID. */
@@ -541,7 +547,14 @@
 #defineMSR_DRAM_ENERGY_STATUS  0x619
 #defineMSR_PP0_ENERGY_STATUS   0x639
 #defineMSR_PP1_ENERGY_STATUS   0x641
+#defineMSR_PPERF   0x64e
 #defineMSR_TSC_DEADLINE0x6e0   /* Writes are not serializing */
+#defineMSR_IA32_PM_ENABLE  0x770
+#defineMSR_IA32_HWP_CAPABILITIES   0x771
+#defineMSR_IA32_HWP_REQUEST_PKG0x772
+#defineMSR_IA32_HWP_INTERRUPT  0x773
+#defineMSR_IA32_HWP_REQUEST0x774
+#defineMSR_IA32_HWP_STATUS 0x777
 
 /*
  * VMX MSRs
@@ -717,6 +730,25 @@
 
 /* MSR IA32_FLUSH_CMD */
 #defineIA32_FLUSH_CMD_L1D  0x0001
+
+/* MSR IA32_HWP_CAPABILITIES */
+#defineIA32_HWP_CAPABILITIES_HIGHEST_PERFORMANCE(x)(((x) >> 0) & 
0xff)
+#defineIA32_HWP_CAPABILITIES_GUARANTEED_PERFORMANCE(x) (((x) >> 8) & 
0xff)
+#defineIA32_HWP_CAPABILITIES_EFFICIENT_PERFORMANCE(x)  (((x) >> 16) & 
0xff)
+#defineIA32_HWP_CAPABILITIES_LOWEST_PERFORMANCE(x) (((x) >> 24) & 
0xff)
+
+/* MSR IA32_HWP_REQUEST */
+#defineIA32_HWP_REQUEST_MINIMUM_VALID  (1ULL << 63)
+#defineIA32_HWP_REQUEST_MAXIMUM_VALID  (1ULL << 62)
+#defineIA32_HWP_REQUEST_DESIRED_VALID  (1ULL << 61)
+#defineIA32_HWP_REQUEST_EPP_VALID  (1ULL << 60)
+#defineIA32_HWP_REQUEST_ACTIVITY_WINDOW_VALID  (1ULL << 59)
+#defineIA32_HWP_REQUEST_PACKAGE_CONTROL(1ULL << 42)
+#defineIA32_HWP_ACTIVITY_WINDOW(0x3ffULL << 32)
+#defineIA32_HWP_REQUEST_ENERGY_PERFORMANCE_PREFERENCE  (0xffULL << 24)
+#defineIA32_HWP_DESIRED_PERFORMANCE(0xffULL << 16)
+#defineIA32_HWP_REQUEST_MAXIMUM_PERFORMANCE(0xffULL << 8)
+#defineIA32_HWP_MINIMUM_PERFORMANCE(0xffULL << 0)
 
 /*
  * PAT modes.
___
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: r340712 - head/tools/tools/git

2018-11-20 Thread Ben Widawsky
Author: bwidawsk
Date: Tue Nov 20 23:27:15 2018
New Revision: 340712
URL: https://svnweb.freebsd.org/changeset/base/340712

Log:
  git-svn-init: Add docs to the choice of repos

Modified:
  head/tools/tools/git/git-svn-init

Modified: head/tools/tools/git/git-svn-init
==
--- head/tools/tools/git/git-svn-init   Tue Nov 20 23:07:45 2018
(r340711)
+++ head/tools/tools/git/git-svn-init   Tue Nov 20 23:27:15 2018
(r340712)
@@ -35,6 +35,10 @@
 GIT_IN_PATH=$(which git)
 GIT=${GIT-${GIT_IN_PATH}}
 
+GIT_DOCS_REPO=${GIT_DOCS_REPO-git://github.com/freebsd/freebsd-doc.git}
+GIT_SVN_DOCS_ROOT_URI=${GIT_SVN_DOCS_ROOT_URI-svn.freebsd.org/doc}
+GIT_SVN_DOCS_URI=${GIV_SVN_DOCS_URI-repo.freebsd.org/doc}
+
 GIT_PORTS_REPO=${GIT_PORTS_REPO-git://github.com/freebsd/freebsd-ports.git}
 GIT_SVN_PORTS_ROOT_URI=${GIT_SVN_PORTS_ROOT_URI-svn.freebsd.org/ports}
 GIT_SVN_PORTS_URI=${GIT_SVN_PORTS_URI-repo.freebsd.org/ports}
@@ -43,6 +47,7 @@ GIT_SRC_REPO=${GIT_SRC_REPO-git://github.com/freebsd/f
 GIT_SVN_SRC_ROOT_URI=${GIT_SVN_SRC_ROOT_URI-svn.freebsd.org/base}
 GIT_SVN_SRC_URI=${GIT_SVN_SRC_URI-repo.freebsd.org/base}
 
+GIT_SVN_DOCS_PUSH_URI=$GIT_SVN_DOCS_URI
 GIT_SVN_PORTS_PUSH_URI=$GIT_SVN_PORTS_URI
 GIT_SVN_SRC_PUSH_URI=$GIT_SVN_SRC_URI
 
@@ -58,6 +63,7 @@ both ports and src under freebsd in the current workin
 -n Dry run
 -p Exclude ports
 -s Exclude src
+-d Exclude docs
 
 EOF
 }
@@ -138,7 +144,11 @@ doit()
local svn_root_uri=$GIT_SVN_SRC_ROOT_URI
local svn_uri=$GIT_SVN_SRC_URI
local svn_push_uri=$GIT_SVN_SRC_PUSH_URI
-   else
+   elif [ "$3" = "docs" ] ; then
+   local svn_root_uri=$GIT_SVN_DOCS_ROOT_URI
+   local svn_uri=$GIT_SVN_DOCS_URI
+   local svn_push_uri=$GIT_SVN_DOCS_PUSH_URI
+   elif [ "$3" = "ports" ] ; then
local svn_root_uri=$GIT_SVN_PORTS_ROOT_URI
local svn_uri=$GIT_SVN_PORTS_URI
local svn_push_uri=$GIT_SVN_PORTS_PUSH_URI
@@ -160,7 +170,8 @@ doit()
 
 ports=1
 source=1
-while getopts "hb:nr:sp" opt; do
+docs=1
+while getopts "hb:nr:sdp" opt; do
case "$opt" in
b)
base_path="$OPTARG"
@@ -174,6 +185,9 @@ while getopts "hb:nr:sp" opt; do
s)
source=0
;;
+   d)
+   docs=0
+   ;;
h|*)
usage
exit 0
@@ -190,4 +204,8 @@ fi
 
 if [ "$ports" -eq 1 ]; then
doit ${GIT_PORTS_REPO} ${base_path:-freebsd} "ports"
+fi
+
+if [ "$docs" -eq 1 ]; then
+   doit ${GIT_DOCS_REPO} ${base_path:-freebsd} "docs"
 fi
___
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: r340710 - head/sys/compat/linuxkpi/common/include/linux

2018-11-20 Thread Ben Widawsky
Author: bwidawsk
Date: Tue Nov 20 23:05:09 2018
New Revision: 340710
URL: https://svnweb.freebsd.org/changeset/base/340710

Log:
  linuxkpi: Remove duplicated text
  
  Somehow this got botched while moving from git -> svn

Modified:
  head/sys/compat/linuxkpi/common/include/linux/swap.h

Modified: head/sys/compat/linuxkpi/common/include/linux/swap.h
==
--- head/sys/compat/linuxkpi/common/include/linux/swap.hTue Nov 20 
22:49:19 2018(r340709)
+++ head/sys/compat/linuxkpi/common/include/linux/swap.hTue Nov 20 
23:05:09 2018(r340710)
@@ -49,54 +49,3 @@ current_is_kswapd(void)
 }
 
 #endif
-/*-
- * Copyright (c) 2018 Intel Corporation
- *
- * 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$
- */
-
-#ifndef_LINUX_SWAP_H_
-#define_LINUX_SWAP_H_
-
-#include 
-#include 
-
-static inline long
-get_nr_swap_pages(void)
-{
-   int i, j;
-
-   /* NB: This could be done cheaply by obtaining swap_total directly */
-   swap_pager_status(, );
-   return i - j;
-}
-
-static inline int
-current_is_kswapd(void)
-{
-   return vm_curproc_is_vmproc();
-}
-
-#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: r340709 - in head/sys: compat/linuxkpi/common/include/linux vm

2018-11-20 Thread Ben Widawsky
Author: bwidawsk
Date: Tue Nov 20 22:49:19 2018
New Revision: 340709
URL: https://svnweb.freebsd.org/changeset/base/340709

Log:
  linuxkpi: Add some basic swap functions
  
  These are used by kms-drm to determine various heuristics relate
  memory conditions.
  
  The number of free swap pages is just a variable, and it can be
  much cheaper by either adding a new getter, or simply extern'ing
  swap_total. However, this patch opts to use the more expensive,
  existing interface - since this isn't an operation in a high per
  path.
  
  This allows us to remove some more gpl linuxkpi and do the follo
  kms-drm:
  git rm linuxkpi/gplv2/include/linux/swap.h
  
  Reviewed by:mmacy, Johannes Lundberg 
  Approved by:emaste (mentor)
  Differential Revision:  https://reviews.freebsd.org/D18052

Added:
  head/sys/compat/linuxkpi/common/include/linux/swap.h   (contents, props 
changed)
Modified:
  head/sys/vm/vm_pageout.h
  head/sys/vm/vm_swapout.c

Added: head/sys/compat/linuxkpi/common/include/linux/swap.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/swap.hTue Nov 20 
22:49:19 2018(r340709)
@@ -0,0 +1,102 @@
+/*-
+ * Copyright (c) 2018 Intel Corporation
+ *
+ * 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$
+ */
+
+#ifndef_LINUX_SWAP_H_
+#define_LINUX_SWAP_H_
+
+#include 
+#include 
+
+static inline long
+get_nr_swap_pages(void)
+{
+   int i, j;
+
+   /* NB: This could be done cheaply by obtaining swap_total directly */
+   swap_pager_status(, );
+   return i - j;
+}
+
+static inline int
+current_is_kswapd(void)
+{
+   return vm_curproc_is_vmproc();
+}
+
+#endif
+/*-
+ * Copyright (c) 2018 Intel Corporation
+ *
+ * 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$
+ */
+
+#ifndef_LINUX_SWAP_H_
+#define_LINUX_SWAP_H_
+
+#include 
+#include 
+
+static inline long
+get_nr_swap_pages(void)
+{
+   int i, j;
+
+   /* NB: This could be done cheaply by obtaining swap_total directly */
+   swap_pager_status(, );
+   return i - j;
+}
+
+static inline int
+current_is_kswapd(void)
+{
+   return vm_curproc_is_vmproc();
+}
+
+#endif

Modified: head/sys/vm/vm_pageout.h
==
--- head/sys/vm/vm_pageout.h

svn commit: r340644 - in head/sys: dev/acpica kern sys

2018-11-19 Thread Ben Widawsky
Author: bwidawsk
Date: Mon Nov 19 18:29:03 2018
New Revision: 340644
URL: https://svnweb.freebsd.org/changeset/base/340644

Log:
  acpi: fix acpi_ec_probe to only check EC devices
  
  This patch utilizes the fixed_devclass attribute in order to make sure
  other acpi devices with params don't get confused for an EC device.
  
  The existing code assumes that acpi_ec_probe is only ever called with a
  dereferencable acpi param. Aside from being incorrect because other
  devices of ACPI_TYPE_DEVICE may be probed here which aren't ec devices,
  (and they may have set acpi private data), it is even more nefarious if
  another ACPI driver uses private data which is not dereferancable. This
  will result in a pointer deref during boot and therefore boot failure.
  
  On X86, as it stands today, no other devices actually do this (acpi_cpu
  checks for PROCESSOR type devices) and so there is no issue. I ran into
  this because I am adding such a device which gets probed before
  acpi_ec_probe and sets private data. If ARM ever has an EC, I think
  they'd run into this issue as well.
  
  There have been several iterations of this patch. Earlier
  iterations had ECDT enumerated ECs not call into the probe/attach
  functions of this driver. This change was Suggested by: jhb@.
  
  Reviewed by:jhb
  Approved by:  emaste (mentor)
  Differential Revision:  https://reviews.freebsd.org/D16635

Modified:
  head/sys/dev/acpica/acpi_ec.c
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/dev/acpica/acpi_ec.c
==
--- head/sys/dev/acpica/acpi_ec.c   Mon Nov 19 18:26:11 2018
(r340643)
+++ head/sys/dev/acpica/acpi_ec.c   Mon Nov 19 18:29:03 2018
(r340644)
@@ -345,92 +345,95 @@ acpi_ec_probe(device_t dev)
 struct acpi_ec_params *params;
 static char *ec_ids[] = { "PNP0C09", NULL };
 
+ret = ENXIO;
+
 /* Check that this is a device and that EC is not disabled. */
 if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec"))
-   return (ENXIO);
+   return (ret);
 
-/*
- * If probed via ECDT, set description and continue.  Otherwise,
- * we can access the namespace and make sure this is not a
- * duplicate probe.
- */
-ret = ENXIO;
-ecdt = 0;
+if (device_is_devclass_fixed(dev)) {
+   /*
+* If probed via ECDT, set description and continue. Otherwise, we can
+* access the namespace and make sure this is not a duplicate probe.
+*/
+ecdt = 1;
+params = acpi_get_private(dev);
+   if (params != NULL)
+   ret = 0;
+
+   goto out;
+}
+
+ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
+if (ret > 0)
+   return (ret);
+
+params = malloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO);
+
 buf.Pointer = NULL;
 buf.Length = ACPI_ALLOCATE_BUFFER;
-params = acpi_get_private(dev);
-if (params != NULL) {
-   ecdt = 1;
-   ret = 0;
-} else {
-   ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
-   if (ret > 0)
-   goto out;
-   params = malloc(sizeof(struct acpi_ec_params), M_TEMP,
-   M_WAITOK | M_ZERO);
-   h = acpi_get_handle(dev);
+h = acpi_get_handle(dev);
 
-   /*
-* Read the unit ID to check for duplicate attach and the
-* global lock value to see if we should acquire it when
-* accessing the EC.
-*/
-   status = acpi_GetInteger(h, "_UID", >uid);
-   if (ACPI_FAILURE(status))
-   params->uid = 0;
-   status = acpi_GetInteger(h, "_GLK", >glk);
-   if (ACPI_FAILURE(status))
-   params->glk = 0;
+/*
+ * Read the unit ID to check for duplicate attach and the global lock value
+ * to see if we should acquire it when accessing the EC.
+ */
+status = acpi_GetInteger(h, "_UID", >uid);
+if (ACPI_FAILURE(status))
+   params->uid = 0;
 
-   /*
-* Evaluate the _GPE method to find the GPE bit used by the EC to
-* signal status (SCI).  If it's a package, it contains a reference
-* and GPE bit, similar to _PRW.
-*/
-   status = AcpiEvaluateObject(h, "_GPE", NULL, );
-   if (ACPI_FAILURE(status)) {
-   device_printf(dev, "can't evaluate _GPE - %s\n",
- AcpiFormatException(status));
-   goto out;
-   }
-   obj = (ACPI_OBJECT *)buf.Pointer;
-   if (obj == NULL)
-   goto out;
+status = acpi_GetInteger(h, "_GLK", >glk);
+if (ACPI_FAILURE(status))
+   params->glk = 0;
 
-   switch (obj->Type) {
-   case ACPI_TYPE_INTEGER:
-   params->gpe_handle = NULL;
-   params->gpe_bit = obj->Integer.Value;
-   break;
-   case ACPI_TYPE_PACKAGE:
-   if (!ACPI_PKG_VALID(obj, 2))
-   goto out;
-   params->gpe_handle =
- 

svn commit: r340000 - head/sys/compat/linuxkpi/common/include/linux

2018-11-01 Thread Ben Widawsky
Author: bwidawsk
Date: Thu Nov  1 15:30:01 2018
New Revision: 34
URL: https://svnweb.freebsd.org/changeset/base/34

Log:
  linuxkpi: Add GFP flags needed for ttm drivers
  
  Submitted by: Johannes Lundberg 
  Requested by: bwidawsk
  MFC after:3 days
  Approved by:  emaste (mentor)

Modified:
  head/sys/compat/linuxkpi/common/include/linux/gfp.h

Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h
==
--- head/sys/compat/linuxkpi/common/include/linux/gfp.h Thu Nov  1 15:27:22 
2018(r33)
+++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Thu Nov  1 15:30:01 
2018(r34)
@@ -52,6 +52,7 @@
 #define__GFP_RETRY_MAYFAIL 0
 #define__GFP_MOVABLE   0
 #define__GFP_COMP  0
+#define__GFP_KSWAPD_RECLAIM 0
 
 #define__GFP_IO0
 #define__GFP_NO_KSWAPD 0
@@ -73,6 +74,7 @@
 #defineGFP_TEMPORARY   M_NOWAIT
 #defineGFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO)
 #defineGFP_TRANSHUGE   0
+#defineGFP_TRANSHUGE_LIGHT 0
 
 CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0);
 CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK);
___
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: r339577 - head/sys/dev/acpica

2018-10-21 Thread Ben Widawsky
Author: bwidawsk
Date: Mon Oct 22 03:29:54 2018
New Revision: 339577
URL: https://svnweb.freebsd.org/changeset/base/339577

Log:
  acpi: Add an interface to obtain DSM information
  
  The Device Specific Method (_DSM) is on optional object that defines
  device specific controls. This will be useful for our power management
  controller in upcoming patches. More information can be found in ACPI
  spec 6.2 section 9.1.1
  
  https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf
  
  This patch had a minor modification changing ENOMEM to AE_NO_MEMORY
  after it got review and approval but before committing.
  
  Test Plan: Tested in my s0ix branch
  
  Reviewed by:  kib
  Approved by:  emaste (mentor)
  Differential Revision: https://reviews.freebsd.org/D17121

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpivar.h

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Mon Oct 22 02:42:14 2018(r339576)
+++ head/sys/dev/acpica/acpi.c  Mon Oct 22 03:29:54 2018(r339577)
@@ -2570,6 +2570,98 @@ acpi_AppendBufferResource(ACPI_BUFFER *buf, ACPI_RESOU
 return (AE_OK);
 }
 
+UINT8
+acpi_DSMQuery(ACPI_HANDLE h, uint8_t *uuid, int revision)
+{
+/*
+ * ACPI spec 9.1.1 defines this.
+ *
+ * "Arg2: Function Index Represents a specific function whose meaning is
+ * specific to the UUID and Revision ID. Function indices should start
+ * with 1. Function number zero is a query function (see the special
+ * return code defined below)."
+ */
+ACPI_BUFFER buf;
+ACPI_OBJECT *obj;
+UINT8 ret = 0;
+
+if (!ACPI_SUCCESS(acpi_EvaluateDSM(h, uuid, revision, 0, NULL, ))) {
+   ACPI_INFO(("Failed to enumerate DSM functions\n"));
+   return (0);
+}
+
+obj = (ACPI_OBJECT *)buf.Pointer;
+KASSERT(obj, ("Object not allowed to be NULL\n"));
+
+/*
+ * From ACPI 6.2 spec 9.1.1:
+ * If Function Index = 0, a Buffer containing a function index bitfield.
+ * Otherwise, the return value and type depends on the UUID and revision
+ * ID (see below).
+ */
+switch (obj->Type) {
+case ACPI_TYPE_BUFFER:
+   ret = *(uint8_t *)obj->Buffer.Pointer;
+   break;
+case ACPI_TYPE_INTEGER:
+   ACPI_BIOS_WARNING((AE_INFO,
+   "Possibly buggy BIOS with ACPI_TYPE_INTEGER for function 
enumeration\n"));
+   ret = obj->Integer.Value & 0xFF;
+   break;
+default:
+   ACPI_WARNING((AE_INFO, "Unexpected return type %u\n", obj->Type));
+};
+
+AcpiOsFree(obj);
+return ret;
+}
+
+/*
+ * DSM may return multiple types depending on the function. It is therefore
+ * unsafe to use the typed evaluation. It is highly recommended that the caller
+ * check the type of the returned object.
+ */
+ACPI_STATUS
+acpi_EvaluateDSM(ACPI_HANDLE handle, uint8_t *uuid, int revision,
+uint64_t function, union acpi_object *package, ACPI_BUFFER *out_buf)
+{
+ACPI_OBJECT arg[4];
+ACPI_OBJECT_LIST arglist;
+ACPI_BUFFER buf;
+ACPI_STATUS status;
+
+if (out_buf == NULL)
+   return (AE_NO_MEMORY);
+
+arg[0].Type = ACPI_TYPE_BUFFER;
+arg[0].Buffer.Length = ACPI_UUID_LENGTH;
+arg[0].Buffer.Pointer = uuid;
+arg[1].Type = ACPI_TYPE_INTEGER;
+arg[1].Integer.Value = revision;
+arg[2].Type = ACPI_TYPE_INTEGER;
+arg[2].Integer.Value = function;
+if (package) {
+   arg[3] = *package;
+} else {
+   arg[3].Type = ACPI_TYPE_PACKAGE;
+   arg[3].Package.Count = 0;
+   arg[3].Package.Elements = NULL;
+}
+
+arglist.Pointer = arg;
+arglist.Count = 4;
+buf.Pointer = NULL;
+buf.Length = ACPI_ALLOCATE_BUFFER;
+status = AcpiEvaluateObject(handle, "_DSM", , );
+if (ACPI_FAILURE(status))
+   return (status);
+
+KASSERT(ACPI_SUCCESS(status), ("Unexpected status"));
+
+*out_buf = buf;
+return (status);
+}
+
 ACPI_STATUS
 acpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid, int revision, int count,
 uint32_t *caps_in, uint32_t *caps_out, bool query)

Modified: head/sys/dev/acpica/acpivar.h
==
--- head/sys/dev/acpica/acpivar.h   Mon Oct 22 02:42:14 2018
(r339576)
+++ head/sys/dev/acpica/acpivar.h   Mon Oct 22 03:29:54 2018
(r339577)
@@ -349,6 +349,10 @@ ACPI_STATUSacpi_FindIndexedResource(ACPI_BUFFER 
*buf,
ACPI_RESOURCE **resp);
 ACPI_STATUSacpi_AppendBufferResource(ACPI_BUFFER *buf,
ACPI_RESOURCE *res);
+UINT8  acpi_DSMQuery(ACPI_HANDLE h, uint8_t *uuid, int revision);
+ACPI_STATUSacpi_EvaluateDSM(ACPI_HANDLE handle, uint8_t *uuid,
+   int revision, uint64_t function, union acpi_object *package,
+   ACPI_BUFFER *out_buf);
 ACPI_STATUSacpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid,
int revision, 

svn commit: r338504 - head/share/man/man9

2018-09-06 Thread Ben Widawsky
Author: bwidawsk
Date: Thu Sep  6 18:45:31 2018
New Revision: 338504
URL: https://svnweb.freebsd.org/changeset/base/338504

Log:
  Add device_attach and device_detach events to man page.
  
  Approved by:  bcr, emaste (mentor), imp, jhb
  Approved by:  re (gjb)
  Differential Revision:https://reviews.freebsd.org/D17052

Modified:
  head/share/man/man9/EVENTHANDLER.9

Modified: head/share/man/man9/EVENTHANDLER.9
==
--- head/share/man/man9/EVENTHANDLER.9  Thu Sep  6 18:34:11 2018
(r338503)
+++ head/share/man/man9/EVENTHANDLER.9  Thu Sep  6 18:45:31 2018
(r338504)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\" $FreeBSD$
 .\"
-.Dd October 31, 2017
+.Dd September 6, 2018
 .Dt EVENTHANDLER 9
 .Os
 .Sh NAME
@@ -283,6 +283,10 @@ Callback invoked after cpu frequency has changed.
 Callback invoked before cpu frequency has changed.
 .It Vt dcons_poll
 Callback invoked to poll for dcons changes.
+.It Vt device_attach
+Callback invoked after a device has attached.
+.It Vt device_detach
+Callbacks invoked before and after a device has detached.
 .It Vt dev_clone
 Callbacks invoked when a new entry is created under
 .Pa /dev .
___
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: r337365 - head/tools/tools/git

2018-08-05 Thread Ben Widawsky
Author: bwidawsk
Date: Mon Aug  6 01:08:43 2018
New Revision: 337365
URL: https://svnweb.freebsd.org/changeset/base/337365

Log:
  git-svn-init: Clarify branch creation commands
  
  Suggested by: eadler
  Reviewed by:  eadler
  Approved by:  emaste (mentor)
  Differential Revision:https://reviews.freebsd.org/D16593

Modified:
  head/tools/tools/git/git-svn-init   (contents, props changed)

Modified: head/tools/tools/git/git-svn-init
==
--- head/tools/tools/git/git-svn-init   Sun Aug  5 22:24:38 2018
(r337364)
+++ head/tools/tools/git/git-svn-init   Mon Aug  6 01:08:43 2018
(r337365)
@@ -119,11 +119,9 @@ git_checkout()
# Arrange to have 'master' reference 'trunk'
${GIT} checkout trunk
 
-   # Delete master
-   ${GIT} branch -D master
-
-   # Make master really be trunk
-   ${GIT} checkout -b master trunk
+   # Make master reference trunk
+   ${GIT} branch --force master trunk
+   ${GIT} checkout master
 }
 
 rebase()
___
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"


Re: svn commit: r337157 - in head: . tools/tools/git

2018-08-04 Thread Ben Widawsky
On 18-08-04 19:36:11, Warner Losh wrote:
> 
> 
> On Sat, Aug 4, 2018, 7:11 PM Eitan Adler  wrote:
> 
> On Sat, 4 Aug 2018 at 10:16, Warner Losh  wrote:
> >
> >
> >
> > On Sat, Aug 4, 2018, 6:08 PM Eitan Adler  wrote:
> >>
> >> On Thu, 2 Aug 2018 at 11:28, Ben Widawsky  wrote:
> >> > +git_checkout()
> >> > +{
> >> > +       # Delete master
> >> > +       ${GIT} branch -D master
> >> > +
> >> > +       # Make master really be trunk
> >> > +       ${GIT} checkout -b master trunk
> >>
> >> Can't this be git branch --force master trunk ?
> >
> >
> > No. That won't work. We do not want to change the location of master.
> This will reset it to trunk, which is nearly always wrong.
> 
> See this:
> 
> ${GIT} branch -D master
> ${GIT} checkout -b master trunk
> 
> For clarity I'd expect something closer to:
> 
> git branch --force master trunk
> git checkout master
> 
> The end result is the same, but IMHO this is clearer in intent.
> 
> 
> Oh, that... yes, you may be right. There is another script that it would be
> wrong in, but not this one...
> 
> Warner
> 

LGTM. Thanks. To me, --force is a little more advanced usage, but I agree this
is a more direct approach. Would one of you mind updating the wiki so that the
two sources match (maybe also have the wiki point to this script)? I am
currently unable to register for a wiki account.

I've added you both as reviewers:
https://reviews.freebsd.org/D16593
___
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: r337158 - head

2018-08-02 Thread Ben Widawsky
Author: bwidawsk
Date: Thu Aug  2 18:37:02 2018
New Revision: 337158
URL: https://svnweb.freebsd.org/changeset/base/337158

Log:
  Remove spuriously added svn properties

Modified:
  head/.gitattributes

Modified: head/.gitattributes
==
--- head/.gitattributes Thu Aug  2 18:28:02 2018(r337157)
+++ head/.gitattributes Thu Aug  2 18:37:02 2018(r337158)
@@ -3,4 +3,3 @@
 *.cpp  diff=cpp
 *.hpp  diff=cpp
 *.py   diff=python
-. svn-properties=svn:executable=tools/tools/git/git-svn-init
___
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: r337157 - in head: . tools/tools/git

2018-08-02 Thread Ben Widawsky
Author: bwidawsk
Date: Thu Aug  2 18:28:02 2018
New Revision: 337157
URL: https://svnweb.freebsd.org/changeset/base/337157

Log:
  tools: Add a git-svn bootstrap script
  
  codified version of https://wiki.freebsd.org/GitWorkflow/GitSvn#Using_git-svn
  
  Approved by:  emaste (mentor)
  Suggested by: Warner Losh (imp)
  Differential Revision:  https://reviews.freebsd.org/D16528

Added:
  head/tools/tools/git/git-svn-init   (contents, props changed)
Modified:
  head/.gitattributes
  head/tools/tools/git/HOWTO

Modified: head/.gitattributes
==
--- head/.gitattributes Thu Aug  2 18:24:03 2018(r337156)
+++ head/.gitattributes Thu Aug  2 18:28:02 2018(r337157)
@@ -3,3 +3,4 @@
 *.cpp  diff=cpp
 *.hpp  diff=cpp
 *.py   diff=python
+. svn-properties=svn:executable=tools/tools/git/git-svn-init

Modified: head/tools/tools/git/HOWTO
==
--- head/tools/tools/git/HOWTO  Thu Aug  2 18:24:03 2018(r337156)
+++ head/tools/tools/git/HOWTO  Thu Aug  2 18:28:02 2018(r337157)
@@ -157,3 +157,10 @@ and it will do its thing and leave the tree on the mas
 
 Your tree must be clean to start this, and while it tries to catch
 some failures, not all of them have been allowed for.
+
+IV. git-svn-init
+git-svn-init is a script that initializes the right git-svn connection as
+outlined in https://wiki.freebsd.org/GitWorkflow/GitSvn. It would be a 
precursor
+to the script git-svn-rebase. The script contains help, but generally you can
+run the script with no arguments and it will attempt to set up both src and
+ports repositories.

Added: head/tools/tools/git/git-svn-init
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/git/git-svn-init   Thu Aug  2 18:28:02 2018
(r337157)
@@ -0,0 +1,195 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+#  Copyright(c) 2018 Intel Corporation.
+#
+#  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.
+
+# This is the codified version of what was/is on the wiki page for using git in
+# your workflow. It sets up proper repositories, with the correct remotes.
+
+# Environment variables which can be overridden if desired. Not worth
+# parameterizing them.
+GIT_IN_PATH=$(which git)
+GIT=${GIT-${GIT_IN_PATH}}
+
+GIT_PORTS_REPO=${GIT_PORTS_REPO-git://github.com/freebsd/freebsd-ports.git}
+GIT_SVN_PORTS_ROOT_URI=${GIT_SVN_PORTS_ROOT_URI-svn.freebsd.org/ports}
+GIT_SVN_PORTS_URI=${GIT_SVN_PORTS_URI-repo.freebsd.org/ports}
+
+GIT_SRC_REPO=${GIT_SRC_REPO-git://github.com/freebsd/freebsd.git}
+GIT_SVN_SRC_ROOT_URI=${GIT_SVN_SRC_ROOT_URI-svn.freebsd.org/base}
+GIT_SVN_SRC_URI=${GIT_SVN_SRC_URI-repo.freebsd.org/base}
+
+GIT_SVN_PORTS_PUSH_URI=$GIT_SVN_PORTS_URI
+GIT_SVN_SRC_PUSH_URI=$GIT_SVN_SRC_URI
+
+usage()
+{
+   cat 

Re: svn commit: r336431 - head/stand/efi/libefi

2018-07-18 Thread Ben Widawsky
On 18-07-17 21:45:14, Warner Losh wrote:
> Author: imp
> Date: Tue Jul 17 21:45:14 2018
> New Revision: 336431
> URL: https://svnweb.freebsd.org/changeset/base/336431
> 
> Log:
>   Remove bogus attempt to simulate scrolling. It's not needed and messes
>   up serial output. Setting the cursor position after every character is
>   inefficient, and causes all lines to be over-printed in the serial
>   console for the boot loader. Allow the terminal to do the emulation.
>   
>   This isn't completely perfect when the size of the terminal attached
>   to the serial port isn't the same as 80x25 to match the viedoe console
>   (or whatever the video console is). While imperfect still, these
>   changes make it much better.
>   
>   This makes the serial port useful with UEFI.

Unfortunately, I still can't use EFI and serial console together reliably, but
when I have used both, this issue was incredibly annoying. Thanks for fixing.

>   
>   Differential Revision: https://reviews.freebsd.org/D16309
> 
> Modified:
>   head/stand/efi/libefi/efi_console.c
> 
> Modified: head/stand/efi/libefi/efi_console.c
> ==
> --- head/stand/efi/libefi/efi_console.c   Tue Jul 17 21:18:49 2018
> (r336430)
> +++ head/stand/efi/libefi/efi_console.c   Tue Jul 17 21:45:14 2018
> (r336431)
> @@ -147,20 +147,20 @@ efi_cons_rawputchar(int c)
>   switch (c) {
>   case '\r':
>   curx = 0;
> - curs_move(, , curx, cury);
> + efi_cons_efiputchar('\r');
>   return;
>   case '\n':
> + efi_cons_efiputchar('\n');
> + efi_cons_efiputchar('\r');
>   cury++;
> - if (cury >= y) {
> - efi_cons_efiputchar('\n');
> + if (cury >= y)
>   cury--;
> - } else
> - curs_move(, , curx, cury);
> + curx = 0;
>   return;
>   case '\b':
>   if (curx > 0) {
> + efi_cons_efiputchar('\b');
>   curx--;
> - curs_move(, , curx, cury);
>   }
>   return;
>   default:
> @@ -175,7 +175,6 @@ efi_cons_rawputchar(int c)
>   cury--;
>   }
>   }
> - curs_move(, , curx, cury);
>  #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"


Re: svn commit: r336187 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan

2018-07-10 Thread Ben Widawsky
I accidentally snipped the Submitted By: before committing. This was actually
authored by Scott...
Scott Phillips 

On 18-07-11 02:32:06, Ben Widawsky wrote:
> Author: bwidawsk
> Date: Wed Jul 11 02:32:06 2018
> New Revision: 336187
> URL: https://svnweb.freebsd.org/changeset/base/336187
> 
> Log:
>   run(4): Add a new USB device ID.
>   
>   Summary:
>   Add the device id of the Panda Wireless PAU06 which seems to be
>   the already-supported combination of RT5392 MAC and RF RT5372
>   radio.
>   
>   Reviewed By: allanjude, eadler, jhb
>   Approved By: jhb
>   Differential Revision: https://reviews.freebsd.org/D16211
> 
> Modified:
>   head/share/man/man4/run.4
>   head/sys/dev/usb/usbdevs
>   head/sys/dev/usb/wlan/if_run.c
> 
> Modified: head/share/man/man4/run.4
> ==
> --- head/share/man/man4/run.4 Wed Jul 11 02:09:11 2018(r336186)
> +++ head/share/man/man4/run.4 Wed Jul 11 02:32:06 2018(r336187)
> @@ -16,7 +16,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd April 19, 2015
> +.Dd July 10, 2018
>  .Dt RUN 4
>  .Os
>  .Sh NAME
> @@ -164,6 +164,7 @@ driver supports the following wireless adapters:
>  .It Linksys WUSB600N
>  .It Logitec LAN-W150N/U2
>  .It Mvix Nubbin MS-811N
> +.It Panda Wireless PAU06
>  .It Planex GW-USMicroN
>  .It Planex GW-US300MiniS
>  .It Sitecom WL-182
> 
> Modified: head/sys/dev/usb/usbdevs
> ==
> --- head/sys/dev/usb/usbdevs  Wed Jul 11 02:09:11 2018(r336186)
> +++ head/sys/dev/usb/usbdevs  Wed Jul 11 02:32:06 2018(r336187)
> @@ -3900,6 +3900,7 @@ product RALINK RT3370   0x3370  RT3370
>  product RALINK RT35720x3572  RT3572
>  product RALINK RT35730x3573  RT3573
>  product RALINK RT53700x5370  RT5370
> +product RALINK RT53720x5372  RT5372
>  product RALINK RT55720x5572  RT5572
>  product RALINK RT80700x8070  RT8070
>  product RALINK RT2570_3  0x9020  RT2500USB Wireless Adapter
> 
> Modified: head/sys/dev/usb/wlan/if_run.c
> ==
> --- head/sys/dev/usb/wlan/if_run.cWed Jul 11 02:09:11 2018
> (r336186)
> +++ head/sys/dev/usb/wlan/if_run.cWed Jul 11 02:32:06 2018
> (r336187)
> @@ -301,6 +301,7 @@ static const STRUCT_USB_HOST_ID run_devs[] = {
>  RUN_DEV(RALINK,  RT3572),
>  RUN_DEV(RALINK,  RT3573),
>  RUN_DEV(RALINK,  RT5370),
> +RUN_DEV(RALINK,  RT5372),
>  RUN_DEV(RALINK,  RT5572),
>  RUN_DEV(RALINK,  RT8070),
>  RUN_DEV(SAMSUNG, WIS09ABGN),
> 
___
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: r336187 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan

2018-07-10 Thread Ben Widawsky
Author: bwidawsk
Date: Wed Jul 11 02:32:06 2018
New Revision: 336187
URL: https://svnweb.freebsd.org/changeset/base/336187

Log:
  run(4): Add a new USB device ID.
  
  Summary:
  Add the device id of the Panda Wireless PAU06 which seems to be
  the already-supported combination of RT5392 MAC and RF RT5372
  radio.
  
  Reviewed By: allanjude, eadler, jhb
  Approved By: jhb
  Differential Revision: https://reviews.freebsd.org/D16211

Modified:
  head/share/man/man4/run.4
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb/wlan/if_run.c

Modified: head/share/man/man4/run.4
==
--- head/share/man/man4/run.4   Wed Jul 11 02:09:11 2018(r336186)
+++ head/share/man/man4/run.4   Wed Jul 11 02:32:06 2018(r336187)
@@ -16,7 +16,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 19, 2015
+.Dd July 10, 2018
 .Dt RUN 4
 .Os
 .Sh NAME
@@ -164,6 +164,7 @@ driver supports the following wireless adapters:
 .It Linksys WUSB600N
 .It Logitec LAN-W150N/U2
 .It Mvix Nubbin MS-811N
+.It Panda Wireless PAU06
 .It Planex GW-USMicroN
 .It Planex GW-US300MiniS
 .It Sitecom WL-182

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsWed Jul 11 02:09:11 2018(r336186)
+++ head/sys/dev/usb/usbdevsWed Jul 11 02:32:06 2018(r336187)
@@ -3900,6 +3900,7 @@ product RALINK RT3370 0x3370  RT3370
 product RALINK RT3572  0x3572  RT3572
 product RALINK RT3573  0x3573  RT3573
 product RALINK RT5370  0x5370  RT5370
+product RALINK RT5372  0x5372  RT5372
 product RALINK RT5572  0x5572  RT5572
 product RALINK RT8070  0x8070  RT8070
 product RALINK RT2570_30x9020  RT2500USB Wireless Adapter

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Wed Jul 11 02:09:11 2018
(r336186)
+++ head/sys/dev/usb/wlan/if_run.c  Wed Jul 11 02:32:06 2018
(r336187)
@@ -301,6 +301,7 @@ static const STRUCT_USB_HOST_ID run_devs[] = {
 RUN_DEV(RALINK,RT3572),
 RUN_DEV(RALINK,RT3573),
 RUN_DEV(RALINK,RT5370),
+RUN_DEV(RALINK,RT5372),
 RUN_DEV(RALINK,RT5572),
 RUN_DEV(RALINK,RT8070),
 RUN_DEV(SAMSUNG,   WIS09ABGN),
___
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"


Re: svn commit: r336185 - head/usr.sbin/acpi/acpidump

2018-07-10 Thread Ben Widawsky
Here is sample output from the tool:
LPIT: Length=148, Revision=1, Checksum=32,
  OEMID=INTEL, OEM Table ID=SKL, OEM Revision=0x0,
  Creator ID=MSFT, Creator Revision=0x5f

  Type=ACPI_LPIT_TYPE_NATIVE_CSTATE
  Length=56
  UniqueId=0x
  Flags=
  EntryTrigger=0x0060 (?) Residency=3
  Latency=3000
  ResidencyCounter=0x0632 (?) CounterFrequency=TSC

  Type=ACPI_LPIT_TYPE_NATIVE_CSTATE
  Length=56
  UniqueId=0x0001
  Flags=
  EntryTrigger=0x0060 (?) Residency=3
  Latency=3000
  ResidencyCounter=0x0632 (?) CounterFrequency=TSC


On 18-07-11 01:37:01, Ben Widawsky wrote:
> Author: bwidawsk
> Date: Wed Jul 11 01:37:01 2018
> New Revision: 336185
> URL: https://svnweb.freebsd.org/changeset/base/336185
> 
> Log:
>   acpidump(8): Add ACPI LPIT (Low Power Idle Table)
>   
>   The LPIT is the part of the "standardized" way that one can enumerate
>   various power state information on Intel platforms.
>   
>   The documentation for this change can be found here:
>   
> http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf
>   
>   Reviewed By: jhb
>   Approved By: jhb
>   Differential Revision: https://reviews.freebsd.org/D15931
> 
> Modified:
>   head/usr.sbin/acpi/acpidump/acpi.c
>   head/usr.sbin/acpi/acpidump/acpidump.8
> 
> Modified: head/usr.sbin/acpi/acpidump/acpi.c
> ==
> --- head/usr.sbin/acpi/acpidump/acpi.cTue Jul 10 23:30:19 2018
> (r336184)
> +++ head/usr.sbin/acpi/acpidump/acpi.cWed Jul 11 01:37:01 2018
> (r336185)
> @@ -68,6 +68,7 @@ static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp);
>  static void  acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp);
>  static void  acpi_handle_slit(ACPI_TABLE_HEADER *sdp);
>  static void  acpi_handle_wddt(ACPI_TABLE_HEADER *sdp);
> +static void  acpi_handle_lpit(ACPI_TABLE_HEADER *sdp);
>  static void  acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain,
>   uint32_t flags);
>  static void  acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp);
> @@ -716,6 +717,79 @@ acpi_handle_wddt(ACPI_TABLE_HEADER *sdp)
>  }
>  
>  static void
> +acpi_print_native_lpit(ACPI_LPIT_NATIVE *nl)
> +{
> + printf("\tEntryTrigger=");
> + acpi_print_gas(>EntryTrigger);
> + printf("\tResidency=%u\n", nl->Residency);
> + printf("\tLatency=%u\n", nl->Latency);
> + if (nl->Header.Flags & ACPI_LPIT_NO_COUNTER)
> + printf("\tResidencyCounter=Not Present");
> + else {
> + printf("\tResidencyCounter=");
> + acpi_print_gas(>ResidencyCounter);
> + }
> + if (nl->CounterFrequency)
> + printf("\tCounterFrequency=%ju\n", nl->CounterFrequency);
> + else
> + printf("\tCounterFrequency=TSC\n");
> +}
> +
> +static void
> +acpi_print_lpit(ACPI_LPIT_HEADER *lpit)
> +{
> + if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE)
> + printf("\tType=ACPI_LPIT_TYPE_NATIVE_CSTATE\n");
> + else
> + warnx("unknown LPIT type %u", lpit->Type);
> +
> + printf("\tLength=%u\n", lpit->Length);
> + printf("\tUniqueId=0x%04x\n", lpit->UniqueId);
> +#define  PRINTFLAG(var, flag)printflag((var), ACPI_LPIT_## flag, 
> #flag)
> + printf("\tFlags=");
> + PRINTFLAG(lpit->Flags, STATE_DISABLED);
> + PRINTFLAG_END();
> +#undef PRINTFLAG
> +
> + if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE)
> + return acpi_print_native_lpit((ACPI_LPIT_NATIVE *)lpit);
> +}
> +
> +static void
> +acpi_walk_lpit(ACPI_TABLE_HEADER *table, void *first,
> +void (*action)(ACPI_LPIT_HEADER *))
> +{
> + ACPI_LPIT_HEADER *subtable;
> + char *end;
> +
> + subtable = first;
> + end = (char *)table + table->Length;
> + while ((char *)subtable < end) {
> + printf("\n");
> + if (subtable->Length < sizeof(ACPI_LPIT_HEADER)) {
> + warnx("invalid subtable length %u", subtable->Length);
> + return;
> + }
> + action(subtable);
> + subtable = (ACPI_LPIT_HEADER *)((char *)subtable +
> + subtable->Length);
> + }
> +}
> +
> +static void
> +acpi_handle_lpit(ACPI_TABLE_HEADER *sdp)
> +{
> + ACPI_TABLE_LPIT *lpit;
> +
> + printf(BEGIN_COMMENT);
> + 

svn commit: r336185 - head/usr.sbin/acpi/acpidump

2018-07-10 Thread Ben Widawsky
Author: bwidawsk
Date: Wed Jul 11 01:37:01 2018
New Revision: 336185
URL: https://svnweb.freebsd.org/changeset/base/336185

Log:
  acpidump(8): Add ACPI LPIT (Low Power Idle Table)
  
  The LPIT is the part of the "standardized" way that one can enumerate
  various power state information on Intel platforms.
  
  The documentation for this change can be found here:
  
http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf
  
  Reviewed By: jhb
  Approved By: jhb
  Differential Revision: https://reviews.freebsd.org/D15931

Modified:
  head/usr.sbin/acpi/acpidump/acpi.c
  head/usr.sbin/acpi/acpidump/acpidump.8

Modified: head/usr.sbin/acpi/acpidump/acpi.c
==
--- head/usr.sbin/acpi/acpidump/acpi.c  Tue Jul 10 23:30:19 2018
(r336184)
+++ head/usr.sbin/acpi/acpidump/acpi.c  Wed Jul 11 01:37:01 2018
(r336185)
@@ -68,6 +68,7 @@ static void   acpi_handle_hpet(ACPI_TABLE_HEADER *sdp);
 static voidacpi_handle_mcfg(ACPI_TABLE_HEADER *sdp);
 static voidacpi_handle_slit(ACPI_TABLE_HEADER *sdp);
 static voidacpi_handle_wddt(ACPI_TABLE_HEADER *sdp);
+static voidacpi_handle_lpit(ACPI_TABLE_HEADER *sdp);
 static voidacpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain,
uint32_t flags);
 static voidacpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp);
@@ -716,6 +717,79 @@ acpi_handle_wddt(ACPI_TABLE_HEADER *sdp)
 }
 
 static void
+acpi_print_native_lpit(ACPI_LPIT_NATIVE *nl)
+{
+   printf("\tEntryTrigger=");
+   acpi_print_gas(>EntryTrigger);
+   printf("\tResidency=%u\n", nl->Residency);
+   printf("\tLatency=%u\n", nl->Latency);
+   if (nl->Header.Flags & ACPI_LPIT_NO_COUNTER)
+   printf("\tResidencyCounter=Not Present");
+   else {
+   printf("\tResidencyCounter=");
+   acpi_print_gas(>ResidencyCounter);
+   }
+   if (nl->CounterFrequency)
+   printf("\tCounterFrequency=%ju\n", nl->CounterFrequency);
+   else
+   printf("\tCounterFrequency=TSC\n");
+}
+
+static void
+acpi_print_lpit(ACPI_LPIT_HEADER *lpit)
+{
+   if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE)
+   printf("\tType=ACPI_LPIT_TYPE_NATIVE_CSTATE\n");
+   else
+   warnx("unknown LPIT type %u", lpit->Type);
+
+   printf("\tLength=%u\n", lpit->Length);
+   printf("\tUniqueId=0x%04x\n", lpit->UniqueId);
+#definePRINTFLAG(var, flag)printflag((var), ACPI_LPIT_## flag, 
#flag)
+   printf("\tFlags=");
+   PRINTFLAG(lpit->Flags, STATE_DISABLED);
+   PRINTFLAG_END();
+#undef PRINTFLAG
+
+   if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE)
+   return acpi_print_native_lpit((ACPI_LPIT_NATIVE *)lpit);
+}
+
+static void
+acpi_walk_lpit(ACPI_TABLE_HEADER *table, void *first,
+void (*action)(ACPI_LPIT_HEADER *))
+{
+   ACPI_LPIT_HEADER *subtable;
+   char *end;
+
+   subtable = first;
+   end = (char *)table + table->Length;
+   while ((char *)subtable < end) {
+   printf("\n");
+   if (subtable->Length < sizeof(ACPI_LPIT_HEADER)) {
+   warnx("invalid subtable length %u", subtable->Length);
+   return;
+   }
+   action(subtable);
+   subtable = (ACPI_LPIT_HEADER *)((char *)subtable +
+   subtable->Length);
+   }
+}
+
+static void
+acpi_handle_lpit(ACPI_TABLE_HEADER *sdp)
+{
+   ACPI_TABLE_LPIT *lpit;
+
+   printf(BEGIN_COMMENT);
+   acpi_print_sdt(sdp);
+   lpit = (ACPI_TABLE_LPIT *)sdp;
+   acpi_walk_lpit(sdp, (lpit + 1), acpi_print_lpit);
+
+   printf(END_COMMENT);
+}
+
+static void
 acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain,
 uint32_t flags)
 {
@@ -1693,6 +1767,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp)
acpi_handle_nfit(sdp);
else if (!memcmp(sdp->Signature, ACPI_SIG_WDDT, 4))
acpi_handle_wddt(sdp);
+   else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4))
+   acpi_handle_lpit(sdp);
else {
printf(BEGIN_COMMENT);
acpi_print_sdt(sdp);

Modified: head/usr.sbin/acpi/acpidump/acpidump.8
==
--- head/usr.sbin/acpi/acpidump/acpidump.8  Tue Jul 10 23:30:19 2018
(r336184)
+++ head/usr.sbin/acpi/acpidump/acpidump.8  Wed Jul 11 01:37:01 2018
(r336185)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 20, 2018
+.Dd July 10, 2018
 .Dt ACPIDUMP 8
 .Os
 .Sh NAME
@@ -103,6 +103,7 @@ utility dumps contents of the following tables:
 .It FACS
 .It FADT
 .It HPET
+.It LPIT
 .It MADT
 .It MCFG
 .It NFIT
___
svn-src-head@freebsd.org mailing list

svn commit: r336034 - in head: share/misc usr.bin/calendar/calendars

2018-07-06 Thread Ben Widawsky
Author: bwidawsk
Date: Fri Jul  6 16:22:26 2018
New Revision: 336034
URL: https://svnweb.freebsd.org/changeset/base/336034

Log:
  Adding myself to committers-src.dot and calendar.freebsd
  
  Approved by: emaste (mentor)
  Differential Revision: https://reviews.freebsd.org/D16154

Modified:
  head/share/misc/committers-src.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Jul  6 13:34:45 2018
(r336033)
+++ head/share/misc/committers-src.dot  Fri Jul  6 16:22:26 2018
(r336034)
@@ -135,6 +135,7 @@ brueffer [label="Christian Brueffer\nbrueffer@FreeBSD.
 bruno [label="Bruno Ducrot\nbr...@freebsd.org\n2005/07/18"]
 bryanv [label="Bryan Venteicher\nbry...@freebsd.org\n2012/11/03"]
 bschmidt [label="Bernhard Schmidt\nbschm...@freebsd.org\n2010/02/06"]
+bwidawsk [label="Ben Widawsky\nbwida...@freebsd.org\n2018/07/05"]
 bz [label="Bjoern A. Zeeb\n...@freebsd.org\n2004/07/27"]
 cem [label="Conrad Meyer\n...@freebsd.org\n2015/07/05"]
 chuck [label="Chuck Tuffli\nch...@freebsd.org\n2017/09/06"]
@@ -495,6 +496,7 @@ eivind -> des
 eivind -> rwatson
 
 emaste -> achim
+emaste -> bwidawsk
 emaste -> dteske
 emaste -> kevans
 emaste -> markj

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdFri Jul  6 13:34:45 
2018(r336033)
+++ head/usr.bin/calendar/calendars/calendar.freebsdFri Jul  6 16:22:26 
2018(r336034)
@@ -185,6 +185,7 @@
 05/11  Roman Kurakin  born in Moscow, USSR, 1979
 05/11  Ulrich Spoerlein  born in Schesslitz, Bayern, 
Germany, 1981
 05/13  Pete Fritchman  born in Lansdale, Pennsylvania, 
United States, 1983
+05/13  Ben Widawsky  born in New York City, New York, 
United States, 1982
 05/14  Tatsumi Hosokawa  born in Tokyo, Japan, 1968
 05/14  Shigeyuku Fukushima  born in Osaka, Japan, 1974
 05/14  Rebecca Cran  born in Cambridge, United Kingdom, 1981
___
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"


Re: svn commit: r334431 - head/share/man/man3

2018-05-31 Thread Ben Widawsky
On 18-05-31 07:42:08, Rodney W. Grimes wrote:
> > Author: imp
> > Date: Thu May 31 14:23:33 2018
> > New Revision: 334431
> > URL: https://svnweb.freebsd.org/changeset/base/334431
> > 
> > Log:
> >   Depart from normal man page proactice a little and provide guidance on
  ^ typo


> >   when to use assert, as well as providing a bad example of using
> >   assert.  While not strictly necessary, experience has shown issues
> >   with poor assert choice happen often enough that this departure seems
> >   warranted. Also, tighten up the previous example (there's no need
> >   to have extra paragraphs or gratuitously long lines).
> 
> Thank you!
> 
> >   Reviewed by: emaste@ (earlier version)
> > 
> > Modified:
> >   head/share/man/man3/assert.3
> > 
> > Modified: head/share/man/man3/assert.3
> > ==
> > --- head/share/man/man3/assert.3Thu May 31 13:26:12 2018
> > (r334430)
> > +++ head/share/man/man3/assert.3Thu May 31 14:23:33 2018
> > (r334431)
> > @@ -28,7 +28,7 @@
> >  .\" @(#)assert.3   8.1 (Berkeley) 6/9/93
> >  .\" $FreeBSD$
> >  .\"
> > -.Dd May 28, 2018
> > +.Dd May 31, 2018
> >  .Dt ASSERT 3
> >  .Os
> >  .Sh NAME
> > @@ -44,8 +44,7 @@ macro tests the given
> >  .Ar expression
> >  and if it is false,
> >  the calling process is terminated.
> > -A
> > -diagnostic message is written to
> > +A diagnostic message is written to
> >  .Dv stderr
> >  and the function
> >  .Xr abort 3
> > @@ -76,14 +75,26 @@ Each time whether or not
> >  is defined determines the behavior of assert from that point forward
> >  until the end of the unit or another include of
> >  .In assert.h .
> > +.Pp
> > +The
> > +.Fn assert
> > +macro should only be used for ensuring the developer's expectations
> > +hold true.
> > +It is not appropriate for regular run-time error detection.
> >  .Sh EXAMPLES
> >  The assertion:
> > -.Pp
> >  .Dl "assert(1 == 0);"
> > -.Pp
> >  generates a diagnostic message similar to the following:
> > +.Dl "Assertion failed: (1 == 0), function main, file main.c, line 100."
> >  .Pp
> > -.Dl "Assertion failed: (1 == 0), function main, file assertion.c, line 
> > 100."
> > +The following assert tries to assert there was no partial read:
> > +.Dl "assert(read(fd, buf, nbytes) == nbytes);"
> > +However, there are two problems.
> > +First, it checks for normal conditions, rather than conditions that
> > +indicate a bug.
> > +Second, the code will disappear if
> > +.Dv NDEBUG
> > +is defined, changing the semantics of the program.
> >  .Sh SEE ALSO
> >  .Xr abort2 2 ,
> >  .Xr abort 3
> > 
> > 
> 
> -- 
> Rod Grimes rgri...@freebsd.org
> ___
> 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-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"