CVS commit: src/sys/dev/sdmmc

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 05:51:45 UTC 2019

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.c
Added Files:
src/sys/dev/sdmmc: if_bwfm_sdio.h

Log Message:
>From OpenBSD:
- All the missing pieces (firmware load, chip setup, protocol handling)
TX queue and interrupt handling via sdmmc_task.
Fix locking.
Fix packet parsing.
Add parser for original firmware config files.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sdmmc/if_bwfm_sdio.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/sdmmc/if_bwfm_sdio.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/sdmmc

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 05:51:45 UTC 2019

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.c
Added Files:
src/sys/dev/sdmmc: if_bwfm_sdio.h

Log Message:
>From OpenBSD:
- All the missing pieces (firmware load, chip setup, protocol handling)
TX queue and interrupt handling via sdmmc_task.
Fix locking.
Fix packet parsing.
Add parser for original firmware config files.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sdmmc/if_bwfm_sdio.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/sdmmc/if_bwfm_sdio.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sdmmc/if_bwfm_sdio.c
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.3 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.4
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.3	Fri May 11 07:41:11 2018
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Sun Sep  1 05:51:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.3 2018/05/11 07:41:11 maya Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.4 2019/09/01 05:51:45 mlelstv Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -20,14 +20,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -37,20 +36,16 @@
 
 #include 
 
+#include 
+
 #include 
 
+#include 
 #include 
 
 #include 
 #include 
-
-#define BWFM_SDIO_CCCR_BRCM_CARDCAP			0xf0
-#define  BWFM_SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT	0x02
-#define  BWFM_SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT		0x04
-#define  BWFM_SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC		0x08
-#define BWFM_SDIO_CCCR_BRCM_CARDCTRL			0xf1
-#define  BWFM_SDIO_CCCR_BRCM_CARDCTRL_WLANRESET		0x02
-#define BWFM_SDIO_CCCR_BRCM_SEPINT			0xf2
+#include 
 
 #ifdef BWFM_DEBUG
 #define DPRINTF(x)	do { if (bwfm_debug > 0) printf x; } while (0)
@@ -63,34 +58,122 @@ static int bwfm_debug = 2;
 
 #define DEVNAME(sc)	device_xname((sc)->sc_sc.sc_dev)
 
+enum bwfm_sdio_clkstate {
+	CLK_NONE,
+	CLK_SDONLY,
+	CLK_PENDING,
+	CLK_AVAIL
+};
+
 struct bwfm_sdio_softc {
-	struct bwfm_softc	  sc_sc;
+	struct bwfm_softc	sc_sc;
+	kmutex_t		sc_lock;
+	kmutex_t		sc_intr_lock;
+
+	bool			sc_bwfm_attached;
+
 	struct sdmmc_function	**sc_sf;
-	uint32_t		  sc_bar0;
+	size_t			sc_sf_size;
+
+	uint32_t		sc_bar0;
+	enum bwfm_sdio_clkstate	sc_clkstate;
+	bool			sc_sr_enabled;
+	bool			sc_alp_only;
+	bool			sc_sleeping;
+
+	struct sdmmc_task	sc_task;
+	bool			sc_task_queued;
+
+	uint8_t			sc_tx_seq;
+	uint8_t			sc_tx_max_seq;
+	int			sc_tx_count;
+	MBUFQ_HEAD()		sc_tx_queue;
+
+	struct mbuf		*sc_rxctl_queue;
+	kcondvar_t		sc_rxctl_cv;
+
+	void			*sc_ih;
+	struct bwfm_core	*sc_cc;
+
+	char			*sc_bounce_buf;
+	size_t			sc_bounce_size;
+
+	uint32_t		sc_console_addr;
+	char			*sc_console_buf;
+	size_t			sc_console_buf_size;
+	uint32_t		sc_console_readidx;
 };
 
