CVS commit: src/sys/arch/arm/sociox

2021-12-19 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Dec 20 06:47:25 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
- iron out attach error case messages
- use 64-bit paddr bus_dma_tag
- dig and decode FDT "clock-frequency" value


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/sociox/if_scx.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.29 src/sys/arch/arm/sociox/if_scx.c:1.30
--- src/sys/arch/arm/sociox/if_scx.c:1.29	Mon Dec 20 02:24:33 2021
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Dec 20 06:47:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.29 2021/12/20 02:24:33 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.30 2021/12/20 06:47:24 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 #define NOT_MP_SAFE	0
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.29 2021/12/20 02:24:33 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.30 2021/12/20 06:47:24 nisimura Exp $");
 
 #include 
 #include 
@@ -449,7 +449,6 @@ struct scx_softc {
 	bus_space_handle_t sc_eesh;	/* eeprom section handle */
 	bus_size_t sc_eesz;		/* eeprom map size */
 	bus_dma_tag_t sc_dmat;		/* bus DMA tag */
-	bus_dma_tag_t sc_dmat32;
 	struct ethercom sc_ethercom;	/* Ethernet common data */
 	struct mii_data sc_mii;		/* MII */
 	callout_t sc_callout;		/* PHY monitor callout */
@@ -618,6 +617,37 @@ mac_write(struct scx_softc *sc, int reg,
 	(void)WAIT_FOR_CLR(sc, MACCMD, CMD_BUSY, 0);
 }
 
+static int
+get_clk_freq(int phandle, const char *clkname)
+{
+	u_int index, n, cells;
+	const u_int *p;
+	int err, len, resid;
+	unsigned int freq = 0;
+
+	err = fdtbus_get_index(phandle, "clock-names", clkname, );
+	if (err == -1)
+		return -1;
+	p = fdtbus_get_prop(phandle, "clocks", );
+	if (p == NULL)
+		return -1;
+	for (n = 0, resid = len; resid > 0; n++) {
+		const int cc_phandle =
+		fdtbus_get_phandle_from_native(be32toh(p[0]));
+		if (of_getprop_uint32(cc_phandle, "#clock-cells", ))
+			return -1;
+		if (n == index) {
+			if (of_getprop_uint32(cc_phandle,
+			"clock-frequency", ))
+return -1;
+			return freq;
+		}
+		resid -= (cells + 1) * 4;
+		p += (cells + 1) * 4;
+	}
+	return -1;
+}
+
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "socionext,synquacer-netsec" },
 	DEVICE_COMPAT_EOL
@@ -647,15 +677,21 @@ scx_fdt_attach(device_t parent, device_t
 	bus_addr_t addr[2];
 	bus_size_t size[2];
 	char intrstr[128];
-	const char *phy_mode;
+	int phy_phandle;
+	bus_addr_t phy_id;
+	const char *phy_type;
+	long ref_clk;
+
+	aprint_naive("\n");
+	aprint_normal(": Gigabit Ethernet Controller\n");
 
 	if (fdtbus_get_reg(phandle, 0, addr+0, size+0) != 0
 	|| bus_space_map(faa->faa_bst, addr[0], size[0], 0, ) != 0) {
-		aprint_error(": unable to map device csr\n");
+		aprint_error_dev(self, "unable to map device csr\n");
 		return;
 	}
 	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
-		aprint_error(": failed to decode interrupt\n");
+		aprint_error_dev(self, "failed to decode interrupt\n");
 		goto fail;
 	}
 	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_NET,
@@ -666,14 +702,10 @@ scx_fdt_attach(device_t parent, device_t
 	}
 	if (fdtbus_get_reg(phandle, 1, addr+1, size+1) != 0
 	|| bus_space_map(faa->faa_bst, addr[1], size[1], 0, ) != 0) {
-		aprint_error(": unable to map device eeprom\n");
+		aprint_error_dev(self, "unable to map device eeprom\n");
 		goto fail;
 	}
 
-	aprint_naive("\n");
-	/* aprint_normal(": Gigabit Ethernet Controller\n"); */
-	aprint_normal_dev(self, "interrupt on %s\n", intrstr);
-
 	sc->sc_dev = self;
 	sc->sc_st = bst;
 	sc->sc_sh = bsh;
