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 <sys/cdefs.h>
-__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 0x00000102
+/* mimic HP/UX, this will return the device's graphics ID */
+#define GCID _IOR('G', 40, u_int)
+
#endif /* _IC_STIREG_H_ */