-int		 bwfm_sdio_match(device_t, cfdata_t, void *);
-void		 bwfm_sdio_attach(device_t, struct device *, void *);
-int		 bwfm_sdio_detach(device_t, int);
-
-void		 bwfm_sdio_backplane(struct bwfm_sdio_softc *, uint32_t);
-uint8_t		 bwfm_sdio_read_1(struct bwfm_sdio_softc *, uint32_t);
-uint32_t	 bwfm_sdio_read_4(struct bwfm_sdio_softc *, uint32_t);
-void		 bwfm_sdio_write_1(struct bwfm_sdio_softc *, uint32_t,
+int		bwfm_sdio_match(device_t, cfdata_t, void *);
+void		bwfm_sdio_attach(device_t, struct device *, void *);
+int		bwfm_sdio_detach(device_t, int);
+void		bwfm_sdio_attachhook(device_t);
+
+void		bwfm_sdio_backplane(struct bwfm_sdio_softc *, uint32_t);
+uint8_t		bwfm_sdio_read_1(struct bwfm_sdio_softc *, uint32_t);
+uint32_t	bwfm_sdio_read_4(struct bwfm_sdio_softc *, uint32_t);
+void		bwfm_sdio_write_1(struct bwfm_sdio_softc *, uint32_t,
 		 uint8_t);
-void		 bwfm_sdio_write_4(struct bwfm_sdio_softc *, uint32_t,
+void		bwfm_sdio_write_4(struct bwfm_sdio_softc *, uint32_t,
+		 uint32_t);
+
+uint32_t	bwfm_sdio_dev_read(struct bwfm_sdio_softc *, uint32_t);
+void		bwfm_sdio_dev_write(struct bwfm_sdio_softc *, uint32_t,
 		 uint32_t);
 
-uint32_t	 bwfm_sdio_buscore_read(struct bwfm_softc *, uint32_t);
-void		 bwfm_sdio_buscore_write(struct bwfm_softc *, uint32_t,
+uint32_t	bwfm_sdio_buscore_read(struct bwfm_softc *, uint32_t);
+void		bwfm_sdio_buscore_write(struct bwfm_softc *, uint32_t,
 		 uint32_t);
-int		 bwfm_sdio_buscore_prepare(struct bwfm_softc *);
-void		 bwfm_sdio_buscore_activate(struct bwfm_softc *, uint32_t);
+int		bwfm_sdio_buscore_prepare(struct bwfm_softc *);
+void		bwfm_sdio_buscore_activate(struct bwfm_softc *, uint32_t);
 
-int		 bwfm_sdio_txcheck(struct bwfm_softc *);
-int		 bwfm_sdio_txdata(struct bwfm_softc *, struct mbuf *);
-int		 bwfm_sdio_txctl(struct bwfm_softc *, char *, size_t);
-int		 bwfm_sdio_rxctl(struct bwfm_softc *, char *, size_t *);
+int		bwfm_sdio_buf_read(struct bwfm_sdio_softc *,
+		struct sdmmc_function *, uint32_t, 

CVS commit: src/sys/dev/sdmmc

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 05:45:42 UTC 2019

Modified Files:
src/sys/dev/sdmmc: sdmmc.c sdmmc_cis.c sdmmc_io.c sdmmc_ioreg.h
sdmmcvar.h

Log Message:
>From OpenBSD:
- support block length per function
- add functions to read/write regions
Decode (but not use) SDIO tuple in CIS.
Fix locking.
Add more SDIO defines (partially from version 3.0).


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/sdmmc/sdmmc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sdmmc/sdmmc_cis.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/sdmmc/sdmmc_io.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sdmmc/sdmmc_ioreg.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sdmmc/sdmmcvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/sdmmc

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 05:45:42 UTC 2019

Modified Files:
src/sys/dev/sdmmc: sdmmc.c sdmmc_cis.c sdmmc_io.c sdmmc_ioreg.h
sdmmcvar.h

Log Message:
>From OpenBSD:
- support block length per function
- add functions to read/write regions
Decode (but not use) SDIO tuple in CIS.
Fix locking.
Add more SDIO defines (partially from version 3.0).


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/sdmmc/sdmmc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sdmmc/sdmmc_cis.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/sdmmc/sdmmc_io.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sdmmc/sdmmc_ioreg.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sdmmc/sdmmcvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sdmmc/sdmmc.c
diff -u src/sys/dev/sdmmc/sdmmc.c:1.36 src/sys/dev/sdmmc/sdmmc.c:1.37
--- src/sys/dev/sdmmc/sdmmc.c:1.36	Tue Nov  6 16:01:38 2018
+++ src/sys/dev/sdmmc/sdmmc.c	Sun Sep  1 05:45:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc.c,v 1.36 2018/11/06 16:01:38 jmcneill Exp $	*/
+/*	$NetBSD: sdmmc.c,v 1.37 2019/09/01 05:45:42 mlelstv Exp $	*/
 /*	$OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $	*/
 
 /*
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.36 2018/11/06 16:01:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.37 2019/09/01 05:45:42 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -656,6 +656,7 @@ sdmmc_function_alloc(struct sdmmc_softc 
 	sf->cis.product = SDMMC_PRODUCT_INVALID;
 	sf->cis.function = SDMMC_FUNCTION_INVALID;
 	sf->width = 1;
+	sf->blklen = sdmmc_chip_host_maxblklen(sc->sc_sct, sc->sc_sch);
 
 	if (ISSET(sc->sc_flags, SMF_MEM_MODE) &&
 	ISSET(sc->sc_caps, SMC_CAPS_DMA) &&

Index: src/sys/dev/sdmmc/sdmmc_cis.c
diff -u src/sys/dev/sdmmc/sdmmc_cis.c:1.5 src/sys/dev/sdmmc/sdmmc_cis.c:1.6
--- src/sys/dev/sdmmc/sdmmc_cis.c:1.5	Sun Jan 28 14:34:06 2018
+++ src/sys/dev/sdmmc/sdmmc_cis.c	Sun Sep  1 05:45:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_cis.c,v 1.5 2018/01/28 14:34:06 jmcneill Exp $	*/
+/*	$NetBSD: sdmmc_cis.c,v 1.6 2019/09/01 05:45:42 mlelstv Exp $	*/
 /*	$OpenBSD: sdmmc_cis.c,v 1.1 2006/06/01 21:53:41 uwe Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Routines to decode the Card Information Structure of SD I/O cards */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_cis.c,v 1.5 2018/01/28 14:34:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_cis.c,v 1.6 2019/09/01 05:45:42 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -130,6 +130,7 @@ decode_funce_function(struct sdmmc_funct
 	max_blk_size = sdmmc_io_read_1(sf0, reg + 11);
 	max_blk_size |= sdmmc_io_read_1(sf0, reg + 12) << 8;
 
+device_printf(dev, "MAX_BLK_SIZE%d = %d\n", sf->number, max_blk_size);
 	DPRINTF(("CISTPL_FUNCE: MAX_BLK_SIZE=0x%x\n", max_blk_size));
 }
 
@@ -259,6 +260,11 @@ sdmmc_read_cis(struct sdmmc_function *sf
 			reg += tpllen;
 			break;
 
+		case PCMCIA_CISTPL_SDIO:
+			aprint_normal_dev(dev, "SDIO function\n");
+			reg += tpllen;
+			break;
+
 		default:
 			/*
 			 * Tuple codes between 80h-8Fh are vendor unique.

Index: src/sys/dev/sdmmc/sdmmc_io.c
diff -u src/sys/dev/sdmmc/sdmmc_io.c:1.14 src/sys/dev/sdmmc/sdmmc_io.c:1.15
--- src/sys/dev/sdmmc/sdmmc_io.c:1.14	Sun Oct 14 17:37:40 2018
+++ src/sys/dev/sdmmc/sdmmc_io.c	Sun Sep  1 05:45:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_io.c,v 1.14 2018/10/14 17:37:40 jdolecek Exp $	*/
+/*	$NetBSD: sdmmc_io.c,v 1.15 2019/09/01 05:45:42 mlelstv Exp $	*/
 /*	$OpenBSD: sdmmc_io.c,v 1.10 2007/09/17 01:33:33 krw Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Routines for SD I/O cards. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.14 2018/10/14 17:37:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.15 2019/09/01 05:45:42 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -194,6 +194,8 @@ sdmmc_io_init(struct sdmmc_softc *sc, st
 
 	SDMMC_LOCK(sc);
 
+	sf->blklen = sdmmc_chip_host_maxblklen(sc->sc_sct, sc->sc_sch);
+
 	if (sf->number == 0) {
 		reg = sdmmc_io_read_1(sf, SD_IO_CCCR_CAPABILITY);
 		if (!(reg & CCCR_CAPS_LSC) || (reg & CCCR_CAPS_4BLS)) {
@@ -395,8 +397,8 @@ sdmmc_io_rw_extended(struct sdmmc_softc 
 	cmd.c_flags = SCF_CMD_AC | SCF_RSP_R5;
 	cmd.c_data = datap;
 	cmd.c_datalen = datalen;
-	cmd.c_blklen = MIN(datalen,
-	sdmmc_chip_host_maxblklen(sc->sc_sct,sc->sc_sch));
+	cmd.c_blklen = MIN(datalen, sf->blklen);
+
 	if (!ISSET(arg, SD_ARG_CMD53_WRITE))
 		cmd.c_flags |= SCF_CMD_READ;
 
@@ -476,21 +478,26 @@ int
 sdmmc_io_read_multi_1(struct sdmmc_function *sf, int reg, u_char *data,
 int datalen)
 {
-	int error;
+	int blocks, bytes, error = 0;
 
 	/* Don't lock */
 
-	while (datalen > SD_ARG_CMD53_LENGTH_MAX) {
+	while (datalen >= sf->blklen) {
+		//blocks = imin(datalen / sf->blklen,
+		//  SD_ARG_CMD53_LENGTH_MAX);
+		blocks = 1;
+		bytes = blocks * sf->blklen;
 		

CVS commit: src/sys/dev/ic

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 05:40:40 UTC 2019

Modified Files:
src/sys/dev/ic: bwfm.c bwfmreg.h bwfmvar.h

Log Message:
>From OpenBSD:
- move event handling to workqueue
- check for save/restore capability
Tag work queue as MPsafe and increase length.
Juse use bpf_mtap(), the 802.11 encapsulation is handled by firmware.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/bwfmreg.h src/sys/dev/ic/bwfmvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.14 src/sys/dev/ic/bwfm.c:1.15
--- src/sys/dev/ic/bwfm.c:1.14	Sun Sep  2 19:46:53 2018
+++ src/sys/dev/ic/bwfm.c	Sun Sep  1 05:40:39 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.14 2018/09/02 19:46:53 maya Exp $ */
+/* $NetBSD: bwfm.c,v 1.15 2019/09/01 05:40:39 mlelstv Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -114,7 +114,8 @@ void	 bwfm_scan(struct bwfm_softc *);
 void	 bwfm_connect(struct bwfm_softc *);
 
 void	 bwfm_rx(struct bwfm_softc *, struct mbuf *);
-void	 bwfm_rx_event(struct bwfm_softc *, char *, size_t);
+void	 bwfm_rx_event(struct bwfm_softc *, struct mbuf *);
+void	 bwfm_rx_event_cb(struct bwfm_softc *, struct mbuf *);
 void	 bwfm_scan_node(struct bwfm_softc *, struct bwfm_bss_info *, size_t);
 
 uint8_t bwfm_2ghz_channels[] = {
@@ -142,7 +143,7 @@ bwfm_attach(struct bwfm_softc *sc)
 	int i, j, error;
 
 	error = workqueue_create(>sc_taskq, DEVNAME(sc),
-	bwfm_task, sc, PRI_NONE, IPL_NET, 0);
+	bwfm_task, sc, PRI_NONE, IPL_NET, WQ_MPSAFE);
 	if (error != 0) {
 		printf("%s: could not create workqueue\n", DEVNAME(sc));
 		return;
@@ -304,9 +305,6 @@ bwfm_start(struct ifnet *ifp)
 	/* TODO: return if no link? */
 
 	for (;;) {
-		struct ieee80211_node *ni;
-		struct ether_header *eh;
-
 		/* Discard management packets (fw handles this for us) */
 		IF_DEQUEUE(>ic_mgtq, m);
 		if (m != NULL) {
@@ -323,36 +321,19 @@ bwfm_start(struct ifnet *ifp)
 		if (m == NULL)
 			break;
 
-		eh = mtod(m, struct ether_header *);
-		ni = ieee80211_find_txnode(ic, eh->ether_dhost);
-		if (ni == NULL) {
-			ifp->if_oerrors++;
-			m_freem(m);
-			continue;
-		}
-
-		if (ieee80211_classify(ic, m, ni) != 0) {
-			ifp->if_oerrors++;
-			m_freem(m);
-			ieee80211_free_node(ni);
-			continue;
-		}
-
 		error = sc->sc_bus_ops->bs_txdata(sc, );
 		if (error == ENOBUFS) {
 			IF_PREPEND(>if_snd, m);
 			ifp->if_flags |= IFF_OACTIVE;
 			break;
 		}
-
 		if (error != 0) {
 			ifp->if_oerrors++;
 			m_freem(m);
-			if (ni != NULL)
-ieee80211_free_node(ni);
-		} else {
-			bpf_mtap3(ic->ic_rawbpf, m, BPF_D_OUT);
+			continue;
 		}
+
+		bpf_mtap(ifp, m, BPF_D_OUT);
 	}
 }
 
@@ -770,6 +751,9 @@ bwfm_task(struct work *wk, void *arg)
 	case BWFM_TASK_KEY_DELETE:
 		bwfm_key_delete_cb(sc, >t_key);
 		break;
+	case BWFM_TASK_RX_EVENT:
+		bwfm_rx_event_cb(sc, t->t_mbuf);
+		break;
 	default:
 		panic("bwfm: unknown task command %d", t->t_cmd);
 	}
@@ -1261,6 +1245,52 @@ bwfm_chip_cm3_set_passive(struct bwfm_so
 	}
 }
 
+int
+bwfm_chip_sr_capable(struct bwfm_softc *sc)
+{
+	struct bwfm_core *core;
+	uint32_t reg;
+
+	if (sc->sc_chip.ch_pmurev < 17)
+		return 0;
+
+	switch (sc->sc_chip.ch_chip) {
+	case BRCM_CC_4345_CHIP_ID:
+	case BRCM_CC_4354_CHIP_ID:
+	case BRCM_CC_4356_CHIP_ID:
+		core = bwfm_chip_get_pmu(sc);
+		sc->sc_buscore_ops->bc_write(sc, core->co_base +
+		BWFM_CHIP_REG_CHIPCONTROL_ADDR, 3);
+		reg = sc->sc_buscore_ops->bc_read(sc, core->co_base +
+		BWFM_CHIP_REG_CHIPCONTROL_DATA);
+		return (reg & (1 << 2)) != 0;
+	case BRCM_CC_43241_CHIP_ID:
+	case BRCM_CC_4335_CHIP_ID:
+	case BRCM_CC_4339_CHIP_ID:
+		core = bwfm_chip_get_pmu(sc);
+		sc->sc_buscore_ops->bc_write(sc, core->co_base +
+		BWFM_CHIP_REG_CHIPCONTROL_ADDR, 3);
+		reg = sc->sc_buscore_ops->bc_read(sc, core->co_base +
+		BWFM_CHIP_REG_CHIPCONTROL_DATA);
+		return reg != 0;
+	case BRCM_CC_43430_CHIP_ID:
+		core = bwfm_chip_get_core(sc, BWFM_AGENT_CORE_CHIPCOMMON);
+		reg = sc->sc_buscore_ops->bc_read(sc, core->co_base +
+		BWFM_CHIP_REG_SR_CONTROL1);
+		return reg != 0;
+	default:
+		core = bwfm_chip_get_pmu(sc);
+		reg = sc->sc_buscore_ops->bc_read(sc, core->co_base +
+		BWFM_CHIP_REG_PMUCAPABILITIES_EXT);
+		if ((reg & BWFM_CHIP_REG_PMUCAPABILITIES_SR_SUPP) == 0)
+			return 0;
+		reg = sc->sc_buscore_ops->bc_read(sc, core->co_base +
+		BWFM_CHIP_REG_RETENTION_CTL);
+		return (reg & (BWFM_CHIP_REG_RETENTION_CTL_MACPHY_DIS |
+		   BWFM_CHIP_REG_RETENTION_CTL_LOGIC_DIS)) == 0;
+	}
+}
+
 /* RAM size helpers */
 void
 bwfm_chip_socram_ramsize(struct bwfm_softc *sc, struct bwfm_core *core)
@@ -1455,8 +1485,6 @@ bwfm_proto_bcdc_query_dcmd(struct bwfm_s
 	}
 
 	if (buf) {
-		if (size > *len)
-			size = *len;
 		if (size 

CVS commit: src/sys/dev/ic

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 05:40:40 UTC 2019

Modified Files:
src/sys/dev/ic: bwfm.c bwfmreg.h bwfmvar.h

Log Message:
>From OpenBSD:
- move event handling to workqueue
- check for save/restore capability
Tag work queue as MPsafe and increase length.
Juse use bpf_mtap(), the 802.11 encapsulation is handled by firmware.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/bwfmreg.h src/sys/dev/ic/bwfmvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/stdio

2019-08-31 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep  1 01:23:14 UTC 2019

Modified Files:
src/lib/libc/stdio: tmpnam.3

Log Message:
Refer to "w+" as "mode" as that's what fopen(3) calls it.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/stdio/tmpnam.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/stdio

2019-08-31 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep  1 01:23:14 UTC 2019

Modified Files:
src/lib/libc/stdio: tmpnam.3

Log Message:
Refer to "w+" as "mode" as that's what fopen(3) calls it.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/stdio/tmpnam.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdio/tmpnam.3
diff -u src/lib/libc/stdio/tmpnam.3:1.17 src/lib/libc/stdio/tmpnam.3:1.18
--- src/lib/libc/stdio/tmpnam.3:1.17	Fri Apr 30 04:55:10 2010
+++ src/lib/libc/stdio/tmpnam.3	Sun Sep  1 01:23:14 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tmpnam.3,v 1.17 2010/04/30 04:55:10 jruoho Exp $
+.\"	$NetBSD: tmpnam.3,v 1.18 2019/09/01 01:23:14 uwe Exp $
 .\"
 .\" Copyright (c) 1988, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -62,7 +62,7 @@ The created file is unlinked before
 .Fn tmpfile
 returns, causing the file to be automatically deleted when the last
 reference to it is closed.
-The file is opened with the access value
+The file is opened with the access mode
 .Ql w+ .
 .Pp
 The



CVS commit: src/sys/dev/pcmcia

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 00:36:52 UTC 2019

Modified Files:
src/sys/dev/pcmcia: pcmciareg.h

Log Message:
add PCMCIA_CISTPL_SDIO definition.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pcmcia/pcmciareg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pcmcia/pcmciareg.h
diff -u src/sys/dev/pcmcia/pcmciareg.h:1.10 src/sys/dev/pcmcia/pcmciareg.h:1.11
--- src/sys/dev/pcmcia/pcmciareg.h:1.10	Sun Dec 11 12:23:23 2005
+++ src/sys/dev/pcmcia/pcmciareg.h	Sun Sep  1 00:36:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcmciareg.h,v 1.10 2005/12/11 12:23:23 christos Exp $	*/
+/*	$NetBSD: pcmciareg.h,v 1.11 2019/09/01 00:36:52 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -202,6 +202,7 @@
 
 /* #define	PCMCIA_CISTPL_RESERVED		0x80-0x8F */
 #define	PCMCIA_CISTPL_SPCL			0x90
+#define	PCMCIA_CISTPL_SDIO			0x91
 /* #define	PCMCIA_CISTPL_RESERVED		0x90-0xFE */
 
 /*



CVS commit: src/sys/dev/pcmcia

2019-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  1 00:36:52 UTC 2019

Modified Files:
src/sys/dev/pcmcia: pcmciareg.h

Log Message:
add PCMCIA_CISTPL_SDIO definition.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pcmcia/pcmciareg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man1

2019-08-31 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Aug 31 21:35:50 UTC 2019

Modified Files:
src/share/man/man1: cd.1

Log Message:
Move the text that explains that cd(1) is a shell built-in to the very
beginning of the description where it can be seen prominently.
Improve formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man1/cd.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man1

2019-08-31 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Aug 31 21:35:50 UTC 2019

Modified Files:
src/share/man/man1: cd.1

Log Message:
Move the text that explains that cd(1) is a shell built-in to the very
beginning of the description where it can be seen prominently.
Improve formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man1/cd.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man1/cd.1
diff -u src/share/man/man1/cd.1:1.9 src/share/man/man1/cd.1:1.10
--- src/share/man/man1/cd.1:1.9	Sat Aug 31 17:34:46 2019
+++ src/share/man/man1/cd.1	Sat Aug 31 21:35:50 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: cd.1,v 1.9 2019/08/31 17:34:46 sevan Exp $
+.\"	$NetBSD: cd.1,v 1.10 2019/08/31 21:35:50 uwe Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -40,24 +40,42 @@
 .Nd change working directory
 .Sh SYNOPSIS
 .Nm cd
-.Ar directory
+.Op Ar directory
 .Sh DESCRIPTION
-.Ar Directory
-is an absolute or relative pathname which becomes the new working
-directory.
-The interpretation of a relative pathname by cd depends on the
+Since
+.Nm
+affects the current shell execution environment, it is always provided
+as a shell regular built-in.
+For more information consult the manual page for the shell in use.
+.Pp
+The
+.Ar directory
+operand is an absolute or relative pathname which becomes the new
+working directory.
+The interpretation of a relative pathname by
+.Nm
+depends on the
 .Ev CDPATH
 environment variable (see below).
 .Sh ENVIRONMENT
-The following environment variables affect the execution of cd:
-.Bl -tag -width indent
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width Ev
 .It Ev CDPATH
+A colon-separated list of pathnames that refer to directories.
 If the
 .Ar directory
-operand does not begin with a slash (/) character, and the first
-component is not dot (.) or dot-dot (..),
-.Nm cd
-searches for the directory relative to each directory named in the
+operand does not begin with a slash
+.Pq Ql \&/
+character, and the first
+component is not dot
+.Pq Ql \&.
+or dot-dot
+.Pq Ql \&.. ,
+.Nm
+searches for the
+.Ar directory
+relative to each directory named in the
 .Ev CDPATH
 variable, in the order listed.
 The new working directory is set to the first matching directory found.
@@ -75,13 +93,11 @@ environment variable exists and contains
 becomes the new working directory.
 .It Ev OLDPWD
 Set to the previous working directory after a directory change.
-Unsupported by
+Not supported by
 .Xr csh 1 .
 .It Ev PWD
 Set to the current working directory.
 .El
-.Pp
-For more information on environment variables consult manual for shell in use.
 .Sh EXIT STATUS
 .Ex -std cd
 .Sh SEE ALSO



CVS commit: src/external/gpl3/gdb/dist/gdb

2019-08-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 31 20:16:25 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb: arm-nbsd-nat.c

Log Message:
Restore the kvm support


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/gdb/dist/gdb

2019-08-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 31 20:16:25 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb: arm-nbsd-nat.c

Log Message:
Restore the kvm support


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.11 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.12
--- src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.11	Thu May 30 16:02:23 2019
+++ src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c	Sat Aug 31 20:16:25 2019
@@ -536,6 +536,9 @@ _initialize_arm_netbsd_nat (void)
 {
   add_inf_child_target (_arm_nbsd_nat_target);
 
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (armnbsd_supply_pcb);
+
   deprecated_add_core_fns (_netbsd_core_fns);
   deprecated_add_core_fns (_netbsd_elfcore_fns);
 }



CVS commit: src/sbin/route

2019-08-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Aug 31 18:20:08 UTC 2019

Modified Files:
src/sbin/route: route.c

Log Message:
route(8): show addrs for RTM_MISS


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sbin/route/route.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/route/route.c
diff -u src/sbin/route/route.c:1.161 src/sbin/route/route.c:1.162
--- src/sbin/route/route.c:1.161	Thu Aug 22 16:10:48 2019
+++ src/sbin/route/route.c	Sat Aug 31 18:20:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.161 2019/08/22 16:10:48 roy Exp $	*/
+/*	$NetBSD: route.c,v 1.162 2019/08/31 18:20:08 roy Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)route.c	8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: route.c,v 1.161 2019/08/22 16:10:48 roy Exp $");
+__RCSID("$NetBSD: route.c,v 1.162 2019/08/31 18:20:08 roy Exp $");
 #endif
 #endif /* not lint */
 
@@ -1463,6 +1463,7 @@ print_rtmsg(struct rt_msghdr *rtm, int m
 	case RTM_CHANGE:
 	case RTM_DELETE:
 	case RTM_GET:
+	case RTM_MISS:
 		(void)printf("pid %d, seq %d, errno %d, flags: ",
 			rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
 		bprintf(stdout, rtm->rtm_flags, routeflags);



CVS commit: src/sbin/route

2019-08-31 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Aug 31 18:20:08 UTC 2019

Modified Files:
src/sbin/route: route.c

Log Message:
route(8): show addrs for RTM_MISS


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sbin/route/route.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man1

2019-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Aug 31 17:34:46 UTC 2019

Modified Files:
src/share/man/man1: cd.1

Log Message:
Direct reader to shell documentation generally, rather than csh(1) specifically.
Mention variables OLDPWD and PWD.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man1/cd.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/man/man1

2019-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Aug 31 17:34:46 UTC 2019

Modified Files:
src/share/man/man1: cd.1

Log Message:
Direct reader to shell documentation generally, rather than csh(1) specifically.
Mention variables OLDPWD and PWD.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man1/cd.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man1/cd.1
diff -u src/share/man/man1/cd.1:1.8 src/share/man/man1/cd.1:1.9
--- src/share/man/man1/cd.1:1.8	Tue Jul  4 06:33:13 2017
+++ src/share/man/man1/cd.1	Sat Aug 31 17:34:46 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: cd.1,v 1.8 2017/07/04 06:33:13 wiz Exp $
+.\"	$NetBSD: cd.1,v 1.9 2019/08/31 17:34:46 sevan Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)cd.1	8.1 (Berkeley) 6/5/93
 .\"
-.Dd June 5, 1993
+.Dd August 31, 2019
 .Dt CD 1
 .Os
 .Sh NAME
@@ -73,15 +73,20 @@ is invoked without arguments and the
 .Ev HOME
 environment variable exists and contains a directory name, that directory
 becomes the new working directory.
+.It Ev OLDPWD
+Set to the previous working directory after a directory change.
+Unsupported by
+.Xr csh 1 .
+.It Ev PWD
+Set to the current working directory.
 .El
 .Pp
-See
-.Xr csh 1
-for more information on environment variables.
+For more information on environment variables consult manual for shell in use.
 .Sh EXIT STATUS
 .Ex -std cd
 .Sh SEE ALSO
 .Xr csh 1 ,
+.Xr ksh 1 ,
 .Xr pwd 1 ,
 .Xr sh 1 ,
 .Xr chdir 2



CVS commit: src/libexec/lfs_cleanerd

2019-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 31 07:49:48 UTC 2019

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.8

Log Message:
New sentence, new line. Punctuation improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/libexec/lfs_cleanerd/lfs_cleanerd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/libexec/lfs_cleanerd

2019-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 31 07:49:48 UTC 2019

Modified Files:
src/libexec/lfs_cleanerd: lfs_cleanerd.8

Log Message:
New sentence, new line. Punctuation improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/libexec/lfs_cleanerd/lfs_cleanerd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/lfs_cleanerd/lfs_cleanerd.8
diff -u src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.19 src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.20
--- src/libexec/lfs_cleanerd/lfs_cleanerd.8:1.19	Fri Aug 30 23:37:23 2019
+++ src/libexec/lfs_cleanerd/lfs_cleanerd.8	Sat Aug 31 07:49:48 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lfs_cleanerd.8,v 1.19 2019/08/30 23:37:23 brad Exp $
+.\"	$NetBSD: lfs_cleanerd.8,v 1.20 2019/08/31 07:49:48 wiz Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -98,9 +98,9 @@ This option is used by
 and should not be specified on the command line.
 .It Fl J Ar raw device
 Specify the raw device that the cleaner is to work against rather than
-trying to figure it out from the mount point.  This is mostly useful
-when the cleaner is compiled into
-.Xr rump_lfs 8 ,
+trying to figure it out from the mount point.
+This is mostly useful when the cleaner is compiled into
+.Xr rump_lfs 8
 and the ATF test framework.
 .It Fl l Ar load-threshhold
 Clean more aggressively when the system load is below the given threshhold.
@@ -122,11 +122,11 @@ Give an efficiency report after every
 times through the main loop.
 .It Fl S Ar semaphore address
 When the cleaner code is compiled into
-.Xr rump_lfs 8 ,
+.Xr rump_lfs 8
 and the ATF frame work, this option allows for a synchronization
-semaphore to be specified.  This option is not available in the
-stand alone
-.Xr lfs_cleanerd 8 .
+semaphore to be specified.
+This option is not available in the stand-alone
+.Nm .
 .It Fl s
 When cleaning the file system,
 send only a few blocks through lfs_markv at a time.
@@ -148,7 +148,7 @@ to a low value.
 .Xr lfs_markv 2 ,
 .Xr lfs_segwait 2 ,
 .Xr mount_lfs 8 ,
-.Xr rump_lfs 8 .
+.Xr rump_lfs 8
 .Sh HISTORY
 The
 .Nm