CVS commit: src/sys/stand/efiboot

2024-09-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Sep 19 06:26:12 UTC 2024

Modified Files:
src/sys/stand/efiboot: exec.c

Log Message:
when freeing pages, pass page count instead of byte count.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/stand/efiboot/exec.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/stand/efiboot/exec.c
diff -u src/sys/stand/efiboot/exec.c:1.25 src/sys/stand/efiboot/exec.c:1.26
--- src/sys/stand/efiboot/exec.c:1.25	Thu Aug 15 05:59:49 2024
+++ src/sys/stand/efiboot/exec.c	Thu Sep 19 06:26:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.25 2024/08/15 05:59:49 skrll Exp $ */
+/* $NetBSD: exec.c,v 1.26 2024/09/19 06:26:11 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2019 Jason R. Thorpe
@@ -154,7 +154,8 @@ generate_efirng(void)
 
 	/* Fill the page with whatever the EFI RNG will do.  */
 	if (efi_rng((void *)(uintptr_t)addr, size)) {
-		uefi_call_wrapper(BS->FreePages, 2, addr, size);
+		uefi_call_wrapper(BS->FreePages, 2, addr,
+		EFI_SIZE_TO_PAGES(size));
 		return;
 	}
 



CVS commit: src/sys/stand/efiboot

2024-09-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Sep 19 06:26:12 UTC 2024

Modified Files:
src/sys/stand/efiboot: exec.c

Log Message:
when freeing pages, pass page count instead of byte count.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/stand/efiboot/exec.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/sunxi

2024-09-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Sep 16 23:37:13 UTC 2024

Modified Files:
src/sys/arch/arm/sunxi: sunxi_ccu.h