@@ -681,13 +713,22 @@ scx_fdt_attach(device_t parent, device_t
 	sc->sc_eesh = eebsh;
 	sc->sc_eesz = size[1];
 	sc->sc_dmat = faa->faa_dmat;
-	sc->sc_dmat32 = faa->faa_dmat; /* XXX */
 	sc->sc_phandle = phandle;
 
-	phy_mode = fdtbus_get_string(phandle, "phy-mode");
-	if (phy_mode == NULL)
-		aprint_error(": missing 'phy-mode' property\n");
-	sc->sc_100mii = (phy_mode  && strcmp(phy_mode, "rgmii") != 0);
+	phy_type = fdtbus_get_string(phandle, "phy-mode");
+	if (phy_type == NULL)
+		aprint_error_dev(self, "missing 'phy-mode' property\n");
+	phy_phandle = fdtbus_get_phandle(phandle, "phy-handle");	
+	if (phy_phandle == -1
+	|| fdtbus_get_reg(phy_phandle, 0, _id, NULL) != 0)
+		phy_id = MII_PHY_ANY;
+	ref_clk = get_clk_freq(phandle, "phy_ref_clk");
+	if (ref_clk == -1)
+		ref_clk = 250 * 1000 * 1000;
+
+	sc->sc_100mii = (phy_type && strncmp(phy_type, "rgmii", 5) != 0);
+	sc->sc_phy_id = phy_id;
+	sc->sc_freq = ref_clk;
 
 	scx_attach_i(sc);
 	return;
@@ -718,23 +759,26 @@ scx_acpi_attach(device_t parent, device_
 	struct acpi_resources res;
 	struct acpi_mem *mem;
 	struct acpi_irq *irq;
-	char *phy_mode;
-	ACPI_INTEGER 

CVS commit: src/sys/arch/arm/sociox

2021-12-19 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Dec 20 06:47:25 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
- iron out attach error case messages
- use 64-bit paddr bus_dma_tag
- dig and decode FDT "clock-frequency" value


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/sociox/if_scx.c

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



CVS commit: src/sys/arch/arm/sociox

2021-12-19 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Dec 20 02:24:33 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
development snapshot; endianness and others.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/sociox/if_scx.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.28 src/sys/arch/arm/sociox/if_scx.c:1.29
--- src/sys/arch/arm/sociox/if_scx.c:1.28	Mon Dec 20 02:23:04 2021
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Dec 20 02:24:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.28 2021/12/20 02:23:04 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.29 2021/12/20 02:24:33 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 #define NOT_MP_SAFE	0
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.28 2021/12/20 02:23:04 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.29 2021/12/20 02:24:33 nisimura Exp $");
 
 #include 
 #include 
@@ -482,8 +482,8 @@ struct scx_softc {
 	int sc_rxptr;			/* next ready Rx descriptor/descsoft */
 
 	krndsource_t rnd_source;	/* random source */
-#ifdef GMAC_EVENT_COUNTER
-	/* 80 event counter exist */
+#ifdef GMAC_EVENT_COUNTERS
+	/* 80 event counters exist */
 #endif
 };
 
@@ -524,11 +524,11 @@ do {	\
 	struct mbuf *__m = __rxs->rxs_mbuf;\
 	bus_addr_t __paddr =__rxs->rxs_dmamap->dm_segs[0].ds_addr;	\
 	__m->m_data = __m->m_ext.ext_buf;\
-	__rxd->r3 = __rxs->rxs_dmamap->dm_segs[0].ds_len;		\
+	__rxd->r3 = htole32(__rxs->rxs_dmamap->dm_segs[0].ds_len);	\
 	__rxd->r2 = htole32(BUS_ADDR_LO32(__paddr));			\
 	__rxd->r1 = htole32(BUS_ADDR_HI32(__paddr));			\
-	__rxd->r0 = R0_OWN | R0_FS | R0_LS;\
-	if ((x) == MD_NRXDESC - 1) __rxd->r0 |= R0_EOD;			\
+	__rxd->r0 = htole32(R0_OWN | R0_FS | R0_LS);			\
+	if ((x) == MD_NRXDESC - 1) __rxd->r0 |= htole32(R0_EOD);	\
 } while (/*CONSTCOND*/0)
 
 /* memory mapped CSR register access */
@@ -1334,20 +1334,20 @@ scx_start(struct ifnet *ifp)
 			 * yet.	 That could cause a race condition.
 			 * We'll do it below.
 			 */
-			tdes->t3 = dmamap->dm_segs[seg].ds_len;
+			tdes->t3 = htole32(dmamap->dm_segs[seg].ds_len);
 			tdes->t2 = htole32(BUS_ADDR_LO32(paddr));
 			tdes->t1 = htole32(BUS_ADDR_HI32(paddr));
-			tdes->t0 = tdes0 | (tdes->t0 & T0_EOD) |
+			tdes->t0 = htole32(tdes0 | (tdes->t0 & T0_EOD) |
 	(15 << T0_TDRID) | T0_PT |
-	sc->sc_t0cotso | T0_TRS;
+	sc->sc_t0cotso | T0_TRS);
 			tdes0 = T0_OWN; /* 2nd and other segments */
 			/* NB; t0 DRID field contains zero */
 			lasttx = nexttx;
 		}
 
 		/* Write deferred 1st segment T0_OWN at the final stage */
-		sc->sc_txdescs[lasttx].t0 |= T0_LS;
-		sc->sc_txdescs[sc->sc_txnext].t0 |= (T0_FS | T0_OWN);
+		sc->sc_txdescs[lasttx].t0 |= htole32(T0_LS);
+		sc->sc_txdescs[sc->sc_txnext].t0 |= htole32(T0_FS | T0_OWN);
 		SCX_CDTXSYNC(sc, sc->sc_txnext, dmamap->dm_nsegs,
 		BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
@@ -1468,7 +1468,7 @@ rxintr(struct scx_softc *sc)
 		SCX_CDRXSYNC(sc, i,
 		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
-		rxstat = sc->sc_rxdescs[i].r0;
+		rxstat = le32toh(sc->sc_rxdescs[i].r0);
 		if (rxstat & R0_OWN) /* desc is left empty */
 			break;
 
@@ -1569,16 +1569,19 @@ mii_statchg(struct ifnet *ifp)
 
 	/* decode MIISR register value */
 	miisr = mac_read(sc, GMACMIISR);
-	spd = Mbps[(miisr >> 1) & 03];
+	spd = Mbps[(miisr & MIISR_SPD) >> 1];
 #if 1
-	printf("MII link status (0x%x) %s",
-	miisr, (miisr & 8) ? "up" : "down");
-	if (miisr & 8) {
-		printf(" spd%d", spd);
-		if (miisr & 01)
-			printf(",full-duplex");
+	static uint32_t oldmiisr = 0;
+	if (miisr != oldmiisr) {
+		printf("MII link status (0x%x) %s",
+		miisr, (miisr & MIISR_LUP) ? "up" : "down");
+		if (miisr & MIISR_LUP) {
+			printf(" spd%d", spd);
+			if (miisr & MIISR_FDX)
+printf(",full-duplex");
+		}
+		printf("\n");
 	}
-	printf("\n");
 #endif
 	/* Get flow control negotiation result. */
 	if (IFM_SUBTYPE(mii->mii_media.ifm_cur->ifm_media) == IFM_AUTO &&
@@ -1601,7 +1604,7 @@ mii_statchg(struct ifnet *ifp)
 	/* Adjust duplexity and PAUSE flow control. */
 	mcr &= ~MCR_USEFDX;
 	fcr = mac_read(sc, GMACFCR) & ~(FCR_TFE | FCR_RFE);
-	if (miisr & 01) {
+	if (miisr & MIISR_FDX) {
 		if (sc->sc_flowflags & IFM_ETH_TXPAUSE)
 			fcr |= FCR_TFE;
 		if (sc->sc_flowflags & IFM_ETH_RXPAUSE)
@@ -1611,8 +1614,14 @@ mii_statchg(struct ifnet *ifp)
 	mac_write(sc, GMACMCR, mcr);
 	mac_write(sc, GMACFCR, fcr);
 
-printf("%ctxfe, %crxfe\n",
- (fcr & FCR_TFE) ? '+' : '-', (fcr & FCR_RFE) ? '+' : '-');
+#if 1
+	if (miisr != oldmiisr) {
+		printf("%ctxfe, %crxfe\n",
+		(fcr & FCR_TFE) ? '+' : '-',
+		(fcr & FCR_RFE) ? '+' : '-');
+	}
+	oldmiisr = miisr;
+#endif
 }
 
 static void
@@ -1680,6 +1689,7 @@ phy_tick(void *arg)
 	mii_tick(mii);
 	splx(s);
 #ifdef 

CVS commit: src/sys/arch/arm/sociox

2021-12-19 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Dec 20 02:24:33 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
development snapshot; endianness and others.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/sociox/if_scx.c

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



CVS commit: src/sys/arch/arm/sociox

2021-12-19 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Dec 20 02:23:04 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
fix and improve register definitions


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/sociox/if_scx.c

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

Modified files:

Index: src/sys/arch/arm/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.27 src/sys/arch/arm/sociox/if_scx.c:1.28
--- src/sys/arch/arm/sociox/if_scx.c:1.27	Thu Dec 16 11:36:25 2021
+++ src/sys/arch/arm/sociox/if_scx.c	Mon Dec 20 02:23:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.27 2021/12/16 11:36:25 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.28 2021/12/20 02:23:04 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 #define NOT_MP_SAFE	0
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.27 2021/12/16 11:36:25 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.28 2021/12/20 02:23:04 nisimura Exp $");
 
 #include 
 #include 
@@ -126,7 +126,7 @@ struct rdes {
 #define  RPTHDCOMP	(1U<<2)		/* log HD imcomplete condition */
 #define  RPTHDERR	(1U<<1)		/* log HD error */
 #define  DROPNOMATCH	(1U<<0)		/* drop no match frames */
-#define xINTSR		0x200		/* aggregated interrupt status report */
+#define xINTSR		0x200		/* aggregated interrupt status */
 #define  IRQ_RX		(1U<<1)		/* top level Rx interrupt */
 #define  IRQ_TX		(1U<<0)		/* top level Rx interrupt */
 #define  IRQ_UCODE	(1U<<20)	/* ucode load completed */
@@ -144,18 +144,18 @@ struct rdes {
 #define  TXI_TR_ERR	(1U<<16)	/* tx error */
 #define  TXI_TXDONE	(1U<<15)	/* tx completed */
 #define  TXI_TMREXP	(1U<<14)	/* coalesce timer expired */
-#define RXISR		0x440		/* receipt status */
+#define RXISR		0x440		/* receive status */
 #define RXIEN		0x444		/* rx interrupt enable */
 #define RXIE_SET	0x468		/* bit to set */
 #define RXIE_CLR	0x46c		/* bit to clr */
 #define  RXI_RC_ERR	(1U<<16)	/* rx error */
-#define  RXI_PKTCNT	(1U<<15)	/* rx counter has new value report */
+#define  RXI_PKTCNT	(1U<<15)	/* rx counter has new value */
 #define  RXI_TMREXP	(1U<<14)	/* coalesce timer expired */
 #define TDBA_LO		0x408		/* tdes array base addr 31:0 */
 #define TDBA_HI		0x434		/* tdes array base addr 63:32 */
 #define RDBA_LO		0x448		/* rdes array base addr 31:0 */
 #define RDBA_HI		0x474		/* rdes array base addr 63:32 */
-/* 13 pairs of special purpose desc array address registers exit */
+/* 13 pairs of special purpose desc array base address register exist */
 #define TXCONF		0x430
 #define RXCONF		0x470
 #define  DESCNF_UP	(1U<<31)	/* up-and-running */
@@ -166,8 +166,8 @@ struct rdes {
 #define RXCOLMAX	0x454		/* rx intr coalesce upper bound */
 #define TXITIMER	0x420		/* coalesce timer usec, MSB to use */
 #define RXITIMER	0x460		/* coalesce timer usec, MSB to use */
-#define TXDONECNT	0x424		/* tx completion report, auto-clear */
-#define RXDONECNT	0x458		/* rx completion report, auto-clear */
+#define TXDONECNT	0x424		/* tx completed count, auto-zero */
+#define RXDONECNT	0x458		/* rx available count, auto-zero */
 #define UCODE_H2M	0x210		/* host2media engine ucode port */
 #define UCODE_M2H	0x21c		/* media2host engine ucode port */
 #define CORESTAT	0x218		/* engine run state */
@@ -214,15 +214,18 @@ struct rdes {
 #define  MCR_IBN	(1U<<30)	/* ??? */
 #define  MCR_CST	(1U<<25)	/* strip CRC */
 #define  MCR_TC		(1U<<24)	/* keep RGMII PHY notified */
-#define  MCR_JE		(1U<<20)	/* ignore oversized >9018 condition */
+#define  MCR_WD		(1U<<23)	/* allow long >2048 tx frame */
+#define  MCR_JE		(1U<<20)	/* allow ~9018 tx jumbo frame */
 #define  MCR_IFG	(7U<<17)	/* 19:17 IFG value 0~7 */
 #define  MCR_DRCS	(1U<<16)	/* ignore (G)MII HDX Tx error */
 #define  MCR_USEMII	(1U<<15)	/* 1: RMII/MII, 0: RGMII (_PS) */
 #define  MCR_SPD100	(1U<<14)	/* force speed 100 (_FES) */
-#define  MCR_DO		(1U<<13)	/* ??? don't receive my own Tx frames */
+#define  MCR_DO		(1U<<13)	/* don't receive my own HDX Tx frames */
 #define  MCR_LOOP	(1U<<12)	/* run loop back */
 #define  MCR_USEFDX	(1U<<11)	/* force full duplex */
 #define  MCR_IPCEN	(1U<<10)	/* handle checksum */
+#define  MCR_DR		(1U<<9)		/* attempt no tx retry, send once */
+#define  MCR_LUD	(1U<<8)		/* link condition report when RGMII */
 #define  MCR_ACS	(1U<<7)		/* auto pad strip CRC */
 #define  MCR_TE		(1U<<3)		/* run Tx MAC engine, 0 to stop */
 #define  MCR_RE		(1U<<2)		/* run Rx MAC engine, 0 to stop */
@@ -258,12 +261,9 @@ struct rdes {
 /* 31:16 pause timer value, 5:4 pause timer threshold */
 #define  FCR_RFE	(1U<<2)		/* accept PAUSE to throttle Tx */
 #define  FCR_TFE	(1U<<1)		/* generate PAUSE to moderate Rx lvl */
-#define GMACVTAG	0x001c		/* VLAN tag control */
-#define GMACIMPL	0x0020		/* implementation number XX.YY */
-#define GMACLPIS	0x0030		/* ??? AXI LPI control */
-#define GMACLPIC	0x0034		/* ??? AXI LPI 

CVS commit: src/sys/arch/arm/sociox

2021-12-19 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Mon Dec 20 02:23:04 UTC 2021

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
fix and improve register definitions


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/sociox/if_scx.c

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



CVS commit: src/sys/external/bsd/drm2/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 00:27:53 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/drm: drmfb.c

Log Message:
drm: Simplify use of drm API for display on/off logic in drmfb.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/drm/drmfb.c

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

Modified files:

Index: src/sys/external/bsd/drm2/drm/drmfb.c
diff -u src/sys/external/bsd/drm2/drm/drmfb.c:1.10 src/sys/external/bsd/drm2/drm/drmfb.c:1.11
--- src/sys/external/bsd/drm2/drm/drmfb.c:1.10	Sun Dec 19 10:32:59 2021
+++ src/sys/external/bsd/drm2/drm/drmfb.c	Mon Dec 20 00:27:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmfb.c,v 1.10 2021/12/19 10:32:59 riastradh Exp $	*/
+/*	$NetBSD: drmfb.c,v 1.11 2021/12/20 00:27:53 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.10 2021/12/19 10:32:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.11 2021/12/20 00:27:53 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -196,8 +196,6 @@ drmfb_genfb_ioctl(void *v, void *vs, uns
 	struct genfb_softc *const genfb = v;
 	struct drmfb_softc *const sc = container_of(genfb, struct drmfb_softc,
 	sc_genfb);
-	struct drm_connector_list_iter conn_iter;
-	struct drm_connector *connector;
 	int error;
 
 	if (sc->sc_da.da_params->dp_ioctl) {
@@ -227,17 +225,10 @@ drmfb_genfb_ioctl(void *v, void *vs, uns
 		const int on = *(const int *)data;
 		const int dpms_mode = on? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
 		struct drm_fb_helper *const fb_helper = sc->sc_da.da_fb_helper;
-		struct drm_device *const dev = fb_helper->dev;
 
-		drm_modeset_lock_all(dev);
-		drm_connector_list_iter_begin(fb_helper->dev, _iter);
-		drm_client_for_each_connector_iter(connector, _iter) {
-			(*connector->funcs->dpms)(connector, dpms_mode);
-			drm_object_property_set_value(>base,
-			dev->mode_config.dpms_property, dpms_mode);
-		}
-		drm_connector_list_iter_end(_iter);
-		drm_modeset_unlock_all(dev);
+		mutex_lock(_helper->lock);
+		drm_client_modeset_dpms(_helper->client, dpms_mode);
+		mutex_unlock(_helper->lock);
 
 		return 0;
 	}



CVS commit: src/sys/external/bsd/drm2/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 00:27:53 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/drm: drmfb.c

Log Message:
drm: Simplify use of drm API for display on/off logic in drmfb.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/drm/drmfb.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 00:27:42 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_atomic_helper.c

Log Message:
drm: Fix return code interpretation in timed wait loop.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 00:27:42 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_atomic_helper.c

Log Message:
drm: Fix return code interpretation in timed wait loop.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c:1.10 src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c:1.10	Sun Dec 19 12:43:52 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c	Mon Dec 20 00:27:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_atomic_helper.c,v 1.10 2021/12/19 12:43:52 riastradh Exp $	*/
+/*	$NetBSD: drm_atomic_helper.c,v 1.11 2021/12/20 00:27:42 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2014 Red Hat
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_atomic_helper.c,v 1.10 2021/12/19 12:43:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_atomic_helper.c,v 1.11 2021/12/20 00:27:42 riastradh Exp $");
 
 #include 
 #include 
@@ -1467,20 +1467,20 @@ drm_atomic_helper_wait_for_vblanks(struc
 
 #ifdef __NetBSD__
 		if (cold) {
-			unsigned timo = 100;
+			bool done = false;
 
-			ret = -ETIMEDOUT;
-			while (timo --> 0 && ret) {
+			ret = 100;
+			for (ret = 100; !done && ret; DELAY(1000), ret--) {
 spin_lock(>event_lock);
 if (old_state->crtcs[i].last_vblank_count !=
 drm_crtc_vblank_count(crtc)) {
-	ret = 0;
+	done = true;
 }
 spin_unlock(>event_lock);
 			}
 		} else {
 			spin_lock(>event_lock);
-			DRM_SPIN_WAIT_ON(ret, >vblank[i].queue,
+			DRM_SPIN_TIMED_WAIT_UNTIL(ret, >vblank[i].queue,
 			>event_lock,
 			msecs_to_jiffies(100),
 			(old_state->crtcs[i].last_vblank_count !=



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 00:27:17 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_drm.c rk_vop.c

Log Message:
rkdrm: Implement vblank.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/rockchip/rk_drm.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/rockchip/rk_vop.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_drm.c
diff -u src/sys/arch/arm/rockchip/rk_drm.c:1.17 src/sys/arch/arm/rockchip/rk_drm.c:1.18
--- src/sys/arch/arm/rockchip/rk_drm.c:1.17	Sun Dec 19 12:45:04 2021
+++ src/sys/arch/arm/rockchip/rk_drm.c	Mon Dec 20 00:27:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_drm.c,v 1.17 2021/12/19 12:45:04 riastradh Exp $ */
+/* $NetBSD: rk_drm.c,v 1.18 2021/12/20 00:27:17 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.17 2021/12/19 12:45:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.18 2021/12/20 00:27:17 riastradh Exp $");
 
 #include 
 #include 
@@ -77,10 +77,6 @@ static void	rk_drm_attach(device_t, devi
 static void	rk_drm_init(device_t);
 static vmem_t	*rk_drm_alloc_cma_pool(struct drm_device *, size_t);
 
-static uint32_t	rk_drm_get_vblank_counter(struct drm_device *, unsigned int);
-static int	rk_drm_enable_vblank(struct drm_device *, unsigned int);
-static void	rk_drm_disable_vblank(struct drm_device *, unsigned int);
-
 static int	rk_drm_load(struct drm_device *, unsigned long);
 static void	rk_drm_unload(struct drm_device *);
 
@@ -99,10 +95,6 @@ static struct drm_driver rk_drm_driver =
 	.dumb_create = drm_gem_cma_dumb_create,
 	.dumb_destroy = drm_gem_dumb_destroy,
 
-	.get_vblank_counter = rk_drm_get_vblank_counter,
-	.enable_vblank = rk_drm_enable_vblank,
-	.disable_vblank = rk_drm_disable_vblank,
-
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
 	.date = DRIVER_DATE,
@@ -440,7 +432,7 @@ rk_drm_load(struct drm_device *ddev, uns
 
 	drm_fb_helper_initial_config(>helper, 32);
 
-	/* XXX */
+	/* XXX Delegate this to rk_vop.c?  */
 	ddev->irq_enabled = true;
 	drm_vblank_init(ddev, num_crtc);
 
@@ -454,50 +446,6 @@ drmerr:
 	return error;
 }
 
-static uint32_t
-rk_drm_get_vblank_counter(struct drm_device *ddev, unsigned int crtc)
-{
-	struct rk_drm_softc * const sc = rk_drm_private(ddev);
-
-	if (crtc >= __arraycount(sc->sc_vbl))
-		return 0;
-
-	if (sc->sc_vbl[crtc].get_vblank_counter == NULL)
-		return 0;
-
-	return sc->sc_vbl[crtc].get_vblank_counter(sc->sc_vbl[crtc].priv);
-}
-
-static int
-rk_drm_enable_vblank(struct drm_device *ddev, unsigned int crtc)
-{
-	struct rk_drm_softc * const sc = rk_drm_private(ddev);
-
-	if (crtc >= __arraycount(sc->sc_vbl))
-		return 0;
-
-	if (sc->sc_vbl[crtc].enable_vblank == NULL)
-		return 0;
-
-	sc->sc_vbl[crtc].enable_vblank(sc->sc_vbl[crtc].priv);
-
-	return 0;
-}
-
-static void
-rk_drm_disable_vblank(struct drm_device *ddev, unsigned int crtc)
-{
-	struct rk_drm_softc * const sc = rk_drm_private(ddev);
-
-	if (crtc >= __arraycount(sc->sc_vbl))
-		return;
-
-	if (sc->sc_vbl[crtc].disable_vblank == NULL)
-		return;
-
-	sc->sc_vbl[crtc].disable_vblank(sc->sc_vbl[crtc].priv);
-}
-
 static void
 rk_drm_unload(struct drm_device *ddev)
 {

Index: src/sys/arch/arm/rockchip/rk_vop.c
diff -u src/sys/arch/arm/rockchip/rk_vop.c:1.15 src/sys/arch/arm/rockchip/rk_vop.c:1.16
--- src/sys/arch/arm/rockchip/rk_vop.c:1.15	Sun Dec 19 12:45:27 2021
+++ src/sys/arch/arm/rockchip/rk_vop.c	Mon Dec 20 00:27:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_vop.c,v 1.15 2021/12/19 12:45:27 riastradh Exp $ */
+/* $NetBSD: rk_vop.c,v 1.16 2021/12/20 00:27:17 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.15 2021/12/19 12:45:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.16 2021/12/20 00:27:17 riastradh Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #define	VOP_REG_CFG_DONE		0x
 #define	 REG_LOAD_EN			__BIT(0)
@@ -104,6 +105,26 @@ __KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1
 #define	VOP_DSP_VACT_ST_END		0x0194
 #define	 DSP_VACT_ST			__BITS(28,16)
 #define	 DSP_VACT_END			__BITS(12,0)
+#define	VOP_INTR_EN0			0x0280
+#define	VOP_INTR_CLEAR0			0x0284
+#define	VOP_INTR_STATUS0		0x0288
+#define	VOP_INTR_RAW_STATUS0		0x028c
+#define	 VOP_INTR0_DMA_FINISH		__BIT(15)
+#define	 VOP_INTR0_MMU			__BIT(14)
+#define	 VOP_INTR0_DSP_HOLD_VALID	__BIT(13)
+#define	 VOP_INTR0_FS_FIELD		__BIT(12)
+#define	 VOP_INTR0_POST_BUF_EMPTY	__BIT(11)
+#define	 VOP_INTR0_HWC_EMPTY		__BIT(10)
+#define	 VOP_INTR0_WIN3_EMPTY		__BIT(9)
+#define	 VOP_INTR0_WIN2_EMPTY		__BIT(8)
+#define	 VOP_INTR0_WIN1_EMPTY		__BIT(7)
+#define	 VOP_INTR0_WIN0_EMPTY		__BIT(6)
+#define	 VOP_INTR0_BUS_ERROR		__BIT(5)
+#define	 

CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Dec 20 00:27:17 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_drm.c rk_vop.c

Log Message:
rkdrm: Implement vblank.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/rockchip/rk_drm.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/rockchip/rk_vop.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 20 00:10:07 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: debug.c

Log Message:
lint: in debug mode, output value of boolean expressions


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/lint1/debug.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.5 src/usr.bin/xlint/lint1/debug.c:1.6
--- src/usr.bin/xlint/lint1/debug.c:1.5	Tue Nov 16 21:01:05 2021
+++ src/usr.bin/xlint/lint1/debug.c	Mon Dec 20 00:10:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.5 2021/11/16 21:01:05 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.6 2021/12/20 00:10:07 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: debug.c,v 1.5 2021/11/16 21:01:05 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.6 2021/12/20 00:10:07 rillig Exp $");
 #endif
 
 #include 
@@ -132,6 +132,9 @@ debug_node(const tnode_t *tn)
 		debug_printf(", value %llu\n", (unsigned long long)tn->tn_val->v_quad);
 	else if (op == CON && is_integer(tn->tn_type->t_tspec))
 		debug_printf(", value %lld\n", (long long)tn->tn_val->v_quad);
+	else if (op == CON && tn->tn_type->t_tspec == BOOL)
+		debug_printf(", value %s\n",
+		tn->tn_val->v_quad != 0 ? "true" : "false");
 	else if (op == CON)
 		debug_printf(", unknown value\n");
 	else if (op == STRING && tn->tn_string->st_tspec == CHAR)



CVS commit: src/usr.bin/xlint/lint1

2021-12-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Dec 20 00:10:07 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: debug.c

Log Message:
lint: in debug mode, output value of boolean expressions


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/lint1/debug.c

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



CVS commit: src/usr.bin/xlint/lint1

2021-12-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 19 23:50:27 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: split local variable in initialization_end_brace_level

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/xlint/lint1/init.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/init.c
diff -u src/usr.bin/xlint/lint1/init.c:1.221 src/usr.bin/xlint/lint1/init.c:1.222
--- src/usr.bin/xlint/lint1/init.c:1.221	Sun Dec 19 10:17:00 2021
+++ src/usr.bin/xlint/lint1/init.c	Sun Dec 19 23:50:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.221 2021/12/19 10:17:00 rillig Exp $	*/
+/*	$NetBSD: init.c,v 1.222 2021/12/19 23:50:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.221 2021/12/19 10:17:00 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.222 2021/12/19 23:50:27 rillig Exp $");
 #endif
 
 #include 
@@ -768,7 +768,7 @@ initialization_set_size_of_unknown_array
 static void
 initialization_end_brace_level(initialization *in)
 {
-	brace_level *bl;
+	brace_level *inner_bl, *outer_bl;
 
 	debug_enter();
 
@@ -776,15 +776,15 @@ initialization_end_brace_level(initializ
 	if (in->in_err)
 		goto done;
 
-	bl = in->in_brace_level;
-	in->in_brace_level = bl->bl_enclosing;
-	brace_level_free(bl);
-	bl = in->in_brace_level;
-
-	if (bl != NULL)
-		brace_level_advance(bl, >in_max_subscript);
-	if (bl != NULL)
-		designation_reset(>bl_designation);
+	inner_bl = in->in_brace_level;
+	outer_bl = inner_bl->bl_enclosing;
+	in->in_brace_level = outer_bl;
+	brace_level_free(inner_bl);
+
+	if (outer_bl != NULL) {
+		brace_level_advance(outer_bl, >in_max_subscript);
+		designation_reset(_bl->bl_designation);
+	}
 
 done:
 	initialization_debug(in);



CVS commit: src/usr.bin/xlint/lint1

2021-12-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Dec 19 23:50:27 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: init.c

Log Message:
lint: split local variable in initialization_end_brace_level

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/usr.bin/xlint/lint1/init.c

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



CVS commit: src/sys/dev/pci/bktr

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 22:03:41 UTC 2021

Modified Files:
src/sys/dev/pci/bktr: bktr_audio.c bktr_core.c bktr_core.h bktr_tuner.c

Log Message:
fix various typos in bktr driver comments.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/bktr/bktr_audio.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/bktr/bktr_core.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/bktr/bktr_core.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/bktr/bktr_tuner.c

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



CVS commit: src/sys/dev/pci/bktr

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 22:03:41 UTC 2021

Modified Files:
src/sys/dev/pci/bktr: bktr_audio.c bktr_core.c bktr_core.h bktr_tuner.c

Log Message:
fix various typos in bktr driver comments.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/bktr/bktr_audio.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/bktr/bktr_core.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/bktr/bktr_core.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/bktr/bktr_tuner.c

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/pci/bktr/bktr_audio.c
diff -u src/sys/dev/pci/bktr/bktr_audio.c:1.19 src/sys/dev/pci/bktr/bktr_audio.c:1.20
--- src/sys/dev/pci/bktr/bktr_audio.c:1.19	Fri Dec  7 05:56:30 2012
+++ src/sys/dev/pci/bktr/bktr_audio.c	Sun Dec 19 22:03:41 2021
@@ -1,6 +1,6 @@
 /* $SourceForge: bktr_audio.c,v 1.6 2003/03/11 23:11:20 thomasklausner Exp $ */
 
-/*	$NetBSD: bktr_audio.c,v 1.19 2012/12/07 05:56:30 msaitoh Exp $	*/
+/*	$NetBSD: bktr_audio.c,v 1.20 2021/12/19 22:03:41 andvar Exp $	*/
 /* $FreeBSD: src/sys/dev/bktr/bktr_audio.c,v 1.8 2000/10/31 13:09:56 roger Exp$ */
 /*
  * This is part of the Driver for Video Capture Cards (Frame grabbers)
@@ -71,7 +71,7 @@
 
 #ifdef __NetBSD__
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bktr_audio.c,v 1.19 2012/12/07 05:56:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bktr_audio.c,v 1.20 2021/12/19 22:03:41 andvar Exp $");
 
 #include 
 #include 	/* NetBSD location of .h files */
@@ -560,7 +560,7 @@ void msp_autodetect(bktr_ptr_t bktr) {
 msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0020);/* Loudspeaker set stereo*/
 /*
   set spatial effect strength to 50% enlargement
-  set spatial effect mode b, stereo basewidth enlargment only
+  set spatial effect mode b, stereo basewidth enlargement only
 */
 msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0005,0x3f28);
   } else if (stereo > 0x8000) {/* bilingual mode */
@@ -572,7 +572,7 @@ void msp_autodetect(bktr_ptr_t bktr) {
 msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0030);/* Loudspeaker */
 /*
   set spatial effect strength to 50% enlargement
-  set spatial effect mode a, stereo basewidth enlargment
+  set spatial effect mode a, stereo basewidth enlargement
   and pseudo stereo effect with automatic high-pass filter
 */
 msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0005,0x3f08);

Index: src/sys/dev/pci/bktr/bktr_core.c
diff -u src/sys/dev/pci/bktr/bktr_core.c:1.58 src/sys/dev/pci/bktr/bktr_core.c:1.59
--- src/sys/dev/pci/bktr/bktr_core.c:1.58	Sat May 23 23:42:42 2020
+++ src/sys/dev/pci/bktr/bktr_core.c	Sun Dec 19 22:03:41 2021
@@ -1,6 +1,6 @@
 /* $SourceForge: bktr_core.c,v 1.6 2003/03/11 23:11:22 thomasklausner Exp $ */
 
-/*	$NetBSD: bktr_core.c,v 1.58 2020/05/23 23:42:42 ad Exp $	*/
+/*	$NetBSD: bktr_core.c,v 1.59 2021/12/19 22:03:41 andvar Exp $	*/
 /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp$ */
 
 /*
@@ -11,7 +11,7 @@
  *
  * bktr_core : This deals with the Bt848/849/878/879 PCI Frame Grabber,
  *   Handles all the open, close, ioctl and read userland calls.
- *   Sets the Bt848 registers and generates RISC pograms.
+ *   Sets the Bt848 registers and generates RISC programs.
  *   Controls the i2c bus and GPIO interface.
  *   Contains the interface to the kernel.
  *   (eg probe/attach and open/close/ioctl)
@@ -98,7 +98,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bktr_core.c,v 1.58 2020/05/23 23:42:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bktr_core.c,v 1.59 2021/12/19 22:03:41 andvar Exp $");
 
 #include "opt_bktr.h"		/* Include any kernel config options */
 
@@ -265,7 +265,7 @@ typedef u_char bool_t;
  * user program from /dev/vbi.
  */
 
-#define MAX_VBI_LINES	  16   /* Maximum for all vidoe formats */
+#define MAX_VBI_LINES	  16   /* Maximum for all video formats */
 #define VBI_LINE_SIZE 2048 /* Store upto 2048 bytes per line */
 #define VBI_BUFFER_ITEMS  20   /* Number of frames we buffer */
 #define VBI_DATA_SIZE (VBI_LINE_SIZE * MAX_VBI_LINES * 2)
@@ -1336,7 +1336,7 @@ video_ioctl(bktr_ptr_t bktr, int unit, i
 	}
 	bktr->max_clip_node = i;
 
-	/* make sure that the list contains a valid clip secquence */
+	/* make sure that the list contains a valid clip sequence */
 	/* the clip rectangles should be sorted by x then by y as the
second order sort key */
 
@@ -1667,7 +1667,7 @@ video_ioctl(bktr_ptr_t bktr, int unit, i
 
 			start_capture(bktr, METEOR_CONTIN);
 
-			/* Clear the interrypt status register */
+			/* Clear the interrupt status register */
 			OUTL(bktr, BKTR_INT_STAT, INL(bktr, BKTR_INT_STAT));
 
 			OUTW(bktr, BKTR_GPIO_DMA_CTL, 

CVS commit: src

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 21:15:28 UTC 2021

Modified Files:
src/bin/sh: jobs.c
src/sys/dev/hpc: hpcfb.c
src/sys/dev/pci: pm2fb.c

Log Message:
s/forground/foreground/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/bin/sh/jobs.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/hpc/hpcfb.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/pm2fb.c

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

Modified files:

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.114 src/bin/sh/jobs.c:1.115
--- src/bin/sh/jobs.c:1.114	Sun Oct 10 18:46:25 2021
+++ src/bin/sh/jobs.c	Sun Dec 19 21:15:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.114 2021/10/10 18:46:25 rillig Exp $	*/
+/*	$NetBSD: jobs.c,v 1.115 2021/12/19 21:15:27 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.114 2021/10/10 18:46:25 rillig Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.115 2021/12/19 21:15:27 andvar Exp $");
 #endif
 #endif /* not lint */
 
@@ -1308,7 +1308,7 @@ forkchild(struct job *jp, union node *n,
  * the interactive program catches interrupts, the user doesn't want
  * these interrupts to also abort the loop.  The approach we take here
  * is to have the shell ignore interrupt signals while waiting for a
- * forground process to terminate, and then send itself an interrupt
+ * foreground process to terminate, and then send itself an interrupt
  * signal if the child process was terminated by an interrupt signal.
  * Unfortunately, some programs want to do a bit of cleanup and then
  * exit on interrupt; unless these processes terminate themselves by

Index: src/sys/dev/hpc/hpcfb.c
diff -u src/sys/dev/hpc/hpcfb.c:1.64 src/sys/dev/hpc/hpcfb.c:1.65
--- src/sys/dev/hpc/hpcfb.c:1.64	Sat Sep 18 15:14:41 2021
+++ src/sys/dev/hpc/hpcfb.c	Sun Dec 19 21:15:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcfb.c,v 1.64 2021/09/18 15:14:41 tsutsui Exp $	*/
+/*	$NetBSD: hpcfb.c,v 1.65 2021/12/19 21:15:28 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1999
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.64 2021/09/18 15:14:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.65 2021/12/19 21:15:28 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcfb.h"
@@ -516,7 +516,7 @@ hpcfb_cmap_reorder(struct hpcfb_fbconf *
 	int i, j, bg, fg, tmp;
 
 	/*
-	 * Set forground and background so that the screen
+	 * Set foreground and background so that the screen
 	 * looks black on white.
 	 * Normally, black = 00 and white = ff.
 	 * HPCFB_ACCESS_REVERSE means black = ff and white = 00.

Index: src/sys/dev/pci/pm2fb.c
diff -u src/sys/dev/pci/pm2fb.c:1.33 src/sys/dev/pci/pm2fb.c:1.34
--- src/sys/dev/pci/pm2fb.c:1.33	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/pm2fb.c	Sun Dec 19 21:15:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm2fb.c,v 1.33 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: pm2fb.c,v 1.34 2021/12/19 21:15:28 andvar Exp $	*/
 
 /*
  * Copyright (c) 2009, 2012 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.33 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.34 2021/12/19 21:15:28 andvar Exp $");
 
 #include 
 #include 
@@ -1218,7 +1218,7 @@ pm2fb_putchar_aa(void *cookie, int row, 
 	pm2fb_wait(sc, uimin(200, ri->ri_fontscale));
 
 	/*
-	 * and now we just hammer the forground colour and alpha values into
+	 * and now we just hammer the foreground colour and alpha values into
 	 * the upload port
 	 */
 	for (i = 0; i < ri->ri_fontscale; i++) {



CVS commit: src

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 21:15:28 UTC 2021

Modified Files:
src/bin/sh: jobs.c
src/sys/dev/hpc: hpcfb.c
src/sys/dev/pci: pm2fb.c

Log Message:
s/forground/foreground/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/bin/sh/jobs.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/hpc/hpcfb.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/pm2fb.c

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



CVS commit: src/bin/csh/USD.doc

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 21:02:49 UTC 2021

Modified Files:
src/bin/csh/USD.doc: csh.2

Log Message:
s/backgound/background/


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/csh/USD.doc/csh.2

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



CVS commit: src/bin/csh/USD.doc

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 21:02:49 UTC 2021

Modified Files:
src/bin/csh/USD.doc: csh.2

Log Message:
s/backgound/background/


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/csh/USD.doc/csh.2

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

Modified files:

Index: src/bin/csh/USD.doc/csh.2
diff -u src/bin/csh/USD.doc/csh.2:1.7 src/bin/csh/USD.doc/csh.2:1.8
--- src/bin/csh/USD.doc/csh.2:1.7	Thu Aug  7 09:05:08 2003
+++ src/bin/csh/USD.doc/csh.2	Sun Dec 19 21:02:49 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: csh.2,v 1.7 2003/08/07 09:05:08 agc Exp $
+.\"	$NetBSD: csh.2,v 1.8 2021/12/19 21:02:49 andvar Exp $
 .\"
 .\" Copyright (c) 1980, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -673,7 +673,7 @@ which can be used later to refer to the 
 Job numbers remain
 the same until the job terminates and then are re-used.
 .PP
-When a job is started in the backgound using `&', its number, as well
+When a job is started in the background using `&', its number, as well
 as the process numbers of all its (top level) commands, is typed by the shell
 before prompting you for another command. For example,
 .DS
@@ -698,7 +698,7 @@ foreground job.  A background job can be
 .I stop
 command described below.  When jobs are suspended they merely stop
 any further progress until started again, either in the foreground
-or the backgound.  The shell notices when a job becomes stopped and
+or the background.  The shell notices when a job becomes stopped and
 reports this fact, much like it reports the termination of background jobs.
 For foreground jobs this looks like
 .DS
@@ -741,7 +741,7 @@ starts `du' in the foreground, stops it 
 it in the background allowing more foreground commands to be executed.
 This is especially helpful
 when a foreground job ends up taking longer than you expected and you
-wish you had started it in the backgound in the beginning.
+wish you had started it in the background in the beginning.
 .PP
 All
 .I "job control"
@@ -774,7 +774,7 @@ in only one of the jobs.
 The
 .I jobs
 command types the table of jobs, giving the job number,
-commands and status (`Stopped' or `Running') of each backgound or
+commands and status (`Stopped' or `Running') of each background or
 suspended job.  With the `\-l' option the process numbers are also
 typed.
 .DS
@@ -873,7 +873,7 @@ and then put in the background using
 Some time later when the `s' command was finished,
 .I ed
 tried to read another command and was stopped because jobs
-in the backgound cannot read from the terminal.  The
+in the background cannot read from the terminal.  The
 .I fg
 command returned the `ed' job to the foreground where it could once again
 accept commands from the terminal.



CVS commit: src/sys/dev/acpi

2021-12-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 19 19:26:48 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_pci_link.c

Log Message:
Tweak comments.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/acpi/acpi_pci_link.c

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/acpi/acpi_pci_link.c
diff -u src/sys/dev/acpi/acpi_pci_link.c:1.27 src/sys/dev/acpi/acpi_pci_link.c:1.28
--- src/sys/dev/acpi/acpi_pci_link.c:1.27	Sun Dec 19 19:15:48 2021
+++ src/sys/dev/acpi/acpi_pci_link.c	Sun Dec 19 19:26:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_pci_link.c,v 1.27 2021/12/19 19:15:48 skrll Exp $	*/
+/*	$NetBSD: acpi_pci_link.c,v 1.28 2021/12/19 19:26:48 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 Mitsuru IWASAKI 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.27 2021/12/19 19:15:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.28 2021/12/19 19:26:48 skrll Exp $");
 
 #include 
 #include 
@@ -1049,7 +1049,6 @@ acpi_pci_link_route_interrupt(void *v, p
 		return (link->l_irq);
 	}
 
-	/* Choose an IRQ if we need one. */
 	if (PCI_INTERRUPT_VALID(link->l_irq)) {
 		*irq = link->l_irq;
 		*pol = link->l_pol;
@@ -1057,15 +1056,15 @@ acpi_pci_link_route_interrupt(void *v, p
 		goto done;
 	}
 
+	/* The link device doesn't have an interrupt, so try to choose one. */
 	link->l_irq = acpi_pci_link_choose_irq(sc, link);
+	if (!PCI_INTERRUPT_VALID(link->l_irq))
+		goto done;
 
 	/*
 	 * Try to route the interrupt we picked.  If it fails, then
 	 * assume the interrupt is not routed.
 	 */
-	if (!PCI_INTERRUPT_VALID(link->l_irq))
-		goto done;
-
 	acpi_pci_link_route_irqs(sc, irq, pol, trig);
 	if (!link->l_routed) {
 		link->l_irq = PCI_INVALID_IRQ;



CVS commit: src/sys/dev/acpi

2021-12-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 19 19:26:48 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_pci_link.c

Log Message:
Tweak comments.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/acpi/acpi_pci_link.c

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



CVS commit: src/sys/dev/acpi

2021-12-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 19 19:15:48 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_pci_link.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/acpi/acpi_pci_link.c

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/acpi/acpi_pci_link.c
diff -u src/sys/dev/acpi/acpi_pci_link.c:1.26 src/sys/dev/acpi/acpi_pci_link.c:1.27
--- src/sys/dev/acpi/acpi_pci_link.c:1.26	Fri Jan 17 17:06:32 2020
+++ src/sys/dev/acpi/acpi_pci_link.c	Sun Dec 19 19:15:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_pci_link.c,v 1.26 2020/01/17 17:06:32 jmcneill Exp $	*/
+/*	$NetBSD: acpi_pci_link.c,v 1.27 2021/12/19 19:15:48 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002 Mitsuru IWASAKI 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.26 2020/01/17 17:06:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.27 2021/12/19 19:15:48 skrll Exp $");
 
 #include 
 #include 
@@ -1220,14 +1220,14 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
 	 * Check the size of the buffer and expand if required.
 	 *
 	 * Required size is:
-	 *	size of existing resources before terminator + 
+	 *	size of existing resources before terminator +
 	 *	size of new resource and header +
 	 * 	size of terminator.
 	 *
 	 * Note that this loop should really only run once, unless
 	 * for some reason we are stuffing a *really* huge resource.
 	 */
-	while u_int8_t *)rp - (u_int8_t *)buf->Pointer) + 
+	while u_int8_t *)rp - (u_int8_t *)buf->Pointer) +
 	res->Length + ACPI_RS_SIZE_NO_DATA +
 	ACPI_RS_SIZE_MIN) >= buf->Length) {
 		if ((newp = ACPI_ALLOCATE(buf->Length * 2)) == NULL)



CVS commit: src/sys/dev/acpi

2021-12-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 19 19:15:48 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_pci_link.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/acpi/acpi_pci_link.c

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



CVS commit: src/sys/external/bsd/acpica/dist/include

2021-12-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 19 17:51:08 UTC 2021

Modified Files:
src/sys/external/bsd/acpica/dist/include: acoutput.h

Log Message:
PR/56544: Andreas Gustafsson: Disable ACPI_LV_DEBUG_OBJECT; it is too chatty,
and was disabled in the previous version.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/sys/external/bsd/acpica/dist/include/acoutput.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/external/bsd/acpica/dist/include/acoutput.h
diff -u src/sys/external/bsd/acpica/dist/include/acoutput.h:1.14 src/sys/external/bsd/acpica/dist/include/acoutput.h:1.15
--- src/sys/external/bsd/acpica/dist/include/acoutput.h:1.14	Thu Oct 28 10:53:09 2021
+++ src/sys/external/bsd/acpica/dist/include/acoutput.h	Sun Dec 19 12:51:08 2021
@@ -187,7 +187,7 @@
 /* Defaults for DebugLevel, debug and normal */
 
 #define ACPI_DEBUG_DEFAULT  (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_EVALUATION | ACPI_LV_REPAIR)
-#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR)
+#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_REPAIR)
 #define ACPI_DEBUG_ALL  (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
 
 



CVS commit: src/sys/external/bsd/acpica/dist/include

2021-12-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 19 17:51:08 UTC 2021

Modified Files:
src/sys/external/bsd/acpica/dist/include: acoutput.h

Log Message:
PR/56544: Andreas Gustafsson: Disable ACPI_LV_DEBUG_OBJECT; it is too chatty,
and was disabled in the previous version.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/sys/external/bsd/acpica/dist/include/acoutput.h

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



CVS commit: [netbsd-9] src/doc

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:39:28 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Tickets #1394 and #1395


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.58 -r1.1.2.59 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.58 src/doc/CHANGES-9.3:1.1.2.59
--- src/doc/CHANGES-9.3:1.1.2.58	Tue Dec 14 19:06:08 2021
+++ src/doc/CHANGES-9.3	Sun Dec 19 16:39:28 2021
@@ -1,4 +1,4 @@
-29~# $NetBSD: CHANGES-9.3,v 1.1.2.58 2021/12/14 19:06:08 martin Exp $
+29~# $NetBSD: CHANGES-9.3,v 1.1.2.59 2021/12/19 16:39:28 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -1112,3 +1112,16 @@ sys/dev/cgd.c	1.141
 	destroying mutex.
 	[riastradh, ticket #1393]
 
+sys/dev/raidframe/rf_diskqueue.c		1.63 (patch)
+
+	raid(4): add missing buf_destroy() call.
+	[mrg, ticket #1394]
+
+sys/dev/usb/usb_quirks.c			1.101
+sys/dev/usb/usbdevs1.799
+sys/dev/usb/usbdevs.h(regen)
+sys/dev/usb/usbdevs_data.h			(regen)
+
+	Add two additional cyperpower UPS ids to be ignored as HID devices.
+	[mrg, ticket #1395]
+



CVS commit: [netbsd-9] src/doc

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:39:28 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Tickets #1394 and #1395


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.58 -r1.1.2.59 src/doc/CHANGES-9.3

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



CVS commit: [netbsd-9] src/sys/dev/usb

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:38:24 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: usb_quirks.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1395):

sys/dev/usb/usb_quirks.c: revision 1.101

add two additional cyperpower ups ids for ignore hid.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.92.2.1 src/sys/dev/usb/usb_quirks.c

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/usb/usb_quirks.c
diff -u src/sys/dev/usb/usb_quirks.c:1.92 src/sys/dev/usb/usb_quirks.c:1.92.2.1
--- src/sys/dev/usb/usb_quirks.c:1.92	Thu May 23 04:44:49 2019
+++ src/sys/dev/usb/usb_quirks.c	Sun Dec 19 16:38:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.c,v 1.92 2019/05/23 04:44:49 msaitoh Exp $	*/
+/*	$NetBSD: usb_quirks.c,v 1.92.2.1 2021/12/19 16:38:24 martin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.30 2003/01/02 04:15:55 imp Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92 2019/05/23 04:44:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92.2.1 2021/12/19 16:38:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -184,8 +184,12 @@ Static const struct usbd_quirk_entry {
  /* Devices which should be ignored by uhid */
  { USB_VENDOR_APC,		USB_PRODUCT_APC_UPS,			ANY,
 	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS0,		ANY,
+	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS,		ANY,
 	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS2,		ANY,
+	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_GRETAGMACBETH,	ANY,	ANY,
 	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_MGE,		USB_PRODUCT_MGE_UPS1,			ANY,



CVS commit: [netbsd-9] src/sys/dev/usb

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:38:24 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: usb_quirks.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1395):

sys/dev/usb/usb_quirks.c: revision 1.101

add two additional cyperpower ups ids for ignore hid.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.92.2.1 src/sys/dev/usb/usb_quirks.c

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



CVS commit: [netbsd-9] src/sys/dev/usb

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:37:23 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs.h usbdevs_data.h

Log Message:
regen for ticket #1395 (add two more models of cyperpower UPS)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.9 -r1.760.4.10 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.760.4.9 src/sys/dev/usb/usbdevs.h:1.760.4.10
--- src/sys/dev/usb/usbdevs.h:1.760.4.9	Sat Oct 23 11:21:27 2021
+++ src/sys/dev/usb/usbdevs.h	Sun Dec 19 16:37:21 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.760.4.9 2021/10/23 11:21:27 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.760.4.10 2021/12/19 16:37:21 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.9 2021/10/23 11:17:43 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp
  */
 
 /*-
@@ -1294,7 +1294,9 @@
 #define	USB_PRODUCT_CTX_EX1300	0x		/* Ex1300 hub */
 
 /* CyberPower Systems, Inc. products */
+#define	USB_PRODUCT_CYBERPOWER_UPS0	0x0005		/* Uninterruptible Power Supply */
 #define	USB_PRODUCT_CYBERPOWER_UPS	0x0501		/* Uninterruptible Power Supply */
+#define	USB_PRODUCT_CYBERPOWER_UPS2	0x0601		/* Uninterruptible Power Supply */
 
 /* CyberTAN Technology products */
 #define	USB_PRODUCT_CYBERTAN_TG54USB	0x1666		/* TG54USB */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.760.4.9 src/sys/dev/usb/usbdevs_data.h:1.760.4.10
--- src/sys/dev/usb/usbdevs_data.h:1.760.4.9	Sat Oct 23 11:21:28 2021
+++ src/sys/dev/usb/usbdevs_data.h	Sun Dec 19 16:37:21 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.760.4.9 2021/10/23 11:21:28 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.760.4.10 2021/12/19 16:37:21 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.9 2021/10/23 11:17:43 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp
  */
 
 /*-
@@ -1574,8 +1574,12 @@ static const uint16_t usb_products[] = {
 	4893, 8446, 8450, 0,
 	USB_VENDOR_CTX, USB_PRODUCT_CTX_EX1300, 
 	8456, 7013, 0,
+	USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_UPS0, 
+	5932, 1229, 1982, 0,
 	USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_UPS, 
 	5932, 1229, 1982, 0,
+	USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_UPS2, 
+	5932, 1229, 1982, 0,
 	USB_VENDOR_CYBERTAN, USB_PRODUCT_CYBERTAN_TG54USB, 
 	8463, 0,
 	USB_VENDOR_CYBERTAN, USB_PRODUCT_CYBERTAN_ZD1211B, 
@@ -5163,7 +5167,7 @@ static const char usb_words[] = { "." 
 	"Components\0" /* 3 refs @ 1200 */
 	"Kawatsu\0" /* 1 refs @ 1211 */
 	"Composite\0" /* 1 refs @ 1219 */
-	"Power\0" /* 4 refs @ 1229 */
+	"Power\0" /* 6 refs @ 1229 */
 	"Conversion\0" /* 1 refs @ 1235 */
 	"Connectek\0" /* 1 refs @ 1246 */
 	"USA\0" /* 1 refs @ 1256 */
@@ -5263,7 +5267,7 @@ static const char usb_words[] = { "." 
 	"TEAC\0" /* 1 refs @ 1962 */
 	"Graphics\0" /* 2 refs @ 1967 */
 	"Sanwa\0" /* 1 refs @ 1976 */
-	"Supply\0" /* 3 refs @ 1982 */
+	"Supply\0" /* 5 refs @ 1982 */
 	"Linksys\0" /* 4 refs @ 1989 */
 	"Sigmatel\0" /* 1 refs @ 1997 */
 	"DrayTek\0" /* 1 refs @ 2006 */
@@ -5792,7 +5796,7 @@ static const char usb_words[] = { "." 
 	"ADA70\0" /* 1 refs @ 5910 */
 	"Speakers\0" /* 3 refs @ 5916 */
 	"ASC495\0" /* 1 refs @ 5925 */
-	"Uninterruptible\0" /* 2 refs @ 5932 */
+	"Uninterruptible\0" /* 4 refs @ 5932 */
 	"NTL\0" /* 1 refs @ 5948 */
 	"250\0" /* 3 refs @ 5952 */
 	"cable\0" /* 2 refs @ 5956 */



CVS commit: [netbsd-9] src/sys/dev/usb

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:37:23 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs.h usbdevs_data.h

Log Message:
regen for ticket #1395 (add two more models of cyperpower UPS)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.9 -r1.760.4.10 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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



CVS commit: [netbsd-9] src/sys/dev/usb

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:34:40 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1395):

sys/dev/usb/usbdevs: revision 1.799

add two more models of cyperpower UPS.


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.9 -r1.770.4.10 src/sys/dev/usb/usbdevs

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



CVS commit: [netbsd-9] src/sys/dev/usb

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:34:40 UTC 2021

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1395):

sys/dev/usb/usbdevs: revision 1.799

add two more models of cyperpower UPS.


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.9 -r1.770.4.10 src/sys/dev/usb/usbdevs

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/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.770.4.9 src/sys/dev/usb/usbdevs:1.770.4.10
--- src/sys/dev/usb/usbdevs:1.770.4.9	Sat Oct 23 11:17:43 2021
+++ src/sys/dev/usb/usbdevs	Sun Dec 19 16:34:39 2021
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.9 2021/10/23 11:17:43 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1287,7 +1287,9 @@ product CMEDIA USBAUDIO		0x013c	USB Pnp 
 product CTX EX1300		0x	Ex1300 hub
 
 /* CyberPower Systems, Inc. products */
+product CYBERPOWER UPS0		0x0005	Uninterruptible Power Supply
 product CYBERPOWER UPS		0x0501	Uninterruptible Power Supply
+product CYBERPOWER UPS2		0x0601	Uninterruptible Power Supply
 
 /* CyberTAN Technology products */
 product CYBERTAN TG54USB	0x1666	TG54USB



CVS commit: [netbsd-9] src/sys/dev/raidframe

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:29:44 UTC 2021

Modified Files:
src/sys/dev/raidframe [netbsd-9]: rf_diskqueue.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1394):

sys/dev/raidframe/rf_diskqueue.c: revision 1.63 (patch)

call buf_destroy() after buf_init().  hopefully fixes the lockdebug
problem shown here:

   http://mail-index.netbsd.org/tech-kern/2021/12/10/msg027851.html

but seems unlikely to fix the original problem.

tested on i386/anita.  ok oster@

XXX: pullup-9 (netbsd-8 uses old APIs.)


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.1 -r1.55.4.2 src/sys/dev/raidframe/rf_diskqueue.c

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/raidframe/rf_diskqueue.c
diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.55.4.1 src/sys/dev/raidframe/rf_diskqueue.c:1.55.4.2
--- src/sys/dev/raidframe/rf_diskqueue.c:1.55.4.1	Tue Oct 19 10:55:15 2021
+++ src/sys/dev/raidframe/rf_diskqueue.c	Sun Dec 19 16:29:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_diskqueue.c,v 1.55.4.1 2021/10/19 10:55:15 martin Exp $	*/
+/*	$NetBSD: rf_diskqueue.c,v 1.55.4.2 2021/12/19 16:29:43 martin Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -66,7 +66,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.55.4.1 2021/10/19 10:55:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.55.4.2 2021/12/19 16:29:43 martin Exp $");
 
 #include 
 
@@ -413,6 +413,9 @@ rf_CreateDiskQueueData(RF_IoType_t typ, 
 void
 rf_FreeDiskQueueData(RF_DiskQueueData_t *p)
 {
+
+	buf_destroy(p->bp);
+
 	pool_put(_pools.bufio, p->bp);
 	pool_put(_pools.dqd, p);
 }



CVS commit: [netbsd-9] src/sys/dev/raidframe

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:29:44 UTC 2021

Modified Files:
src/sys/dev/raidframe [netbsd-9]: rf_diskqueue.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1394):

sys/dev/raidframe/rf_diskqueue.c: revision 1.63 (patch)

call buf_destroy() after buf_init().  hopefully fixes the lockdebug
problem shown here:

   http://mail-index.netbsd.org/tech-kern/2021/12/10/msg027851.html

but seems unlikely to fix the original problem.

tested on i386/anita.  ok oster@

XXX: pullup-9 (netbsd-8 uses old APIs.)


To generate a diff of this commit:
cvs rdiff -u -r1.55.4.1 -r1.55.4.2 src/sys/dev/raidframe/rf_diskqueue.c

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



CVS commit: src/sys/modules/viadrmums

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 16:01:29 UTC 2021

Modified Files:
src/sys/modules/viadrmums: Makefile

Log Message:
Fix i386 modules build: viadrmums requires CONFIG_DRM_LEGACY.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/modules/viadrmums/Makefile

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



CVS commit: src/sys/modules/viadrmums

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 16:01:29 UTC 2021

Modified Files:
src/sys/modules/viadrmums: Makefile

Log Message:
Fix i386 modules build: viadrmums requires CONFIG_DRM_LEGACY.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/modules/viadrmums/Makefile

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

Modified files:

Index: src/sys/modules/viadrmums/Makefile
diff -u src/sys/modules/viadrmums/Makefile:1.4 src/sys/modules/viadrmums/Makefile:1.5
--- src/sys/modules/viadrmums/Makefile:1.4	Sun Sep 29 23:45:00 2019
+++ src/sys/modules/viadrmums/Makefile	Sun Dec 19 16:01:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2019/09/29 23:45:00 mrg Exp $
+# $NetBSD: Makefile,v 1.5 2021/12/19 16:01:29 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -9,6 +9,8 @@ IOCONF=	viadrmums.ioconf
 CPPFLAGS+=	-I${S}/external/bsd/drm2/dist/drm/via
 CPPFLAGS+=	-I${S}/external/bsd/drm2/via
 
+CPPFLAGS+=	-DCONFIG_DRM_LEGACY
+
 .PATH:	${S}/external/bsd/drm2/via
 .PATH:	${S}/external/bsd/drm2/dist/drm/via
 



CVS commit: src/sys/external/bsd/drm2/include/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:50 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/include/linux: sched.h

Log Message:
linux: Define need_resched as alias for preempt_needed.

No need to open-code this (nor to do it slightly wrong).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/include/linux/sched.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/external/bsd/drm2/include/linux/sched.h
diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.21 src/sys/external/bsd/drm2/include/linux/sched.h:1.22
--- src/sys/external/bsd/drm2/include/linux/sched.h:1.21	Sun Dec 19 12:35:54 2021
+++ src/sys/external/bsd/drm2/include/linux/sched.h	Sun Dec 19 12:45:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched.h,v 1.21 2021/12/19 12:35:54 riastradh Exp $	*/
+/*	$NetBSD: sched.h,v 1.22 2021/12/19 12:45:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -97,9 +97,8 @@ schedule_timeout_uninterruptible(long ti
 static inline bool
 need_resched(void)
 {
-	/* XXX kpreempt_disable */
-	/* XXX ci_want_resched */
-	return (curcpu()->ci_schedstate.spc_flags & SPCF_SHOULDYIELD);
+
+	return preempt_needed();
 }
 
 static inline void



CVS commit: src/sys/external/bsd/drm2/include/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:50 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/include/linux: sched.h

Log Message:
linux: Define need_resched as alias for preempt_needed.

No need to open-code this (nor to do it slightly wrong).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/include/linux/sched.h

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:43 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_phys.c

Log Message:
i915: Use BUS_DMA_COHERENT where Linux uses dma_alloc_coherent.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c:1.7	Sun Dec 19 12:10:42 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c	Sun Dec 19 12:45:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_phys.c,v 1.7 2021/12/19 12:10:42 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_phys.c,v 1.8 2021/12/19 12:45:43 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_phys.c,v 1.7 2021/12/19 12:10:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_phys.c,v 1.8 2021/12/19 12:45:43 riastradh Exp $");
 
 #include 
 #include 
@@ -66,7 +66,8 @@ static int i915_gem_object_get_pages_phy
 		return -ENOMEM;
 	KASSERT(rsegs == 1);
 	ret = -bus_dmamem_map(dmat, >mm.u.phys.seg, 1,
-	roundup_pow_of_two(obj->base.size), , BUS_DMA_WAITOK);
+	roundup_pow_of_two(obj->base.size), ,
+	BUS_DMA_WAITOK|BUS_DMA_COHERENT);
 	if (ret)
 		goto err_pci;
 	obj->mm.u.phys.kva = vaddr;



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:43 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_phys.c

Log Message:
i915: Use BUS_DMA_COHERENT where Linux uses dma_alloc_coherent.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_phys.c

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



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:35 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: adjust the list of PCI devices to match

linux 5.6 drm supports all the cards previously listed as unsupported.
make those supported, and, add the newer list of unsupported (the
supported list goes to GTX 20 series.)

Author: phone 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

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

Modified files:

Index: src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.34 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.35
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.34	Sun Dec 19 12:28:12 2021
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Sun Dec 19 12:45:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.34 2021/12/19 12:28:12 riastradh Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.35 2021/12/19 12:45:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.34 2021/12/19 12:28:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.35 2021/12/19 12:45:35 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #if defined(__arm__) || defined(__aarch64__)
@@ -109,26 +109,19 @@ nouveau_pci_match(device_t parent, cfdat
 		return 0;
 
 	/*
-	 * NetBSD drm2 doesn't support Pascal, Volta or Turing based cards:
-	 *   0x1580-0x15ff 	GP100
-	 *   0x1b00-0x1b7f 	GP102
-	 *   0x1b80-0x1bff 	GP104
-	 *   0x1c00-0x1c7f 	GP106
-	 *   0x1c80-0x1cff 	GP107
-	 *   0x1d00-0x1d7f 	GP108
-	 *   0x1d80-0x1dff 	GV100
-	 *   0x1e00-0x1e7f 	TU102
-	 *   0x1e80-0x1eff 	TU104
-	 *   0x1f00-0x1f7f 	TU106
-	 *   0x1f80-0x1fff 	TU117
-	 *   0x2180-0x21ff 	TU116
+	 * NetBSD drm2/5.6 doesn't support Ampere (GTX 30 series) based cards:
+	 *   0x2080-0x20ff 	GA100
+	 *   0x2200-0x227f 	GA102
+	 *   0x2300-0x237f 	GA103
+	 *   0x2480-0x24ff 	GA104
+	 *   0x2500-0x257f 	GA106
+	 *   0x2580-0x25ff 	GA107
 	 *
-	 * reduce this to >= 1580, so that new chipsets not explictly
-	 * listed above will be picked up.
-	 *
-	 * XXX perhaps switch this to explicitly match known list.
+	 * TU116 (GTX 16xx) occupies the space from 0x2180-0x21ff.
 	 */
-	if (PCI_PRODUCT(pa->pa_id) >= 0x1580)
+	if (PCI_PRODUCT(pa->pa_id) >= 0x1fff && PCI_PRODUCT(pa->pa_id) < 0x2180)
+		return 0;
+	if (PCI_PRODUCT(pa->pa_id) >= 0x21ff)
 		return 0;
 
 	linux_pci_dev_init(, parent /* XXX bogus */, parent, pa, 0);



CVS commit: src/sys/external/bsd/drm2/nouveau

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:35 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
nouveau: adjust the list of PCI devices to match

linux 5.6 drm supports all the cards previously listed as unsupported.
make those supported, and, add the newer list of unsupported (the
supported list goes to GTX 20 series.)

Author: phone 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

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



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:27 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_vop.c

Log Message:
rkdrm: Implement atomic disable for planes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/rockchip/rk_vop.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_vop.c
diff -u src/sys/arch/arm/rockchip/rk_vop.c:1.14 src/sys/arch/arm/rockchip/rk_vop.c:1.15
--- src/sys/arch/arm/rockchip/rk_vop.c:1.14	Sun Dec 19 12:45:12 2021
+++ src/sys/arch/arm/rockchip/rk_vop.c	Sun Dec 19 12:45:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_vop.c,v 1.14 2021/12/19 12:45:12 riastradh Exp $ */
+/* $NetBSD: rk_vop.c,v 1.15 2021/12/19 12:45:27 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.14 2021/12/19 12:45:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.15 2021/12/19 12:45:27 riastradh Exp $");
 
 #include 
 #include 
@@ -344,9 +344,13 @@ rk_vop_plane_atomic_update(struct drm_pl
 }
 
 static void
-rk_vop_plane_atomic_disable(struct drm_plane *plane, struct drm_plane_state *state)
+rk_vop_plane_atomic_disable(struct drm_plane *plane,
+struct drm_plane_state *state)
 {
-	DRM_DEBUG_KMS("[PLANE:%s] disable TODO\n", plane->name);
+	struct rk_vop_plane *vop_plane = to_rk_vop_plane(plane);
+	struct rk_vop_softc * const sc = vop_plane->sc;
+
+	WR4(sc, VOP_WIN0_CTRL, 0);	/* clear WIN0_EN */
 }
 
 static const struct drm_plane_helper_funcs rk_vop_plane_helper_funcs = {



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:27 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_vop.c

Log Message:
rkdrm: Implement atomic disable for planes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/rockchip/rk_vop.c

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



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:20 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_fb.c

Log Message:
rkdrm: Turn display off and back on again at config_interrupts.

This grody kludge works around whatever we're doing wrong in the
initial modeset that causes it not to take.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_fb.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_fb.c
diff -u src/sys/arch/arm/rockchip/rk_fb.c:1.5 src/sys/arch/arm/rockchip/rk_fb.c:1.6
--- src/sys/arch/arm/rockchip/rk_fb.c:1.5	Sun Dec 19 12:28:27 2021
+++ src/sys/arch/arm/rockchip/rk_fb.c	Sun Dec 19 12:45:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_fb.c,v 1.5 2021/12/19 12:28:27 riastradh Exp $ */
+/* $NetBSD: rk_fb.c,v 1.6 2021/12/19 12:45:19 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_fb.c,v 1.5 2021/12/19 12:28:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_fb.c,v 1.6 2021/12/19 12:45:19 riastradh Exp $");
 
 #include 
 #include 
@@ -99,6 +99,25 @@ rk_fb_attach(device_t parent, device_t s
 }
 
 static void
+rk_fb_turnoffandbackonagain(device_t self)
+{
+	struct rk_fb_softc *sc = device_private(self);
+	struct rk_drmfb_attach_args * const sfa = >sc_sfa;
+
+	/*
+	 * This is a grody kludge to turn the display off and back on
+	 * again at boot; otherwise the initial modeset doesn't take.
+	 * This is surely a bug somewhere in rk_vop.c or nearby, but I
+	 * haven't been able to find it, and this gives us almost the
+	 * same effect.
+	 */
+	mutex_lock(>sfa_fb_helper->lock);
+	drm_client_modeset_dpms(>sfa_fb_helper->client, DRM_MODE_DPMS_OFF);
+	drm_client_modeset_dpms(>sfa_fb_helper->client, DRM_MODE_DPMS_ON);
+	mutex_unlock(>sfa_fb_helper->lock);
+}
+
+static void
 rk_fb_init(struct rk_drm_task *task)
 {
 	struct rk_fb_softc * const sc =
@@ -123,6 +142,8 @@ rk_fb_init(struct rk_drm_task *task)
 	}
 
 	pmf_device_register1(self, NULL, NULL, rk_fb_shutdown);
+
+	config_interrupts(self, rk_fb_turnoffandbackonagain);
 }
 
 static bool



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:20 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_fb.c

Log Message:
rkdrm: Turn display off and back on again at config_interrupts.

This grody kludge works around whatever we're doing wrong in the
initial modeset that causes it not to take.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_fb.c

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



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:12 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_vop.c

Log Message:
rkdrm: Reset vop for 10us on attach.

This avoids creepy lines slowly appearing, and freezing themselves
semipermanently on the display, until the first successful modeset.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/rockchip/rk_vop.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_vop.c
diff -u src/sys/arch/arm/rockchip/rk_vop.c:1.13 src/sys/arch/arm/rockchip/rk_vop.c:1.14
--- src/sys/arch/arm/rockchip/rk_vop.c:1.13	Sun Dec 19 12:43:37 2021
+++ src/sys/arch/arm/rockchip/rk_vop.c	Sun Dec 19 12:45:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_vop.c,v 1.13 2021/12/19 12:43:37 riastradh Exp $ */
+/* $NetBSD: rk_vop.c,v 1.14 2021/12/19 12:45:12 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.13 2021/12/19 12:43:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.14 2021/12/19 12:45:12 riastradh Exp $");
 
 #include 
 #include 
@@ -624,13 +624,25 @@ rk_vop_attach(device_t parent, device_t 
 
 	fdtbus_clock_assign(phandle);
 
+	/* assert all the reset signals for 20us */
+	for (n = 0; n < __arraycount(reset_names); n++) {
+		rst = fdtbus_reset_get(phandle, reset_names[n]);
+		if (rst == NULL || fdtbus_reset_assert(rst) != 0) {
+			aprint_error(": couldn't assert reset %s\n",
+			reset_names[n]);
+			return;
+		}
+	}
+	DELAY(10);
 	for (n = 0; n < __arraycount(reset_names); n++) {
 		rst = fdtbus_reset_get(phandle, reset_names[n]);
 		if (rst == NULL || fdtbus_reset_deassert(rst) != 0) {
-			aprint_error(": couldn't de-assert reset %s\n", reset_names[n]);
+			aprint_error(": couldn't de-assert reset %s\n",
+			reset_names[n]);
 			return;
 		}
 	}
+
 	for (n = 0; n < __arraycount(clock_names); n++) {
 		if (fdtbus_clock_enable(phandle, clock_names[n], true) != 0) {
 			aprint_error(": couldn't enable clock %s\n", clock_names[n]);



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:12 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_vop.c

Log Message:
rkdrm: Reset vop for 10us on attach.

This avoids creepy lines slowly appearing, and freezing themselves
semipermanently on the display, until the first successful modeset.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/rockchip/rk_vop.c

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



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:05 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_drm.c

Log Message:
rkdrm: Comment why we config_defer rk_drm_init.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/rockchip/rk_drm.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_drm.c
diff -u src/sys/arch/arm/rockchip/rk_drm.c:1.16 src/sys/arch/arm/rockchip/rk_drm.c:1.17
--- src/sys/arch/arm/rockchip/rk_drm.c:1.16	Sun Dec 19 12:43:37 2021
+++ src/sys/arch/arm/rockchip/rk_drm.c	Sun Dec 19 12:45:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_drm.c,v 1.16 2021/12/19 12:43:37 riastradh Exp $ */
+/* $NetBSD: rk_drm.c,v 1.17 2021/12/19 12:45:04 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.16 2021/12/19 12:43:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.17 2021/12/19 12:45:04 riastradh Exp $");
 
 #include 
 #include 
@@ -167,6 +167,10 @@ rk_drm_attach(device_t parent, device_t 
 
 	fdt_remove_bycompat(fb_compatible);
 
+	/*
+	 * Wait until rk_vop is attached as a sibling to this device --
+	 * we need that to actually display our framebuffer.
+	 */
 	config_defer(self, rk_drm_init);
 }
 



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:45:05 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_drm.c

Log Message:
rkdrm: Comment why we config_defer rk_drm_init.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/rockchip/rk_drm.c

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



CVS commit: src/sys/arch/arm/ti

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:58 UTC 2021

Modified Files:
src/sys/arch/arm/ti: ti_fb.c ti_lcdc.c ti_lcdc.h

Log Message:
drm: Do the attach task dance for ti lcdc drm.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/ti_fb.c \
src/sys/arch/arm/ti/ti_lcdc.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/ti/ti_lcdc.c

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

Modified files:

Index: src/sys/arch/arm/ti/ti_fb.c
diff -u src/sys/arch/arm/ti/ti_fb.c:1.2 src/sys/arch/arm/ti/ti_fb.c:1.3
--- src/sys/arch/arm/ti/ti_fb.c:1.2	Sun Dec 19 12:44:25 2021
+++ src/sys/arch/arm/ti/ti_fb.c	Sun Dec 19 12:44:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_fb.c,v 1.2 2021/12/19 12:44:25 riastradh Exp $ */
+/* $NetBSD: ti_fb.c,v 1.3 2021/12/19 12:44:57 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_fb.c,v 1.2 2021/12/19 12:44:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_fb.c,v 1.3 2021/12/19 12:44:57 riastradh Exp $");
 
 #include 
 #include 
@@ -46,6 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: ti_fb.c,v 1.
 static int	ti_fb_match(device_t, cfdata_t, void *);
 static void	ti_fb_attach(device_t, device_t, void *);
 
+static void	tilcdc_fb_init(struct tilcdc_drm_task *);
+
 static bool	ti_fb_shutdown(device_t, int);
 
 struct ti_fb_softc {
@@ -53,6 +55,7 @@ struct ti_fb_softc {
 	device_t		sc_dev;
 	struct tilcdc_framebuffer *sc_fb;
 	struct tilcdcfb_attach_args sc_tfa;
+	struct tilcdc_drm_task	sc_attach_task;
 };
 
 static paddr_t	ti_fb_mmapfb(struct drmfb_softc *, off_t, int);
@@ -78,7 +81,6 @@ ti_fb_attach(device_t parent, device_t s
 {
 	struct ti_fb_softc * const sc = device_private(self);
 	struct tilcdcfb_attach_args * const tfa = aux;
-	int error;
 
 	sc->sc_dev = self;
 	sc->sc_tfa = *tfa;
@@ -87,6 +89,18 @@ ti_fb_attach(device_t parent, device_t s
 	aprint_naive("\n");
 	aprint_normal("\n");
 
+	tilcdc_task_init(>sc_attach_task, _fb_init);
+	tilcdc_task_schedule(parent, >sc_attach_task);
+}
+
+static void
+tilcdc_fb_init(struct tilcdc_drm_task *task)
+{
+	struct ti_fb_softc *sc = container_of(task, struct ti_fb_softc,
+	sc_attach_task);
+	device_t self = sc->sc_dev;
+	struct tilcdcfb_attach_args * const tfa = >sc_tfa;
+
 #ifdef WSDISPLAY_MULTICONS
 	prop_dictionary_t dict = device_properties(self);
 	const bool is_console = true;
@@ -101,6 +115,7 @@ ti_fb_attach(device_t parent, device_t s
 		.da_fb_linebytes = tfa->tfa_fb_linebytes,
 		.da_params = _drmfb_params,
 	};
+	int error;
 
 	error = drmfb_attach(>sc_drmfb, );
 	if (error) {
Index: src/sys/arch/arm/ti/ti_lcdc.h
diff -u src/sys/arch/arm/ti/ti_lcdc.h:1.2 src/sys/arch/arm/ti/ti_lcdc.h:1.3
--- src/sys/arch/arm/ti/ti_lcdc.h:1.2	Sun Dec 19 12:44:25 2021
+++ src/sys/arch/arm/ti/ti_lcdc.h	Sun Dec 19 12:44:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_lcdc.h,v 1.2 2021/12/19 12:44:25 riastradh Exp $ */
+/* $NetBSD: ti_lcdc.h,v 1.3 2021/12/19 12:44:57 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -29,6 +29,8 @@
 #ifndef _ARM_TI_TI_LCDC_H
 #define _ARM_TI_TI_LCDC_H
 
+#include 
+
 #include 
 #include 
 #include 
@@ -74,6 +76,12 @@ struct tilcdc_softc {
 	struct clk		*sc_clk;
 	int			sc_phandle;
 
+	struct lwp			*sc_task_thread;
+	SIMPLEQ_HEAD(, tilcdc_drm_task)	sc_tasks;
+	struct workqueue		*sc_task_wq;
+
+	bool			sc_dev_registered;
+
 	struct tilcdc_crtc	sc_crtc;
 	struct tilcdc_encoder	sc_encoder;
 	struct tilcdc_vblank	sc_vbl;
@@ -99,6 +107,14 @@ struct tilcdcfb_attach_args {
 	uint32_t		tfa_fb_linebytes;
 };
 
+struct tilcdc_drm_task {
+	union {
+		SIMPLEQ_ENTRY(tilcdc_drm_task)	queue;
+		struct work			work;
+	}		tdt_u;
+	void		(*tdt_fn)(struct tilcdc_drm_task *);
+};
+
 #define tilcdc_private(ddev)		(ddev)->dev_private
 #define	to_tilcdc_framebuffer(x)	container_of(x, struct tilcdc_framebuffer, base)
 #define	to_tilcdc_crtc(x)		container_of(x, struct tilcdc_crtc, base)
@@ -108,4 +124,8 @@ struct tilcdcfb_attach_args {
 #define	WR4(sc, reg, val)		\
 	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
 
+void	tilcdc_task_init(struct tilcdc_drm_task *,
+	void (*)(struct tilcdc_drm_task *));
+void	tilcdc_task_schedule(device_t, struct tilcdc_drm_task *);
+
 #endif /* _ARM_TI_TI_LCDC_H */

Index: src/sys/arch/arm/ti/ti_lcdc.c
diff -u src/sys/arch/arm/ti/ti_lcdc.c:1.9 src/sys/arch/arm/ti/ti_lcdc.c:1.10
--- src/sys/arch/arm/ti/ti_lcdc.c:1.9	Sun Dec 19 12:44:25 2021
+++ src/sys/arch/arm/ti/ti_lcdc.c	Sun Dec 19 12:44:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_lcdc.c,v 1.9 2021/12/19 12:44:25 riastradh Exp $ */
+/* $NetBSD: ti_lcdc.c,v 1.10 2021/12/19 12:44:57 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 1.9 2021/12/19 12:44:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/arch/arm/ti

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:58 UTC 2021

Modified Files:
src/sys/arch/arm/ti: ti_fb.c ti_lcdc.c ti_lcdc.h

Log Message:
drm: Do the attach task dance for ti lcdc drm.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/ti_fb.c \
src/sys/arch/arm/ti/ti_lcdc.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/ti/ti_lcdc.c

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



CVS commit: src/sys/arch/arm/nvidia

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:50 UTC 2021

Modified Files:
src/sys/arch/arm/nvidia: tegra_drm.c tegra_drm.h tegra_fb.c

Log Message:
drm: Do the attach task dance for tegra drm.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/nvidia/tegra_drm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/nvidia/tegra_drm.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra_fb.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_drm.c
diff -u src/sys/arch/arm/nvidia/tegra_drm.c:1.13 src/sys/arch/arm/nvidia/tegra_drm.c:1.14
--- src/sys/arch/arm/nvidia/tegra_drm.c:1.13	Sun Dec 19 12:44:14 2021
+++ src/sys/arch/arm/nvidia/tegra_drm.c	Sun Dec 19 12:44:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm.c,v 1.13 2021/12/19 12:44:14 riastradh Exp $ */
+/* $NetBSD: tegra_drm.c,v 1.14 2021/12/19 12:44:50 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,v 1.13 2021/12/19 12:44:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,v 1.14 2021/12/19 12:44:50 riastradh Exp $");
 
 #include 
 #include 
@@ -55,6 +55,8 @@ static void	tegra_drm_attach(device_t, d
 static int	tegra_drm_load(struct drm_device *, unsigned long);
 static void	tegra_drm_unload(struct drm_device *);
 
+static void	tegra_drm_task_work(struct work *, void *);
+
 static struct drm_driver tegra_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM,
 	.dev_priv_size = 0,
@@ -123,6 +125,14 @@ tegra_drm_attach(device_t parent, device
 	sc->sc_dmat = faa->faa_dmat;
 	sc->sc_bst = faa->faa_bst;
 	sc->sc_phandle = faa->faa_phandle;
+	sc->sc_task_thread = NULL;
+	SIMPLEQ_INIT(>sc_tasks);
+	if (workqueue_create(>sc_task_wq, "tegradrm",
+	_drm_task_work, NULL, PRI_NONE, IPL_NONE, WQ_MPSAFE)) {
+		aprint_error_dev(self, "unable to create workqueue\n");
+		sc->sc_task_wq = NULL;
+		return;
+	}
 
 	aprint_naive("\n");
 	aprint_normal("\n");
@@ -204,19 +214,43 @@ tegra_drm_attach(device_t parent, device
 	sc->sc_ddev->dmat = sc->sc_ddev->bus_dmat;
 	sc->sc_ddev->dmat_subregion_p = false;
 
+	/*
+	 * Cause any tasks issued synchronously during attach to be
+	 * processed at the end of this function.
+	 */
+	sc->sc_task_thread = curlwp;
+
 	error = -drm_dev_register(sc->sc_ddev, 0);
 	if (error) {
 		drm_dev_put(sc->sc_ddev);
+		sc->sc_ddev = NULL;
 		aprint_error_dev(self, "couldn't register DRM device: %d\n",
 		error);
-		return;
+		goto out;
 	}
+	sc->sc_dev_registered = true;
 
 	aprint_normal_dev(self, "initialized %s %d.%d.%d %s on minor %d\n",
 	driver->name, driver->major, driver->minor, driver->patchlevel,
 	driver->date, sc->sc_ddev->primary->index);
 
-	return;
+	/*
+	 * Process asynchronous tasks queued synchronously during
+	 * attach.  This will be for display detection to attach a
+	 * framebuffer, so we have the opportunity for a console device
+	 * to attach before autoconf has completed, in time for init(8)
+	 * to find that console without panicking.
+	 */
+	while (!SIMPLEQ_EMPTY(>sc_tasks)) {
+		struct tegra_drm_task *const task =
+		SIMPLEQ_FIRST(>sc_tasks);
+
+		SIMPLEQ_REMOVE_HEAD(>sc_tasks, tdt_u.queue);
+		(*task->tdt_fn)(task);
+	}
+
+out:	/* Cause any subesquent tasks to be processed by the workqueue.  */
+	atomic_store_relaxed(>sc_task_thread, NULL);
 }
 
 static int
@@ -246,3 +280,31 @@ tegra_drm_unload(struct drm_device *ddev
 
 	drm_mode_config_cleanup(ddev);
 }
+
+static void
+tegra_drm_task_work(struct work *work, void *cookie)
+{
+	struct tegra_drm_task *task = container_of(work, struct tegra_drm_task,
+	tdt_u.work);
+
+	(*task->tdt_fn)(task);
+}
+
+void
+tegra_task_init(struct tegra_drm_task *task,
+void (*fn)(struct tegra_drm_task *))
+{
+
+	task->tdt_fn = fn;
+}
+
+void
+tegra_task_schedule(device_t self, struct tegra_drm_task *task)
+{
+	struct tegra_drm_softc *sc = device_private(self);
+
+	if (atomic_load_relaxed(>sc_task_thread) == curlwp)
+		SIMPLEQ_INSERT_TAIL(>sc_tasks, task, tdt_u.queue);
+	else
+		workqueue_enqueue(sc->sc_task_wq, >tdt_u.work, NULL);
+}

Index: src/sys/arch/arm/nvidia/tegra_drm.h
diff -u src/sys/arch/arm/nvidia/tegra_drm.h:1.10 src/sys/arch/arm/nvidia/tegra_drm.h:1.11
--- src/sys/arch/arm/nvidia/tegra_drm.h:1.10	Sun Dec 19 12:44:14 2021
+++ src/sys/arch/arm/nvidia/tegra_drm.h	Sun Dec 19 12:44:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm.h,v 1.10 2021/12/19 12:44:14 riastradh Exp $ */
+/* $NetBSD: tegra_drm.h,v 1.11 2021/12/19 12:44:50 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,6 +29,8 @@
 #ifndef _ARM_TEGRA_DRM_H
 #define _ARM_TEGRA_DRM_H
 
+#include 
+
 #include 
 #include 
 #include 
@@ -54,6 +56,12 @@ struct tegra_drm_softc {
 
 	int			sc_phandle;
 
+	struct lwp			*sc_task_thread;
+	SIMPLEQ_HEAD(, tegra_drm_task)	sc_tasks;
+	struct workqueue	

CVS commit: src/sys/arch/arm/nvidia

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:50 UTC 2021

Modified Files:
src/sys/arch/arm/nvidia: tegra_drm.c tegra_drm.h tegra_fb.c

Log Message:
drm: Do the attach task dance for tegra drm.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/nvidia/tegra_drm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/nvidia/tegra_drm.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/nvidia/tegra_fb.c

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



CVS commit: src/sys/external/bsd

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:43 UTC 2021

Modified Files:
src/sys/external/bsd/common/linux: linux_tasklet.c
src/sys/external/bsd/drm2/include/linux: interrupt.h

Log Message:
drm: Sprinkle miscellaneous includes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/common/linux/linux_tasklet.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/interrupt.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/external/bsd/common/linux/linux_tasklet.c
diff -u src/sys/external/bsd/common/linux/linux_tasklet.c:1.8 src/sys/external/bsd/common/linux/linux_tasklet.c:1.9
--- src/sys/external/bsd/common/linux/linux_tasklet.c:1.8	Sun Dec 19 11:57:34 2021
+++ src/sys/external/bsd/common/linux/linux_tasklet.c	Sun Dec 19 12:44:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_tasklet.c,v 1.8 2021/12/19 11:57:34 riastradh Exp $	*/
+/*	$NetBSD: linux_tasklet.c,v 1.9 2021/12/19 12:44:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018, 2020, 2021 The NetBSD Foundation, Inc.
@@ -30,9 +30,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.8 2021/12/19 11:57:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.9 2021/12/19 12:44:43 riastradh Exp $");
 
+#include 
 #include 
+
 #include 
 #include 
 #include 

Index: src/sys/external/bsd/drm2/include/linux/interrupt.h
diff -u src/sys/external/bsd/drm2/include/linux/interrupt.h:1.9 src/sys/external/bsd/drm2/include/linux/interrupt.h:1.10
--- src/sys/external/bsd/drm2/include/linux/interrupt.h:1.9	Sun Dec 19 11:33:49 2021
+++ src/sys/external/bsd/drm2/include/linux/interrupt.h	Sun Dec 19 12:44:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: interrupt.h,v 1.9 2021/12/19 11:33:49 riastradh Exp $	*/
+/*	$NetBSD: interrupt.h,v 1.10 2021/12/19 12:44:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,9 @@
 #ifndef _LINUX_INTERRUPT_H_
 #define _LINUX_INTERRUPT_H_
 
+#include 
+#include 
+
 #include 
 
 #include 



CVS commit: src/sys/external/bsd

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:43 UTC 2021

Modified Files:
src/sys/external/bsd/common/linux: linux_tasklet.c
src/sys/external/bsd/drm2/include/linux: interrupt.h

Log Message:
drm: Sprinkle miscellaneous includes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/common/linux/linux_tasklet.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/interrupt.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/i2c

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:35 UTC 2021

Modified Files:
src/sys/dev/i2c: tda19988.c

Log Message:
drm: Fix tda19988 drm build.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/tda19988.c

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/i2c/tda19988.c
diff -u src/sys/dev/i2c/tda19988.c:1.7 src/sys/dev/i2c/tda19988.c:1.8
--- src/sys/dev/i2c/tda19988.c:1.7	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/tda19988.c	Sun Dec 19 12:44:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tda19988.c,v 1.7 2021/01/27 02:29:48 thorpej Exp $ */
+/* $NetBSD: tda19988.c,v 1.8 2021/12/19 12:44:34 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Oleksandr Tymoshenko 
@@ -27,10 +27,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tda19988.c,v 1.7 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tda19988.c,v 1.8 2021/12/19 12:44:34 riastradh Exp $");
 
 /*
-* NXP TDA19988 HDMI encoder 
+* NXP TDA19988 HDMI encoder
 */
 #include 
 #include 
@@ -49,10 +49,12 @@ __KERNEL_RCSID(0, "$NetBSD: tda19988.c,v
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 enum {
 	TDA19988_PORT_INPUT = 0
@@ -729,7 +731,6 @@ tda19988_connector_get_modes(struct drm_
 	struct tda19988_connector *tda_connector = to_tda_connector(connector);
 	struct tda19988_softc * const sc = tda_connector->sc;
 	struct edid *pedid = NULL;
-	int error;
 
 	if (sc->sc_edid_valid) {
 		pedid = (struct edid *)sc->sc_edid;
@@ -741,37 +742,15 @@ tda19988_connector_get_modes(struct drm_
 		sc->sc_edid_valid = true;
 	}
 
-	drm_mode_connector_update_edid_property(connector, pedid);
+	drm_connector_update_edid_property(connector, pedid);
 	if (pedid == NULL)
 		return 0;
 
-	error = drm_add_edid_modes(connector, pedid);
-	drm_edid_to_eld(connector, pedid);
-
-	return error;
-}
-
-static struct drm_encoder *
-tda19988_connector_best_encoder(struct drm_connector *connector)
-{
-	int enc_id = connector->encoder_ids[0];
-	struct drm_mode_object *obj;
-	struct drm_encoder *encoder = NULL;
-
-	if (enc_id) {
-		obj = drm_mode_object_find(connector->dev, enc_id,
-		DRM_MODE_OBJECT_ENCODER);
-		if (obj == NULL)
-			return NULL;
-		encoder = obj_to_encoder(obj);
-	}
-
-	return encoder;
+	return drm_add_edid_modes(connector, pedid);
 }
 
 static const struct drm_connector_helper_funcs tda19988_connector_helper_funcs = {
 	.get_modes = tda19988_connector_get_modes,
-	.best_encoder = tda19988_connector_best_encoder,
 };
 
 static int
@@ -792,8 +771,8 @@ tda19988_bridge_attach(struct drm_bridge
 	DRM_MODE_CONNECTOR_HDMIA);
 	drm_connector_helper_add(connector, _connector_helper_funcs);
 
-	error = drm_mode_connector_attach_encoder(connector, bridge->encoder);
-	if (error != 0)
+	error = drm_connector_attach_encoder(connector, bridge->encoder);
+	if (error)
 		return error;
 
 	return drm_connector_register(connector);
@@ -827,7 +806,8 @@ tda19988_bridge_post_disable(struct drm_
 
 static void
 tda19988_bridge_mode_set(struct drm_bridge *bridge,
-struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
+const struct drm_display_mode *mode,
+const struct drm_display_mode *adjusted_mode)
 {
 	struct tda19988_softc * const sc = bridge->driver_private;
 
@@ -882,12 +862,10 @@ tda19988_ep_activate(device_t dev, struc
 	sc->sc_bridge.driver_private = sc;
 	sc->sc_bridge.funcs = _bridge_funcs;
 	sc->sc_bridge.encoder = encoder;
-	error = drm_bridge_attach(encoder->dev, >sc_bridge);
-	if (error != 0)
+	error = drm_bridge_attach(encoder, >sc_bridge, NULL);
+	if (error)
 		return EIO;
 
-	encoder->bridge = >sc_bridge;
-
 	return 0;
 }
 



CVS commit: src/sys/dev/i2c

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:35 UTC 2021

Modified Files:
src/sys/dev/i2c: tda19988.c

Log Message:
drm: Fix tda19988 drm build.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/tda19988.c

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



CVS commit: src/sys/arch/arm/ti

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:25 UTC 2021

Modified Files:
src/sys/arch/arm/ti: ti_fb.c ti_lcdc.c ti_lcdc.h

Log Message:
drm: Fix arm/ti drm build.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_fb.c \
src/sys/arch/arm/ti/ti_lcdc.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/ti/ti_lcdc.c

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

Modified files:

Index: src/sys/arch/arm/ti/ti_fb.c
diff -u src/sys/arch/arm/ti/ti_fb.c:1.1 src/sys/arch/arm/ti/ti_fb.c:1.2
--- src/sys/arch/arm/ti/ti_fb.c:1.1	Sun Nov  3 22:59:06 2019
+++ src/sys/arch/arm/ti/ti_fb.c	Sun Dec 19 12:44:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_fb.c,v 1.1 2019/11/03 22:59:06 jmcneill Exp $ */
+/* $NetBSD: ti_fb.c,v 1.2 2021/12/19 12:44:25 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_fb.c,v 1.1 2019/11/03 22:59:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_fb.c,v 1.2 2021/12/19 12:44:25 riastradh Exp $");
 
 #include 
 #include 
@@ -38,7 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: ti_fb.c,v 1.
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 #include 
@@ -62,7 +62,6 @@ static int	ti_fb_ioctl(struct drmfb_soft
 static const struct drmfb_params tifb_drmfb_params = {
 	.dp_mmapfb = ti_fb_mmapfb,
 	.dp_ioctl = ti_fb_ioctl,
-	
 };
 
 CFATTACH_DECL_NEW(ti_fb, sizeof(struct ti_fb_softc),
Index: src/sys/arch/arm/ti/ti_lcdc.h
diff -u src/sys/arch/arm/ti/ti_lcdc.h:1.1 src/sys/arch/arm/ti/ti_lcdc.h:1.2
--- src/sys/arch/arm/ti/ti_lcdc.h:1.1	Sun Nov  3 22:59:06 2019
+++ src/sys/arch/arm/ti/ti_lcdc.h	Sun Dec 19 12:44:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_lcdc.h,v 1.1 2019/11/03 22:59:06 jmcneill Exp $ */
+/* $NetBSD: ti_lcdc.h,v 1.2 2021/12/19 12:44:25 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -29,6 +29,7 @@
 #ifndef _ARM_TI_TI_LCDC_H
 #define _ARM_TI_TI_LCDC_H
 
+#include 
 #include 
 #include 
 

Index: src/sys/arch/arm/ti/ti_lcdc.c
diff -u src/sys/arch/arm/ti/ti_lcdc.c:1.8 src/sys/arch/arm/ti/ti_lcdc.c:1.9
--- src/sys/arch/arm/ti/ti_lcdc.c:1.8	Sun Dec 19 11:01:21 2021
+++ src/sys/arch/arm/ti/ti_lcdc.c	Sun Dec 19 12:44:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_lcdc.c,v 1.8 2021/12/19 11:01:21 riastradh Exp $ */
+/* $NetBSD: ti_lcdc.c,v 1.9 2021/12/19 12:44:25 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 1.8 2021/12/19 11:01:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 1.9 2021/12/19 12:44:25 riastradh Exp $");
 
 #include 
 #include 
@@ -41,11 +41,12 @@ __KERNEL_RCSID(0, "$NetBSD: ti_lcdc.c,v 
 #include 
 #include 
 
-#include 
 #include 
 #include 
-#include 
+#include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -66,13 +67,11 @@ enum {
 static int	tilcdc_match(device_t, cfdata_t, void *);
 static void	tilcdc_attach(device_t, device_t, void *);
 
-static int	tilcdc_set_busid(struct drm_device *, struct drm_master *);
-
 static int	tilcdc_load(struct drm_device *, unsigned long);
-static int	tilcdc_unload(struct drm_device *);
+static void	tilcdc_unload(struct drm_device *);
 
 static struct drm_driver tilcdc_driver = {
-	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
+	.driver_features = DRIVER_MODESET | DRIVER_GEM,
 	.dev_priv_size = 0,
 	.load = tilcdc_load,
 	.unload = tilcdc_unload,
@@ -82,8 +81,6 @@ static struct drm_driver tilcdc_driver =
 	.gem_uvm_ops = _gem_cma_uvm_ops,
 
 	.dumb_create = drm_gem_cma_dumb_create,
-	.dumb_map_offset = drm_gem_cma_dumb_map_offset,
-	.dumb_destroy = drm_gem_dumb_destroy,
 
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
@@ -91,8 +88,6 @@ static struct drm_driver tilcdc_driver =
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-
-	.set_busid = tilcdc_set_busid,
 };
 
 CFATTACH_DECL_NEW(ti_lcdc, sizeof(struct tilcdc_softc),
@@ -353,8 +348,9 @@ tilcdc_ep_activate(device_t dev, struct 
 	sc->sc_encoder.base.possible_crtcs = 1 << drm_crtc_index(>sc_crtc.base);
 
 	drm_encoder_init(ddev, >sc_encoder.base, _encoder_funcs,
-	DRM_MODE_ENCODER_TMDS);
-	drm_encoder_helper_add(>sc_encoder.base, _encoder_helper_funcs);
+	DRM_MODE_ENCODER_TMDS, NULL);
+	drm_encoder_helper_add(>sc_encoder.base,
+	_encoder_helper_funcs);
 
 	return fdt_endpoint_activate(ep, activate);
 }
@@ -432,7 +428,7 @@ tilcdc_attach(device_t parent, device_t 
 
 	error = -drm_dev_register(sc->sc_ddev, 0);
 	if (error) {
-		drm_dev_unref(sc->sc_ddev);
+		drm_dev_put(sc->sc_ddev);
 		aprint_error_dev(self, "couldn't register DRM device: %d\n",
 		error);
 		return;
@@ -444,23 +440,6 @@ tilcdc_attach(device_t parent, device_t 
 }
 
 static int
-tilcdc_set_busid(struct drm_device *ddev, struct drm_master *master)
-{
-	struct tilcdc_softc * const sc = 

CVS commit: src/sys/arch/arm/ti

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:25 UTC 2021

Modified Files:
src/sys/arch/arm/ti: ti_fb.c ti_lcdc.c ti_lcdc.h

Log Message:
drm: Fix arm/ti drm build.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_fb.c \
src/sys/arch/arm/ti/ti_lcdc.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/ti/ti_lcdc.c

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



CVS commit: src/sys/arch/arm/nvidia

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:14 UTC 2021

Modified Files:
src/sys/arch/arm/nvidia: tegra_drm.c tegra_drm.h tegra_drm_fb.c
tegra_drm_mode.c tegra_fb.c

Log Message:
drm: Make tegra drm build again.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra_drm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/nvidia/tegra_drm.h \
src/sys/arch/arm/nvidia/tegra_drm_fb.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/nvidia/tegra_drm_mode.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nvidia/tegra_fb.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_drm.c
diff -u src/sys/arch/arm/nvidia/tegra_drm.c:1.12 src/sys/arch/arm/nvidia/tegra_drm.c:1.13
--- src/sys/arch/arm/nvidia/tegra_drm.c:1.12	Sun Dec 19 11:01:21 2021
+++ src/sys/arch/arm/nvidia/tegra_drm.c	Sun Dec 19 12:44:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm.c,v 1.12 2021/12/19 11:01:21 riastradh Exp $ */
+/* $NetBSD: tegra_drm.c,v 1.13 2021/12/19 12:44:14 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,v 1.12 2021/12/19 11:01:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,v 1.13 2021/12/19 12:44:14 riastradh Exp $");
 
 #include 
 #include 
@@ -40,7 +40,8 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,
 #include 
 #include 
 
-#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -51,10 +52,8 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,
 static int	tegra_drm_match(device_t, cfdata_t, void *);
 static void	tegra_drm_attach(device_t, device_t, void *);
 
-static int	tegra_drm_set_busid(struct drm_device *, struct drm_master *);
-
 static int	tegra_drm_load(struct drm_device *, unsigned long);
-static int	tegra_drm_unload(struct drm_device *);
+static void	tegra_drm_unload(struct drm_device *);
 
 static struct drm_driver tegra_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM,
@@ -67,8 +66,6 @@ static struct drm_driver tegra_drm_drive
 	.gem_uvm_ops = _gem_cma_uvm_ops,
 
 	.dumb_create = drm_gem_cma_dumb_create,
-	.dumb_map_offset = drm_gem_cma_dumb_map_offset,
-	.dumb_destroy = drm_gem_dumb_destroy,
 
 	.get_vblank_counter = tegra_drm_get_vblank_counter,
 	.enable_vblank = tegra_drm_enable_vblank,
@@ -80,8 +77,6 @@ static struct drm_driver tegra_drm_drive
 	.major = DRIVER_MAJOR,
 	.minor = DRIVER_MINOR,
 	.patchlevel = DRIVER_PATCHLEVEL,
-
-	.set_busid = tegra_drm_set_busid,
 };
 
 CFATTACH_DECL_NEW(tegra_drm, sizeof(struct tegra_drm_softc),
@@ -211,7 +206,7 @@ tegra_drm_attach(device_t parent, device
 
 	error = -drm_dev_register(sc->sc_ddev, 0);
 	if (error) {
-		drm_dev_unref(sc->sc_ddev);
+		drm_dev_put(sc->sc_ddev);
 		aprint_error_dev(self, "couldn't register DRM device: %d\n",
 		error);
 		return;
@@ -225,21 +220,6 @@ tegra_drm_attach(device_t parent, device
 }
 
 static int
-tegra_drm_set_busid(struct drm_device *ddev, struct drm_master *master)
-{
-	const char *id = "platform:tegra:0";
-
-	master->unique = kzalloc(strlen(id) + 1, GFP_KERNEL);
-	if (master->unique == NULL)
-		return -ENOMEM;
-	strcpy(master->unique, id);
-	master->unique_len = strlen(master->unique);
-
-	return 0;
-}
-
-
-static int
 tegra_drm_load(struct drm_device *ddev, unsigned long flags)
 {
 	int error;
@@ -260,10 +240,9 @@ drmerr:
 	return error;
 }
 
-static int
+static void
 tegra_drm_unload(struct drm_device *ddev)
 {
-	drm_mode_config_cleanup(ddev);
 
-	return 0;
+	drm_mode_config_cleanup(ddev);
 }

Index: src/sys/arch/arm/nvidia/tegra_drm.h
diff -u src/sys/arch/arm/nvidia/tegra_drm.h:1.9 src/sys/arch/arm/nvidia/tegra_drm.h:1.10
--- src/sys/arch/arm/nvidia/tegra_drm.h:1.9	Mon Aug 27 15:31:51 2018
+++ src/sys/arch/arm/nvidia/tegra_drm.h	Sun Dec 19 12:44:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm.h,v 1.9 2018/08/27 15:31:51 riastradh Exp $ */
+/* $NetBSD: tegra_drm.h,v 1.10 2021/12/19 12:44:14 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,6 +29,7 @@
 #ifndef _ARM_TEGRA_DRM_H
 #define _ARM_TEGRA_DRM_H
 
+#include 
 #include 
 #include 
 
Index: src/sys/arch/arm/nvidia/tegra_drm_fb.c
diff -u src/sys/arch/arm/nvidia/tegra_drm_fb.c:1.9 src/sys/arch/arm/nvidia/tegra_drm_fb.c:1.10
--- src/sys/arch/arm/nvidia/tegra_drm_fb.c:1.9	Sat Aug  7 16:18:44 2021
+++ src/sys/arch/arm/nvidia/tegra_drm_fb.c	Sun Dec 19 12:44:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm_fb.c,v 1.9 2021/08/07 16:18:44 thorpej Exp $ */
+/* $NetBSD: tegra_drm_fb.c,v 1.10 2021/12/19 12:44:14 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,12 +27,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_drm_fb.c,v 1.9 2021/08/07 16:18:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_drm_fb.c,v 1.10 2021/12/19 12:44:14 riastradh Exp $");
 
-#include 
 #include 
-#include 
 #include 
+#include 
+#include 

CVS commit: src/sys/arch/arm/nvidia

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:14 UTC 2021

Modified Files:
src/sys/arch/arm/nvidia: tegra_drm.c tegra_drm.h tegra_drm_fb.c
tegra_drm_mode.c tegra_fb.c

Log Message:
drm: Make tegra drm build again.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra_drm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/nvidia/tegra_drm.h \
src/sys/arch/arm/nvidia/tegra_drm_fb.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/nvidia/tegra_drm_mode.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nvidia/tegra_fb.c

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



CVS commit: src/sys/external/bsd/drm2/dist

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:04 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_edid.c
src/sys/external/bsd/drm2/dist/include/drm: drm_connector.h

Log Message:
drm: Restore local patch for struct drm_connector::physical_address.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/dist/drm/drm_edid.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/include/drm/drm_connector.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/external/bsd/drm2/dist/drm/drm_edid.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.14 src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.15
--- src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.14	Sun Dec 19 09:46:13 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_edid.c	Sun Dec 19 12:44:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_edid.c,v 1.14 2021/12/19 09:46:13 riastradh Exp $	*/
+/*	$NetBSD: drm_edid.c,v 1.15 2021/12/19 12:44:04 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Luc Verhaegen (quirks list)
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v 1.14 2021/12/19 09:46:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v 1.15 2021/12/19 12:44:04 riastradh Exp $");
 
 #include 
 #include 
@@ -4267,6 +4267,9 @@ drm_parse_hdmi_vsdb_audio(struct drm_con
 {
 	u8 len = cea_db_payload_len(db);
 
+	if (len >= 5) {
+		connector->physical_address = (db[4] << 8) | db[5];
+	}
 	if (len >= 6 && (db[6] & (1 << 7)))
 		connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_SUPPORTS_AI;
 	if (len >= 8) {

Index: src/sys/external/bsd/drm2/dist/include/drm/drm_connector.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_connector.h:1.4 src/sys/external/bsd/drm2/dist/include/drm/drm_connector.h:1.5
--- src/sys/external/bsd/drm2/dist/include/drm/drm_connector.h:1.4	Sun Dec 19 09:43:13 2021
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_connector.h	Sun Dec 19 12:44:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_connector.h,v 1.4 2021/12/19 09:43:13 riastradh Exp $	*/
+/*	$NetBSD: drm_connector.h,v 1.5 2021/12/19 12:44:04 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2016 Intel Corporation
@@ -1317,6 +1317,9 @@ struct drm_connector {
 	 */
 	struct drm_encoder *encoder;
 
+	/** @physical_address: HDMI physical address */
+	uint16_t physical_address;
+
 #define MAX_ELD_BYTES	128
 	/** @eld: EDID-like data, if present */
 	uint8_t eld[MAX_ELD_BYTES];



CVS commit: src/sys/external/bsd/drm2/dist

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:44:04 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_edid.c
src/sys/external/bsd/drm2/dist/include/drm: drm_connector.h

Log Message:
drm: Restore local patch for struct drm_connector::physical_address.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/dist/drm/drm_edid.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/include/drm/drm_connector.h

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



CVS commit: src/sys/external/bsd/drm2/dist/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:53 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_atomic_helper.c

Log Message:
drm: Allow drm_atomic_helper_wait_for_vblanks while cold.

This enables us to do a mode-switch before interrupts are running.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c:1.9 src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c:1.9	Sun Dec 19 12:05:08 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c	Sun Dec 19 12:43:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_atomic_helper.c,v 1.9 2021/12/19 12:05:08 riastradh Exp $	*/
+/*	$NetBSD: drm_atomic_helper.c,v 1.10 2021/12/19 12:43:52 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2014 Red Hat
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_atomic_helper.c,v 1.9 2021/12/19 12:05:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_atomic_helper.c,v 1.10 2021/12/19 12:43:52 riastradh Exp $");
 
 #include 
 #include 
@@ -1466,13 +1466,27 @@ drm_atomic_helper_wait_for_vblanks(struc
 			continue;
 
 #ifdef __NetBSD__
-		spin_lock(>event_lock);
-		DRM_SPIN_WAIT_ON(ret, >vblank[i].queue,
-		>event_lock,
-		msecs_to_jiffies(50),
-		(old_state->crtcs[i].last_vblank_count !=
-			drm_crtc_vblank_count(crtc)));
-		spin_unlock(>event_lock);
+		if (cold) {
+			unsigned timo = 100;
+
+			ret = -ETIMEDOUT;
+			while (timo --> 0 && ret) {
+spin_lock(>event_lock);
+if (old_state->crtcs[i].last_vblank_count !=
+drm_crtc_vblank_count(crtc)) {
+	ret = 0;
+}
+spin_unlock(>event_lock);
+			}
+		} else {
+			spin_lock(>event_lock);
+			DRM_SPIN_WAIT_ON(ret, >vblank[i].queue,
+			>event_lock,
+			msecs_to_jiffies(100),
+			(old_state->crtcs[i].last_vblank_count !=
+drm_crtc_vblank_count(crtc)));
+			spin_unlock(>event_lock);
+		}
 #else
 		ret = wait_event_timeout(dev->vblank[i].queue,
 old_state->crtcs[i].last_vblank_count !=



CVS commit: src/sys/external/bsd/drm2/dist/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:53 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_atomic_helper.c

Log Message:
drm: Allow drm_atomic_helper_wait_for_vblanks while cold.

This enables us to do a mode-switch before interrupts are running.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:45 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci:
nouveau_nvkm_subdev_pci_base.c

Log Message:
nouveau: Disable MSI on G84 devices.

Fails to switch modes with MSI, works without MSI, on T61p.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_base.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_base.c:1.10 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_base.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_base.c:1.10	Sun Dec 19 12:31:26 2021
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_base.c	Sun Dec 19 12:43:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.10 2021/12/19 12:31:26 riastradh Exp $	*/
+/*	$NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.11 2021/12/19 12:43:45 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs 
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.10 2021/12/19 12:31:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_pci_base.c,v 1.11 2021/12/19 12:43:45 riastradh Exp $");
 
 #include "priv.h"
 #include "agp.h"
@@ -276,6 +276,7 @@ nvkm_pci_new_(const struct nvkm_pci_func
 		break;
 	default:
 		switch (device->chipset) {
+		case 0x84:	/* G84, no mode switch with MSI */
 		case 0xaa:
 			/* reported broken, nv also disable it */
 			break;



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:45 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci:
nouveau_nvkm_subdev_pci_base.c

Log Message:
nouveau: Disable MSI on G84 devices.

Fails to switch modes with MSI, works without MSI, on T61p.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_base.c

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



CVS commit: src/sys

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:37 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_anxdp.c rk_drm.c rk_vop.c
src/sys/dev/ic: anx_dp.c anx_dp.h
src/sys/external/bsd/drm2/drm: drm_module.c

Log Message:
rkdrm: Convert to atomic modesetting, as needed for bridges.

Author: Jared McNeill 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_anxdp.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/rockchip/rk_drm.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/rockchip/rk_vop.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/anx_dp.c src/sys/dev/ic/anx_dp.h
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/drm2/drm/drm_module.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_anxdp.c
diff -u src/sys/arch/arm/rockchip/rk_anxdp.c:1.5 src/sys/arch/arm/rockchip/rk_anxdp.c:1.6
--- src/sys/arch/arm/rockchip/rk_anxdp.c:1.5	Sun Dec 19 11:00:46 2021
+++ src/sys/arch/arm/rockchip/rk_anxdp.c	Sun Dec 19 12:43:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_anxdp.c,v 1.5 2021/12/19 11:00:46 riastradh Exp $ */
+/* $NetBSD: rk_anxdp.c,v 1.6 2021/12/19 12:43:37 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jonathan A. Kollasch 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.5 2021/12/19 11:00:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.6 2021/12/19 12:43:37 riastradh Exp $");
 
 #include 
 #include 
@@ -117,19 +117,6 @@ rk_anxdp_encoder_prepare(struct drm_enco
 	rk_anxdp_select_input(sc, crtc_index);
 }
 
-static void
-rk_anxdp_encoder_commit(struct drm_encoder *encoder)
-{
-}
-
-static void
-rk_anxdp_encoder_dpms(struct drm_encoder *encoder, int mode)
-{
-	struct rk_anxdp_softc * const sc = to_rk_anxdp_encoder(encoder);
-
-	anxdp_dpms(>sc_base, mode);
-}
-
 static const struct drm_encoder_funcs rk_anxdp_encoder_funcs = {
 	.destroy = drm_encoder_cleanup,
 };
@@ -140,8 +127,6 @@ static const struct drm_encoder_helper_f
 	.mode_set = rk_anxdp_encoder_mode_set,
 	.enable = rk_anxdp_encoder_enable,
 	.disable = rk_anxdp_encoder_disable,
-	.commit = rk_anxdp_encoder_commit,
-	.dpms = rk_anxdp_encoder_dpms,
 };
 
 static int

Index: src/sys/arch/arm/rockchip/rk_drm.c
diff -u src/sys/arch/arm/rockchip/rk_drm.c:1.15 src/sys/arch/arm/rockchip/rk_drm.c:1.16
--- src/sys/arch/arm/rockchip/rk_drm.c:1.15	Sun Dec 19 12:43:29 2021
+++ src/sys/arch/arm/rockchip/rk_drm.c	Sun Dec 19 12:43:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_drm.c,v 1.15 2021/12/19 12:43:29 riastradh Exp $ */
+/* $NetBSD: rk_drm.c,v 1.16 2021/12/19 12:43:37 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.15 2021/12/19 12:43:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.16 2021/12/19 12:43:37 riastradh Exp $");
 
 #include 
 #include 
@@ -46,8 +46,10 @@ __KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1
 
 #include 
 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -85,7 +87,7 @@ static void	rk_drm_unload(struct drm_dev
 static void	rk_drm_task_work(struct work *, void *);
 
 static struct drm_driver rk_drm_driver = {
-	.driver_features = DRIVER_MODESET | DRIVER_GEM,
+	.driver_features = DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
 	.dev_priv_size = 0,
 	.load = rk_drm_load,
 	.unload = rk_drm_unload,
@@ -252,6 +254,7 @@ rk_drm_fb_destroy(struct drm_framebuffer
 static const struct drm_framebuffer_funcs rk_drm_framebuffer_funcs = {
 	.create_handle = rk_drm_fb_create_handle,
 	.destroy = rk_drm_fb_destroy,
+	.dirty = drm_atomic_helper_dirtyfb,
 };
 
 static struct drm_framebuffer *
@@ -289,6 +292,12 @@ dealloc:
 
 static struct drm_mode_config_funcs rk_drm_mode_config_funcs = {
 	.fb_create = rk_drm_fb_create,
+	.atomic_check = drm_atomic_helper_check,
+	.atomic_commit = drm_atomic_helper_commit,
+};
+
+static struct drm_mode_config_helper_funcs rk_drm_mode_config_helper_funcs = {
+	.atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
 };
 
 static int
@@ -328,7 +337,6 @@ rk_drm_fb_probe(struct drm_fb_helper *he
 	fb->offsets[0] = 0;
 	fb->width = width;
 	fb->height = height;
-	fb->dev = ddev;
 	fb->modifier = 0;
 	fb->flags = 0;
 #ifdef __ARM_BIG_ENDIAN
@@ -336,6 +344,7 @@ rk_drm_fb_probe(struct drm_fb_helper *he
 #else
 	fb->format = drm_format_info(DRM_FORMAT_XRGB);
 #endif
+	fb->dev = ddev;
 
 	error = drm_framebuffer_init(ddev, fb, _drm_framebuffer_funcs);
 	if (error != 0) {
@@ -381,6 +390,7 @@ rk_drm_load(struct drm_device *ddev, uns
 	ddev->mode_config.max_width = RK_DRM_MAX_WIDTH;
 	ddev->mode_config.max_height = RK_DRM_MAX_HEIGHT;
 	ddev->mode_config.funcs = _drm_mode_config_funcs;
+	ddev->mode_config.helper_private = _drm_mode_config_helper_funcs;
 
 	num_crtc = 0;
 	data = fdtbus_get_prop(sc->sc_phandle, "ports", );
@@ -424,8 

CVS commit: src/sys

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:37 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_anxdp.c rk_drm.c rk_vop.c
src/sys/dev/ic: anx_dp.c anx_dp.h
src/sys/external/bsd/drm2/drm: drm_module.c

Log Message:
rkdrm: Convert to atomic modesetting, as needed for bridges.

Author: Jared McNeill 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_anxdp.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/rockchip/rk_drm.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/rockchip/rk_vop.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/anx_dp.c src/sys/dev/ic/anx_dp.h
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/drm2/drm/drm_module.c

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



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:29 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_drm.c

Log Message:
rkdrm: Do drm_mode_config_reset on init.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/rockchip/rk_drm.c

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk_drm.c
diff -u src/sys/arch/arm/rockchip/rk_drm.c:1.14 src/sys/arch/arm/rockchip/rk_drm.c:1.15
--- src/sys/arch/arm/rockchip/rk_drm.c:1.14	Sun Dec 19 12:28:44 2021
+++ src/sys/arch/arm/rockchip/rk_drm.c	Sun Dec 19 12:43:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_drm.c,v 1.14 2021/12/19 12:28:44 riastradh Exp $ */
+/* $NetBSD: rk_drm.c,v 1.15 2021/12/19 12:43:29 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.14 2021/12/19 12:28:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.15 2021/12/19 12:43:29 riastradh Exp $");
 
 #include 
 #include 
@@ -410,6 +410,8 @@ rk_drm_load(struct drm_device *ddev, uns
 		goto drmerr;
 	}
 
+	drm_mode_config_reset(ddev);
+
 	fbdev = kmem_zalloc(sizeof(*fbdev), KM_SLEEP);
 
 	drm_fb_helper_prepare(ddev, >helper, _drm_fb_helper_funcs);



CVS commit: src/sys/arch/arm/rockchip

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:29 UTC 2021

Modified Files:
src/sys/arch/arm/rockchip: rk_drm.c

Log Message:
rkdrm: Do drm_mode_config_reset on init.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/rockchip/rk_drm.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:23 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_print.c

Log Message:
drm: Use {} instead of [] for drm prints.

Using [] confuses dmesg timestamp parsing.  We should maybe fix that,
but this will serve for now.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/dist/drm/drm_print.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_print.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_print.c:1.14 src/sys/external/bsd/drm2/dist/drm/drm_print.c:1.15
--- src/sys/external/bsd/drm2/dist/drm/drm_print.c:1.14	Sun Dec 19 12:40:43 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_print.c	Sun Dec 19 12:43:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_print.c,v 1.14 2021/12/19 12:40:43 riastradh Exp $	*/
+/*	$NetBSD: drm_print.c,v 1.15 2021/12/19 12:43:22 riastradh Exp $	*/
 
 /*
  * Copyright (C) 2016 Red Hat
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_print.c,v 1.14 2021/12/19 12:40:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_print.c,v 1.15 2021/12/19 12:43:22 riastradh Exp $");
 
 #ifndef __NetBSD__		/* XXX ??? */
 #define DEBUG /* for pr_debug() */
@@ -207,7 +207,7 @@ EXPORT_SYMBOL(__drm_printfn_seq_file);
 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
 {
 #ifdef __NetBSD__
-	dev_info(p->arg, "[" DRM_NAME "] ");
+	dev_info(p->arg, "{" DRM_NAME "} ");
 	vprintf(vaf->fmt, *vaf->va);	/* XXX */
 #else
 	dev_info(p->arg, "[" DRM_NAME "] %pV", vaf);
@@ -308,10 +308,12 @@ void drm_dev_printk(const struct device 
 	char symbuf[128];
 
 	drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf);
-	if (dev)
-		printf("%s [" DRM_NAME ":%s] ", device_xname(__UNCONST(dev)), symbuf);
-	else
-		printf("[" DRM_NAME ":%s] ", symbuf);
+	if (dev) {
+		printf("%s {" DRM_NAME ":%s} ", device_xname(__UNCONST(dev)),
+		symbuf);
+	} else {
+		printf("{" DRM_NAME ":%s} ", symbuf);
+	}
 
 	va_start(va, format);
 	vprintf(format, va);
@@ -347,10 +349,12 @@ void drm_dev_dbg(const struct device *de
 		return;
 
 	drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf);
-	if (dev)
-		printf("%s [" DRM_NAME ":%s] ", device_xname(__UNCONST(dev)), symbuf);
-	else
-		printf("[" DRM_NAME ":%s] ", symbuf);
+	if (dev) {
+		printf("%s {" DRM_NAME ":%s} ", device_xname(__UNCONST(dev)),
+		symbuf);
+	} else {
+		printf("{" DRM_NAME ":%s} ", symbuf);
+	}
 
 	va_start(va, format);
 	vprintf(format, va);
@@ -387,8 +391,9 @@ void __drm_dbg(enum drm_debug_category c
 	if (!(__drm_debug & category))
 		return;
 
+	memset(symbuf, 0, sizeof symbuf);
 	drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf);
-	printf("[" DRM_NAME ":%s] ", symbuf);
+	printf("{" DRM_NAME ":%s} ", symbuf);
 
 	va_start(va, format);
 	vprintf(format, va);
@@ -419,7 +424,7 @@ void __drm_err(const char *format, ...)
 	va_list va;
 
 	drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf);
-	printf("[" DRM_NAME ":%s] *ERROR* ", symbuf);
+	printf("{" DRM_NAME ":%s} *ERROR* ", symbuf);
 
 	va_start(va, format);
 	vprintf(format, va);



CVS commit: src/sys/external/bsd/drm2/dist/drm

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:23 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_print.c

Log Message:
drm: Use {} instead of [] for drm prints.

Using [] confuses dmesg timestamp parsing.  We should maybe fix that,
but this will serve for now.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/dist/drm/drm_print.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:14 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_context.c

Log Message:
i915: For now, pretend gtt size is zero.

Something goes wrong with EXEC_OBJECT_PINNED in Mesa i965 brw bufmgr
if we expose this parameter; this is a sleazy workaround pending
diagnosis of the underlying problem.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c:1.5	Sun Dec 19 12:32:15 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c	Sun Dec 19 12:43:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_context.c,v 1.5 2021/12/19 12:32:15 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_context.c,v 1.6 2021/12/19 12:43:14 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_context.c,v 1.5 2021/12/19 12:32:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_context.c,v 1.6 2021/12/19 12:43:14 riastradh Exp $");
 
 #include 
 #include 
@@ -2380,6 +2380,10 @@ int i915_gem_context_getparam_ioctl(stru
 		else
 			args->value = to_i915(dev)->ggtt.vm.total;
 		rcu_read_unlock();
+#ifdef __NetBSD__		/* XXX */
+		/* XXX Something is broken with EXEC_OBJECT_PINNED.  */
+		args->value = 0;
+#endif
 		break;
 
 	case I915_CONTEXT_PARAM_NO_ERROR_CAPTURE:



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915/gem

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:14 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_context.c

Log Message:
i915: For now, pretend gtt size is zero.

Something goes wrong with EXEC_OBJECT_PINNED in Mesa i965 brw bufmgr
if we expose this parameter; this is a sleazy workaround pending
diagnosis of the underlying problem.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c

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



CVS commit: src/sys/external/bsd/drm2/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:06 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Work around busted kthread_join.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/linux/linux_kthread.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_kthread.c
diff -u src/sys/external/bsd/drm2/linux/linux_kthread.c:1.8 src/sys/external/bsd/drm2/linux/linux_kthread.c:1.9
--- src/sys/external/bsd/drm2/linux/linux_kthread.c:1.8	Sun Dec 19 12:42:48 2021
+++ src/sys/external/bsd/drm2/linux/linux_kthread.c	Sun Dec 19 12:43:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_kthread.c,v 1.8 2021/12/19 12:42:48 riastradh Exp $	*/
+/*	$NetBSD: linux_kthread.c,v 1.9 2021/12/19 12:43:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.8 2021/12/19 12:42:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.9 2021/12/19 12:43:05 riastradh Exp $");
 
 #include 
 
@@ -53,6 +53,8 @@ struct task_struct {
 	bool		kt_shouldstop:1;
 	bool		kt_shouldpark:1;
 	bool		kt_parked:1;
+	bool		kt_exited:1;
+	int		kt_ret;
 
 	int		(*kt_func)(void *);
 	void		*kt_cookie;
@@ -111,7 +113,19 @@ linux_kthread_start(void *cookie)
 	lwp_setspecific(linux_kthread_key, T);
 
 	ret = (*T->kt_func)(T->kt_cookie);
-	kthread_exit(ret);
+
+	/*
+	 * Mark the thread exited, set the return value, and wake any
+	 * waiting kthread_stop.
+	 */
+	mutex_enter(>kt_lock);
+	T->kt_exited = true;
+	T->kt_ret = ret;
+	cv_broadcast(>kt_cv);
+	mutex_exit(>kt_lock);
+
+	/* Exit the (NetBSD) kthread.  */
+	kthread_exit(0);
 }
 
 static struct task_struct *
@@ -125,6 +139,12 @@ kthread_alloc(int (*func)(void *), void 
 	mutex_init(>kt_lock, MUTEX_DEFAULT, IPL_VM);
 	cv_init(>kt_cv, "lnxkthrd");
 
+	T->kt_shouldstop = false;
+	T->kt_shouldpark = false;
+	T->kt_parked = false;
+	T->kt_exited = false;
+	T->kt_ret = 0;
+
 	T->kt_func = func;
 	T->kt_cookie = cookie;
 	T->kt_interlock = interlock;
@@ -137,6 +157,8 @@ static void
 kthread_free(struct task_struct *T)
 {
 
+	KASSERT(T->kt_exited);
+
 	cv_destroy(>kt_cv);
 	mutex_destroy(>kt_lock);
 	kmem_free(T, sizeof(*T));
@@ -150,7 +172,7 @@ kthread_run(int (*func)(void *), void *c
 	int error;
 
 	T = kthread_alloc(func, cookie, interlock, wq);
-	error = kthread_create(PRI_NONE, KTHREAD_MPSAFE|KTHREAD_MUSTJOIN, NULL,
+	error = kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
 	linux_kthread_start, T, >kt_lwp, "%s", name);
 	if (error) {
 		kthread_free(T);
@@ -178,12 +200,16 @@ kthread_stop(struct task_struct *T)
 	cv_broadcast(>kt_cv);
 	DRM_SPIN_WAKEUP_ALL(T->kt_wq, T->kt_interlock);
 
-	/* Release the locks.  */
-	mutex_exit(>kt_lock);
+	/* Release the interlock while we wait for thread to finish.  */
 	spin_unlock(T->kt_interlock);
 
-	/* Wait for the (NetBSD) kthread to exit.  */
-	ret = kthread_join(T->kt_lwp);
+	/* Wait for the thread to finish.  */
+	while (!T->kt_exited)
+		cv_wait(>kt_cv, >kt_lock);
+
+	/* Grab the return code and release the lock -- we're done.  */
+	ret = T->kt_ret;
+	mutex_exit(>kt_lock);
 
 	/* Free the (Linux) kthread.  */
 	kthread_free(T);



CVS commit: src/sys/external/bsd/drm2/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:43:06 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Work around busted kthread_join.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/linux/linux_kthread.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:58 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c

Log Message:
drm: Don't try to use sched->thread until it's initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
diff -u src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.10 src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.10	Sun Dec 19 12:42:40 2021
+++ src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c	Sun Dec 19 12:42:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_main.c,v 1.10 2021/12/19 12:42:40 riastradh Exp $	*/
+/*	$NetBSD: sched_main.c,v 1.11 2021/12/19 12:42:58 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.10 2021/12/19 12:42:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.11 2021/12/19 12:42:58 riastradh Exp $");
 
 #include 
 #include 
@@ -751,6 +751,12 @@ static int drm_sched_main(void *param)
 
 	sched_setscheduler(current, SCHED_FIFO, );
 
+	/* Wait for sched->thread to be initialized by drm_sched_init.  */
+	spin_lock(>job_list_lock);
+	DRM_SPIN_WAIT_UNTIL(r, >wake_up_worker, >job_list_lock,
+	sched->thread != NULL);
+	spin_unlock(>job_list_lock);
+
 	while (!kthread_should_stop()) {
 		struct drm_sched_entity *entity = NULL;
 		struct drm_sched_fence *s_fence;
@@ -854,14 +860,19 @@ int drm_sched_init(struct drm_gpu_schedu
 	atomic64_set(>job_id_count, 0);
 
 	/* Each scheduler will run on a seperate kernel thread */
-	sched->thread = kthread_run(drm_sched_main, sched, sched->name,
-	>job_list_lock, >wake_up_worker);
-	if (IS_ERR(sched->thread)) {
-		ret = PTR_ERR(sched->thread);
+	struct task_struct *thread =
+	kthread_run(drm_sched_main, sched, sched->name,
+		>job_list_lock, >wake_up_worker);
+	if (IS_ERR(thread)) {
+		ret = PTR_ERR(thread);
 		sched->thread = NULL;
 		DRM_ERROR("Failed to create scheduler for %s.\n", name);
 		return ret;
 	}
+	spin_lock(>job_list_lock);
+	sched->thread = thread;
+	DRM_SPIN_WAKEUP_ALL(>wake_up_worker, >job_list_lock);
+	spin_unlock(>job_list_lock);
 
 	sched->ready = true;
 	return 0;



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:58 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c

Log Message:
drm: Don't try to use sched->thread until it's initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c

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



CVS commit: src/sys/external/bsd/drm2/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:48 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Fix error return for kthread_run: error pointer, not null.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/linux/linux_kthread.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_kthread.c
diff -u src/sys/external/bsd/drm2/linux/linux_kthread.c:1.7 src/sys/external/bsd/drm2/linux/linux_kthread.c:1.8
--- src/sys/external/bsd/drm2/linux/linux_kthread.c:1.7	Sun Dec 19 12:42:32 2021
+++ src/sys/external/bsd/drm2/linux/linux_kthread.c	Sun Dec 19 12:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_kthread.c,v 1.7 2021/12/19 12:42:32 riastradh Exp $	*/
+/*	$NetBSD: linux_kthread.c,v 1.8 2021/12/19 12:42:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.7 2021/12/19 12:42:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.8 2021/12/19 12:42:48 riastradh Exp $");
 
 #include 
 
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_kthrea
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -153,7 +154,7 @@ kthread_run(int (*func)(void *), void *c
 	linux_kthread_start, T, >kt_lwp, "%s", name);
 	if (error) {
 		kthread_free(T);
-		T = NULL;
+		return ERR_PTR(-error); /* XXX errno NetBSD->Linux */
 	}
 
 	return T;



CVS commit: src/sys/external/bsd/drm2/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:48 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Fix error return for kthread_run: error pointer, not null.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/linux/linux_kthread.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c

Log Message:
drm: Omit needless local brace diff.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
diff -u src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.9 src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.9	Sun Dec 19 12:42:32 2021
+++ src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c	Sun Dec 19 12:42:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_main.c,v 1.9 2021/12/19 12:42:32 riastradh Exp $	*/
+/*	$NetBSD: sched_main.c,v 1.10 2021/12/19 12:42:40 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.9 2021/12/19 12:42:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.10 2021/12/19 12:42:40 riastradh Exp $");
 
 #include 
 #include 
@@ -877,9 +877,8 @@ EXPORT_SYMBOL(drm_sched_init);
  */
 void drm_sched_fini(struct drm_gpu_scheduler *sched)
 {
-	if (sched->thread) {
+	if (sched->thread)
 		kthread_stop(sched->thread);
-	}
 
 	sched->ready = false;
 



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:40 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c

Log Message:
drm: Omit needless local brace diff.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c

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



CVS commit: src/sys/external/bsd/drm2

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:33 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Take advantage of kthread interlock to reduce diff.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/linux/linux_kthread.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
diff -u src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.8 src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.9
--- src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.8	Sun Dec 19 12:42:25 2021
+++ src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c	Sun Dec 19 12:42:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_main.c,v 1.8 2021/12/19 12:42:25 riastradh Exp $	*/
+/*	$NetBSD: sched_main.c,v 1.9 2021/12/19 12:42:32 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.8 2021/12/19 12:42:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.9 2021/12/19 12:42:32 riastradh Exp $");
 
 #include 
 #include 
@@ -728,11 +728,8 @@ drm_sched_get_cleanup_job(struct drm_gpu
  */
 static bool drm_sched_blocked(struct drm_gpu_scheduler *sched)
 {
-	assert_spin_locked(>job_list_lock);
 	if (kthread_should_park()) {
-		spin_unlock(>job_list_lock);
 		kthread_parkme();
-		spin_lock(>job_list_lock);
 		return true;
 	}
 

Index: src/sys/external/bsd/drm2/linux/linux_kthread.c
diff -u src/sys/external/bsd/drm2/linux/linux_kthread.c:1.6 src/sys/external/bsd/drm2/linux/linux_kthread.c:1.7
--- src/sys/external/bsd/drm2/linux/linux_kthread.c:1.6	Sun Dec 19 12:42:25 2021
+++ src/sys/external/bsd/drm2/linux/linux_kthread.c	Sun Dec 19 12:42:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_kthread.c,v 1.6 2021/12/19 12:42:25 riastradh Exp $	*/
+/*	$NetBSD: linux_kthread.c,v 1.7 2021/12/19 12:42:32 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.6 2021/12/19 12:42:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.7 2021/12/19 12:42:32 riastradh Exp $");
 
 #include 
 
@@ -275,6 +275,9 @@ kthread_parkme(void)
 {
 	struct task_struct *T = linux_kthread();
 
+	assert_spin_locked(T->kt_interlock);
+
+	spin_unlock(T->kt_interlock);
 	mutex_enter(>kt_lock);
 	while (T->kt_shouldpark) {
 		T->kt_parked = true;
@@ -283,4 +286,5 @@ kthread_parkme(void)
 		T->kt_parked = false;
 	}
 	mutex_exit(>kt_lock);
+	spin_lock(T->kt_interlock);
 }



CVS commit: src/sys/external/bsd/drm2

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:33 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Take advantage of kthread interlock to reduce diff.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/linux/linux_kthread.c

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



CVS commit: src/sys/external/bsd/drm2

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:25 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c
src/sys/external/bsd/drm2/include/linux: kthread.h
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Rework Linux `kthread' abstraction to avoid race to sleep.

Requires passing in the caller's lock and condvar to kthread_run, but
for the one user that appears not to be an onerous requirement.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/kthread.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/linux/linux_kthread.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
diff -u src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.7 src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.7	Sun Dec 19 12:41:44 2021
+++ src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c	Sun Dec 19 12:42:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_main.c,v 1.7 2021/12/19 12:41:44 riastradh Exp $	*/
+/*	$NetBSD: sched_main.c,v 1.8 2021/12/19 12:42:25 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.7 2021/12/19 12:41:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.8 2021/12/19 12:42:25 riastradh Exp $");
 
 #include 
 #include 
@@ -857,7 +857,8 @@ int drm_sched_init(struct drm_gpu_schedu
 	atomic64_set(>job_id_count, 0);
 
 	/* Each scheduler will run on a seperate kernel thread */
-	sched->thread = kthread_run(drm_sched_main, sched, sched->name);
+	sched->thread = kthread_run(drm_sched_main, sched, sched->name,
+	>job_list_lock, >wake_up_worker);
 	if (IS_ERR(sched->thread)) {
 		ret = PTR_ERR(sched->thread);
 		sched->thread = NULL;

Index: src/sys/external/bsd/drm2/include/linux/kthread.h
diff -u src/sys/external/bsd/drm2/include/linux/kthread.h:1.3 src/sys/external/bsd/drm2/include/linux/kthread.h:1.4
--- src/sys/external/bsd/drm2/include/linux/kthread.h:1.3	Sun Dec 19 12:23:07 2021
+++ src/sys/external/bsd/drm2/include/linux/kthread.h	Sun Dec 19 12:42:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kthread.h,v 1.3 2021/12/19 12:23:07 riastradh Exp $	*/
+/*	$NetBSD: kthread.h,v 1.4 2021/12/19 12:42:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,10 @@
 #ifndef _LINUX_KTHREAD_H_
 #define _LINUX_KTHREAD_H_
 
+#include 
+
+#include 
+
 struct task_struct;
 
 #define	__kthread_should_park	linux___kthread_should_park
@@ -43,7 +47,8 @@ struct task_struct;
 #define	kthread_stop		linux_kthread_stop
 #define	kthread_unpark		linux_kthread_unpark
 
-struct task_struct *kthread_run(int (*)(void *), void *, const char *);
+struct task_struct *kthread_run(int (*)(void *), void *, const char *,
+spinlock_t *, drm_waitqueue_t *);
 
 int kthread_stop(struct task_struct *);
 int kthread_should_stop(void);

Index: src/sys/external/bsd/drm2/linux/linux_kthread.c
diff -u src/sys/external/bsd/drm2/linux/linux_kthread.c:1.5 src/sys/external/bsd/drm2/linux/linux_kthread.c:1.6
--- src/sys/external/bsd/drm2/linux/linux_kthread.c:1.5	Sun Dec 19 12:42:14 2021
+++ src/sys/external/bsd/drm2/linux/linux_kthread.c	Sun Dec 19 12:42:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_kthread.c,v 1.5 2021/12/19 12:42:14 riastradh Exp $	*/
+/*	$NetBSD: linux_kthread.c,v 1.6 2021/12/19 12:42:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.5 2021/12/19 12:42:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.6 2021/12/19 12:42:25 riastradh Exp $");
 
 #include 
 
@@ -42,6 +42,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_kthrea
 #include 
 
 #include 
+#include 
+
+#include 
 
 struct task_struct {
 	kmutex_t	kt_lock;
@@ -52,6 +55,8 @@ struct task_struct {
 
 	int		(*kt_func)(void *);
 	void		*kt_cookie;
+	spinlock_t	*kt_interlock;
+	drm_waitqueue_t	*kt_wq;
 	struct lwp	*kt_lwp;
 };
 
@@ -109,7 +114,8 @@ linux_kthread_start(void *cookie)
 }
 
 static struct task_struct *
-kthread_alloc(int (*func)(void *), void *cookie)
+kthread_alloc(int (*func)(void *), void *cookie, spinlock_t *interlock,
+drm_waitqueue_t *wq)
 {
 	struct task_struct *T;
 
@@ -120,6 +126,8 @@ kthread_alloc(int (*func)(void *), void 
 
 	T->kt_func = func;
 	T->kt_cookie = cookie;
+	T->kt_interlock = interlock;
+	T->kt_wq = wq;
 
 	return T;
 }
@@ -134,12 +142,13 @@ kthread_free(struct task_struct *T)
 }
 
 struct task_struct *
-kthread_run(int (*func)(void *), void *cookie, const char *name)
+kthread_run(int (*func)(void *), void 

CVS commit: src/sys/external/bsd/drm2

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:25 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c
src/sys/external/bsd/drm2/include/linux: kthread.h
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Rework Linux `kthread' abstraction to avoid race to sleep.

Requires passing in the caller's lock and condvar to kthread_run, but
for the one user that appears not to be an onerous requirement.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/kthread.h
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/linux/linux_kthread.c

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



CVS commit: src/sys/external/bsd/drm2/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:15 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Trigger `spurious' wakeup for kthread_stop too.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/linux/linux_kthread.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_kthread.c
diff -u src/sys/external/bsd/drm2/linux/linux_kthread.c:1.4 src/sys/external/bsd/drm2/linux/linux_kthread.c:1.5
--- src/sys/external/bsd/drm2/linux/linux_kthread.c:1.4	Sun Dec 19 12:38:56 2021
+++ src/sys/external/bsd/drm2/linux/linux_kthread.c	Sun Dec 19 12:42:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_kthread.c,v 1.4 2021/12/19 12:38:56 riastradh Exp $	*/
+/*	$NetBSD: linux_kthread.c,v 1.5 2021/12/19 12:42:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.4 2021/12/19 12:38:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_kthread.c,v 1.5 2021/12/19 12:42:14 riastradh Exp $");
 
 #include 
 
@@ -150,18 +150,56 @@ kthread_run(int (*func)(void *), void *c
 	return T;
 }
 
+/*
+ * lwp_kick(l)
+ *
+ *	Cause l to wake up if it is asleep, no matter what condvar or
+ *	other wchan it's asleep on.  This logic is like sleepq_timeout,
+ *	but without setting LW_STIMO.  This is not a general-purpose
+ *	mechanism -- don't go around using this instead of condvars.
+ */
+static void
+lwp_kick(struct lwp *l)
+{
+
+	lwp_lock(l);
+	if (l->l_wchan == NULL) {
+		/* Not sleeping, so no need to wake up.  */
+		lwp_unlock(l);
+	} else {
+		/*
+		 * Sleeping, so wake it up.  lwp_unsleep has the side
+		 * effect of unlocking l when we pass unlock=true.
+		 */
+		lwp_unsleep(l, /*unlock*/true);
+	}
+}
+
 int
 kthread_stop(struct task_struct *T)
 {
+	struct lwp *l;
 	int ret;
 
+	/*
+	 * Notify the thread that it's stopping, and wake it if it's
+	 * parked.
+	 */
 	mutex_enter(>kt_lock);
 	T->kt_shouldpark = false;
 	T->kt_shouldstop = true;
 	cv_broadcast(>kt_cv);
 	mutex_exit(>kt_lock);
 
-	ret = kthread_join(T->kt_lwp);
+	/*
+	 * Kick the lwp in case it's waiting on anything else, and then
+	 * wait for it to complete.  It is the thread's obligation to
+	 * check kthread_shouldstop before sleeping again.
+	 */
+	l = T->kt_lwp;
+	KASSERT(l != curlwp);
+	lwp_kick(l);
+	ret = kthread_join(l);
 
 	kthread_free(T);
 
@@ -201,23 +239,9 @@ kthread_park(struct task_struct *T)
 	/*
 	 * If the thread is asleep for any reason, give it a spurious
 	 * wakeup.  The thread is responsible for checking
-	 * kthread_shouldpark before sleeping.  This logic is like
-	 * sleepq_timeout, but without setting LW_STIMO.
+	 * kthread_shouldpark before sleeping.
 	 */
-	lwp_lock(l);
-	if (l->l_wchan == NULL) {
-		/*
-		 * Not sleeping, so no need to wake up -- the thread
-		 * will eventually check kthread_shouldpark.
-		 */
-		lwp_unlock(l);
-	} else {
-		/*
-		 * Sleeping, so wake it up.  lwp_unsleep has the side
-		 * effect of unlocking l when we pass unlock=true.
-		 */
-		lwp_unsleep(l, /*unlock*/true);
-	}
+	lwp_kick(l);
 
 	/* Wait until the thread has issued kthread_parkme.  */
 	while (!T->kt_parked)



CVS commit: src/sys/external/bsd/drm2/linux

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:15 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_kthread.c

Log Message:
drm: Trigger `spurious' wakeup for kthread_stop too.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/linux/linux_kthread.c

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



CVS commit: src/sys/external/bsd/drm2/include

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:06 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/include: i915_trace.h
src/sys/external/bsd/drm2/include/drm: drm_trace_netbsd.h

Log Message:
drm: Mark variable as used only by trace point.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm2/include/i915_trace.h
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.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/external/bsd/drm2/include/i915_trace.h
diff -u src/sys/external/bsd/drm2/include/i915_trace.h:1.22 src/sys/external/bsd/drm2/include/i915_trace.h:1.23
--- src/sys/external/bsd/drm2/include/i915_trace.h:1.22	Sun Dec 19 11:49:12 2021
+++ src/sys/external/bsd/drm2/include/i915_trace.h	Sun Dec 19 12:42:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_trace.h,v 1.22 2021/12/19 11:49:12 riastradh Exp $	*/
+/*	$NetBSD: i915_trace.h,v 1.23 2021/12/19 12:42:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -262,7 +262,7 @@ static inline void
 trace_i915_reg_rw(bool write, i915_reg_t reg, uint64_t value, size_t len,
 bool trace)
 {
-	uint32_t regoff = i915_mmio_reg_offset(reg);
+	uint32_t regoff __trace_used = i915_mmio_reg_offset(reg);
 
 	if (!trace)
 		return;

Index: src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h:1.1 src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h:1.2
--- src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h:1.1	Mon Aug 27 15:23:40 2018
+++ src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h	Sun Dec 19 12:42:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_trace_netbsd.h,v 1.1 2018/08/27 15:23:40 riastradh Exp $	*/
+/*	$NetBSD: drm_trace_netbsd.h,v 1.2 2021/12/19 12:42:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -67,4 +67,10 @@
 #define	TRACE6(m,p,n,a,b,c,d,e,f)	SDT_PROBE6(sdt,m,p,n,a,b,c,d,e,f)
 #define	TRACE7(m,p,n,a,b,c,d,e,f,g)	SDT_PROBE7(sdt,m,p,n,a,b,c,d,e,f,g)
 
+#ifdef KDTRACE_HOOKS
+#define	__trace_used	/* empty */
+#else
+#define	__trace_used	__unused
+#endif
+
 #endif	/* _LINUX_TRACEPOINT_H_ */



CVS commit: src/sys/external/bsd/drm2/include

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:42:06 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/include: i915_trace.h
src/sys/external/bsd/drm2/include/drm: drm_trace_netbsd.h

Log Message:
drm: Mark variable as used only by trace point.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm2/include/i915_trace.h
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/include/drm/drm_trace_netbsd.h

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



CVS commit: src/sys/external/bsd/drm2/dist

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:41:54 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_dp_helper.c
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_dp.c
src/sys/external/bsd/drm2/dist/include/drm: drm_dp_helper.h

Log Message:
drm: add drm_dp_aux_fini; use it in i915 to fix missing mutex destroy.

Author: chuq 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/include/drm/drm_dp_helper.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/external/bsd/drm2/dist/drm/drm_dp_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c:1.15 src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c:1.16
--- src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c:1.15	Sun Dec 19 12:32:01 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c	Sun Dec 19 12:41:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_dp_helper.c,v 1.15 2021/12/19 12:32:01 riastradh Exp $	*/
+/*	$NetBSD: drm_dp_helper.c,v 1.16 2021/12/19 12:41:54 riastradh Exp $	*/
 
 /*
  * Copyright © 2009 Keith Packard
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_dp_helper.c,v 1.15 2021/12/19 12:32:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_dp_helper.c,v 1.16 2021/12/19 12:41:54 riastradh Exp $");
 
 #include 
 #include 
@@ -1024,6 +1024,17 @@ void drm_dp_aux_init(struct drm_dp_aux *
 EXPORT_SYMBOL(drm_dp_aux_init);
 
 /**
+ * drm_dp_aux_fini() - undo what drm_dp_aux_init() does.
+ * @aux: DisplayPort AUX channel
+ */
+void drm_dp_aux_fini(struct drm_dp_aux *aux)
+{
+	mutex_destroy(>cec.lock);
+	mutex_destroy(>hw_mutex);
+}
+EXPORT_SYMBOL(drm_dp_aux_fini);
+
+/**
  * drm_dp_aux_register() - initialise and register aux channel
  * @aux: DisplayPort AUX channel
  *
@@ -1075,8 +1086,7 @@ void drm_dp_aux_unregister(struct drm_dp
 {
 	drm_dp_aux_unregister_devnode(aux);
 	i2c_del_adapter(>ddc);
-	mutex_destroy(>cec.lock);
-	mutex_destroy(>hw_mutex);
+	drm_dp_aux_fini(aux);
 }
 EXPORT_SYMBOL(drm_dp_aux_unregister);
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c:1.6 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c:1.6	Sun Dec 19 12:40:31 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c	Sun Dec 19 12:41:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_dp.c,v 1.6 2021/12/19 12:40:31 riastradh Exp $	*/
+/*	$NetBSD: intel_dp.c,v 1.7 2021/12/19 12:41:54 riastradh Exp $	*/
 
 /*
  * Copyright © 2008 Intel Corporation
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.6 2021/12/19 12:40:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.7 2021/12/19 12:41:54 riastradh Exp $");
 
 #include 
 #include 
@@ -1730,6 +1730,7 @@ static i915_reg_t skl_aux_data_reg(struc
 static void
 intel_dp_aux_fini(struct intel_dp *intel_dp)
 {
+	drm_dp_aux_fini(_dp->aux);
 	kfree(__UNCONST(intel_dp->aux.name));
 }
 

Index: src/sys/external/bsd/drm2/dist/include/drm/drm_dp_helper.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_dp_helper.h:1.8 src/sys/external/bsd/drm2/dist/include/drm/drm_dp_helper.h:1.9
--- src/sys/external/bsd/drm2/dist/include/drm/drm_dp_helper.h:1.8	Sun Dec 19 10:48:47 2021
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_dp_helper.h	Sun Dec 19 12:41:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_dp_helper.h,v 1.8 2021/12/19 10:48:47 riastradh Exp $	*/
+/*	$NetBSD: drm_dp_helper.h,v 1.9 2021/12/19 12:41:54 riastradh Exp $	*/
 
 /*
  * Copyright © 2008 Keith Packard
@@ -1472,6 +1472,7 @@ void drm_dp_downstream_debug(struct seq_
 
 void drm_dp_remote_aux_init(struct drm_dp_aux *aux);
 void drm_dp_aux_init(struct drm_dp_aux *aux);
+void drm_dp_aux_fini(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
 void drm_dp_aux_unregister(struct drm_dp_aux *aux);
 



CVS commit: src/sys/external/bsd/drm2/dist

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:41:54 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_dp_helper.c
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_dp.c
src/sys/external/bsd/drm2/dist/include/drm: drm_dp_helper.h

Log Message:
drm: add drm_dp_aux_fini; use it in i915 to fix missing mutex destroy.

Author: chuq 
Committer: Taylor R Campbell 


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/include/drm/drm_dp_helper.h

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:41:44 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c

Log Message:
drm: Omit bogus spin locking around kthread_stop, which blocks.

Blocking is not allowed while holding a spin lock, and there's
nothing here that needs a lock either.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c
diff -u src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.6 src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c:1.6	Sun Dec 19 12:34:24 2021
+++ src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c	Sun Dec 19 12:41:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_main.c,v 1.6 2021/12/19 12:34:24 riastradh Exp $	*/
+/*	$NetBSD: sched_main.c,v 1.7 2021/12/19 12:41:44 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.6 2021/12/19 12:34:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_main.c,v 1.7 2021/12/19 12:41:44 riastradh Exp $");
 
 #include 
 #include 
@@ -880,9 +880,7 @@ EXPORT_SYMBOL(drm_sched_init);
 void drm_sched_fini(struct drm_gpu_scheduler *sched)
 {
 	if (sched->thread) {
-		spin_lock(>job_list_lock);
 		kthread_stop(sched->thread);
-		spin_unlock(>job_list_lock);
 	}
 
 	sched->ready = false;



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2021-12-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Dec 19 12:41:44 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_main.c

Log Message:
drm: Omit bogus spin locking around kthread_stop, which blocks.

Blocking is not allowed while holding a spin lock, and there's
nothing here that needs a lock either.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_main.c

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



  1   2   3   4   5   6   7   8   9   10   >