Log Message:
set CLK_SET_RATE_PARENT for mux type clocks so clk_set_rate() can work
with this my pinebook can change cpu speed again
ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/sunxi/sunxi_ccu.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/arch/arm/sunxi/sunxi_ccu.h
diff -u src/sys/arch/arm/sunxi/sunxi_ccu.h:1.23 src/sys/arch/arm/sunxi/sunxi_ccu.h:1.24
--- src/sys/arch/arm/sunxi/sunxi_ccu.h:1.23	Sun Nov  7 17:13:12 2021
+++ src/sys/arch/arm/sunxi/sunxi_ccu.h	Mon Sep 16 23:37:13 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.h,v 1.23 2021/11/07 17:13:12 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.h,v 1.24 2024/09/16 23:37:13 macallan Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -432,6 +432,7 @@ const char *sunxi_ccu_mux_get_parent(str
 	[_id] = {		\
 		.type = SUNXI_CCU_MUX,\
 		.base.name = (_name),\
+		.base.flags = CLK_SET_RATE_PARENT,		\
 		.u.mux.reg = (_reg),\
 		.u.mux.parents = (_parents),			\
 		.u.mux.nparents = __arraycount(_parents),	\



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

2024-09-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Sep 16 23:37:13 UTC 2024

Modified Files:
src/sys/arch/arm/sunxi: sunxi_ccu.h

Log Message:
set CLK_SET_RATE_PARENT for mux type clocks so clk_set_rate() can work
with this my pinebook can change cpu speed again
ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/sunxi/sunxi_ccu.h

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



CVS commit: src/sbin/dkctl

2024-09-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 14 08:30:44 UTC 2024

Modified Files:
src/sbin/dkctl: dkctl.8 dkctl.c

Log Message:
Expose DIOCGMEDIASIZE, DIOCGSECTORSIZE with new getgeometry command.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/dkctl/dkctl.8
cvs rdiff -u -r1.26 -r1.27 src/sbin/dkctl/dkctl.c

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



CVS commit: src/sbin/dkctl

2024-09-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 14 08:30:44 UTC 2024

Modified Files:
src/sbin/dkctl: dkctl.8 dkctl.c

Log Message:
Expose DIOCGMEDIASIZE, DIOCGSECTORSIZE with new getgeometry command.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/dkctl/dkctl.8
cvs rdiff -u -r1.26 -r1.27 src/sbin/dkctl/dkctl.c

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

Modified files:

Index: src/sbin/dkctl/dkctl.8
diff -u src/sbin/dkctl/dkctl.8:1.29 src/sbin/dkctl/dkctl.8:1.30
--- src/sbin/dkctl/dkctl.8:1.29	Mon Mar 30 08:36:09 2020
+++ src/sbin/dkctl/dkctl.8	Sat Sep 14 08:30:44 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dkctl.8,v 1.29 2020/03/30 08:36:09 wiz Exp $
+.\"	$NetBSD: dkctl.8,v 1.30 2024/09/14 08:30:44 mlelstv Exp $
 .\"
 .\" Copyright 2002 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -132,6 +132,8 @@ Get and display the cache enables for th
 Display information about the specified disk wedge.
 .Ar device
 in this case is the wedge name.
+.It Ic getgeometry
+Display media and sector size of the specified disk, wedge or volume.
 .It Ic keeplabel Op Ar yes | no
 Specify to keep or drop the in-core disklabel on the last close of
 the disk device.

Index: src/sbin/dkctl/dkctl.c
diff -u src/sbin/dkctl/dkctl.c:1.26 src/sbin/dkctl/dkctl.c:1.27
--- src/sbin/dkctl/dkctl.c:1.26	Sun Jan  7 12:29:25 2018
+++ src/sbin/dkctl/dkctl.c	Sat Sep 14 08:30:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: dkctl.c,v 1.26 2018/01/07 12:29:25 kre Exp $	*/
+/*	$NetBSD: dkctl.c,v 1.27 2024/09/14 08:30:44 mlelstv Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: dkctl.c,v 1.26 2018/01/07 12:29:25 kre Exp $");
+__RCSID("$NetBSD: dkctl.c,v 1.27 2024/09/14 08:30:44 mlelstv Exp $");
 #endif
 
 #include 
@@ -100,6 +100,7 @@ static void	disk_badsectors(int, char *[
 static void	disk_addwedge(int, char *[]);
 static void	disk_delwedge(int, char *[]);
 static void	disk_getwedgeinfo(int, char *[]);
+static void	disk_getgeometry(int, char *[]);
 static void	disk_listwedges(int, char *[]);
 static void	disk_makewedges(int, char *[]);
 static void	disk_strategy(int, char *[]);
@@ -130,6 +131,11 @@ static struct command commands[] = {
 	  disk_getwedgeinfo,
 	  O_RDONLY },
 
+	{ "getgeometry",
+	  "",
+	  disk_getgeometry,
+	  O_RDONLY },
+
 	{ "keeplabel",
 	  YESNO_ARG,
 	  disk_keeplabel,
@@ -626,6 +632,26 @@ disk_getwedgeinfo(int argc, char *argv[]
 }
 
 static void
+disk_getgeometry(int argc, char *argv[])
+{
+	off_t bytes;
+	u_int secsize;
+
+	if (argc != 1)
+		usage();
+
+	if (ioctl(fd, DIOCGMEDIASIZE, &bytes) == -1)
+		err(EXIT_FAILURE, "%s: getmediasize", dvname);
+
+	secsize = DEV_BSIZE;
+	if (ioctl(fd, DIOCGSECTORSIZE, &secsize) == -1)
+		warn("%s: getsectorsize", dvname);
+
+	printf("%s: %"PRIu64" bytes in %"PRIu64" blocks of %u bytes\n",
+	dvname, bytes, bytes/secsize, secsize);
+}
+
+static void
 disk_listwedges(int argc, char *argv[])
 {
 	struct dkwedge_info *dkw;



CVS commit: src/sbin/gpt

2024-09-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Sep 13 11:11:30 UTC 2024

Modified Files:
src/sbin/gpt: biosboot.c

Log Message:
Don't use kernel type daddr_t for disk offsets.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sbin/gpt/biosboot.c

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

Modified files:

Index: src/sbin/gpt/biosboot.c
diff -u src/sbin/gpt/biosboot.c:1.32 src/sbin/gpt/biosboot.c:1.33
--- src/sbin/gpt/biosboot.c:1.32	Thu Jun 20 10:56:38 2019
+++ src/sbin/gpt/biosboot.c	Fri Sep 13 11:11:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosboot.c,v 1.32 2019/06/20 10:56:38 martin Exp $ */
+/*	$NetBSD: biosboot.c,v 1.33 2024/09/13 11:11:29 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: biosboot.c,v 1.32 2019/06/20 10:56:38 martin Exp $");
+__RCSID("$NetBSD: biosboot.c,v 1.33 2024/09/13 11:11:29 mlelstv Exp $");
 #endif
 
 #include 
@@ -167,7 +167,7 @@ set_bootable(gpt_t gpt, map_t map, map_t
 }
 
 static int
-biosboot(gpt_t gpt, daddr_t start, uint64_t size, u_int entry, uint8_t *label,
+biosboot(gpt_t gpt, off_t start, uint64_t size, u_int entry, uint8_t *label,
 const char *bootpath, int active)
 {
 	map_t mbrmap, m;
@@ -267,7 +267,7 @@ cmd_biosboot(gpt_t gpt, int argc, char *
 #endif
 	int ch;
 	gpt_t ngpt = gpt;
-	daddr_t start = 0;
+	off_t start = 0;
 	uint64_t size = 0;
 	int active = 0;
 	unsigned int entry = 0;



CVS commit: src/sbin/gpt

2024-09-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Sep 13 11:11:30 UTC 2024

Modified Files:
src/sbin/gpt: biosboot.c

Log Message:
Don't use kernel type daddr_t for disk offsets.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sbin/gpt/biosboot.c

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



CVS commit: src/sbin/gpt

2024-09-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Sep 13 11:07:35 UTC 2024

Modified Files:
src/sbin/gpt: show.c

Log Message:
Use destination variable also to determine size. No binary change, both
buffers are of the same size.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sbin/gpt/show.c

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

Modified files:

Index: src/sbin/gpt/show.c
diff -u src/sbin/gpt/show.c:1.44 src/sbin/gpt/show.c:1.45
--- src/sbin/gpt/show.c:1.44	Tue Mar 26 11:23:55 2019
+++ src/sbin/gpt/show.c	Fri Sep 13 11:07:35 2024
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.44 2019/03/26 11:23:55 martin Exp $");
+__RCSID("$NetBSD: show.c,v 1.45 2024/09/13 11:07:35 mlelstv Exp $");
 #endif
 
 #include 
@@ -286,7 +286,7 @@ show_all(gpt_t gpt)
 			printf(PFX "Type: %s\n", s1);
 			printf(PFX "TypeID: %s\n", s2);
 
-			gpt_uuid_snprintf(s2, sizeof(s1), "%d", ent->ent_guid);
+			gpt_uuid_snprintf(s2, sizeof(s2), "%d", ent->ent_guid);
 			printf(PFX "GUID: %s\n", s2);
 
 			printf(PFX "Size: ");



CVS commit: src/sbin/gpt

2024-09-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Sep 13 11:07:35 UTC 2024

Modified Files:
src/sbin/gpt: show.c

Log Message:
Use destination variable also to determine size. No binary change, both
buffers are of the same size.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sbin/gpt/show.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/hppa/dev

2024-09-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 11 13:31:13 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
now that we know how, draw characters by hardware


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.14 src/sys/arch/hppa/dev/hyperfb.c:1.15
--- src/sys/arch/hppa/dev/hyperfb.c:1.14	Wed Sep  4 10:35:43 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Sep 11 13:31:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.14 2024/09/04 10:35:43 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.15 2024/09/11 13:31:13 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.14 2024/09/04 10:35:43 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.15 2024/09/11 13:31:13 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -1122,8 +1122,9 @@ hyperfb_putchar(void *cookie, int row, i
 	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct vcons_screen *scr = ri->ri_hw;
 	struct hyperfb_softc *sc = scr->scr_cookie;
-	int x, y, wi, he/*, rv = GC_NOPE*/;
-	uint32_t bg;
+	uint8_t *data;
+	int i, x, y, wi, he/*, rv = GC_NOPE*/;
+	uint32_t bg, fg, mask;
 
 	if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL)
 		return;
@@ -1142,19 +1143,54 @@ hyperfb_putchar(void *cookie, int row, i
 	y = ri->ri_yorigin + row * he;
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
+	fg = ri->ri_devcmap[(attr >> 24) & 0x0f];
 
-	if (c == 0x20) {
-		hyperfb_rectfill(sc, x, y, wi, he, bg);
+	/* clear the character cell */
+	hyperfb_rectfill(sc, x, y, wi, he, bg);
+
+	/* if we're drawing a space we're done here */
+	if (c == 0x20) 
 		return;
-	}
 
 #if 0
 	rv = glyphcache_try(&sc->sc_gc, c, x, y, attr);
 	if (rv == GC_OK)
 		return;
 #endif
-	if (sc->sc_hwmode != HW_FB) hyperfb_setup_fb(sc);
-	sc->sc_putchar(cookie, row, col, c, attr);
+
+	data = WSFONT_GLYPH(c, font);
+
+	hyperfb_wait_fifo(sc, 2);
+
+	/* character colour */
+	hyperfb_write4(sc, NGLE_REG_35, fg);
+	/* dst XY */
+	hyperfb_write4(sc, NGLE_REG_6, (x << 16) | y);
+
+	/*
+	 * drawing a rectangle moves the starting coordinates down the
+	 * y-axis so we can just hammer the wi/he register to draw a full
+	 * character
+	 */
+	if (ri->ri_font->stride == 1) {
+		for (i = 0; i < he; i++) {
+			hyperfb_wait_fifo(sc, 2);
+			mask = ((uint32_t)*data) << 24;
+			hyperfb_write4(sc, NGLE_REG_8, mask);	
+			hyperfb_write4(sc, NGLE_REG_9, (wi << 16) | 1);
+			data++;
+		}
+	} else {
+		for (i = 0; i < he; i++) {
+			hyperfb_wait_fifo(sc, 2);
+			mask = ((uint32_t)*data) << 8;
+			data++;
+			mask |= *data;
+			data++;
+			hyperfb_write4(sc, NGLE_REG_8, mask << 16);	
+			hyperfb_write4(sc, NGLE_REG_9, (wi << 16) | 1);
+		}
+	}
 #if 0
 	if (rv == GC_ADD)
 		glyphcache_add(&sc->sc_gc, c, x, y);



CVS commit: src/sys/arch/hppa/dev

2024-09-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 11 13:31:13 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
now that we know how, draw characters by hardware


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev

2024-09-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep 10 08:49:33 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
as suspected the Visualize EG's rectangle fill function works exactly the same
as HCRX's, so apply the same trick to draw less than 32 pixel wide rectangles
and get rid of the workaround


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.19 src/sys/arch/hppa/dev/gftfb.c:1.20
--- src/sys/arch/hppa/dev/gftfb.c:1.19	Wed Aug 28 06:20:30 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Tue Sep 10 08:49:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.19 2024/08/28 06:20:30 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.20 2024/09/10 08:49:33 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -85,7 +85,6 @@ struct	gftfb_softc {
 #define HW_FB	0
 #define HW_FILL	1
 #define HW_BLIT	2
-	uint32_t sc_rect_colour, sc_rect_height;
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -223,8 +222,6 @@ gftfb_attach(device_t parent, device_t s
 
 	sc->sc_width = sc->sc_scr.scr_cfg.scr_width;
 	sc->sc_height = sc->sc_scr.scr_cfg.scr_height;
-	sc->sc_rect_colour = 0xf000;
-	sc->sc_rect_height = 0;
 
 	aprint_normal_dev(sc->sc_dev, "%s at %dx%d\n", sc->sc_scr.name, 
 	sc->sc_width, sc->sc_height);
@@ -654,8 +651,6 @@ gftfb_setup(struct gftfb_softc *sc)
 	sc->sc_enabled = 0;
 	sc->sc_video_on = 1;
 
-	sc->sc_rect_colour = 0xf000;
-	sc->sc_rect_height = 0;
 
 	/* set Bt458 read mask register to all planes */
 	gftfb_wait(sc);
@@ -869,7 +864,6 @@ gftfb_mmap(void *v, void *vs, off_t offs
 	struct sti_rom *rom = sc->sc_base.sc_rom;
 	paddr_t pa = -1;
 
-
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
@@ -1038,28 +1032,32 @@ gftfb_wait_fifo(struct gftfb_softc *sc, 
 }
 
 static void
-gftfb_real_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he,
+gftfb_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he,
 		  uint32_t bg)
 {
 	struct sti_rom *rom = sc->sc_base.sc_rom;
 	bus_space_tag_t memt = rom->memt;
 	bus_space_handle_t memh = rom->regh[2];
+	uint32_t mask = 0x;
 
 	if (sc->sc_hwmode != HW_FILL) {
-		gftfb_wait_fifo(sc, 4);
-		/* transfer data */
-		bus_space_write_stream_4(memt, memh, NGLE_REG_8, 0x);
+		gftfb_wait_fifo(sc, 3);
 		/* plane mask */
 		bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0xff);
 		/* bitmap op */
 		bus_space_write_stream_4(memt, memh, NGLE_REG_14, 
-		IBOvals(RopSrc, 0, BitmapExtent08, 0, DataDynamic, MaskOtc, 0, 0));
+		IBOvals(RopSrc, 0, BitmapExtent08, 0, DataDynamic, MaskOtc, 1, 0));
 		/* dst bitmap access */
 		bus_space_write_stream_4(memt, memh, NGLE_REG_11,
 		BA(IndexedDcd, Otc32, OtsIndirect, AddrLong, 0, BINapp0I, 0));
 		sc->sc_hwmode = HW_FILL;
 	}
-	gftfb_wait_fifo(sc, 3);
+	gftfb_wait_fifo(sc, 4);
+
+	if (wi < 32)
+		mask = 0x << (32 - wi);
+	/* transfer data */
+	bus_space_write_stream_4(memt, memh, NGLE_REG_8, mask);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_35, bg);
 	/* dst XY */
 	bus_space_write_stream_4(memt, memh, NGLE_REG_6, (x << 16) | y);
@@ -1069,31 +1067,6 @@ gftfb_real_rectfill(struct gftfb_softc *
 }
 
 static void
-gftfb_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he,
-		  uint32_t bg)
-{
-	/*
-	 * For some reason my 4MB VisEG always draws rectangles at least 32
-	 * pixels wide - no idea why, the bitblt command doesn't have this
-	 * problem.
-	 * So, as a workaround, we draw a 50xFontHeight rectangle to the right
-	 * of the visible fb, keep track of the colour so we don't need to
-	 * redraw every time, and bitblt the portion we need
-	 */
-	if (wi < 50) {
-		if ((bg != sc->sc_rect_colour) ||
-		(he > sc->sc_rect_height)) {
-			gftfb_real_rectfill(sc, sc->sc_width + 10, 0, 50, 
-			he, bg);
-			sc->sc_rect_colour = bg;
-			sc->sc_rect_height = he;
-		}
-		gftfb_bitblt(sc, sc->sc_width + 10, 0, x, y, wi, he, RopSrc);
-	} else
-		gftfb_real_rectfill(sc, x, y, wi, he, bg);
-}
-
-static void
 gftfb_bitblt(void *cookie, int xs, int ys, int xd, int yd, int wi,
 			int he, int rop)
 {



CVS commit: src/sys/arch/hppa/dev

2024-09-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep 10 08:49:33 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
as suspected the Visualize EG's rectangle fill function works exactly the same
as HCRX's, so apply the same trick to draw less than 32 pixel wide rectangles
and get rid of the workaround


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hppa/dev/gftfb.c

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



CVS commit: src/usr.sbin/bthcid

2024-09-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  7 13:57:25 UTC 2024

Modified Files:
src/usr.sbin/bthcid: client.c hci.c

Log Message:
Don't get killed when peer vanishes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/bthcid/client.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/bthcid/hci.c

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



CVS commit: src/usr.sbin/bthcid

2024-09-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  7 13:57:25 UTC 2024

Modified Files:
src/usr.sbin/bthcid: client.c hci.c

Log Message:
Don't get killed when peer vanishes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/bthcid/client.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/bthcid/hci.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.sbin/bthcid/client.c
diff -u src/usr.sbin/bthcid/client.c:1.5 src/usr.sbin/bthcid/client.c:1.6
--- src/usr.sbin/bthcid/client.c:1.5	Tue Jan 10 20:56:41 2017
+++ src/usr.sbin/bthcid/client.c	Sat Sep  7 13:57:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: client.c,v 1.5 2017/01/10 20:56:41 christos Exp $	*/
+/*	$NetBSD: client.c,v 1.6 2024/09/07 13:57:25 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: client.c,v 1.5 2017/01/10 20:56:41 christos Exp $");
+__RCSID("$NetBSD: client.c,v 1.6 2024/09/07 13:57:25 mlelstv Exp $");
 
 #include 
 #include 
@@ -268,7 +268,7 @@ send_client_request(bdaddr_t *laddr, bda
 	cp.time = PIN_REQUEST_TIMEOUT;
 
 	LIST_FOREACH(cl, &client_list, next) {
-		if (send(cl->fd, &cp, sizeof(cp), 0) != sizeof(cp))
+		if (send(cl->fd, &cp, sizeof(cp), MSG_NOSIGNAL) != sizeof(cp))
 			syslog(LOG_ERR, "send PIN request failed");
 		else
 			n++;

Index: src/usr.sbin/bthcid/hci.c
diff -u src/usr.sbin/bthcid/hci.c:1.3 src/usr.sbin/bthcid/hci.c:1.4
--- src/usr.sbin/bthcid/hci.c:1.3	Mon Oct  5 12:34:26 2009
+++ src/usr.sbin/bthcid/hci.c	Sat Sep  7 13:57:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.c,v 1.3 2009/10/05 12:34:26 plunky Exp $	*/
+/*	$NetBSD: hci.c,v 1.4 2024/09/07 13:57:25 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -55,7 +55,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: hci.c,v 1.3 2009/10/05 12:34:26 plunky Exp $");
+__RCSID("$NetBSD: hci.c,v 1.4 2024/09/07 13:57:25 mlelstv Exp $");
 
 #include 
 #include 
@@ -335,6 +335,6 @@ send_hci_cmd(int sock, struct sockaddr_b
 	if (len > 0)
 		memcpy(msg + sizeof(hci_cmd_hdr_t), buf, len);
 
-	return sendto(sock, msg, sizeof(hci_cmd_hdr_t) + len, 0,
+	return sendto(sock, msg, sizeof(hci_cmd_hdr_t) + len, MSG_NOSIGNAL,
 			(struct sockaddr *)sa, sizeof(*sa));
 }



CVS commit: src/sys/dev/ic

2024-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  4 10:45:50 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
more annotations:
- 'transfer data' is actually a pixel mask
- transparency
- bg colour register confirmed
all found by experiment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/stireg.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/ic

2024-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  4 10:45:50 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
more annotations:
- 'transfer data' is actually a pixel mask
- transparency
- bg colour register confirmed
all found by experiment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/stireg.h

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

Modified files:

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.13 src/sys/dev/ic/stireg.h:1.14
--- src/sys/dev/ic/stireg.h:1.13	Mon Aug 19 10:57:32 2024
+++ src/sys/dev/ic/stireg.h	Wed Sep  4 10:45:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.13 2024/08/19 10:57:32 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.14 2024/09/04 10:45:50 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -650,6 +650,8 @@ STI_DEP(util);
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
 	/* LSSD       ??BF */
 
+/* B = 1 -> background transparency for masked fills */
+
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
 #define	FractDcd	1	/* Pixel data is Fractional 8-8-8 */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
@@ -687,7 +689,8 @@ STI_DEP(util);
 #define	NGLE_REG_6		0x000800	/* rectfill XY */
 #define	NGLE_REG_7		0x000804	/* bitblt size WH */
 #define	NGLE_REG_24		0x000808	/* bitblt src XY */
-#define	NGLE_REG_8		0x000820	/* transfer data */
+#define	NGLE_REG_8		0x000820	/* 'transfer data' - this is */
+		/* a pixel mask on fills */
 #define	NGLE_REG_37		0x000944	/* HCRX fast rect fill, size */
 #define	NGLE_REG_9		0x000a04	/* rect fill size, start */
 #define	NGLE_REG_25		0x000b00	/* bitblt dst XY, start */
@@ -695,8 +698,8 @@ STI_DEP(util);
 #define	NGLE_REG_10		0x018000	/* buffer ctl */
 #define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
-#define	NGLE_REG_35		0x018010	/* fg color */
-#define	NGLE_REG_36		0x018014	/* bg colour? */
+#define	NGLE_REG_35		0x018010	/* fg colour */
+#define	NGLE_REG_36		0x018014	/* bg colour */
 #define	NGLE_REG_13		0x018018	/* image planemask */
 #define	NGLE_REG_14		0x01801c	/* raster op */
 #define	NGLE_REG_15		0x20	/* 'busy dodger' idle */



CVS commit: src/sys/arch/hppa/dev

2024-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  4 10:35:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
get rid of the workarounds to draw rectangles less than 32 pixels wide
turns out the hardware applies a bit mask to all rectangle fills, and we
can turn the background transparent. With that we just mask off the pixels
we don't need in the less than 32 pixels wide case.
Next step - figure out how to abuse that to draw characters
I bet Visualize EG works exactly the same way in that regard.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.13 src/sys/arch/hppa/dev/hyperfb.c:1.14
--- src/sys/arch/hppa/dev/hyperfb.c:1.13	Wed Aug 28 06:20:30 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Sep  4 10:35:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.13 2024/08/28 06:20:30 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.14 2024/09/04 10:35:43 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.13 2024/08/28 06:20:30 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.14 2024/09/04 10:35:43 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -493,6 +493,36 @@ hyperfb_attach(device_t parent, device_t
 	config_found(sc->sc_dev, &aa, wsemuldisplaydevprint, CFARGS_NONE);
 
 	hyperfb_setup_fb(sc);
+	
+#ifdef HYPERFB_DEBUG
+	int i;
+
+	hyperfb_wait_fifo(sc, 4);
+	/* transfer data */
+	hyperfb_write4(sc, NGLE_REG_8, 0xff00ff00);
+	/* plane mask */
+	hyperfb_write4(sc, NGLE_REG_13, 0xff);
+	/* bitmap op */
+	hyperfb_write4(sc, NGLE_REG_14,
+	IBOvals(RopSrc, 0, BitmapExtent08, 0, DataDynamic, MaskOtc, 1, 0));
+	/* dst bitmap access */
+	hyperfb_write4(sc, NGLE_REG_11,
+	BA(IndexedDcd, Otc32, OtsIndirect, AddrLong, 0, BINovly, 0));
+
+	hyperfb_wait_fifo(sc, 3);
+	hyperfb_write4(sc, NGLE_REG_35, 0xe0);
+	hyperfb_write4(sc, NGLE_REG_36, 0x1c);
+	/* dst XY */
+	hyperfb_write4(sc, NGLE_REG_6, (2 << 16) | 902);
+	/* len XY start */
+	hyperfb_write4(sc, NGLE_REG_9, (28 << 16) | 32);
+
+	for (i = 0; i < 32; i++)
+		hyperfb_write4(sc, NGLE_REG_8, (i & 4) ? 0xff00ff00 : 0x00ff00ff);
+
+	hyperfb_rectfill(sc, 70, 902, 16, 32, 0xe0);
+	hyperfb_rectfill(sc, 50, 902, 16, 32, 0x1c);
+#endif
 }
 
 static void
@@ -504,7 +534,11 @@ hyperfb_init_screen(void *cookie, struct
 
 	ri->ri_depth = 8;
 	ri->ri_width = 1280;
+#ifdef HYPERFB_DEBUG
+	ri->ri_height = 900;
+#else
 	ri->ri_height = 1024;
+#endif
 	ri->ri_stride = 2048;
 	ri->ri_flg = RI_CENTER | RI_8BIT_IS_RGB /*|
 		 RI_ENABLE_ALPHA | RI_PREFER_ALPHA*/;
@@ -973,79 +1007,39 @@ static void
 hyperfb_rectfill(struct hyperfb_softc *sc, int x, int y, int wi, int he,
 uint32_t bg)
 {
+	uint32_t mask = 0x;
+
 	/*
 	 * XXX
-	 * HCRX has the same problem as VisEG drawing rectangles less than 32
-	 * pixels wide, but here we don't seem to have any usable offscreen
-	 * memory, at least not as long as we're using the overlay planes.
-	 * As a workaround, fall back to memset()-based fills for rectangles
-	 * less than 32 pixels wide
+	 * HCRX and EG both always draw rectangles at least 32 pixels wide
+	 * for anything narrower we need to set a bit mask and enable 
+	 * transparency
 	 */
-	if (wi < 32) {
-#if 0
-		int i;
-		uint8_t *ptr = (uint8_t *)sc->sc_fb + (y << 11) + x;
 
-		if (sc->sc_hwmode != HW_FB)
-			hyperfb_setup_fb(sc);
-
-		for (i = 0; i < he; i++) {
-			memset(ptr, bg, wi);
-			ptr += 2048;
-		}
-#else
-		/*
-		 * instead of memset() we abuse the blitter - set / clear the
-		 * planes we want, select colour by planemask, do two passes
-		 * where necessary ( as in, anything not black or white )
-		 */
-		if (sc->sc_hwmode != HW_SFILL) {
-			hyperfb_wait(sc);
-			hyperfb_write4(sc, NGLE_REG_10,
-		 	 BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
-			sc->sc_hwmode = HW_SFILL;
-		}
-		bg &= 0xff;
-		hyperfb_wait_fifo(sc, 2);
-		hyperfb_write4(sc, NGLE_REG_24, (x << 16) | y);
-		if (bg != 0) {
-			hyperfb_wait_fifo(sc, 4);
-			hyperfb_write4(sc, NGLE_REG_14,
-			IBOvals(RopSet, 0, BitmapExtent08, 1, DataDynamic,
-MaskOtc, 0, 0));
-			hyperfb_write4(sc, NGLE_REG_13, bg);
-			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
-			hyperfb_write4(sc, NGLE_REG_25, (x << 16) | y);
-		}
-		if (bg != 0xff) {
-			hyperfb_wait_fifo(sc, 4);
-			hyperfb_write4(sc, NGLE_REG_14,
-			IBOvals(RopClr, 0, BitmapExtent08, 1, DataDynamic,
-MaskOtc, 0, 0));
-			hyperfb_write4(sc, NGLE_REG_13, bg ^ 0xff);
-			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
-			hyperfb

CVS commit: src/sys/arch/hppa/dev

2024-09-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  4 10:35:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
get rid of the workarounds to draw rectangles less than 32 pixels wide
turns out the hardware applies a bit mask to all rectangle fills, and we
can turn the background transparent. With that we just mask off the pixels
we don't need in the less than 32 pixels wide case.
Next step - figure out how to abuse that to draw characters
I bet Visualize EG works exactly the same way in that regard.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: xsrc/external/mit/xf86-video-nv/dist/src

2024-09-02 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Sep  2 07:09:57 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-nv/dist/src: nv_xaa.c

Log Message:
we need NVDMA*() even when building without XAA support


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xf86-video-nv/dist/src/nv_xaa.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-nv/dist/src/nv_xaa.c
diff -u xsrc/external/mit/xf86-video-nv/dist/src/nv_xaa.c:1.4 xsrc/external/mit/xf86-video-nv/dist/src/nv_xaa.c:1.5
--- xsrc/external/mit/xf86-video-nv/dist/src/nv_xaa.c:1.4	Thu Jul  4 06:40:39 2024
+++ xsrc/external/mit/xf86-video-nv/dist/src/nv_xaa.c	Mon Sep  2 07:09:57 2024
@@ -307,8 +307,7 @@ crap:
 NVResetGraphics(pScrn);
 }
 
-#ifdef HAVE_XAA_H
-static void
+void
 NVDMAKickoffCallback (ScrnInfoPtr pScrn)
 {
NVPtr pNv = NVPTR(pScrn);
@@ -317,6 +316,7 @@ NVDMAKickoffCallback (ScrnInfoPtr pScrn)
pNv->DMAKickoffCallback = NULL;
 }
 
+#ifdef HAVE_XAA_H
 static void
 NVSetupForScreenToScreenCopy(
ScrnInfoPtr pScrn, 



CVS commit: xsrc/external/mit/xf86-video-nv/dist/src

2024-09-02 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Sep  2 07:09:57 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-nv/dist/src: nv_xaa.c

Log Message:
we need NVDMA*() even when building without XAA support


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 xsrc/external/mit/xf86-video-nv/dist/src/nv_xaa.c

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



CVS commit: src/sys/lib/libsa

2024-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 31 07:12:57 UTC 2024

Modified Files:
src/sys/lib/libsa: subr_prf.c

Log Message:
Only a leading '0' in a format width marks zero-padding, otherwise
it's a regular digit.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/lib/libsa/subr_prf.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/lib/libsa/subr_prf.c
diff -u src/sys/lib/libsa/subr_prf.c:1.30 src/sys/lib/libsa/subr_prf.c:1.31
--- src/sys/lib/libsa/subr_prf.c:1.30	Mon May 29 03:56:52 2023
+++ src/sys/lib/libsa/subr_prf.c	Sat Aug 31 07:12:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.30 2023/05/29 03:56:52 rin Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.31 2024/08/31 07:12:57 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -197,8 +197,11 @@ reswitch:
 			lflag |= SIGN;
 			goto reswitch;
 		case '0':
-			lflag |= ZEROPAD;
-			goto reswitch;
+			if (width == 0) {
+lflag |= ZEROPAD;
+goto reswitch;
+			}
+			/* FALLTHROUGH */
 		case '1': case '2': case '3': case '4': case '5':
 		case '6': case '7': case '8': case '9':
 			for (;;) {



CVS commit: src/sys/lib/libsa

2024-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 31 07:12:57 UTC 2024

Modified Files:
src/sys/lib/libsa: subr_prf.c

Log Message:
Only a leading '0' in a format width marks zero-padding, otherwise
it's a regular digit.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/lib/libsa/subr_prf.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/hppa/dev

2024-08-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 28 06:20:30 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
properly return status info in ioctl(WSDISPLAYIO_GVIDEO)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev

2024-08-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 28 06:20:30 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
properly return status info in ioctl(WSDISPLAYIO_GVIDEO)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.18 src/sys/arch/hppa/dev/gftfb.c:1.19
--- src/sys/arch/hppa/dev/gftfb.c:1.18	Mon Aug 19 10:58:43 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Aug 28 06:20:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.18 2024/08/19 10:58:43 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.19 2024/08/28 06:20:30 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -854,8 +854,9 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 		gftfb_set_video(sc, *(int *)data);
 		return 0;
 	case WSDISPLAYIO_GVIDEO:
-		return sc->sc_video_on ? 
+		*(u_int *)data = sc->sc_video_on ?
 		WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF;
+		return 0;
 	}
 	return EPASSTHROUGH;
 }

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.12 src/sys/arch/hppa/dev/hyperfb.c:1.13
--- src/sys/arch/hppa/dev/hyperfb.c:1.12	Mon Aug 19 10:58:43 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Aug 28 06:20:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.12 2024/08/19 10:58:43 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.13 2024/08/28 06:20:30 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.12 2024/08/19 10:58:43 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.13 2024/08/28 06:20:30 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -649,8 +649,9 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 		hyperfb_set_video(sc, *(int *)data);
 		return 0;
 	case WSDISPLAYIO_GVIDEO:
-		return sc->sc_video_on ?
+		*(u_int *)data = sc->sc_video_on ?
 		WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF;
+		return 0;
 	}
 	return EPASSTHROUGH;
 }



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 12:38:21 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix off-by-one.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/bcmgenet.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/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.18 src/sys/dev/ic/bcmgenet.c:1.19
--- src/sys/dev/ic/bcmgenet.c:1.18	Sun Aug 25 08:31:07 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 12:38:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.19 2024/08/25 12:38:20 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.19 2024/08/25 12:38:20 mlelstv Exp $");
 
 #include 
 #include 
@@ -684,7 +684,7 @@ genet_stop_locked(struct genet_softc *sc
 	genet_disable_intr(sc);
 
 	/* Free TX buffers */
-	for (i=0; i<=TX_DESC_COUNT; ++i)
+	for (i=0; iif_flags &= ~IFF_RUNNING;



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 12:38:21 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix off-by-one.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/bcmgenet.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/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:31:07 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix mbuf leak.
Minor optimizations for send queue.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/bcmgenet.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/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:31:07 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix mbuf leak.
Minor optimizations for send queue.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/bcmgenet.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/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.17 src/sys/dev/ic/bcmgenet.c:1.18
--- src/sys/dev/ic/bcmgenet.c:1.17	Sun Aug 25 08:27:06 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 08:31:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.18 2024/08/25 08:31:07 mlelstv Exp $");
 
 #include 
 #include 
@@ -621,11 +621,33 @@ genet_init(struct ifnet *ifp)
 	return error;
 }
 
+static int
+genet_free_txbuf(struct genet_softc *sc, int index)
+{
+	struct genet_bufmap *bmap;
+
+	bmap = &sc->sc_tx.buf_map[index];
+	if (bmap->mbuf == NULL)
+		return 0;
+
+	if (bmap->map->dm_mapsize > 0) {
+		bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
+		0, bmap->map->dm_mapsize,
+		BUS_DMASYNC_POSTWRITE);
+	}
+	bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
+	m_freem(bmap->mbuf);
+	bmap->mbuf = NULL;
+
+	return 1;
+}
+
 static void
 genet_stop_locked(struct genet_softc *sc, int disable)
 {
 	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	uint32_t val;
+	int i;
 
 	GENET_ASSERT_LOCKED(sc);
 
@@ -661,6 +683,10 @@ genet_stop_locked(struct genet_softc *sc
 	/* Disable interrupts */
 	genet_disable_intr(sc);
 
+	/* Free TX buffers */
+	for (i=0; i<=TX_DESC_COUNT; ++i)
+		genet_free_txbuf(sc, i);
+
 	ifp->if_flags &= ~IFF_RUNNING;
 }
 
@@ -771,34 +797,22 @@ static void
 genet_txintr(struct genet_softc *sc, int qid)
 {
 	struct ifnet *ifp = &sc->sc_ec.ec_if;
-	struct genet_bufmap *bmap;
 	int cidx, i, pkts = 0;
 
 	cidx = RD4(sc, GENET_TX_DMA_CONS_INDEX(qid)) & 0x;
 	i = sc->sc_tx.cidx % TX_DESC_COUNT;
 	while (sc->sc_tx.cidx != cidx) {
-		bmap = &sc->sc_tx.buf_map[i];
-		if (bmap->mbuf != NULL) {
-			/* XXX first segment already unloads */
-			if (bmap->map->dm_mapsize > 0) {
-bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
-0, bmap->map->dm_mapsize,
-BUS_DMASYNC_POSTWRITE);
-			}
-			bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
-			m_freem(bmap->mbuf);
-			bmap->mbuf = NULL;
-			++pkts;
-		}
-
+		pkts += genet_free_txbuf(sc, i);
 		i = TX_NEXT(i);
 		sc->sc_tx.cidx = (sc->sc_tx.cidx + 1) & 0x;
 	}
 
-	if_statadd(ifp, if_opackets, pkts);
-
-	if (pkts != 0)
+	if (pkts != 0) {
+		if_statadd(ifp, if_opackets, pkts);
 		rnd_add_uint32(&sc->sc_rndsource, pkts);
+	}
+
+	if_schedule_deferred_start(ifp);
 }
 
 static void
@@ -819,7 +833,11 @@ genet_start_locked(struct genet_softc *s
 	cnt = 0;
 
 	sc->sc_tx.queued = (RD4(sc, GENET_TX_DMA_PROD_INDEX(qid))
-	  - RD4(sc, GENET_TX_DMA_CONS_INDEX(qid))) & 0x;
+	  - sc->sc_tx.cidx) & 0x;
+
+	/* At least one descriptor free ? */
+	if (sc->sc_tx.queued >= TX_DESC_COUNT - 1)
+		return;
 
 	for (;;) {
 		IFQ_POLL(&ifp->if_snd, m);
@@ -863,9 +881,7 @@ int
 genet_intr(void *arg)
 {
 	struct genet_softc *sc = arg;
-	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	uint32_t val;
-	bool dotx = false;
 
 	val = RD4(sc, GENET_INTRL2_CPU_STAT);
 	val &= ~RD4(sc, GENET_INTRL2_CPU_STAT_MASK);
@@ -879,12 +895,8 @@ genet_intr(void *arg)
 
 	if (val & GENET_IRQ_TXDMA_DONE) {
 		genet_txintr(sc, GENET_DMA_DEFAULT_QUEUE);
-		dotx = true;
 	}
 
-	if (dotx)
-		if_schedule_deferred_start(ifp);
-
 	return 1;
 }
 



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:27:06 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix MBUFTRACE


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/bcmgenet.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/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.16 src/sys/dev/ic/bcmgenet.c:1.17
--- src/sys/dev/ic/bcmgenet.c:1.16	Sun Aug 25 08:24:42 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 08:27:06 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.17 2024/08/25 08:27:06 mlelstv Exp $");
 
 #include 
 #include 
@@ -722,10 +722,12 @@ genet_rxintr(struct genet_softc *sc, int
 			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
+		MCLAIM(m0, &sc->sc_ec.ec_rx_mowner);
 
 		/* unload map before it gets loaded in setup_rxbuf */
 		if (sc->sc_rx.buf_map[index].map->dm_mapsize > 0) {
-			bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
+			bus_dmamap_sync(sc->sc_rx.buf_tag,
+			sc->sc_rx.buf_map[index].map,
 			0, sc->sc_rx.buf_map[index].map->dm_mapsize,
 			BUS_DMASYNC_POSTREAD);
 		}
@@ -1011,6 +1013,21 @@ genet_setup_dma(struct genet_softc *sc, 
 	return 0;
 }
 
+static void
+genet_claim_rxring(struct genet_softc *sc, int qid)
+{
+	struct mbuf *m;
+	int i;
+
+	/* Claim mbufs from RX ring */
+	for (i = 0; i < RX_DESC_COUNT; i++) {
+		m = sc->sc_rx.buf_map[i].mbuf;
+		if (m != NULL) {
+			MCLAIM(m, &sc->sc_ec.ec_rx_mowner);
+		}
+	}
+}
+
 int
 genet_attach(struct genet_softc *sc)
 {
@@ -1110,6 +1127,9 @@ genet_attach(struct genet_softc *sc)
 	/* Attach ethernet interface */
 	ether_ifattach(ifp, eaddr);
 
+	/* MBUFTRACE */
+	genet_claim_rxring(sc, GENET_DMA_DEFAULT_QUEUE);
+
 	rnd_attach_source(&sc->sc_rndsource, ifp->if_xname, RND_TYPE_NET,
 	RND_FLAG_DEFAULT);
 



CVS commit: src/sys/dev/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:27:06 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Fix MBUFTRACE


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/bcmgenet.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/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:24:42 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Don't mix endianess and MAC address layout.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/bcmgenet.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/ic

2024-08-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 25 08:24:42 UTC 2024

Modified Files:
src/sys/dev/ic: bcmgenet.c

Log Message:
Don't mix endianess and MAC address layout.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/bcmgenet.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/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.15 src/sys/dev/ic/bcmgenet.c:1.16
--- src/sys/dev/ic/bcmgenet.c:1.15	Sun Aug 25 07:02:27 2024
+++ src/sys/dev/ic/bcmgenet.c	Sun Aug 25 08:24:42 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.15 2024/08/25 07:02:27 skrll Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.15 2024/08/25 07:02:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.16 2024/08/25 08:24:42 mlelstv Exp $");
 
 #include 
 #include 
@@ -949,8 +949,8 @@ genet_get_eaddr(struct genet_softc *sc, 
 
 	val = RD4(sc, GENET_SYS_RBUF_FLUSH_CTRL);
 	if ((val & GENET_SYS_RBUF_FLUSH_RESET) == 0) {
-		maclo = htobe32(RD4(sc, GENET_UMAC_MAC0));
-		machi = htobe16(RD4(sc, GENET_UMAC_MAC1) & 0x);
+		maclo = RD4(sc, GENET_UMAC_MAC0);
+		machi = RD4(sc, GENET_UMAC_MAC1) & 0x;
 	}
 
 	if (maclo == 0 && machi == 0) {
@@ -959,12 +959,12 @@ genet_get_eaddr(struct genet_softc *sc, 
 		machi = cprng_strong32() & 0x;
 	}
 
-	eaddr[0] = maclo & 0xff;
-	eaddr[1] = (maclo >> 8) & 0xff;
-	eaddr[2] = (maclo >> 16) & 0xff;
-	eaddr[3] = (maclo >> 24) & 0xff;
-	eaddr[4] = machi & 0xff;
-	eaddr[5] = (machi >> 8) & 0xff;
+	eaddr[0] = (maclo >> 24) & 0xff;
+	eaddr[1] = (maclo >> 16) & 0xff;
+	eaddr[2] = (maclo >>  8) & 0xff;
+	eaddr[3] = (maclo >>  0) & 0xff;
+	eaddr[4] = (machi >>  8) & 0xff;
+	eaddr[5] = (machi >>  0) & 0xff;
 }
 
 static int



CVS commit: src/sys/dev/iscsi

2024-08-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 24 09:39:44 UTC 2024

Modified Files:
src/sys/dev/iscsi: iscsi_ioctl.c iscsi_send.c

Log Message:
Avoid race in timeout handling.
Don't try to wake up CCB without connection (which led to a NULL pointer deref).


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/iscsi/iscsi_send.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/iscsi/iscsi_ioctl.c
diff -u src/sys/dev/iscsi/iscsi_ioctl.c:1.34 src/sys/dev/iscsi/iscsi_ioctl.c:1.35
--- src/sys/dev/iscsi/iscsi_ioctl.c:1.34	Sat Nov 25 10:08:27 2023
+++ src/sys/dev/iscsi/iscsi_ioctl.c	Sat Aug 24 09:39:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.34 2023/11/25 10:08:27 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.35 2024/08/24 09:39:44 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -1635,9 +1635,11 @@ connection_timeout_co(void *par)
 	connection_t *conn = par;
 
 	mutex_enter(&iscsi_cleanup_mtx);
-	conn->c_timedout = TOUT_QUEUED;
-	TAILQ_INSERT_TAIL(&iscsi_timeout_conn_list, conn, c_tchain);
-	iscsi_notify_cleanup();
+	if (conn->c_timedout == TOUT_ARMED) {
+		conn->c_timedout = TOUT_QUEUED;
+		TAILQ_INSERT_TAIL(&iscsi_timeout_conn_list, conn, c_tchain);
+		iscsi_notify_cleanup();
+	}
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 
@@ -1657,14 +1659,13 @@ connection_timeout_stop(connection_t *co
 {
 	callout_stop(&conn->c_timeout);
 	mutex_enter(&iscsi_cleanup_mtx);
-	if (conn->c_timedout == TOUT_QUEUED) {
+	if (conn->c_timedout == TOUT_QUEUED)
 		TAILQ_REMOVE(&iscsi_timeout_conn_list, conn, c_tchain);
-		conn->c_timedout = TOUT_NONE;
-	}   
 	if (curlwp != iscsi_cleanproc) {
 		while (conn->c_timedout == TOUT_BUSY)
 			kpause("connbusy", false, 1, &iscsi_cleanup_mtx);
 	}
+	conn->c_timedout = TOUT_NONE;
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 
@@ -1674,9 +1675,11 @@ ccb_timeout_co(void *par)
 	ccb_t *ccb = par;
 
 	mutex_enter(&iscsi_cleanup_mtx);
-	ccb->ccb_timedout = TOUT_QUEUED;
-	TAILQ_INSERT_TAIL(&iscsi_timeout_ccb_list, ccb, ccb_tchain);
-	iscsi_notify_cleanup();
+	if (ccb->ccb_timedout == TOUT_ARMED) {
+		ccb->ccb_timedout = TOUT_QUEUED;
+		TAILQ_INSERT_TAIL(&iscsi_timeout_ccb_list, ccb, ccb_tchain);
+		iscsi_notify_cleanup();
+	}
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 
@@ -1696,14 +1699,13 @@ ccb_timeout_stop(ccb_t *ccb)
 {
 	callout_stop(&ccb->ccb_timeout);
 	mutex_enter(&iscsi_cleanup_mtx);
-	if (ccb->ccb_timedout == TOUT_QUEUED) {
+	if (ccb->ccb_timedout == TOUT_QUEUED)
 		TAILQ_REMOVE(&iscsi_timeout_ccb_list, ccb, ccb_tchain);
-		ccb->ccb_timedout = TOUT_NONE;
-	} 
 	if (curlwp != iscsi_cleanproc) {
 		while (ccb->ccb_timedout == TOUT_BUSY)
 			kpause("ccbbusy", false, 1, &iscsi_cleanup_mtx);
 	}
+	ccb->ccb_timedout = TOUT_NONE;
 	mutex_exit(&iscsi_cleanup_mtx);
 }
 

Index: src/sys/dev/iscsi/iscsi_send.c
diff -u src/sys/dev/iscsi/iscsi_send.c:1.40 src/sys/dev/iscsi/iscsi_send.c:1.41
--- src/sys/dev/iscsi/iscsi_send.c:1.40	Sat Nov 25 10:08:27 2023
+++ src/sys/dev/iscsi/iscsi_send.c	Sat Aug 24 09:39:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_send.c,v 1.40 2023/11/25 10:08:27 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_send.c,v 1.41 2024/08/24 09:39:44 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -1723,19 +1723,19 @@ ccb_timeout(ccb_t *ccb)
 {
 	connection_t *conn = ccb->ccb_connection;
 
+	if (conn == NULL) {
+		/* XXX Should never happen */
+		printf("ccb_timeout: num=%d total=%d disp=%d invalid ccb=%p\n",
+			ccb->ccb_num_timeouts+1, ccb->ccb_total_tries,
+			ccb->ccb_disp, ccb);
+		return;
+	}
+
 	ccb->ccb_total_tries++;
 
 	DEBC(conn, 0, ("ccb_timeout: num=%d total=%d disp=%d\n",
 		ccb->ccb_num_timeouts+1, ccb->ccb_total_tries, ccb->ccb_disp));
 
-	/*
-	 * XXX can we time out after connection is closed ?
-	 */
-	if (conn == NULL) {
-		wake_ccb(ccb, ISCSI_STATUS_TIMEOUT);
-		return;
-	}
-
 	if (++ccb->ccb_num_timeouts > MAX_CCB_TIMEOUTS ||
 		ccb->ccb_total_tries > MAX_CCB_TRIES ||
 		ccb->ccb_disp <= CCBDISP_FREE ||



CVS commit: src/sys/dev/iscsi

2024-08-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 24 09:39:44 UTC 2024

Modified Files:
src/sys/dev/iscsi: iscsi_ioctl.c iscsi_send.c

Log Message:
Avoid race in timeout handling.
Don't try to wake up CCB without connection (which led to a NULL pointer deref).


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/iscsi/iscsi_send.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/hppa/dev

2024-08-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 19 10:58:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
implement ioctl(GCID)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.17 src/sys/arch/hppa/dev/gftfb.c:1.18
--- src/sys/arch/hppa/dev/gftfb.c:1.17	Thu Aug  1 00:20:22 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Mon Aug 19 10:58:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.17 2024/08/01 00:20:22 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.18 2024/08/19 10:58:43 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -753,6 +753,10 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 		*(u_int *)data = WSDISPLAY_TYPE_STI;
 		return 0;
 
+	case GCID:
+		*(u_int *)data = STI_DD_EG;
+		return 0;
+
 	/* PCI config read/write passthrough. */
 	case PCI_IOC_CFGREAD:
 	case PCI_IOC_CFGWRITE:

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.11 src/sys/arch/hppa/dev/hyperfb.c:1.12
--- src/sys/arch/hppa/dev/hyperfb.c:1.11	Wed Aug  7 00:47:34 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Mon Aug 19 10:58:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.11 2024/08/07 00:47:34 riastradh Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.12 2024/08/19 10:58:43 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.11 2024/08/07 00:47:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.12 2024/08/19 10:58:43 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -543,6 +543,10 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 		*(u_int *)data = WSDISPLAY_TYPE_STI;
 		return 0;
 
+	case GCID:
+		*(u_int *)data = STI_DD_HCRX;
+		return 0;
+
 	case WSDISPLAYIO_GINFO:
 		if (ms == NULL)
 			return ENODEV;



CVS commit: src/sys/arch/hppa/dev

2024-08-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 19 10:58:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
implement ioctl(GCID)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-08-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 19 10:57:32 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c stireg.h

Log Message:
add an ioctl() to read a device's graphics ID, mimic HP/UX's GCID
that way an xorg driver can identify which WSDISPLAY_TYPE_STI it's talking to
without having to setup its own STI


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/sti.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/stireg.h

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

Modified files:

Index: src/sys/dev/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.37 src/sys/dev/ic/sti.c:1.38
--- src/sys/dev/ic/sti.c:1.37	Wed Jul  3 13:08:36 2024
+++ src/sys/dev/ic/sti.c	Mon Aug 19 10:57:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.38 2024/08/19 10:57:32 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.38 2024/08/19 10:57:32 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -1073,6 +1073,7 @@ int
 sti_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
 {
 	struct sti_screen *scr = (struct sti_screen *)v;
+	struct sti_rom *rom = scr->scr_rom;
 	struct wsdisplay_fbinfo *wdf;
 	struct wsdisplay_cmap *cmapp;
 	u_int mode, idx, count;
@@ -1080,6 +1081,10 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 
 	ret = 0;
 	switch (cmd) {
+	case GCID:
+		*(u_int *) data = rom->rom_dd.dd_grid[0];
+		break;
+
 	case WSDISPLAYIO_GMODE:
 		*(u_int *)data = scr->scr_wsmode;
 		break;
@@ -1117,6 +1122,7 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 		*(u_int *)data = WSDISPLAY_TYPE_STI;
 		break;
 
+
 	case WSDISPLAYIO_GINFO:
 		wdf = (struct wsdisplay_fbinfo *)data;
 		wdf->height = scr->scr_cfg.scr_height;

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.12 src/sys/dev/ic/stireg.h:1.13
--- src/sys/dev/ic/stireg.h:1.12	Tue Aug  6 07:26:56 2024
+++ src/sys/dev/ic/stireg.h	Mon Aug 19 10:57:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.12 2024/08/06 07:26:56 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.13 2024/08/19 10:57:32 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -747,4 +747,7 @@ STI_DEP(util);
 #define	NGLE_BUFF1_CMAP3	0x0c001e02
 #define	NGLE_ARTIST_CMAP0	0x0102
 
+/* mimic HP/UX, this will return the device's graphics ID */
+#define	GCID	_IOR('G', 40, u_int)
+
 #endif /* _IC_STIREG_H_ */



CVS commit: src/sys/dev/ic

2024-08-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug 19 10:57:32 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c stireg.h

Log Message:
add an ioctl() to read a device's graphics ID, mimic HP/UX's GCID
that way an xorg driver can identify which WSDISPLAY_TYPE_STI it's talking to
without having to setup its own STI


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/sti.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/stireg.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

2024-08-15 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Aug 15 21:08:20 UTC 2024

Modified Files:
src/sys/dev: vnd.c

Log Message:
Avoid division by zero when the backing file is revoked (e.g. from umount -f).


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/dev/vnd.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

2024-08-15 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Aug 15 21:08:20 UTC 2024

Modified Files:
src/sys/dev: vnd.c

Log Message:
Avoid division by zero when the backing file is revoked (e.g. from umount -f).


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.289 src/sys/dev/vnd.c:1.290
--- src/sys/dev/vnd.c:1.289	Fri May 19 15:42:43 2023
+++ src/sys/dev/vnd.c	Thu Aug 15 21:08:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.289 2023/05/19 15:42:43 mlelstv Exp $	*/
+/*	$NetBSD: vnd.c,v 1.290 2024/08/15 21:08:20 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.289 2023/05/19 15:42:43 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.290 2024/08/15 21:08:20 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -875,6 +875,9 @@ handle_with_strategy(struct vnd_softc *v
 	bn = obp->b_rawblkno * vnd->sc_dkdev.dk_label->d_secsize;
 
 	bsize = vnd->sc_vp->v_mount->mnt_stat.f_iosize;
+	/* use default if the filesystem didn't specify a block size */
+	if (bsize <= 0)
+		bsize = BLKDEV_IOSIZE;
 	skipped = 0;
 
 	/*



CVS commit: src/sys/dev/pci

2024-08-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 14 12:11:48 UTC 2024

Modified Files:
src/sys/dev/pci: pm3fb.c

Log Message:
initialize a screen even if we're not the console


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/pm3fb.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/pm3fb.c
diff -u src/sys/dev/pci/pm3fb.c:1.9 src/sys/dev/pci/pm3fb.c:1.10
--- src/sys/dev/pci/pm3fb.c:1.9	Sun Sep 25 17:52:25 2022
+++ src/sys/dev/pci/pm3fb.c	Wed Aug 14 12:11:48 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: pm3fb.c,v 1.9 2022/09/25 17:52:25 thorpej Exp $ */
+/* $NetBSD: pm3fb.c,v 1.10 2024/08/14 12:11:48 macallan Exp $ */
 
 /*
  * Copyright (c) 2015 Naruaki Etomi
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm3fb.c,v 1.9 2022/09/25 17:52:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm3fb.c,v 1.10 2024/08/14 12:11:48 macallan Exp $");
 
 #include 
 #include 
@@ -306,30 +306,25 @@ pm3fb_attach(device_t parent, device_t s
 
 	ri = &sc->sc_console_screen.scr_ri;
 
+	vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1, &defattr);
+	sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
+
+	pm3fb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height,
+	ri->ri_devcmap[(defattr >> 16) & 0xff]);
+	pm3fb_init_palette(sc);
+
+	sc->sc_defaultscreen_descr.textops = &ri->ri_ops;
+	sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
+	sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
+	sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
+
 	if (is_console) {
-		vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
-		&defattr);
-		sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
-
-		pm3fb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height,
-		ri->ri_devcmap[(defattr >> 16) & 0xff]);
-		sc->sc_defaultscreen_descr.textops = &ri->ri_ops;
-		sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
-		sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
-		sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
 
 		wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
 		vcons_replay_msgbuf(&sc->sc_console_screen);
-	} else {
-		if (sc->sc_console_screen.scr_ri.ri_rows == 0) {
-			/* do some minimal setup to avoid weirdnesses later */
-			vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
-			   &defattr);
-		}
 	}
 
-	pm3fb_init_palette(sc);
 
 	aa.console = is_console;
 	aa.scrdata = &sc->sc_screenlist;



CVS commit: src/sys/dev/pci

2024-08-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 14 12:11:48 UTC 2024

Modified Files:
src/sys/dev/pci: pm3fb.c

Log Message:
initialize a screen even if we're not the console


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/pm3fb.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/hppa/dev

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:34:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
magic number reduction, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.9 src/sys/arch/hppa/dev/hyperfb.c:1.10
--- src/sys/arch/hppa/dev/hyperfb.c:1.9	Mon Aug  5 09:45:05 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Tue Aug  6 07:34:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.10 2024/08/06 07:34:23 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.10 2024/08/06 07:34:23 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -220,10 +220,12 @@ hyperfb_setup_fb(struct hyperfb_softc *s
 	 */
 	hyperfb_wait(sc);
 	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
-		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(FractDcd, Otc24, Ots08, AddrLong, 0, BINapp0F8, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
 	} else {
-		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(IndexedDcd, Otc04, Ots08, AddrByte, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0xff);
 	}
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
@@ -237,7 +239,8 @@ hyperfb_setup_fb24(struct hyperfb_softc 
 {
 
 	hyperfb_wait(sc);
-	hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+	hyperfb_write4(sc, NGLE_REG_10, 
+	BA(FractDcd, Otc24, Ots08, AddrLong, 0, BINapp0F8, 0));
 	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
 	//IBOvals(RopSrc,0,BitmapExtent08,0,DataDynamic,MaskDynamic,0,0)
@@ -852,7 +855,8 @@ hyperfb_setup(struct hyperfb_softc *sc)
 	if (sc->sc_24bit) {
 		/* overlay transparency */
 		hyperfb_wait_fifo(sc, 7);
-		hyperfb_write4(sc, NGLE_REG_11, 0x13a02000);
+		hyperfb_write4(sc, NGLE_REG_11, 
+		BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_14, 0x03000300);
 		hyperfb_write4(sc, NGLE_REG_3, 0x17f0);
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
@@ -992,7 +996,8 @@ hyperfb_rectfill(struct hyperfb_softc *s
 		 */
 		if (sc->sc_hwmode != HW_SFILL) {
 			hyperfb_wait(sc);
-			hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+			hyperfb_write4(sc, NGLE_REG_10, 
+		 	 BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 			sc->sc_hwmode = HW_SFILL;
 		}
 		bg &= 0xff;
@@ -1051,7 +1056,8 @@ hyperfb_bitblt(void *cookie, int xs, int
 
 	if (sc->sc_hwmode != HW_BLIT) {
 		hyperfb_wait(sc);
-		hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0xff);
 		sc->sc_hwmode = HW_BLIT;
 	}



CVS commit: src/sys/arch/hppa/dev

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:34:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
magic number reduction, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:26:56 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits & pieces


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/stireg.h

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

Modified files:

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.11 src/sys/dev/ic/stireg.h:1.12
--- src/sys/dev/ic/stireg.h:1.11	Mon Aug  5 09:43:37 2024
+++ src/sys/dev/ic/stireg.h	Tue Aug  6 07:26:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.11 2024/08/05 09:43:37 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.12 2024/08/06 07:26:56 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -644,23 +644,28 @@ STI_DEP(util);
 
 #define BA(F,C,S,A,J,B,I)		\
 	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-	/* FSSSAAAJ */
+	/* FCCC CSSS AAAJ      */
 
 #define IBOvals(R,M,X,S,D,L,B,F)	\
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSD??BF */
+	/* LSSD       ??BF */
 
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	FractDcd	1	/* Pixel data is Fractional 8-8-8 */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
 #define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Otc24	7	/* NGLE uses this for 24bit blits */
 #define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
 #define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrByte	3	/* byte access? Used by NGLE for direct fb */
 #define	AddrLong	5	/* FB address is Long aligned (pixel) */
-#define	BINovly	0x2	/* 8 bit overlay */
 #define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
 #define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINcursor	0x7	/* cursor bitmap on EG */
 #define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
 #define	BINattr	0xd	/* Attribute Bitmap */
+#define	BINcmap	0xf	/* colour map(s) */
 #define	RopClr 	0x0
 #define	RopSrc 	0x3
 #define	RopInv 	0xc



CVS commit: src/sys/dev/ic

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:26:56 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits & pieces


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/dev

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
do cursor position updated the way NGLE does - poke reg 28 and wait_fifo
instead of waiting for the whole thing to go idle


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.8 src/sys/arch/hppa/dev/hyperfb.c:1.9
--- src/sys/arch/hppa/dev/hyperfb.c:1.8	Thu Aug  1 00:20:22 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Mon Aug  5 09:45:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -1268,7 +1268,8 @@ hyperfb_move_cursor(struct hyperfb_softc
 	if (y < 0) y = 0x1000 - y;
 	pos = (x << 16) | y;
 	if (sc->sc_enabled) pos |= HCRX_ENABLE_CURSOR;
-	hyperfb_wait(sc);
+	hyperfb_wait_fifo(sc, 2);
+	hyperfb_write4(sc, NGLE_REG_28, 0);
 	hyperfb_write4(sc, NGLE_REG_29, pos);
 }
 



CVS commit: src/sys/arch/hppa/dev

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
do cursor position updated the way NGLE does - poke reg 28 and wait_fifo
instead of waiting for the whole thing to go idle


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:43:38 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
describe more register functions


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

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

Modified files:

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.10 src/sys/dev/ic/stireg.h:1.11
--- src/sys/dev/ic/stireg.h:1.10	Wed Jul 31 09:54:13 2024
+++ src/sys/dev/ic/stireg.h	Mon Aug  5 09:43:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.10 2024/07/31 09:54:13 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.11 2024/08/05 09:43:37 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -672,11 +672,11 @@ STI_DEP(util);
 #define	MaskOtc	0	/* Mask contains Object Count valid bits */
 
 #define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
-#define	NGLE_REG_28		0x000420
-#define	NGLE_REG_2		0x000480	/* LUT blt src? */
-#define	NGLE_REG_3		0x0004a0	/* palette index */
-#define	NGLE_REG_22		0x0005a0
-#define	NGLE_REG_23		0x0005c0
+#define	NGLE_REG_28		0x000420	/* HCRX video bus access */
+#define	NGLE_REG_2		0x000480	/* BINC src */
+#define	NGLE_REG_3		0x0004a0	/* BINC dst */
+#define	NGLE_REG_22		0x0005a0	/* BINC dst mask */
+#define	NGLE_REG_23		0x0005c0	/* BINC data */
 #define	NGLE_REG_4		0x000600	/* palette data */
 #define	NGLE_REG_5		0x0006a0	/* cursor data */
 #define	NGLE_REG_6		0x000800	/* rectfill XY */
@@ -691,19 +691,20 @@ STI_DEP(util);
 #define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
 #define	NGLE_REG_35		0x018010	/* fg color */
-#define	NGLE_REG_36		0x018014
+#define	NGLE_REG_36		0x018014	/* bg colour? */
 #define	NGLE_REG_13		0x018018	/* image planemask */
 #define	NGLE_REG_14		0x01801c	/* raster op */
-#define	NGLE_REG_15		0x20
+#define	NGLE_REG_15		0x20	/* 'busy dodger' idle */
+	#define DODGER_IDLE	0x1000	/* or 0x1, likely tpyo */
 #define	NGLE_REG_15b0		0x20	/* busy register */
 #define	NGLE_REG_16		0x24
-#define	NGLE_REG_16b1		0x25
-#define	NGLE_REG_16b3		0x27
+#define	NGLE_REG_16b1		0x25	/* setup copyarea */
+#define	NGLE_REG_16b3		0x27	/* ROM table index on CRX */
 #define	NGLE_REG_34		0x28	/* # of fifo slots */
 #define	NGLE_REG_17		0x200100	/* cursor coordinates */
 #define	NGLE_REG_18		0x200104	/* cursor enable */
 #define	NGLE_REG_26		0x200118	/* EG LUT blt ctrl */
-#define	NGLE_REG_19		0x200200
+#define	NGLE_REG_19		0x200200	/* artist sprite size */
 #define	NGLE_REG_20		0x200208	/* cursor geometry */
 #define	NGLE_REG_21		0x200218	/* Artist misc video */
 #define	NGLE_REG_27		0x200308	/* Artist misc ctrl */
@@ -722,11 +723,11 @@ STI_DEP(util);
 	#define LBC_TYPE_OVERLAY	0xc000
 	#define LBC_LENGTH_SHIFT	0
 #define	NGLE_REG_41		0x210024
-#define	NGLE_REG_42		0x210028
-#define	NGLE_REG_43		0x21002c
-#define	NGLE_REG_44		0x210030
-#define	NGLE_REG_45		0x210034
-#define	NGLE_REG_32		0x21003c
+#define	NGLE_REG_42		0x210028	/* these seem to control */
+#define	NGLE_REG_43		0x21002c	/* how the 24bit planes */
+#define	NGLE_REG_44		0x210030	/* are displayed on HCRX - */
+#define	NGLE_REG_45		0x210034	/* no info on bits */
+#define	NGLE_REG_32		0x21003c	/* HCRX plane enable */ 
 #define	NGLE_REG_33		0x210040	/* HCRX misc video */
 	#define HCRX_VIDEO_ENABLE	0x0A00
 #define	NGLE_REG_39		0x210120	/* HCRX 'hyperbowl' mode 2 */



CVS commit: src/sys/dev/ic

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:43:38 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
describe more register functions


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

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



CVS commit: src/sys/arch/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug  1 00:20:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
fix tpyo and properly limit what we can mmap()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.16 src/sys/arch/hppa/dev/gftfb.c:1.17
--- src/sys/arch/hppa/dev/gftfb.c:1.16	Wed Jul 17 08:30:28 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Thu Aug  1 00:20:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.16 2024/07/17 08:30:28 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.17 2024/08/01 00:20:22 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -868,7 +868,7 @@ gftfb_mmap(void *v, void *vs, off_t offs
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	if (offset >= 0 || offset < sc->sc_scr.fblen) {
+	if (offset >= 0 && offset < sc->sc_scr.fblen) {
 		/* framebuffer */
 		pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset,
 		prot, BUS_SPACE_MAP_LINEAR);

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.7 src/sys/arch/hppa/dev/hyperfb.c:1.8
--- src/sys/arch/hppa/dev/hyperfb.c:1.7	Wed Jul 31 16:38:00 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Thu Aug  1 00:20:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -659,7 +659,8 @@ hyperfb_mmap(void *v, void *vs, off_t of
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	if (offset >= 0 || offset < 2048 * 1024) {
+	/* GSC framebuffer space is 16MB */
+	if (offset >= 0 && offset < 0x100) {
 		/* framebuffer */
 		pa = bus_space_mmap(sc->sc_iot, sc->sc_base + HCRX_FBOFFSET,
 		offset, prot,



CVS commit: src/sys/arch/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug  1 00:20:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
fix tpyo and properly limit what we can mmap()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:56:04 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
use the blitter to draw small rectangles as well by abusing set/clear ops
and the plane mask


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.5 src/sys/arch/hppa/dev/hyperfb.c:1.6
--- src/sys/arch/hppa/dev/hyperfb.c:1.5	Wed Jul 24 08:34:03 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 31 09:56:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.6 2024/07/31 09:56:04 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.6 2024/07/31 09:56:04 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -98,9 +98,10 @@ struct	hyperfb_softc {
 	u_char sc_cmap_blue[256];
 	kmutex_t sc_hwlock;
 	uint32_t sc_hwmode;
-#define HW_FB	0
-#define HW_FILL	1
-#define HW_BLIT	2
+#define HW_FB		0
+#define HW_FILL		1
+#define HW_BLIT		2
+#define HW_SFILL	3
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -210,12 +211,18 @@ static inline void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
 
+	/*
+	 * turns out the plane mask is applied to everything, including
+	 * direct framebuffer writes, so make sure we always set it
+	 */
 	hyperfb_wait(sc);
 	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
 		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
-	} else
+	} else {
 		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+		hyperfb_write4(sc, NGLE_REG_13, 0xff);
+	}
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
 	hyperfb_wait(sc);
 	hyperfb_write1(sc, NGLE_REG_16b1, 1);
@@ -479,7 +486,6 @@ hyperfb_attach(device_t parent, device_t
 	config_found(sc->sc_dev, &aa, wsemuldisplaydevprint, CFARGS_NONE);
 
 	hyperfb_setup_fb(sc);
-
 }
 
 static void
@@ -957,6 +963,7 @@ hyperfb_rectfill(struct hyperfb_softc *s
 	 * less than 32 pixels wide
 	 */
 	if (wi < 32) {
+#if 0
 		int i;
 		uint8_t *ptr = (uint8_t *)sc->sc_fb + (y << 11) + x;
 
@@ -967,6 +974,37 @@ hyperfb_rectfill(struct hyperfb_softc *s
 			memset(ptr, bg, wi);
 			ptr += 2048;
 		}
+#else
+		/*
+		 * instead of memset() we abuse the blitter - set / clear the
+		 * planes we want, select colour by planemask, do two passes
+		 * where necessary ( as in, anything not black or white )
+		 */ 
+		if (sc->sc_hwmode != HW_SFILL) {
+			hyperfb_wait(sc);
+			hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+			sc->sc_hwmode = HW_SFILL;
+		}
+		bg &= 0xff;
+		hyperfb_wait_fifo(sc, 2);
+		hyperfb_write4(sc, NGLE_REG_24, (x << 16) | y);
+		if (bg != 0) {
+			hyperfb_wait_fifo(sc, 4);
+			hyperfb_write4(sc, NGLE_REG_14, 
+			IBOvals(RopSet, 0, BitmapExtent08, 1, DataDynamic, MaskOtc, 0, 0));
+			hyperfb_write4(sc, NGLE_REG_13, bg);
+			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
+			hyperfb_write4(sc, NGLE_REG_25, (x << 16) | y);
+		}
+		if (bg != 0xff) {
+			hyperfb_wait_fifo(sc, 4);
+			hyperfb_write4(sc, NGLE_REG_14, 
+			IBOvals(RopClr, 0, BitmapExtent08, 1, DataDynamic, MaskOtc, 0, 0));
+			hyperfb_write4(sc, NGLE_REG_13, bg ^ 0xff);
+			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
+			hyperfb_write4(sc, NGLE_REG_25, (x << 16) | y);
+		}
+#endif
 		return;
 	}
 	if (sc->sc_hwmode != HW_FILL) {



CVS commit: src/sys/arch/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:56:04 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
use the blitter to draw small rectangles as well by abusing set/clear ops
and the plane mask


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:54:13 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar ROPs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/stireg.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/ic

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:54:13 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar ROPs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/stireg.h

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

Modified files:

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.9 src/sys/dev/ic/stireg.h:1.10
--- src/sys/dev/ic/stireg.h:1.9	Wed Jul 17 08:28:22 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 31 09:54:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.9 2024/07/17 08:28:22 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.10 2024/07/31 09:54:13 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -648,7 +648,7 @@ STI_DEP(util);
 
 #define IBOvals(R,M,X,S,D,L,B,F)	\
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSDBBBF */
+	/* LSSD??BF */
 
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
@@ -661,8 +661,10 @@ STI_DEP(util);
 #define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
 #define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
 #define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopClr 	0x0
 #define	RopSrc 	0x3
 #define	RopInv 	0xc
+#define	RopSet 	0xf
 #define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
 #define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
 #define	DataDynamic	0	/* Data register reloaded by direct access */



CVS commit: src/libexec/ld.elf_so/arch/hppa

2024-07-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 29 05:32:39 UTC 2024

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
skip R_PARISC_NONE reloc entries instead of segfaulting on them
now windowmaker runs on my C360


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.51 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.52
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.51	Mon Jul 22 23:10:46 2024
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Mon Jul 29 05:32:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.51 2024/07/22 23:10:46 riastradh Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.52 2024/07/29 05:32:39 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: hppa_reloc.c,v 1.51 2024/07/22 23:10:46 riastradh Exp $");
+__RCSID("$NetBSD: hppa_reloc.c,v 1.52 2024/07/29 05:32:39 macallan Exp $");
 #endif /* not lint */
 
 #include 
@@ -625,6 +625,9 @@ _rtld_relocate_plt_lazy(Obj_Entry *obj)
 		Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
 		Elf_Addr func_pc, func_sl;
 
+		/* skip R_PARISC_NONE entries */
+		if (ELF_R_TYPE(rela->r_info) == R_TYPE(NONE)) continue;
+			
 		assert(ELF_R_TYPE(rela->r_info) == R_TYPE(IPLT));
 
 		/*



CVS commit: src/libexec/ld.elf_so/arch/hppa

2024-07-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 29 05:32:39 UTC 2024

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
skip R_PARISC_NONE reloc entries instead of segfaulting on them
now windowmaker runs on my C360


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.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/hppa/dev

2024-07-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 24 08:34:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
hand X a 24bit framebuffer if the hardware supports it


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev

2024-07-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 24 08:34:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
hand X a 24bit framebuffer if the hardware supports it


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.4 src/sys/arch/hppa/dev/hyperfb.c:1.5
--- src/sys/arch/hppa/dev/hyperfb.c:1.4	Wed Jul 17 08:30:28 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 24 08:34:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -113,7 +113,8 @@ extern struct cfdriver hyperfb_cd;
 CFATTACH_DECL_NEW(hyperfb, sizeof(struct hyperfb_softc), hyperfb_match,
 hyperfb_attach, NULL, NULL);
 
-void 		hyperfb_setup_fb(struct hyperfb_softc *);
+static inline void  hyperfb_setup_fb(struct hyperfb_softc *);
+static inline void  hyperfb_setup_fb24(struct hyperfb_softc *);
 static void 	hyperfb_init_screen(void *, struct vcons_screen *,
 			int, long *);
 static int	hyperfb_ioctl(void *, void *, u_long, void *, int,
@@ -205,13 +206,31 @@ hyperfb_wait_fifo(struct hyperfb_softc *
 	} while (reg < slots);
 }
 
-void
+static inline void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
 
 	hyperfb_wait(sc);
-	hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
+		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+		hyperfb_write4(sc, NGLE_REG_13, 0x);
+	} else
+		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
+	hyperfb_wait(sc);
+	hyperfb_write1(sc, NGLE_REG_16b1, 1);
+	sc->sc_hwmode = HW_FB;
+}
+
+static inline void
+hyperfb_setup_fb24(struct hyperfb_softc *sc)
+{
+
+	hyperfb_wait(sc);
+	hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
+	//IBOvals(RopSrc,0,BitmapExtent08,0,DataDynamic,MaskDynamic,0,0)
 	hyperfb_wait(sc);
 	hyperfb_write1(sc, NGLE_REG_16b1, 1);
 	sc->sc_hwmode = HW_FB;
@@ -367,6 +386,9 @@ hyperfb_attach(device_t parent, device_t
 		eaio_l2(PCXL2_ACCEL_IO_ADDR2MASK(ca->ca_hpa));
 #endif /* HP7300LC_CPU */
 
+	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
+	sc->sc_locked = 0;
+
 	hyperfb_setup(sc);
 	hyperfb_setup_fb(sc);
 
@@ -382,8 +404,6 @@ hyperfb_attach(device_t parent, device_t
 
 	sc->sc_screens[0] = &sc->sc_defaultscreen_descr;
 	sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens};
-	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
-	sc->sc_locked = 0;
 
 	vcons_init(&sc->vd, sc, &sc->sc_defaultscreen_descr,
 	&hyperfb_accessops);
@@ -458,6 +478,8 @@ hyperfb_attach(device_t parent, device_t
 
 	config_found(sc->sc_dev, &aa, wsemuldisplaydevprint, CFARGS_NONE);
 
+	hyperfb_setup_fb(sc);
+
 }
 
 static void
@@ -513,7 +535,7 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 			return ENODEV;
 		wdf = (void *)data;
 		wdf->height = ms->scr_ri.ri_height;
-		wdf->width = ms->scr_ri.ri_width;
+		wdf->width = sc->sc_24bit ? ms->scr_ri.ri_width << 2 : ms->scr_ri.ri_width;
 		wdf->depth = ms->scr_ri.ri_depth;
 		wdf->cmsize = 256;
 		return 0;
@@ -526,7 +548,7 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 		return hyperfb_putcmap(sc,
 		(struct wsdisplay_cmap *)data);
 	case WSDISPLAYIO_LINEBYTES:
-		*(u_int *)data = 2048;
+		*(u_int *)data = sc->sc_24bit ? 8192 : 2048;
 		return 0;
 
 	case WSDISPLAYIO_SMODE: {
@@ -544,6 +566,11 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 (ms->scr_defattr >> 16) & 0xff]);
 vcons_redraw_screen(ms);
 hyperfb_set_video(sc, 1);
+			} else {
+hyperfb_setup(sc);
+hyperfb_rectfill(sc, 0, 0, sc->sc_width,
+sc->sc_height, 0xff);
+hyperfb_setup_fb24(sc);
 			}
 		}
 		}
@@ -556,6 +583,19 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 
 			ret = wsdisplayio_get_fbinfo(&ms->scr_ri, fbi);
 			fbi->fbi_fbsize = sc->sc_height * 2048;
+			if (sc->sc_24bit) {
+fbi->fbi_stride = 8192;
+fbi->fbi_bitsperpixel = 32;
+fbi->fbi_pixeltype = WSFB_RGB;
+fbi->fbi_subtype.fbi_rgbmasks.red_offset = 16;
+fbi->fbi_subtype.fbi_rgbmasks.red_size = 8;
+fbi->fbi_subtype.fbi_rgbmasks.green_offset = 8;
+fbi->fb

CVS commit: src/sys/dev/pckbport

2024-07-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jul 19 04:48:13 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
hw.synaptics.aux_mid_button_scroll translates vertical movements
of an aux device (like a trackpoint) into a scroll event when
the middle mouse button is pressed.

Make this work with either the middle mouse button of the main
device (buttonmask 0x02) or the middle mouse button of the aux
device (buttonmask 0x40).

Fixes PR 58435.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pckbport/synaptics.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/pckbport

2024-07-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jul 19 04:48:13 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
hw.synaptics.aux_mid_button_scroll translates vertical movements
of an aux device (like a trackpoint) into a scroll event when
the middle mouse button is pressed.

Make this work with either the middle mouse button of the main
device (buttonmask 0x02) or the middle mouse button of the aux
device (buttonmask 0x40).

Fixes PR 58435.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pckbport/synaptics.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/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.83 src/sys/dev/pckbport/synaptics.c:1.84
--- src/sys/dev/pckbport/synaptics.c:1.83	Thu Apr 18 17:35:53 2024
+++ src/sys/dev/pckbport/synaptics.c	Fri Jul 19 04:48:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.84 2024/07/19 04:48:13 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.84 2024/07/19 04:48:13 mlelstv Exp $");
 
 #include 
 #include 
@@ -1701,7 +1701,7 @@ pms_synaptics_passthrough(struct pms_sof
 		 * scrolling.
 		 */
 		if (synaptics_aux_mid_button_scroll &&
-		dy && (psc->buttons & 0x2)) {
+		dy && (psc->buttons & 0x42)) {
 			wsmouse_precision_scroll(psc->sc_wsmousedev, dx, dy);
 		} else {
 			buttons = (psc->buttons & 0x1f) | ((psc->buttons >> 5) & 0x7);



CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:30:28 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
remove a bunch of #defines that have been moved to stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.15 src/sys/arch/hppa/dev/gftfb.c:1.16
--- src/sys/arch/hppa/dev/gftfb.c:1.15	Fri Jul 12 08:45:05 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Jul 17 08:30:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.15 2024/07/12 08:45:05 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.16 2024/07/17 08:30:28 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -159,31 +159,6 @@ struct wsdisplay_accessops gftfb_accesso
 	NULL	/* scroll */
 };
 
-#define BA(F,C,S,A,J,B,I)		\
-	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-
-#define IBOvals(R,M,X,S,D,L,B,F)	\
-	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-
-#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
-#define	Otc04	2	/* Pixels in each longword transfer (4) */
-#define	Otc32	5	/* Pixels in each longword transfer (32) */
-#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
-#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
-#define	AddrLong	5	/* FB address is Long aligned (pixel) */
-#define	BINovly	0x2	/* 8 bit overlay */
-#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
-#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
-#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
-#define	BINattr	0xd	/* Attribute Bitmap */
-#define	RopSrc 	0x3
-#define	RopInv 	0xc
-#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
-#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
-#define	DataDynamic	0	/* Data register reloaded by direct access */
-#define	MaskDynamic	1	/* Mask register reloaded by direct access */
-#define	MaskOtc	0	/* Mask contains Object Count valid bits */
-
 static inline void gftfb_wait_fifo(struct gftfb_softc *, uint32_t);
 
 int

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.3 src/sys/arch/hppa/dev/hyperfb.c:1.4
--- src/sys/arch/hppa/dev/hyperfb.c:1.3	Wed Jul 17 07:11:01 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 17 08:30:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -28,10 +28,11 @@
  
 /*
  * a native driver for HCRX / hyperdrive cards
+ * tested on a HCRX24Z in a C360 only so far
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -73,11 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 
 
 #define HCRX_CONFIG_24BIT	0x100
 
-#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
-#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
-#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
-#define HYPERBOWL_MODE2_8_24	15
-
 int hyperfb_match(device_t, cfdata_t, void *);
 void hyperfb_attach(device_t, device_t, void *);
 
@@ -105,7 +101,6 @@ struct	hyperfb_softc {
 #define HW_FB	0
 #define HW_FILL	1
 #define HW_BLIT	2
-	uint32_t sc_rect_colour, sc_rect_height;
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -148,33 +143,6 @@ static void	hyperfb_eraserows(void *, in
 static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
 static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
 
-#define BA(F,C,S,A,J,B,I)		\
-	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-	/* FSSSAAAJ */
-
-#define IBOvals(R,M,X,S,D,L,B,F)	\
-	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSDBBBF */
-
-#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
-#define	Otc04	2	/* Pixels in each longword transfer (4) */
-#define	Otc32	5	/* Pixels in each longword transfer (32) */
-#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
-#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
-#define	AddrLong	5	/* FB

CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:30:28 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
remove a bunch of #defines that have been moved to stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:28:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits
these should probably go into their own header since they don't actually
have anything to do with STI


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.h

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

Modified files:

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.8 src/sys/dev/ic/stireg.h:1.9
--- src/sys/dev/ic/stireg.h:1.8	Wed Jul 17 07:06:21 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 17 08:28:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.9 2024/07/17 08:28:22 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -641,6 +641,34 @@ STI_DEP(util);
  * NGLE register layout.
  * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h
  */
+
+#define BA(F,C,S,A,J,B,I)		\
+	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+	/* FSSSAAAJ */
+
+#define IBOvals(R,M,X,S,D,L,B,F)	\
+	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+	/* LSSDBBBF */
+
+#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	Otc04	2	/* Pixels in each longword transfer (4) */
+#define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
+#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrLong	5	/* FB address is Long aligned (pixel) */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
+#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
+#define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopSrc 	0x3
+#define	RopInv 	0xc
+#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
+#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
+#define	DataDynamic	0	/* Data register reloaded by direct access */
+#define	MaskDynamic	1	/* Mask register reloaded by direct access */
+#define	MaskOtc	0	/* Mask contains Object Count valid bits */
+
 #define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
 #define	NGLE_REG_28		0x000420
 #define	NGLE_REG_2		0x000480	/* LUT blt src? */



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:28:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits
these should probably go into their own header since they don't actually
have anything to do with STI


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/conf

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:19:56 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add hyperfb at uturn
This is a native driver for HCRX cards, with full wscons support
( as in, virtual consoles, fonts, colours, X with hw cursor )
needs testing on anything that isn't a GSC HCRS24Z


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hppa/conf/GENERIC

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



CVS commit: src/sys/arch/hppa/conf

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:19:56 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add hyperfb at uturn
This is a native driver for HCRX cards, with full wscons support
( as in, virtual consoles, fonts, colours, X with hw cursor )
needs testing on anything that isn't a GSC HCRS24Z


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hppa/conf/GENERIC

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/hppa/conf/GENERIC
diff -u src/sys/arch/hppa/conf/GENERIC:1.44 src/sys/arch/hppa/conf/GENERIC:1.45
--- src/sys/arch/hppa/conf/GENERIC:1.44	Thu Mar 14 13:18:35 2024
+++ src/sys/arch/hppa/conf/GENERIC	Wed Jul 17 08:19:56 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.44 2024/03/14 13:18:35 macallan Exp $
+# $NetBSD: GENERIC,v 1.45 2024/07/17 08:19:56 macallan Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@ include 	"arch/hppa/conf/std.hppa"
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-#ident 		"GENERIC-$Revision: 1.44 $"
+#ident 		"GENERIC-$Revision: 1.45 $"
 
 maxusers	32		# estimated number of users
 
@@ -283,7 +283,10 @@ sti*	at mainbus0		# [H]CRX-{8,24,48}[Z] 
 sti*	at phantomas?		# [H]CRX-{8,24,48}[Z] and Visualize graphics
 sti*	at uturn?
 sti*	at pci?			# EG-PCI, FX*
-gftfb* 	at pci?			# PCI Visualize EG
+
+# graphics with native drivers
+hyperfb* 	at uturn?	# hyperdrive / HCRX
+gftfb* 		at pci?		# PCI Visualize EG
 
 # Human Interface Loop
 hil*		at gsc? irq 1	# Human Interface Loop, kbd and mouse



CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:11:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
add cursor sprite support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.2 src/sys/arch/hppa/dev/hyperfb.c:1.3
--- src/sys/arch/hppa/dev/hyperfb.c:1.2	Mon Jul 15 10:26:09 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 17 07:11:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -145,10 +145,8 @@ static void	hyperfb_erasecols(void *, in
 static void	hyperfb_copyrows(void *, int, int, int);
 static void	hyperfb_eraserows(void *, int, int, long);
 
-#if 0
 static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
 static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
-#endif
 
 #define BA(F,C,S,A,J,B,I)		\
 	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
@@ -593,7 +591,6 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 			return ret;
 		}
 
-#if 0
 	case WSDISPLAYIO_GCURPOS:
 		{
 			struct wsdisplay_curpos *cp = (void *)data;
@@ -626,7 +623,6 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 
 			return hyperfb_do_cursor(sc, cursor);
 		}
-#endif
 
 	case WSDISPLAYIO_SVIDEO:
 		hyperfb_set_video(sc, *(int *)data);
@@ -860,18 +856,14 @@ hyperfb_setup(struct hyperfb_softc *sc)
 	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_wait(sc);
 	hyperfb_write4(sc, NGLE_REG_3, 0);
-	hyperfb_write4(sc, NGLE_REG_4, 0);
-	hyperfb_write4(sc, NGLE_REG_4, 0);
 	hyperfb_write4(sc, NGLE_REG_4, 0x00ff);	/* BG */
 	hyperfb_write4(sc, NGLE_REG_4, 0x00ff);	/* FG */
 	hyperfb_wait(sc);
 	hyperfb_write4(sc, NGLE_REG_2, 0);
-	hyperfb_write4(sc, NGLE_REG_1, 0x80008004);
+	hyperfb_write4(sc, NGLE_REG_38, LBC_ENABLE | LBC_TYPE_CURSOR | 4);
 	hyperfb_setup_fb(sc);	
 
-	//hyperfb_write4(sc, NGLE_REG_29, 0x80200020);
-
-	//hyperfb_move_cursor(sc, 100, 100);
+	hyperfb_move_cursor(sc, 100, 100);
 
 }
 
@@ -889,9 +881,9 @@ hyperfb_set_video(struct hyperfb_softc *
 	reg = hyperfb_read4(sc, NGLE_REG_33);
 	
 	if (on) {
-		hyperfb_write4(sc, NGLE_REG_33, reg | 0x0a00);
+		hyperfb_write4(sc, NGLE_REG_33, reg | HCRX_VIDEO_ENABLE);
 	} else {
-		hyperfb_write4(sc, NGLE_REG_33, reg & ~0x0a00);
+		hyperfb_write4(sc, NGLE_REG_33, reg & ~HCRX_VIDEO_ENABLE);
 	}
 }
 
@@ -1151,3 +1143,158 @@ hyperfb_eraserows(void *cookie, int row,
 			ri->ri_flg &= ~RI_CURSOR;
 	}
 }
+
+static void
+hyperfb_move_cursor(struct hyperfb_softc *sc, int x, int y)
+{
+	uint32_t pos;
+
+	sc->sc_cursor_x = x;
+	x -= sc->sc_hot_x;
+	sc->sc_cursor_y = y;
+	y -= sc->sc_hot_y;
+
+	if (x < 0) x = 0x1000 - x;
+	if (y < 0) y = 0x1000 - y;
+	pos = (x << 16) | y;
+	if (sc->sc_enabled) pos |= HCRX_ENABLE_CURSOR;
+	hyperfb_wait(sc);
+	hyperfb_write4(sc, NGLE_REG_29, pos);
+}
+
+static int
+hyperfb_do_cursor(struct hyperfb_softc *sc, struct wsdisplay_cursor *cur)
+{
+
+	if (cur->which & WSDISPLAY_CURSOR_DOCUR) {
+
+		sc->sc_enabled = cur->enable;
+		cur->which |= WSDISPLAY_CURSOR_DOPOS;
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOHOT) {
+
+		sc->sc_hot_x = cur->hot.x;
+		sc->sc_hot_y = cur->hot.y;
+		cur->which |= WSDISPLAY_CURSOR_DOPOS;
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOPOS) {
+
+		hyperfb_move_cursor(sc, cur->pos.x, cur->pos.y);
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
+		uint32_t rgb;
+		uint8_t r[2], g[2], b[2];
+
+		copyin(cur->cmap.blue, b, 2);
+		copyin(cur->cmap.green, g, 2);
+		copyin(cur->cmap.red, r, 2);
+		mutex_enter(&sc->sc_hwlock);
+		hyperfb_wait(sc);
+		hyperfb_write4(sc, NGLE_REG_10, 0xBBE0F000);
+		hyperfb_write4(sc, NGLE_REG_14, 0x03000300);
+		hyperfb_write4(sc, NGLE_REG_13, 0x);
+		hyperfb_wait(sc);
+		hyperfb_write4(sc, NGLE_REG_3, 0);
+		rgb = (r[0] << 16) | (g[0] << 8) | b[0];
+		hyperfb_write4(sc, NGLE_REG_4, rgb);	/* BG */
+		rgb = (r[1] << 16) | (g[1] << 8) | b[1];
+		hyperfb_write4(sc, NGLE_REG_4, rgb);	/* FG */
+		hyperfb_write4(sc, NGLE_REG_2, 0);
+		hyperfb_write4(sc, NGLE_REG_38, LBC_ENABLE | LBC_TYPE_CURSOR | 4);
+
+		hyperfb_setup_fb(sc);	
+		mutex_exit(&sc->sc_hwlock);
+
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOSHAP

CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:11:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
add cursor sprite support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:06:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
document a few more registers & bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.h

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

Modified files:

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.7 src/sys/dev/ic/stireg.h:1.8
--- src/sys/dev/ic/stireg.h:1.7	Mon Jul 15 10:30:42 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 17 07:06:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -641,9 +641,9 @@ STI_DEP(util);
  * NGLE register layout.
  * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h
  */
-#define	NGLE_REG_1		0x000118
+#define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
 #define	NGLE_REG_28		0x000420
-#define	NGLE_REG_2		0x000480
+#define	NGLE_REG_2		0x000480	/* LUT blt src? */
 #define	NGLE_REG_3		0x0004a0	/* palette index */
 #define	NGLE_REG_22		0x0005a0
 #define	NGLE_REG_23		0x0005c0
@@ -672,15 +672,25 @@ STI_DEP(util);
 #define	NGLE_REG_34		0x28	/* # of fifo slots */
 #define	NGLE_REG_17		0x200100	/* cursor coordinates */
 #define	NGLE_REG_18		0x200104	/* cursor enable */
-#define	NGLE_REG_26		0x200118
+#define	NGLE_REG_26		0x200118	/* EG LUT blt ctrl */
 #define	NGLE_REG_19		0x200200
 #define	NGLE_REG_20		0x200208	/* cursor geometry */
 #define	NGLE_REG_21		0x200218	/* Artist misc video */
 #define	NGLE_REG_27		0x200308	/* Artist misc ctrl */
 #define	NGLE_REG_29		0x21	/* HCRX cursor coord & enable */
+	#define HCRX_ENABLE_CURSOR	0x8000
 #define	NGLE_REG_30		0x210004	/* HCRX cursor address */
 #define	NGLE_REG_31		0x210008	/* HCRX cursor data */
-#define	NGLE_REG_38		0x210020	/* colormap data */
+#define	NGLE_REG_38		0x210020	/* HCRX LUT blt ctrl */
+	/* EWOO  TTLL  */
+	#define LBC_ENABLE	0x8000
+	#define LBC_WAIT_BLANK	0x4000
+	#define LBS_OFFSET_SHIFT	16
+	#define LBC_TYPE_MASK		0xc000
+	#define LBC_TYPE_CMAP		0
+	#define LBC_TYPE_CURSOR		0x8000
+	#define LBC_TYPE_OVERLAY	0xc000
+	#define LBC_LENGTH_SHIFT	0
 #define	NGLE_REG_41		0x210024
 #define	NGLE_REG_42		0x210028
 #define	NGLE_REG_43		0x21002c
@@ -688,8 +698,13 @@ STI_DEP(util);
 #define	NGLE_REG_45		0x210034
 #define	NGLE_REG_32		0x21003c
 #define	NGLE_REG_33		0x210040	/* HCRX misc video */
-#define	NGLE_REG_39		0x210120
-#define	NGLE_REG_40		0x210130
+	#define HCRX_VIDEO_ENABLE	0x0A00
+#define	NGLE_REG_39		0x210120	/* HCRX 'hyperbowl' mode 2 */
+	#define HYPERBOWL_MODE2_8_24	15
+#define	NGLE_REG_40		0x210130	/* HCRX 'hyperbowl' */
+	#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
+	#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
+	#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
 
 #define	NGLE_BUFF0_CMAP0	0x1e02
 #define	NGLE_BUFF1_CMAP0	0x02001e02



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:06:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
document a few more registers & bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.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/ic

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:30:42 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
annotate (some) registers if we know what they do
fix a tpyo while there


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.h

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

Modified files:

Index: src/sys/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.6 src/sys/dev/ic/stireg.h:1.7
--- src/sys/dev/ic/stireg.h:1.6	Wed Sep  9 11:56:53 2015
+++ src/sys/dev/ic/stireg.h	Mon Jul 15 10:30:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.6 2015/09/09 11:56:53 skrll Exp $	*/
+/*	$NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -649,16 +649,16 @@ STI_DEP(util);
 #define	NGLE_REG_23		0x0005c0
 #define	NGLE_REG_4		0x000600	/* palette data */
 #define	NGLE_REG_5		0x0006a0	/* cursor data */
-#define	NGLE_REG_6		0x000800
-#define	NGLE_REG_7		0x000804
-#define	NGLE_REG_24		0x000808
-#define	NGLE_REG_8		0x000820
-#define	NGLE_REG_73		0x000944
-#define	NGLE_REG_9		0x000a04
-#define	NGLE_REG_25		0x000b00
+#define	NGLE_REG_6		0x000800	/* rectfill XY */
+#define	NGLE_REG_7		0x000804	/* bitblt size WH */
+#define	NGLE_REG_24		0x000808	/* bitblt src XY */
+#define	NGLE_REG_8		0x000820	/* transfer data */
+#define	NGLE_REG_37		0x000944	/* HCRX fast rect fill, size */
+#define	NGLE_REG_9		0x000a04	/* rect fill size, start */
+#define	NGLE_REG_25		0x000b00	/* bitblt dst XY, start */
 #define	NGLE_REG_RAMDAC		0x001000
-#define	NGLE_REG_10		0x018000
-#define	NGLE_REG_11		0x018004	/* dest coords */
+#define	NGLE_REG_10		0x018000	/* buffer ctl */
+#define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
 #define	NGLE_REG_35		0x018010	/* fg color */
 #define	NGLE_REG_36		0x018014



CVS commit: src/sys/dev/ic

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:30:42 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
annotate (some) registers if we know what they do
fix a tpyo while there


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/dev

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:26:09 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
we have a blitter - use it


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.1 src/sys/arch/hppa/dev/hyperfb.c:1.2
--- src/sys/arch/hppa/dev/hyperfb.c:1.1	Fri Jul 12 08:43:08 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Mon Jul 15 10:26:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -133,6 +133,52 @@ static int 	hyperfb_putpalreg(struct hyp
 void 	hyperfb_setup(struct hyperfb_softc *);
 static void	hyperfb_set_video(struct hyperfb_softc *, int);
 
+static void	hyperfb_rectfill(struct hyperfb_softc *, int, int, int, int,
+			uint32_t);
+static void	hyperfb_bitblt(void *, int, int, int, int, int,
+			int, int);
+
+static void	hyperfb_cursor(void *, int, int, int);
+static void	hyperfb_putchar(void *, int, int, u_int, long);
+static void	hyperfb_copycols(void *, int, int, int, int);
+static void	hyperfb_erasecols(void *, int, int, int, long);
+static void	hyperfb_copyrows(void *, int, int, int);
+static void	hyperfb_eraserows(void *, int, int, long);
+
+#if 0
+static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
+static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
+#endif
+
+#define BA(F,C,S,A,J,B,I)		\
+	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+	/* FSSSAAAJ */
+
+#define IBOvals(R,M,X,S,D,L,B,F)	\
+	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+	/* LSSDBBBF */
+
+#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	Otc04	2	/* Pixels in each longword transfer (4) */
+#define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
+#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrLong	5	/* FB address is Long aligned (pixel) */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
+#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
+#define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopSrc 	0x3
+#define	RopInv 	0xc
+#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
+#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
+#define	DataDynamic	0	/* Data register reloaded by direct access */
+#define	MaskDynamic	1	/* Mask register reloaded by direct access */
+#define	MaskOtc	0	/* Mask contains Object Count valid bits */
+
+static inline void hyperfb_wait_fifo(struct hyperfb_softc *, uint32_t);
+
 #define	ngle_bt458_write(sc, r, v) \
 	hyperfb_write4(sc, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
 
@@ -183,6 +229,16 @@ hyperfb_wait(struct hyperfb_softc *sc)
 	} while (stat != 0);
 }
 
+static inline void
+hyperfb_wait_fifo(struct hyperfb_softc *sc, uint32_t slots)
+{
+	uint32_t reg;
+
+	do {
+		reg = hyperfb_read4(sc, NGLE_REG_34);
+	} while (reg < slots);
+}
+
 void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
@@ -395,10 +451,10 @@ hyperfb_attach(device_t parent, device_t
 #endif
 		wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
-#if 0
+
 		hyperfb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height,
 		ri->ri_devcmap[(defattr >> 16) & 0xff]);
-#endif
+
 		vcons_replay_msgbuf(&sc->sc_console_screen);
 	} else {
 		/*
@@ -456,21 +512,20 @@ hyperfb_init_screen(void *cookie, struct
 	rasops_init(ri, 0, 0);
 	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
 		  WSSCREEN_RESIZE;
-	scr->scr_flags |= VCONS_LOADFONT | VCONS_DONT_READ;
+	scr->scr_flags |= VCONS_LOADFONT;
 
 	rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
 		sc->sc_width / ri->ri_font->fontwidth);
 
 	ri->ri_hw = scr;
-#if 0
+
 	sc->sc_putchar = ri->ri_ops.putchar;
-	ri->ri_ops.copyrows = gftfb_copyrows;
-	ri->ri_ops.copycols = gftfb_copycols;
-	ri->ri_ops.erase

CVS commit: src/sys/arch/hppa/dev

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:26:09 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
we have a blitter - use it


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sbin/iscsid

2024-07-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul 13 23:51:19 UTC 2024

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Abort operation when a target address cannot be resolved.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/iscsid/iscsid_driverif.c

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

Modified files:

Index: src/sbin/iscsid/iscsid_driverif.c
diff -u src/sbin/iscsid/iscsid_driverif.c:1.10 src/sbin/iscsid/iscsid_driverif.c:1.11
--- src/sbin/iscsid/iscsid_driverif.c:1.10	Wed Dec 27 18:07:30 2023
+++ src/sbin/iscsid/iscsid_driverif.c	Sat Jul 13 23:51:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_driverif.c,v 1.10 2023/12/27 18:07:30 mlelstv Exp $	*/
+/*	$NetBSD: iscsid_driverif.c,v 1.11 2024/07/13 23:51:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -293,13 +293,13 @@ make_connection(session_t * sess, iscsid
 		break;
 	case EAI_NODATA:
 		res->status = ISCSID_STATUS_HOST_NOT_FOUND;
-		break;
+		return NULL;
 	case EAI_AGAIN:
 		res->status = ISCSID_STATUS_HOST_TRY_AGAIN;
-		break;
+		return NULL;
 	default:
 		res->status = ISCSID_STATUS_HOST_ERROR;
-		break;
+		return NULL;
 	}
 
 	/* alloc the connection structure */



CVS commit: src/sbin/iscsid

2024-07-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul 13 23:51:19 UTC 2024

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Abort operation when a target address cannot be resolved.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/iscsid/iscsid_driverif.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/hppa/dev

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
STIDEBUG -> GFTFB_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.14 src/sys/arch/hppa/dev/gftfb.c:1.15
--- src/sys/arch/hppa/dev/gftfb.c:1.14	Thu Apr 18 04:52:43 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Fri Jul 12 08:45:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.14 2024/04/18 04:52:43 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.15 2024/07/12 08:45:05 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -47,15 +47,12 @@
 #include 
 #include 
 
-#ifdef STIDEBUG
-#define	DPRINTF(s)	do {	\
-	if (stidebug)		\
-		printf s;	\
-} while(0)
+#include "opt_gftfb.h"
 
-extern int stidebug;
+#ifdef GFTFB_DEBUG
+#define	DPRINTF(s) printf(s)
 #else
-#define	DPRINTF(s)	/* */
+#define	DPRINTF(s) /* */
 #endif
 
 int	gftfb_match(device_t, cfdata_t, void *);
@@ -425,7 +422,7 @@ gftfb_check_rom(struct gftfb_softc *spc,
 		offs + 0x0c);
 		subsize <<= 9;
 
-#ifdef STIDEBUG
+#ifdef GFTFB_DEBUG
 		gftfb_disable_rom_internal(spc);
 		DPRINTF(("ROM offset %08x size %08x type %08x",
 		(u_int)offs, (u_int)subsize, tmp));
@@ -473,7 +470,7 @@ gftfb_check_rom(struct gftfb_softc *spc,
 			break;
 #endif
 		default:
-#ifdef STIDEBUG
+#ifdef GFTFB_DEBUG
 			DPRINTF((" (wrong architecture)"));
 #endif
 			break;



CVS commit: src/sys/arch/hppa/dev

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
STIDEBUG -> GFTFB_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hppa/dev/gftfb.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/hppa

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:43:08 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
first shot at a native driver for HCRX cards
this will give you a fully working wsdisplay in 8bit colour living in the
overlay planes, X/wsfb will also work.
No acceleration or cursor sprite support yet.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/hyperfb.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/hppa/conf/files.hppa
diff -u src/sys/arch/hppa/conf/files.hppa:1.25 src/sys/arch/hppa/conf/files.hppa:1.26
--- src/sys/arch/hppa/conf/files.hppa:1.25	Tue Feb 13 13:40:13 2024
+++ src/sys/arch/hppa/conf/files.hppa	Fri Jul 12 08:43:08 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.hppa,v 1.25 2024/02/13 13:40:13 macallan Exp $
+#	$NetBSD: files.hppa,v 1.26 2024/07/12 08:43:08 macallan Exp $
 #
 #	$OpenBSD: files.hppa,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -275,6 +275,13 @@ file	arch/hppa/gsc/com_harmony.c	com_har
 device	gftfb: wsemuldisplaydev, rasops8, vcons, glyphcache, sti_pci, sti
 attach	gftfb at pci
 file	arch/hppa/dev/gftfb.c		gftfb
+defflag opt_gftfb.h GFTFB_DEBUG
+
+# hyperdrive, aka HCRX
+device	hyperfb: wsemuldisplaydev, rasops8, vcons, glyphcache, sti
+attach	hyperfb at gedoens
+file	arch/hppa/dev/hyperfb.c		hyperfb
+defflag opt_hyperfb.h HYPERFB_DEBUG
 
 # Memory Disk
 file dev/md_root.c			memory_disk_hooks

Added files:

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u /dev/null src/sys/arch/hppa/dev/hyperfb.c:1.1
--- /dev/null	Fri Jul 12 08:43:09 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Fri Jul 12 08:43:08 2024
@@ -0,0 +1,843 @@
+/*	$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $	*/
+
+/*
+ * Copyright (c) 2024 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+/*
+ * a native driver for HCRX / hyperdrive cards
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $");
+
+#include "opt_cputype.h"
+#include "opt_hyperfb.h"
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef HYPERFB_DEBUG
+#define	DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
+#define	STI_ROMSIZE	(sizeof(struct sti_dd) * 4)
+
+#define HCRX_FBOFFSET	0x0100
+#define HCRX_FBLEN	0x0100
+#define HCRX_REGOFFSET	0x0010
+#define HCRX_REGLEN	0x0028
+
+#define HCRX_CONFIG_24BIT	0x100
+
+#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
+#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
+#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
+#define HYPERBOWL_MODE2_8_24	15
+
+int hyperfb_match(device_t, cfdata_t, void *);
+void hyperfb_attach(device_t, device_t, void *);
+
+struct	hyperfb_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_iot;
+	bus_addr_t		sc_base;
+	bus_space_handle_t	sc_hfb, sc_hreg;
+	void 			*sc_fb;
+
+	int sc_width, sc_height;
+	int sc_locked, sc_is_console, sc_24bit;
+	struct vcons_screen sc_console_screen;
+	struct wsscreen_descr sc_defaultscreen_descr;
+	const struct wsscreen_descr *sc_screens[1];
+	struct wsscreen_list sc_screenlist;
+	struct vcons_data vd;
+	int sc_mode;
+	void (*sc_putchar)(void *, int, int, u_int, long);
+	u_char sc_cmap_red[256];
+	u_char sc_cmap_green[256];
+	u_char sc_cmap_blue[256];
+	kmutex_t sc_hwlock

CVS commit: src/sys/arch/hppa

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:43:08 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
first shot at a native driver for HCRX cards
this will give you a fully working wsdisplay in 8bit colour living in the
overlay planes, X/wsfb will also work.
No acceleration or cursor sprite support yet.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/hyperfb.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/usb

2024-07-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul  6 07:09:22 UTC 2024

Modified Files:
src/sys/dev/usb: if_cdce.c

Log Message:
There is no link state for CDCE. Pretend that the link is always up so that
programs like dhcpcd will handle the interface.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/usb/if_cdce.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/usb

2024-07-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul  6 07:09:22 UTC 2024

Modified Files:
src/sys/dev/usb: if_cdce.c

Log Message:
There is no link state for CDCE. Pretend that the link is always up so that
programs like dhcpcd will handle the interface.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/usb/if_cdce.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/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.81 src/sys/dev/usb/if_cdce.c:1.82
--- src/sys/dev/usb/if_cdce.c:1.81	Thu Mar  3 05:56:28 2022
+++ src/sys/dev/usb/if_cdce.c	Sat Jul  6 07:09:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.82 2024/07/06 07:09:22 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.82 2024/07/06 07:09:22 mlelstv Exp $");
 
 #include 
 
@@ -251,6 +251,9 @@ cdce_attach(device_t parent, device_t se
 	usbnet_attach(un);
 	usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
 0, NULL);
+
+	/* XXX There is no link state, pretend we are always on */
+	if_link_state_change(usbnet_ifp(un), LINK_STATE_UP);
 }
 
 static void



CVS commit: src/sys/dev/ic

2024-07-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul  3 13:08:36 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
fix HXRC colour map handling
With this we can run X in 8bit with correct colours.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/sti.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/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.36 src/sys/dev/ic/sti.c:1.37
--- src/sys/dev/ic/sti.c:1.36	Tue Jun 25 11:52:11 2024
+++ src/sys/dev/ic/sti.c	Wed Jul  3 13:08:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -133,6 +133,7 @@ void	ngle_artist_setupfb(struct sti_scre
 void	ngle_elk_setupfb(struct sti_screen *);
 void	ngle_timber_setupfb(struct sti_screen *);
 int	ngle_putcmap(struct sti_screen *, u_int, u_int);
+int	ngle_hcrx_putcmap(struct sti_screen *, u_int, u_int);
 #endif
 
 #define	STI_ENABLE_ROM(sc) \
@@ -685,7 +686,7 @@ sti_screen_setup(struct sti_screen *scr,
 
 	case STI_DD_HCRX:
 		scr->setupfb = ngle_elk_setupfb;
-		scr->putcmap = ngle_putcmap;
+		scr->putcmap = ngle_hcrx_putcmap;
 
 		if (scr->scr_bpp > 8) {
 			scr->reg12_value = NGLE_BUFF1_CMAP3;
@@ -694,7 +695,7 @@ sti_screen_setup(struct sti_screen *scr,
 			scr->reg12_value = NGLE_BUFF1_CMAP0;
 			scr->reg10_value = 0x13602000;
 		}
-		scr->cmap_finish_register = NGLE_REG_1;
+		scr->cmap_finish_register = NGLE_REG_38;
 		break;
 
 	case STI_DD_GRX:
@@ -1649,6 +1650,7 @@ ngle_putcmap(struct sti_screen *scr, u_i
 		r++, g++, b++;
 	}
 
+
 	bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400);
 	bus_space_write_stream_4(memt, memh, scr->cmap_finish_register,
 	cmap_finish);
@@ -1658,6 +1660,49 @@ ngle_putcmap(struct sti_screen *scr, u_i
 	return 0;
 }
 
+int
+ngle_hcrx_putcmap(struct sti_screen *scr, u_int idx, u_int count)
+{
+	struct sti_rom *rom = scr->scr_rom;
+	bus_space_tag_t memt = rom->memt;
+	bus_space_handle_t memh = rom->regh[2];
+	uint8_t *r, *g, *b;
+	uint32_t cmap_finish;
+
+	if (scr->scr_bpp > 8)
+		cmap_finish = 0x8100;
+	else
+		cmap_finish = 0x82000100;
+
+	r = scr->scr_rcmap + idx;
+	g = scr->scr_gcmap + idx;
+	b = scr->scr_bcmap + idx;
+
+	ngle_setup_hw(memt, memh);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_10, 0xbbe0f000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x03000300);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0x);
+
+	while (count-- != 0) {
+		ngle_setup_hw(memt, memh);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_3,
+		0x400 | (idx << 2));
+		bus_space_write_stream_4(memt, memh, NGLE_REG_4,
+		(*r << 16) | (*g << 8) | *b);
+
+		idx++;
+		r++, g++, b++;
+	}
+
+
+	bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_38, cmap_finish);
+	ngle_setup_fb(memt, memh, scr->reg10_value);
+
+
+	return 0;
+}
+
 void
 ngle_setup_hw(bus_space_tag_t memt, bus_space_handle_t memh)
 {



CVS commit: src/sys/dev/ic

2024-07-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul  3 13:08:36 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
fix HXRC colour map handling
With this we can run X in 8bit with correct colours.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/sti.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/ic

2024-06-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 25 11:52:12 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
first step to HCRX support
this gets us an 8bit framebuffer with wrong colours, as opposed to X just
erroring out


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/sti.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/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.35 src/sys/dev/ic/sti.c:1.36
--- src/sys/dev/ic/sti.c:1.35	Tue Feb 13 13:17:51 2024
+++ src/sys/dev/ic/sti.c	Tue Jun 25 11:52:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -683,12 +683,25 @@ sti_screen_setup(struct sti_screen *scr,
 		}
 		break;
 
+	case STI_DD_HCRX:
+		scr->setupfb = ngle_elk_setupfb;
+		scr->putcmap = ngle_putcmap;
+
+		if (scr->scr_bpp > 8) {
+			scr->reg12_value = NGLE_BUFF1_CMAP3;
+			scr->reg10_value = 0xBBA0A000;
+		} else {
+			scr->reg12_value = NGLE_BUFF1_CMAP0;
+			scr->reg10_value = 0x13602000;
+		}
+		scr->cmap_finish_register = NGLE_REG_1;
+		break;
+
 	case STI_DD_GRX:
 	case STI_DD_CRX24:
 	case STI_DD_EVRX:
 	case STI_DD_3X2V:
 	case STI_DD_DUAL_CRX:
-	case STI_DD_HCRX:
 	case STI_DD_LEGO:
 	case STI_DD_SUMMIT:
 	case STI_DD_PINNACLE:



CVS commit: src/sys/dev/ic

2024-06-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 25 11:52:12 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
first step to HCRX support
this gets us an 8bit framebuffer with wrong colours, as opposed to X just
erroring out


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/sti.c

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



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes

2024-06-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jun 10 22:51:01 UTC 2024

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Modes.c

Log Message:
make sure we fill in the name field in generated / converted modes
fixes PR 58321, tested by tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.1.1.8 xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.2
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.1.1.8	Fri Jul 15 02:12:51 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c	Mon Jun 10 22:51:01 2024
@@ -818,6 +818,7 @@ xf86CVTMode(int HDisplay, int VDisplay, 
 Mode->VTotal = libxcvt_mode_info->vtotal;
 Mode->VRefresh   = libxcvt_mode_info->vrefresh;
 Mode->Flags  = libxcvt_mode_info->mode_flags;
+xf86SetModeDefaultName(Mode);
 
 free(libxcvt_mode_info);
 



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes

2024-06-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jun 10 22:51:01 UTC 2024

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Modes.c

Log Message:
make sure we fill in the name field in generated / converted modes
fixes PR 58321, tested by tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.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/broadcom

2024-06-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun 10 06:03:49 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_pmwdog.c

Log Message:
Add support for poweroff.

There is no circuitry to actually remove power from RPI, but you can reboot
into a low power state. Depending on model/firmware release you need a power
cycle or a GPIO signal to leave the low power state again. Add-on hardware
is usually unaffected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_pmwdog.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/broadcom

2024-06-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun 10 06:03:49 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_pmwdog.c

Log Message:
Add support for poweroff.

There is no circuitry to actually remove power from RPI, but you can reboot
into a low power state. Depending on model/firmware release you need a power
cycle or a GPIO signal to leave the low power state again. Add-on hardware
is usually unaffected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_pmwdog.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/broadcom/bcm2835_pmwdog.c
diff -u src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.2 src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.3
--- src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.2	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/broadcom/bcm2835_pmwdog.c	Mon Jun 10 06:03:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_pmwdog.c,v 1.2 2021/01/27 03:10:19 thorpej Exp $	*/
+/*	$NetBSD: bcm2835_pmwdog.c,v 1.3 2024/06/10 06:03:48 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwdog.c,v 1.2 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwdog.c,v 1.3 2024/06/10 06:03:48 mlelstv Exp $");
 
 
 #include 
@@ -54,12 +54,19 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwd
 #endif
 
 #define	 BCM2835_PM_PASSWORD		0x5a00
+#define	 BCM2835_PM_PASSWORD_MASK	0xff00
 
 #define	BCM2835_PM_RSTC		0x1c
 #define	 BCM2835_PM_RSTC_CONFIGMASK	0x0030
 #define	 BCM2835_PM_RSTC_FULL_RESET	0x0020
 #define	 BCM2835_PM_RSTC_RESET		0x0102
 
+#define	BCM2835_PM_RSTS		0x20
+#define  BCM2835_PM_RSTS_PART(x) \
+		((uint16_t)((x) & 0x01) << 0 | (uint16_t)((x) & 0x02) << 1 | \
+		 (uint16_t)((x) & 0x04) << 2 | (uint16_t)((x) & 0x08) << 3 | \
+		 (uint16_t)((x) & 0x10) << 4 | (uint16_t)((x) & 0x20) << 5)
+
 #define	BCM2835_PM_WDOG		0x24
 #define	 BCM2835_PM_WDOG_TIMEMASK	0x000f
 
@@ -82,6 +89,10 @@ static void bcmpmwdog_set_timeout(struct
 static int bcmpmwdog_setmode(struct sysmon_wdog *);
 static int bcmpmwdog_tickle(struct sysmon_wdog *);
 
+/* fdt power controller */
+static void bcm2835_power_reset(device_t);
+static void bcm2835_power_poweroff(device_t);
+
 CFATTACH_DECL_NEW(bcmpmwdog_fdt, sizeof(struct bcm2835pmwdog_softc),
 bcmpmwdog_match, bcmpmwdog_attach, NULL, NULL);
 
@@ -90,6 +101,11 @@ static const struct device_compatible_en
 	DEVICE_COMPAT_EOL
 };
 
+static struct fdtbus_power_controller_func bcmpmwdog_power_funcs = {
+	.reset = bcm2835_power_reset,
+	.poweroff = bcm2835_power_poweroff
+};
+
 /* ARGSUSED */
 static int
 bcmpmwdog_match(device_t parent, cfdata_t match, void *aux)
@@ -136,6 +152,9 @@ bcmpmwdog_attach(device_t parent, device
 	sc->sc_smw.smw_period = BCM2835_PM_DEFAULT_PERIOD;
 	if (sysmon_wdog_register(&sc->sc_smw) != 0)
 		aprint_error_dev(self, "couldn't register watchdog\n");
+
+	fdtbus_register_power_controller(self, phandle,
+	&bcmpmwdog_power_funcs);
 }
 
 static void
@@ -176,6 +195,17 @@ bcmpmwdog_setmode(struct sysmon_wdog *sm
 	return error;
 }
 
+static void
+bcmpmwdog_set_partition(struct bcm2835pmwdog_softc *sc, uint8_t part)
+{
+	uint32_t tmp;
+
+	tmp = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BCM2835_PM_RSTS);
+	tmp &= ~(BCM2835_PM_PASSWORD_MASK | BCM2835_PM_RSTS_PART(~0));
+	tmp |= BCM2835_PM_PASSWORD | BCM2835_PM_RSTS_PART(part);
+	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_PM_RSTS, tmp);
+}
+
 static int
 bcmpmwdog_tickle(struct sysmon_wdog *smw)
 {
@@ -187,11 +217,43 @@ bcmpmwdog_tickle(struct sysmon_wdog *smw
 	return 0;
 }
 
+static void
+bcm2835_restart(struct bcm2835pmwdog_softc *sc, int partition)
+{
+	uint32_t timeout = 10;
+
+	bcmpmwdog_set_partition(sc, partition);
+	bcmpmwdog_set_timeout(sc, timeout);
+}
+
 void
 bcm2835_system_reset(void)
 {
 	struct bcm2835pmwdog_softc *sc = bcm2835pmwdog_sc;
-	uint32_t timeout = 10;
 
-	bcmpmwdog_set_timeout(sc, timeout);
+	bcm2835_restart(sc, 0);
+}
+
+static void
+bcm2835_power_reset(device_t self)
+{
+	struct bcm2835pmwdog_softc *sc = device_private(self);
+
+	bcm2835_restart(sc, 0);
+
+	for (;;) continue;
+	/* NOTREACHED */
 }
+
+static void
+bcm2835_power_poweroff(device_t self)
+{
+	struct bcm2835pmwdog_softc *sc = device_private(self);
+
+	/* Boot from partition 63 is magic to halt boot process */
+	bcm2835_restart(sc, 63);
+
+	for (;;) continue;
+	/* NOTREACHED */
+}
+



CVS commit: src/sys/arch/amiga/stand/bootblock

2024-06-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jun  8 06:39:57 UTC 2024

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/elf2bb: Makefile

Log Message:
Enable and use debug printfs to get some output into the build log.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amiga/stand/bootblock/elf2bb/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/arch/amiga/stand/bootblock/boot/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.62 src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.63
--- src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.62	Fri Apr 29 07:45:20 2022
+++ src/sys/arch/amiga/stand/bootblock/boot/Makefile	Sat Jun  8 06:39:57 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.62 2022/04/29 07:45:20 rin Exp $
+#	$NetBSD: Makefile,v 1.63 2024/06/08 06:39:57 mlelstv Exp $
 
 .include 
 .include 		# for HOST_SH
@@ -53,6 +53,7 @@ OBJS+=	$(SOBJS) $(COBJS)
 DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DSA_HARDCODED_SECSIZE
 DEFS += -D__INTERNAL_LIBSA_CREAD
 DEFS += -DSERCONSOLE
+DEFS += -DLIBSA_NO_RAW_ACCESS
 SOBJS += cread.o
 
 #XX#SOBJS += adler32.o crc32.o inflate.o trees.o \
@@ -109,7 +110,7 @@ CFLAGS+= -Wall -Wmissing-prototypes -Wst
 
 boot.amiga: x.out
 	${_MKTARGET_CREATE}
-	${RELOC2BB} -S x.out $@ || (${NM} -u x.out && false)
+	${RELOC2BB} -d -S x.out $@ || (${NM} -u x.out && false)
 
 x.out: xxstart.o libboot.a ${LIBZ}
 	${_MKTARGET_LINK}

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile:1.4 src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile:1.5
--- src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile:1.4	Sat Sep 17 17:09:10 2016
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile	Sat Jun  8 06:39:57 2024
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.4 2016/09/17 17:09:10 christos Exp $
+#	$NetBSD: Makefile,v 1.5 2024/06/08 06:39:57 mlelstv Exp $
 #
 
 .include 
 
-CPPFLAGS+= -I.
+CPPFLAGS+= -I. -DDEBUG
 PROG=	elf2bb
 MKMAN=	no
 SRCS=	elf2bb.c chksum.c



CVS commit: src/sys/arch/amiga/stand/bootblock

2024-06-07 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jun  8 06:39:57 UTC 2024

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/elf2bb: Makefile

Log Message:
Enable and use debug printfs to get some output into the build log.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amiga/stand/bootblock/elf2bb/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/compat_100

2024-05-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May 29 06:47:23 UTC 2024

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

Log Message:
The module also needs the syscall for old dup3.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/compat_100/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/compat_100/Makefile
diff -u src/sys/modules/compat_100/Makefile:1.2 src/sys/modules/compat_100/Makefile:1.3
--- src/sys/modules/compat_100/Makefile:1.2	Tue Sep  5 14:49:46 2023
+++ src/sys/modules/compat_100/Makefile	Wed May 29 06:47:23 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2023/09/05 14:49:46 christos Exp $
+#	$NetBSD: Makefile,v 1.3 2024/05/29 06:47:23 mlelstv Exp $
 
 .include "../Makefile.inc"
 
@@ -8,6 +8,6 @@ KMOD=	compat_100
 
 CPPFLAGS+=	-DCOMPAT_100
 
-SRCS+=	compat_100_mod.c kern_event_100.c
+SRCS+=	compat_100_mod.c kern_event_100.c sys_descrip_100.c
 
 .include 



CVS commit: src/sys/modules/compat_100

2024-05-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May 29 06:47:23 UTC 2024

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

Log Message:
The module also needs the syscall for old dup3.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/compat_100/Makefile

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



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_machdep.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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.64
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63	Sat Sep 23 21:26:16 2023
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue May 28 11:06:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -113,7 +113,7 @@ struct OF_translation ofw_translations[O
 struct pmap ofw_pmap;
 struct bat ofw_battable[BAT_VA2IDX(0x)+1];
 
-char bootpath[256];
+char bootpath[256] = "";
 char model_name[64];
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 void *startsym, *endsym;
@@ -165,7 +165,10 @@ ofwoea_initppc(u_int startkernel, u_int 
 			while (*args)
 BOOT_FLAG(*args++, boothowto);
 		}
-	} else {
+	}
+
+	/* if bootpath is still empty, get it from /chosen */
+	if (bootpath[0] == 0) {
 		int chs = OF_finddevice("/chosen");
 		int len;
 



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_machdep.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   >