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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 22:46:04 UTC 2022

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

Log Message:
lint: reorganize lexer functions

Move the keywords table to the top, reduce forward declarations.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/xlint/lint1/lex.c

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



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 22:46:04 UTC 2022

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

Log Message:
lint: reorganize lexer functions

Move the keywords table to the top, reduce forward declarations.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/xlint/lint1/lex.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.104 src/usr.bin/xlint/lint1/lex.c:1.105
--- src/usr.bin/xlint/lint1/lex.c:1.104	Sun Feb 27 22:26:12 2022
+++ src/usr.bin/xlint/lint1/lex.c	Sun Feb 27 22:46:04 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.104 2022/02/27 22:26:12 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.105 2022/02/27 22:46:04 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.104 2022/02/27 22:26:12 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.105 2022/02/27 22:46:04 rillig Exp $");
 #endif
 
 #include 
@@ -67,30 +67,6 @@ pos_t	csrc_pos = { "", 1, 0 };
 bool in_gcc_attribute;
 bool in_system_header;
 
-static	int	inpc(void);
-static	int	keyw(sym_t *);
-static	int	get_escaped_char(int);
-
-void
-lex_next_line(void)
-{
-	curr_pos.p_line++;
-	curr_pos.p_uniq = 0;
-	debug_step("parsing %s:%d", curr_pos.p_file, curr_pos.p_line);
-	if (curr_pos.p_file == csrc_pos.p_file) {
-		csrc_pos.p_line++;
-		csrc_pos.p_uniq = 0;
-	}
-}
-
-void
-lex_unknown_character(int c)
-{
-
-	/* unknown character \%o */
-	error(250, c);
-}
-
 #define kwdef(name, token, scl, tspec, tqual,	c90, c99, gcc, attr, deco) \
 	{ \
 		name, token, scl, tspec, tqual, \
@@ -258,6 +234,9 @@ static	sym_t	*symtab[HSHSIZ1];
 symt_t	symtyp;
 
 
+static	int	get_escaped_char(int);
+
+
 static unsigned int
 hash(const char *s)
 {
@@ -402,6 +381,21 @@ inpc(void)
 	return c;
 }
 
+static int
+lex_keyword(sym_t *sym)
+{
+	int	t;
+
+	if ((t = (int)sym->s_value.v_quad) == T_SCLASS) {
+		yylval.y_scl = sym->s_scl;
+	} else if (t == T_TYPE || t == T_STRUCT_OR_UNION) {
+		yylval.y_tspec = sym->s_tspec;
+	} else if (t == T_QUAL) {
+		yylval.y_tqual = sym->s_tqual;
+	}
+	return t;
+}
+
 /*
  * Lex has found a letter followed by zero or more letters or digits.
  * It looks for a symbol in the symbol table with the same name. This
@@ -428,7 +422,7 @@ lex_name(const char *yytext, size_t yyle
 	sb->sb_len = yyleng;
 	if ((sym = symtab_search(sb)) != NULL && sym->s_keyword != NULL) {
 		free(sb);
-		return keyw(sym);
+		return lex_keyword(sym);
 	}
 
 	sb->sb_sym = sym;
@@ -450,21 +444,6 @@ lex_name(const char *yytext, size_t yyle
 	return tok;
 }
 
-static int
-keyw(sym_t *sym)
-{
-	int	t;
-
-	if ((t = (int)sym->s_value.v_quad) == T_SCLASS) {
-		yylval.y_scl = sym->s_scl;
-	} else if (t == T_TYPE || t == T_STRUCT_OR_UNION) {
-		yylval.y_tspec = sym->s_tspec;
-	} else if (t == T_QUAL) {
-		yylval.y_tqual = sym->s_tqual;
-	}
-	return t;
-}
-
 /*
  * Convert a string representing an integer into internal representation.
  * Return T_CON, storing the numeric value in yylval, for yylex.
@@ -1302,6 +1281,26 @@ lex_wide_string(void)
 	return T_STRING;
 }
 
+void
+lex_next_line(void)
+{
+	curr_pos.p_line++;
+	curr_pos.p_uniq = 0;
+	debug_step("parsing %s:%d", curr_pos.p_file, curr_pos.p_line);
+	if (curr_pos.p_file == csrc_pos.p_file) {
+		csrc_pos.p_line++;
+		csrc_pos.p_uniq = 0;
+	}
+}
+
+void
+lex_unknown_character(int c)
+{
+
+	/* unknown character \%o */
+	error(250, c);
+}
+
 #ifdef DEBUG
 static const char *
 symt_name(symt_t kind)



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 22:26:12 UTC 2022

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

Log Message:
lint: group symbol table functions

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/lint1/lex.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.103 src/usr.bin/xlint/lint1/lex.c:1.104
--- src/usr.bin/xlint/lint1/lex.c:1.103	Sun Feb 27 18:29:14 2022
+++ src/usr.bin/xlint/lint1/lex.c	Sun Feb 27 22:26:12 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.103 2022/02/27 18:29:14 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.104 2022/02/27 22:26:12 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.103 2022/02/27 18:29:14 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.104 2022/02/27 22:26:12 rillig Exp $");
 #endif
 
 #include 
@@ -68,8 +68,6 @@ bool in_gcc_attribute;
 bool in_system_header;
 
 static	int	inpc(void);
-static	unsigned int hash(const char *);
-static	sym_t *	search(sbuf_t *);
 static	int	keyw(sym_t *);
 static	int	get_escaped_char(int);
 
@@ -260,10 +258,24 @@ static	sym_t	*symtab[HSHSIZ1];
 symt_t	symtyp;
 
 
+static unsigned int
+hash(const char *s)
+{
+	unsigned int v;
+	const char *p;
+
+	v = 0;
+	for (p = s; *p != '\0'; p++) {
+		v = (v << 4) + (unsigned char)*p;
+		v ^= v >> 28;
+	}
+	return v % HSHSIZ1;
+}
+
 static void
 symtab_add(sym_t *sym)
 {
-	size_t h;
+	unsigned int h;
 
 	h = hash(sym->s_name);
 	if ((sym->s_symtab_next = symtab[h]) != NULL)
@@ -272,6 +284,27 @@ symtab_add(sym_t *sym)
 	symtab[h] = sym;
 }
 
+static sym_t *
+symtab_search(sbuf_t *sb)
+{
+
+	unsigned int h = hash(sb->sb_name);
+	for (sym_t *sym = symtab[h]; sym != NULL; sym = sym->s_symtab_next) {
+		if (strcmp(sym->s_name, sb->sb_name) != 0)
+			continue;
+
+		const struct keyword *kw = sym->s_keyword;
+		if (kw != NULL && !kw->kw_attr)
+			return sym;
+		if (kw != NULL && in_gcc_attribute)
+			return sym;
+		if (kw == NULL && !in_gcc_attribute && sym->s_kind == symtyp)
+			return sym;
+	}
+
+	return NULL;
+}
+
 static void
 symtab_remove(sym_t *sym)
 {
@@ -281,6 +314,19 @@ symtab_remove(sym_t *sym)
 	sym->s_symtab_next = NULL;
 }
 
+static void
+symtab_remove_locals(void)
+{
+
+	for (size_t i = 0; i < HSHSIZ1; i++) {
+		for (sym_t *sym = symtab[i]; sym != NULL; ) {
+			sym_t *next = sym->s_symtab_next;
+			if (sym->s_block_level >= 1)
+symtab_remove(sym);
+			sym = next;
+		}
+	}
+}
 
 static void
 add_keyword(const struct keyword *kw, bool leading, bool trailing)
@@ -356,20 +402,6 @@ inpc(void)
 	return c;
 }
 
-static unsigned int
-hash(const char *s)
-{
-	unsigned int v;
-	const char *p;
-
-	v = 0;
-	for (p = s; *p != '\0'; p++) {
-		v = (v << 4) + (unsigned char)*p;
-		v ^= v >> 28;
-	}
-	return v % HSHSIZ1;
-}
-
 /*
  * Lex has found a letter followed by zero or more letters or digits.
  * It looks for a symbol in the symbol table with the same name. This
@@ -394,7 +426,7 @@ lex_name(const char *yytext, size_t yyle
 	sb = xmalloc(sizeof(*sb));
 	sb->sb_name = yytext;
 	sb->sb_len = yyleng;
-	if ((sym = search(sb)) != NULL && sym->s_keyword != NULL) {
+	if ((sym = symtab_search(sb)) != NULL && sym->s_keyword != NULL) {
 		free(sb);
 		return keyw(sym);
 	}
@@ -418,30 +450,6 @@ lex_name(const char *yytext, size_t yyle
 	return tok;
 }
 
-static sym_t *
-search(sbuf_t *sb)
-{
-	unsigned int h;
-	sym_t *sym;
-	const struct keyword *kw;
-
-	h = hash(sb->sb_name);
-	for (sym = symtab[h]; sym != NULL; sym = sym->s_symtab_next) {
-		if (strcmp(sym->s_name, sb->sb_name) != 0)
-			continue;
-		kw = sym->s_keyword;
-
-		if (kw != NULL && !kw->kw_attr)
-			return sym;
-		if (kw != NULL && in_gcc_attribute)
-			return sym;
-		if (kw == NULL && !in_gcc_attribute && sym->s_kind == symtyp)
-			return sym;
-	}
-
-	return NULL;
-}
-
 static int
 keyw(sym_t *sym)
 {
@@ -1338,7 +1346,7 @@ getsym(sbuf_t *sb)
 	 */
 	if (symtyp == FMEMBER || symtyp == FLABEL) {
 		if (sym == NULL || sym->s_kind == FVFT)
-			sym = search(sb);
+			sym = symtab_search(sb);
 	}
 
 	if (sym != NULL) {
@@ -1475,18 +1483,10 @@ inssym(int bl, sym_t *sym)
 void
 cleanup(void)
 {
-	sym_t	*sym, *nsym;
-	size_t	i;
 
-	for (i = 0; i < HSHSIZ1; i++) {
-		for (sym = symtab[i]; sym != NULL; sym = nsym) {
-			nsym = sym->s_symtab_next;
-			if (sym->s_block_level >= 1)
-symtab_remove(sym);
-		}
-	}
+	symtab_remove_locals();
 
-	for (i = mem_block_level; i > 0; i--)
+	for (size_t i = mem_block_level; i > 0; i--)
 		level_free_all(i);
 }
 



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 22:26:12 UTC 2022

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

Log Message:
lint: group symbol table functions

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/lint1/lex.c

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:23:39 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_psr.h

Log Message:
i915: Disable PSR for now.

Something seems to be wrong with it, causing the display to get
stuck.  To be diagnosed -- this is a performance optimization, but
it's better to work than to fail to work even if failing to work
costs a little less energy!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_psr.h

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_psr.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_psr.h:1.2 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_psr.h:1.3
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_psr.h:1.2	Sat Dec 18 23:45:30 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_psr.h	Sun Feb 27 21:23:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_psr.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
+/*	$NetBSD: intel_psr.h,v 1.3 2022/02/27 21:23:39 riastradh Exp $	*/
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -16,7 +16,8 @@ struct drm_i915_private;
 struct intel_crtc_state;
 struct intel_dp;
 
-#define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
+/* PSR is disabled on NetBSD for now until we find what's wrong with it */
+#define CAN_PSR(dev_priv) 0//(HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
 void intel_psr_init_dpcd(struct intel_dp *intel_dp);
 void intel_psr_enable(struct intel_dp *intel_dp,
 		  const struct intel_crtc_state *crtc_state);



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:23:39 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_psr.h

Log Message:
i915: Disable PSR for now.

Something seems to be wrong with it, causing the display to get
stuck.  To be diagnosed -- this is a performance optimization, but
it's better to work than to fail to work even if failing to work
costs a little less energy!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_psr.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/acpi

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:22:10 UTC 2022

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

Log Message:
acpi: Assert acpi_register_notify is not called twice.


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

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

Modified files:

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.296 src/sys/dev/acpi/acpi.c:1.297
--- src/sys/dev/acpi/acpi.c:1.296	Sat Jan 22 11:49:17 2022
+++ src/sys/dev/acpi/acpi.c	Sun Feb 27 21:22:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.296 2022/01/22 11:49:17 thorpej Exp $	*/
+/*	$NetBSD: acpi.c,v 1.297 2022/02/27 21:22:09 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.296 2022/01/22 11:49:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.297 2022/02/27 21:22:09 riastradh Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -1222,6 +1222,11 @@ acpi_register_notify(struct acpi_devnode
 	if (ad == NULL || notify == NULL)
 		goto fail;
 
+	KASSERTMSG(ad->ad_notify == NULL,
+	"%s: ACPI node %s already has notify handler: %p",
+	ad->ad_device ? device_xname(ad->ad_device) : "(unknown)",
+	ad->ad_name,
+	ad->ad_notify);
 	atomic_store_release(&ad->ad_notify, notify);
 
 	return true;



CVS commit: src/sys/dev/acpi

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:22:10 UTC 2022

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

Log Message:
acpi: Assert acpi_register_notify is not called twice.


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

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:22:01 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_opregion.c
intel_opregion.h
src/sys/external/bsd/drm2/i915drm: files.i915drmkms i915_module.c

Log Message:
i915: Use new acpidisp_register_notify for ACPI VGA events.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
cvs rdiff -u -r1.85 -r1.86 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/i915drm/i915_module.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c:1.5	Fri Dec 24 15:08:09 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c	Sun Feb 27 21:22:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_opregion.c,v 1.5 2021/12/24 15:08:09 riastradh Exp $	*/
+/*	$NetBSD: intel_opregion.c,v 1.6 2022/02/27 21:22:01 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Intel Corporation 
@@ -28,7 +28,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.5 2021/12/24 15:08:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.6 2022/02/27 21:22:01 riastradh Exp $");
+
+#ifdef __NetBSD__
+#include 
+#endif
 
 #include 
 #include 
@@ -623,27 +627,23 @@ void intel_opregion_asle_intr(struct drm
 #define ACPI_EV_DOCK   (1<<2)
 
 #ifdef __NetBSD__
-static struct intel_opregion *system_opregion;
-
 static void
-intel_opregion_video_event(ACPI_HANDLE hdl, uint32_t notify, void *opaque)
+intel_opregion_video_event(ACPI_HANDLE hdl, uint32_t notify, void *cookie)
 {
-	device_t self = opaque;
-	struct opregion_acpi *acpi;
+	struct intel_opregion *opregion = cookie;
+	struct opregion_acpi *acpi = opregion->acpi;
 
-	DRM_DEBUG_DRIVER("notify=0x%08x\n", notify);
+	DRM_DEBUG_DRIVER("notify=0x%08x csts=0x%02x cevt=0x%02x\n", notify,
+	acpi->csts, acpi->cevt);
 
-	if (!system_opregion)
+	/*
+	 * The firmware sets CSTS to 0x03 `Dispatched (ASL)' before
+	 * issuing any graphics notification, and won't issue
+	 * additional notifications until the graphics driver sets CSTS
+	 * to 0x00 `Success (Driver)' to acknowledge it.
+	 */
+	if (acpi->csts != 0x03)
 		return;
-
-	acpi = system_opregion->acpi;
-
-	if (notify != 0x80) {
-		aprint_error_dev(self, "unknown notify 0x%02x\n", notify);
-	} else if ((acpi->cevt & 1) == 0) {
-		aprint_error_dev(self, "bad notify\n");
-	}
-
 	acpi->csts = 0;
 }
 #else	/* !__NetBSD__ */
@@ -1147,13 +1147,9 @@ void intel_opregion_register(struct drm_
 
 	if (opregion->acpi) {
 #ifdef __NetBSD__
-		if (i915->drm.pdev->pd_ad != NULL) {
-			/* XXX gross but expedient */
-			KASSERT(system_opregion == NULL);
-			system_opregion = opregion;
-			acpi_register_notify(i915->drm.pdev->pd_ad,
-			intel_opregion_video_event);
-		}
+		opregion->acpi_notifier =
+		acpidisp_register_notify(intel_opregion_video_event,
+			opregion);
 #else
 		opregion->acpi_notifier.notifier_call =
 			intel_opregion_video_event;
@@ -1220,9 +1216,9 @@ void intel_opregion_unregister(struct dr
 		return;
 
 #ifdef __NetBSD__
-	if (opregion->acpi) {
-		if (i915->drm.pdev->pd_ad != NULL)
-			acpi_deregister_notify(i915->drm.pdev->pd_ad);
+	if (opregion->acpi_notifier) {
+		acpidisp_deregister_notify(opregion->acpi_notifier);
+		opregion->acpi_notifier = NULL;
 	}
 #else
 	if (opregion->acpi_notifier.notifier_call) {

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h:1.4 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h:1.5
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h:1.4	Fri Dec 24 15:08:09 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h	Sun Feb 27 21:22:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_opregion.h,v 1.4 2021/12/24 15:08:09 riastradh Exp $	*/
+/*	$NetBSD: intel_opregion.h,v 1.5 2022/02/27 21:22:01 riastradh Exp $	*/
 
 /*
  * Copyright © 2008-2017 Intel Corporation
@@ -51,7 +51,11 @@ struct intel_opregion {
 	u32 vbt_size;
 	u32 *lid_state;
 	struct work_struct asle_work;
+#ifdef __NetBSD__
+	struct acpidisp_notifier *acpi_notifier;
+#else
 	struct notifier_block acpi_notifier;
+#endif
 };
 
 #define OPREGION_SIZE(8 * 1024)

Index: src/sys/external/bsd/drm2/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.85 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.86
--- src/sys/external/b

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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:22:01 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_opregion.c
intel_opregion.h
src/sys/external/bsd/drm2/i915drm: files.i915drmkms i915_module.c

Log Message:
i915: Use new acpidisp_register_notify for ACPI VGA events.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
cvs rdiff -u -r1.85 -r1.86 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/i915drm/i915_module.c

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



CVS commit: src/sys/dev/acpi

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:21:51 UTC 2022

Modified Files:
src/sys/dev/acpi: acpi_display.c
Added Files:
src/sys/dev/acpi: acpi_display.h

Log Message:
acpivga(4): Provide hooks for ACPI display notifications.

The Intel i915 graphics driver needs to receive ACPI VGA 0x80
notifications, but with NetBSD's ACPI API, each ACPI node -- such as
the VGA node -- can only have one notifier attached, and acpivga(4)
already uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/acpi/acpi_display.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/acpi_display.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/acpi/acpi_display.c
diff -u src/sys/dev/acpi/acpi_display.c:1.21 src/sys/dev/acpi/acpi_display.c:1.22
--- src/sys/dev/acpi/acpi_display.c:1.21	Thu Dec 30 14:40:06 2021
+++ src/sys/dev/acpi/acpi_display.c	Sun Feb 27 21:21:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_display.c,v 1.21 2021/12/30 14:40:06 riastradh Exp $	*/
+/*	$NetBSD: acpi_display.c,v 1.22 2022/02/27 21:21:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -66,19 +66,23 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.21 2021/12/30 14:40:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.22 2022/02/27 21:21:51 riastradh Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -386,6 +390,65 @@ static void	acpidisp_array_search(const 
 		uint8_t *);
 
 /*
+ * Display notification callbacks -- used by i915
+ */
+
+struct acpidisp_notifier {
+	void			(*adn_func)(ACPI_HANDLE, uint32_t, void *);
+	void			*adn_cookie;
+	struct pslist_entry	adn_entry;
+};
+
+static struct {
+	kmutex_t		lock;
+	struct pslist_head	list;
+} acpidisp_notifiers;
+
+struct acpidisp_notifier *
+acpidisp_register_notify(void (*func)(ACPI_HANDLE, uint32_t, void *),
+void *cookie)
+{
+	struct acpidisp_notifier *adn;
+
+	adn = kmem_zalloc(sizeof(*adn), KM_SLEEP);
+	adn->adn_func = func;
+	adn->adn_cookie = cookie;
+	PSLIST_ENTRY_INIT(adn, adn_entry);
+
+	mutex_enter(&acpidisp_notifiers.lock);
+	PSLIST_WRITER_INSERT_HEAD(&acpidisp_notifiers.list, adn, adn_entry);
+	mutex_exit(&acpidisp_notifiers.lock);
+
+	return adn;
+}
+
+void
+acpidisp_deregister_notify(struct acpidisp_notifier *adn)
+{
+
+	mutex_enter(&acpidisp_notifiers.lock);
+	PSLIST_WRITER_REMOVE(adn, adn_entry);
+	mutex_exit(&acpidisp_notifiers.lock);
+
+	xc_barrier(0);
+	kmem_free(adn, sizeof(*adn));
+}
+
+static void
+acpidisp_notify(ACPI_HANDLE handle, uint32_t notify)
+{
+	struct acpidisp_notifier *adn;
+	int s;
+
+	s = pserialize_read_enter();
+	PSLIST_READER_FOREACH(adn, &acpidisp_notifiers.list,
+	struct acpidisp_notifier, adn_entry) {
+		(*adn->adn_func)(handle, notify, adn->adn_cookie);
+	}
+	pserialize_read_exit(s);
+}
+
+/*
  * Autoconfiguration for the acpivga driver.
  */
 
@@ -863,6 +926,8 @@ acpidisp_vga_notify_handler(ACPI_HANDLE 
 
 	KASSERT(callback != NULL);
 	(void)AcpiOsExecute(OSL_NOTIFY_HANDLER, callback, asc);
+
+	acpidisp_notify(handle, notify);
 }
 
 static void
@@ -2081,7 +2146,9 @@ acpivga_modcmd(modcmd_t cmd, void *aux)
 	switch (cmd) {
 
 	case MODULE_CMD_INIT:
-
+		KASSERT(PSLIST_READER_FIRST(&acpidisp_notifiers.list,
+			struct acpidisp_notifier, adn_entry) == NULL);
+		mutex_init(&acpidisp_notifiers.lock, MUTEX_DEFAULT, IPL_NONE);
 #ifdef _MODULE
 		rv = config_init_component(cfdriver_ioconf_acpivga,
 		cfattach_ioconf_acpivga, cfdata_ioconf_acpivga);
@@ -2093,7 +2160,10 @@ acpivga_modcmd(modcmd_t cmd, void *aux)
 #ifdef _MODULE
 		rv = config_fini_component(cfdriver_ioconf_acpivga,
 		cfattach_ioconf_acpivga, cfdata_ioconf_acpivga);
+		if (rv)
+			break;
 #endif
+		mutex_destroy(&acpidisp_notifiers.lock);
 		break;
 
 	default:

Added files:

Index: src/sys/dev/acpi/acpi_display.h
diff -u /dev/null src/sys/dev/acpi/acpi_display.h:1.1
--- /dev/null	Sun Feb 27 21:21:51 2022
+++ src/sys/dev/acpi/acpi_display.h	Sun Feb 27 21:21:51 2022
@@ -0,0 +1,42 @@
+/*	$NetBSD: acpi_display.h,v 1.1 2022/02/27 21:21:51 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ 

CVS commit: src/sys/dev/acpi

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 21:21:51 UTC 2022

Modified Files:
src/sys/dev/acpi: acpi_display.c
Added Files:
src/sys/dev/acpi: acpi_display.h

Log Message:
acpivga(4): Provide hooks for ACPI display notifications.

The Intel i915 graphics driver needs to receive ACPI VGA 0x80
notifications, but with NetBSD's ACPI API, each ACPI node -- such as
the VGA node -- can only have one notifier attached, and acpivga(4)
already uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/acpi/acpi_display.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/acpi_display.h

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



CVS commit: src/sbin/newfs_v7fs

2022-02-27 Thread Zafer Aydogan
Module Name:src
Committed By:   zafer
Date:   Sun Feb 27 21:05:11 UTC 2022

Modified Files:
src/sbin/newfs_v7fs: main.c

Log Message:
fix typo


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

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

Modified files:

Index: src/sbin/newfs_v7fs/main.c
diff -u src/sbin/newfs_v7fs/main.c:1.10 src/sbin/newfs_v7fs/main.c:1.11
--- src/sbin/newfs_v7fs/main.c:1.10	Wed Aug 10 11:31:49 2011
+++ src/sbin/newfs_v7fs/main.c	Sun Feb 27 21:05:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.10 2011/08/10 11:31:49 uch Exp $	*/
+/*	$NetBSD: main.c,v 1.11 2022/02/27 21:05:11 zafer Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.10 2011/08/10 11:31:49 uch Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2022/02/27 21:05:11 zafer Exp $");
 #endif /* not lint */
 
 #include 
@@ -207,7 +207,7 @@ make_filesystem(struct v7fs_self *fs, v7
 	int error = 0;
 	int32_t i, j;
 
-	/* Setup ilist. (ilist must be zero filled. becuase of they are free) */
+	/* Setup ilist. (ilist must be zero filled. because of they are free) */
 	VPRINTF(4, "Zero clear ilist.\n");
 	progress(&(struct progress_arg){ .label = "zero ilist", .tick =
 	ilist_size / PROGRESS_BAR_GRANULE });



CVS commit: src/sbin/newfs_v7fs

2022-02-27 Thread Zafer Aydogan
Module Name:src
Committed By:   zafer
Date:   Sun Feb 27 21:05:11 UTC 2022

Modified Files:
src/sbin/newfs_v7fs: main.c

Log Message:
fix typo


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

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



CVS commit: src

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 20:02:44 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_058.c msg_058.exp msg_059.c
msg_059.exp msg_062.c msg_062.exp msg_063.c msg_063.exp
src/usr.bin/xlint/lint1: decl.c

Log Message:
tests/lint: add tests for messages about old-style functions


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_058.c \
src/tests/usr.bin/xlint/lint1/msg_058.exp \
src/tests/usr.bin/xlint/lint1/msg_059.c \
src/tests/usr.bin/xlint/lint1/msg_059.exp \
src/tests/usr.bin/xlint/lint1/msg_062.c \
src/tests/usr.bin/xlint/lint1/msg_062.exp \
src/tests/usr.bin/xlint/lint1/msg_063.c \
src/tests/usr.bin/xlint/lint1/msg_063.exp
cvs rdiff -u -r1.250 -r1.251 src/usr.bin/xlint/lint1/decl.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_058.c
diff -u src/tests/usr.bin/xlint/lint1/msg_058.c:1.2 src/tests/usr.bin/xlint/lint1/msg_058.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_058.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_058.c	Sun Feb 27 20:02:44 2022
@@ -1,7 +1,16 @@
-/*	$NetBSD: msg_058.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_058.c,v 1.3 2022/02/27 20:02:44 rillig Exp $	*/
 # 3 "msg_058.c"
 
 // Test for message: type does not match prototype: %s [58]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+int function(int, char, const char *);
+
+int
+function(i, dbl, str)
+	int i;
+	double dbl;
+	const char *str;
+/* expect+1: error: type does not match prototype: dbl [58] */
+{
+	return i + (int)dbl + str[0];
+}
Index: src/tests/usr.bin/xlint/lint1/msg_058.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_058.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_058.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_058.exp:1.2	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_058.exp	Sun Feb 27 20:02:44 2022
@@ -1 +1 @@
-msg_058.c(6): error: syntax error ':' [249]
+msg_058.c(14): error: type does not match prototype: dbl [58]
Index: src/tests/usr.bin/xlint/lint1/msg_059.c
diff -u src/tests/usr.bin/xlint/lint1/msg_059.c:1.2 src/tests/usr.bin/xlint/lint1/msg_059.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_059.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_059.c	Sun Feb 27 20:02:44 2022
@@ -1,7 +1,12 @@
-/*	$NetBSD: msg_059.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_059.c,v 1.3 2022/02/27 20:02:44 rillig Exp $	*/
 # 3 "msg_059.c"
 
 // Test for message: formal parameter lacks name: param #%d [59]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* expect+4: error: formal parameter lacks name: param #2 [59] */
+/* expect+3: error: formal parameter lacks name: param #3 [59] */
+int
+function_definition(int a, int, double)
+{
+	return a;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_059.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_059.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_059.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_059.exp:1.2	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_059.exp	Sun Feb 27 20:02:44 2022
@@ -1 +1,2 @@
-msg_059.c(6): error: syntax error ':' [249]
+msg_059.c(10): error: formal parameter lacks name: param #2 [59]
+msg_059.c(10): error: formal parameter lacks name: param #3 [59]
Index: src/tests/usr.bin/xlint/lint1/msg_062.c
diff -u src/tests/usr.bin/xlint/lint1/msg_062.c:1.2 src/tests/usr.bin/xlint/lint1/msg_062.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_062.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_062.c	Sun Feb 27 20:02:44 2022
@@ -1,7 +1,10 @@
-/*	$NetBSD: msg_062.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_062.c,v 1.3 2022/02/27 20:02:44 rillig Exp $	*/
 # 3 "msg_062.c"
 
 // Test for message: function prototype parameters must have types [62]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+outer() {
+	/* expect+2: warning: function prototype parameters must have types [62] */
+	/* expect+1: warning: dubious static function at block level: inner [93] */
+	static int inner(a);
+}
Index: src/tests/usr.bin/xlint/lint1/msg_062.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_062.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_062.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_062.exp:1.2	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_062.exp	Sun Feb 27 20:02:44 2022
@@ -1 +1,2 @@
-msg_062.c(6): error: syntax error ':' [249]
+msg_062.c(9): warning: function prototype parameters must have types [62]
+msg_062.c(9): warning: dubious static function at block level: inner [93]
Index: src/tests/usr

CVS commit: src

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 20:02:44 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_058.c msg_058.exp msg_059.c
msg_059.exp msg_062.c msg_062.exp msg_063.c msg_063.exp
src/usr.bin/xlint/lint1: decl.c

Log Message:
tests/lint: add tests for messages about old-style functions


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_058.c \
src/tests/usr.bin/xlint/lint1/msg_058.exp \
src/tests/usr.bin/xlint/lint1/msg_059.c \
src/tests/usr.bin/xlint/lint1/msg_059.exp \
src/tests/usr.bin/xlint/lint1/msg_062.c \
src/tests/usr.bin/xlint/lint1/msg_062.exp \
src/tests/usr.bin/xlint/lint1/msg_063.c \
src/tests/usr.bin/xlint/lint1/msg_063.exp
cvs rdiff -u -r1.250 -r1.251 src/usr.bin/xlint/lint1/decl.c

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



CVS commit: src

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 19:32:51 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_219.c msg_219.exp msg_292.c
msg_292.exp
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: concatenate string literals from left to right

Previously, the string literals "1" "2" "3" "4" were concatenated in the
order "23", "234", "1234".  This influenced the location of the
diagnostics for traditional C (which doesn't know concatenation at all)
and for mixing regular strings and wide strings.

Now the diagnostics occur exactly where they are expected.  The first
string literal defines whether the whole string is regular or wide, and
any further string literals must match it.

In traditional C mode, there are more diagnostics than before, but that
doesn't hurt since they are still correct and nobody uses lint in
traditional C mode anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_219.c \
src/tests/usr.bin/xlint/lint1/msg_219.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_292.c \
src/tests/usr.bin/xlint/lint1/msg_292.exp
cvs rdiff -u -r1.385 -r1.386 src/usr.bin/xlint/lint1/cgram.y

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



CVS commit: src

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 19:32:51 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_219.c msg_219.exp msg_292.c
msg_292.exp
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: concatenate string literals from left to right

Previously, the string literals "1" "2" "3" "4" were concatenated in the
order "23", "234", "1234".  This influenced the location of the
diagnostics for traditional C (which doesn't know concatenation at all)
and for mixing regular strings and wide strings.

Now the diagnostics occur exactly where they are expected.  The first
string literal defines whether the whole string is regular or wide, and
any further string literals must match it.

In traditional C mode, there are more diagnostics than before, but that
doesn't hurt since they are still correct and nobody uses lint in
traditional C mode anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_219.c \
src/tests/usr.bin/xlint/lint1/msg_219.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_292.c \
src/tests/usr.bin/xlint/lint1/msg_292.exp
cvs rdiff -u -r1.385 -r1.386 src/usr.bin/xlint/lint1/cgram.y

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_219.c
diff -u src/tests/usr.bin/xlint/lint1/msg_219.c:1.4 src/tests/usr.bin/xlint/lint1/msg_219.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_219.c:1.4	Sun Feb 27 18:57:16 2022
+++ src/tests/usr.bin/xlint/lint1/msg_219.c	Sun Feb 27 19:32:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_219.c,v 1.4 2022/02/27 18:57:16 rillig Exp $	*/
+/*	$NetBSD: msg_219.c,v 1.5 2022/02/27 19:32:51 rillig Exp $	*/
 # 3 "msg_219.c"
 
 
@@ -7,13 +7,21 @@
 /* lint1-flags: -t -w */
 
 char concat1[] = "one";
-char concat2[] = "one" "two";			/* expect: 219 */
-char concat3[] = "one" "two" "three";		/* expect: 219 */
-char concat4[] = "one" "two" "three" "four";	/* expect: 219 */
+/* expect+1: warning: concatenated strings are illegal in traditional C [219] */
+char concat2[] = "one" "two";
+/* expect+2: warning: concatenated strings are illegal in traditional C [219] */
+/* expect+1: warning: concatenated strings are illegal in traditional C [219] */
+char concat3[] = "one" "two" "three";
+/* expect+3: warning: concatenated strings are illegal in traditional C [219] */
+/* expect+2: warning: concatenated strings are illegal in traditional C [219] */
+/* expect+1: warning: concatenated strings are illegal in traditional C [219] */
+char concat4[] = "one" "two" "three" "four";
 
 char concat4lines[] =
 	"one"
 	/* expect+1: warning: concatenated strings are illegal in traditional C [219] */
 	"two"
+	/* expect+1: warning: concatenated strings are illegal in traditional C [219] */
 	"three"
+	/* expect+1: warning: concatenated strings are illegal in traditional C [219] */
 	"four";
Index: src/tests/usr.bin/xlint/lint1/msg_219.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_219.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_219.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_219.exp:1.4	Sun Feb 27 18:57:16 2022
+++ src/tests/usr.bin/xlint/lint1/msg_219.exp	Sun Feb 27 19:32:51 2022
@@ -1,4 +1,9 @@
-msg_219.c(10): warning: concatenated strings are illegal in traditional C [219]
 msg_219.c(11): warning: concatenated strings are illegal in traditional C [219]
-msg_219.c(12): warning: concatenated strings are illegal in traditional C [219]
-msg_219.c(17): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(14): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(14): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(18): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(18): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(18): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(23): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(25): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(27): warning: concatenated strings are illegal in traditional C [219]

Index: src/tests/usr.bin/xlint/lint1/msg_292.c
diff -u src/tests/usr.bin/xlint/lint1/msg_292.c:1.3 src/tests/usr.bin/xlint/lint1/msg_292.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_292.c:1.3	Sun Feb 27 18:51:21 2022
+++ src/tests/usr.bin/xlint/lint1/msg_292.c	Sun Feb 27 19:32:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_292.c,v 1.3 2022/02/27 18:51:21 rillig Exp $	*/
+/*	$NetBSD: msg_292.c,v 1.4 2022/02/27 19:32:51 rillig Exp $	*/
 # 3 "msg_292.c"
 
 // Test for message: cannot concatenate wide and regular string literals [292]
@@ -19,21 +19,13 @@ typedef int reveal_sizeof_c_c_c_w_w_w[-(
 
 const char c_w_c_w_c_w[] =
 	"c2"
-	L"w2"
 	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
+	L"w2"
 

CVS commit: src/sys/arch/mips/mips

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:29 UTC 2022

Modified Files:
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Issue a sync plunger at the end of mutex_spin_exit.

Same as mutex_exit.  Relevant only on cnMIPS where the store buffers
get clogged.  Recommended by the Cavium documentation.  No semantic
change, only performance -- this only adds a barrier in some cases
where there was none before, so it can't hurt correctness.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/mips/lock_stubs_llsc.S

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/mips/mips/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.16 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.17
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.16	Sun Feb 27 19:22:02 2022
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Sun Feb 27 19:22:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.16 2022/02/27 19:22:02 riastradh Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.17 2022/02/27 19:22:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.16 2022/02/27 19:22:02 riastradh Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.17 2022/02/27 19:22:29 riastradh Exp $")
 
 #include "assym.h"
 
@@ -342,10 +342,10 @@ LEAF(llsc_mutex_spin_exit)
 	 nop
 #endif
 	j	 _C_LABEL(splx)
-	 nop
+	 BDSYNC_PLUNGER
 1:
 	j	ra
-	 nop
+	 BDSYNC_PLUNGER
 #if defined(DIAGNOSTIC)
 2:
 	j	_C_LABEL(mutex_vector_exit)



CVS commit: src/sys/arch/mips/mips

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:29 UTC 2022

Modified Files:
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Issue a sync plunger at the end of mutex_spin_exit.

Same as mutex_exit.  Relevant only on cnMIPS where the store buffers
get clogged.  Recommended by the Cavium documentation.  No semantic
change, only performance -- this only adds a barrier in some cases
where there was none before, so it can't hurt correctness.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/mips/lock_stubs_llsc.S

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



CVS commit: src/sys/arch/mips/include

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:20 UTC 2022

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
mips: Redefine LLSCSYNC as empty on non-Octeon MP.

This change deletes memory barriers on non-Octeon MP.  However, all
the appropriate acquire and release barriers are already used in
mutex stubs, and no barriers are needed in atomic_* unless we set
__HAVE_ATOMIC_AS_MEMBAR which we don't on MIPS.  So this should be
safe.

Unclear whether we need this even on Octeon -- don't have a clear
reference on why it's here.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/include/asm.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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.68 src/sys/arch/mips/include/asm.h:1.69
--- src/sys/arch/mips/include/asm.h:1.68	Sun Feb 27 19:22:12 2022
+++ src/sys/arch/mips/include/asm.h	Sun Feb 27 19:22:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.68 2022/02/27 19:22:12 riastradh Exp $	*/
+/*	$NetBSD: asm.h,v 1.69 2022/02/27 19:22:20 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -581,7 +581,7 @@ _C_LABEL(x):
 #define	BDSYNC_PLUNGER	sync 4
 #define	SYNC_PLUNGER	sync 4
 #elif __mips >= 3 || !defined(__mips_o32)
-#define	LLSCSYNC	sync
+#define	LLSCSYNC	/* nothing */
 #define	BDSYNC		sync
 #define	BDSYNC_ACQ	sync
 #define	SYNC_ACQ	sync



CVS commit: src/sys/arch/mips/include

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:20 UTC 2022

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
mips: Redefine LLSCSYNC as empty on non-Octeon MP.

This change deletes memory barriers on non-Octeon MP.  However, all
the appropriate acquire and release barriers are already used in
mutex stubs, and no barriers are needed in atomic_* unless we set
__HAVE_ATOMIC_AS_MEMBAR which we don't on MIPS.  So this should be
safe.

Unclear whether we need this even on Octeon -- don't have a clear
reference on why it's here.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/mips/include/asm.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/mips/include

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:12 UTC 2022

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
mips: Redefine BDSYNC as sync on Octeon, not syncw.

BDSYNC is used for membar_sync, which is supposed to be a full
sequential consistency barrier, which is not provided by syncw, so
this is necessary for correctness.

BDSYNC is not used for anything else, so this can't hurt performance,
except where it was necessary for correctness anyway or where the
semantic choice of membar_sync was too strong anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/mips/include/asm.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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.67 src/sys/arch/mips/include/asm.h:1.68
--- src/sys/arch/mips/include/asm.h:1.67	Sun Feb 27 19:22:02 2022
+++ src/sys/arch/mips/include/asm.h	Sun Feb 27 19:22:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.67 2022/02/27 19:22:02 riastradh Exp $	*/
+/*	$NetBSD: asm.h,v 1.68 2022/02/27 19:22:12 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -574,7 +574,7 @@ _C_LABEL(x):
 #if defined(__OCTEON__)
 /* early cnMIPS have erratum which means 2 */
 #define	LLSCSYNC	sync 4; sync 4
-#define	BDSYNC		sync 4		/* sync 4 == syncw - sync all writes */
+#define	BDSYNC		sync
 #define	BDSYNC_ACQ	sync
 #define	SYNC_ACQ	sync
 #define	SYNC_REL	sync



CVS commit: src/sys/arch/mips/include

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:12 UTC 2022

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
mips: Redefine BDSYNC as sync on Octeon, not syncw.

BDSYNC is used for membar_sync, which is supposed to be a full
sequential consistency barrier, which is not provided by syncw, so
this is necessary for correctness.

BDSYNC is not used for anything else, so this can't hurt performance,
except where it was necessary for correctness anyway or where the
semantic choice of membar_sync was too strong anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/mips/include/asm.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/mips

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:03 UTC 2022

Modified Files:
src/sys/arch/mips/include: asm.h
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Omit needless SYNC in mutex_exit.

This change deletes a memory barrier.  However, it should be safe:
The semantic requirement for this is already provided by the SYNC_REL
above, before the ll.  And as currently defined, SYNC_REL is at least
as strong as SYNC, so this change can't hurt correctness on its own
(barring CPU errata, which would apply to other users of SYNC_REL and
can be addressed in the definition of SYNC_REL).

Later, perhaps we can relax SYNC_REL to syncw on Octeon if we prove
that it is correct (e.g., if Octeon follows the SPARCv9 partial store
order semantics).

Nix now-unused SYNC macro in asm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/mips/lock_stubs_llsc.S

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



CVS commit: src/sys/arch/mips

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:22:03 UTC 2022

Modified Files:
src/sys/arch/mips/include: asm.h
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Omit needless SYNC in mutex_exit.

This change deletes a memory barrier.  However, it should be safe:
The semantic requirement for this is already provided by the SYNC_REL
above, before the ll.  And as currently defined, SYNC_REL is at least
as strong as SYNC, so this change can't hurt correctness on its own
(barring CPU errata, which would apply to other users of SYNC_REL and
can be addressed in the definition of SYNC_REL).

Later, perhaps we can relax SYNC_REL to syncw on Octeon if we prove
that it is correct (e.g., if Octeon follows the SPARCv9 partial store
order semantics).

Nix now-unused SYNC macro in asm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/mips/lock_stubs_llsc.S

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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.66 src/sys/arch/mips/include/asm.h:1.67
--- src/sys/arch/mips/include/asm.h:1.66	Sun Feb 27 19:21:53 2022
+++ src/sys/arch/mips/include/asm.h	Sun Feb 27 19:22:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.66 2022/02/27 19:21:53 riastradh Exp $	*/
+/*	$NetBSD: asm.h,v 1.67 2022/02/27 19:22:02 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -574,7 +574,6 @@ _C_LABEL(x):
 #if defined(__OCTEON__)
 /* early cnMIPS have erratum which means 2 */
 #define	LLSCSYNC	sync 4; sync 4
-#define	SYNC		sync 4		/* sync 4 == syncw - sync all writes */
 #define	BDSYNC		sync 4		/* sync 4 == syncw - sync all writes */
 #define	BDSYNC_ACQ	sync
 #define	SYNC_ACQ	sync
@@ -583,7 +582,6 @@ _C_LABEL(x):
 #define	SYNC_PLUNGER	sync 4
 #elif __mips >= 3 || !defined(__mips_o32)
 #define	LLSCSYNC	sync
-#define	SYNC		sync
 #define	BDSYNC		sync
 #define	BDSYNC_ACQ	sync
 #define	SYNC_ACQ	sync
@@ -592,7 +590,6 @@ _C_LABEL(x):
 #define	SYNC_PLUNGER	/* nothing */
 #else
 #define	LLSCSYNC	/* nothing */
-#define	SYNC		/* nothing */
 #define	BDSYNC		nop
 #define	BDSYNC_ACQ	nop
 #define	SYNC_ACQ	/* nothing */

Index: src/sys/arch/mips/mips/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.15 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.16
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.15	Sun Feb 27 19:21:53 2022
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Sun Feb 27 19:22:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.15 2022/02/27 19:21:53 riastradh Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.16 2022/02/27 19:22:02 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.15 2022/02/27 19:21:53 riastradh Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.16 2022/02/27 19:22:02 riastradh Exp $")
 
 #include "assym.h"
 
@@ -207,7 +207,6 @@ STATIC_LEAF(llsc_mutex_exit)
 	SYNC_REL
 	LLSCSYNC
 	PTR_LL	t0, MTX_OWNER(a0)
-	SYNC
 1:
 	bne	t0, MIPS_CURLWP, 2f
 	 move	t2, zero



CVS commit: src

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:21:54 UTC 2022

Modified Files:
src/common/lib/libc/arch/mips/atomic: atomic_cas.S atomic_op_asm.h
atomic_swap.S
src/sys/arch/mips/include: asm.h
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Membar audit.

This change should be safe because it doesn't remove or weaken any
memory barriers, but does add, clarify, or strengthen barriers.

Goals:

- Make sure mutex_enter/exit and mutex_spin_enter/exit have
  acquire/release semantics.

- New macros make maintenance easier and purpose clearer:

  . SYNC_ACQ is for load-before-load/store barrier, and BDSYNC_ACQ
for a branch delay slot -- currently defined as plain sync for MP
and nothing, or nop, for UP; thus it is no weaker than SYNC and
BDSYNC as currently defined, which is syncw on Octeon, plain sync
on non-Octeon MP, and nothing/nop on UP.

It is not clear to me whether load-then-syncw or ll/sc-then-syncw
or even bare load provides load-acquire semantics on Octeon -- if
no, this will fix bugs; if yes (like it is on SPARC PSO), we can
relax SYNC_ACQ to be syncw or nothing later.

  . SYNC_REL is for load/store-before-store barrier -- currently
defined as plain sync for MP and nothing for UP.

It is not clear to me whether syncw-then-store is enough for
store-release on Octeon -- if no, we can leave this as is; if
yes, we can relax SYNC_REL to be syncw on Octeon.

  . SYNC_PLUNGER is there to flush clogged Cavium store buffers, and
BDSYNC_PLUNGER for a branch delay slot -- syncw on Octeon,
nothing or nop on non-Octeon.

=> This is not necessary (or, as far as I'm aware, sufficient)
   for acquire semantics -- it serves only to flush store buffers
   where stores might otherwise linger for hundreds of thousands
   of cycles, which would, e.g., cause spin locks to be held for
   unreasonably long durations.

  Newerish revisions of the MIPS ISA also have finer-grained sync
  variants that could be plopped in here.

Mechanism:

Insert these barriers in the right places, replacing only those where
the definition is currently equivalent, so this change is safe.

- Replace #ifdef _MIPS_ARCH_OCTEONP / syncw / #endif at the end of
  atomic_cas_* by SYNC_PLUNGER, which is `sync 4' (a.k.a. syncw) if
  __OCTEON__ and empty otherwise.

  => From what I can tell, __OCTEON__ is defined in at least as many
 contexts as _MIPS_ARCH_OCTEONP -- i.e., there are some Octeons
 with no _MIPS_ARCH_OCTEONP, but I don't know if any of them are
 relevant to us or ever saw the light of day outside Cavium; we
 seem to buid with `-march=octeonp' so this is unlikely to make a
 difference.  If it turns out that we do care, well, now there's
 a central place to make the distinction for sync instructions.

- Replace post-ll/sc SYNC by SYNC_ACQ in _atomic_cas_*, which are
  internal kernel versions used in sys/arch/mips/include/lock.h where
  it assumes they have load-acquire semantics.  Should move this to
  lock.h later, since we _don't_ define __HAVE_ATOMIC_AS_MEMBAR on
  MIPS and so the extra barrier might be costly.

- Insert SYNC_REL before ll/sc, and replace post-ll/sc SYNC by
  SYNC_ACQ, in _ucas_*, which is used without any barriers in futex
  code and doesn't mention barriers in the man page so I have to
  assume it is required to be a release/acquire barrier.

- Change BDSYNC to BDSYNC_ACQ in mutex_enter and mutex_spin_enter.
  This is necessary to provide load-acquire semantics -- unclear if
  it was provided already by syncw on Octeon, but it seems more
  likely that either (a) no sync or syncw is needed at all, or (b)
  syncw is not enough and sync is needed, since syncw is only a
  store-before-store ordering barrier.

- Insert SYNC_REL before ll/sc in mutex_exit and mutex_spin_exit.
  This is currently redundant with the SYNC already there, but
  SYNC_REL more clearly identifies the necessary semantics in case we
  want to define it differently on different systems, and having a
  sync in the middle of an ll/sc is a bit weird and possibly not a
  good idea, so I intend to (carefully) remove the redundant SYNC in
  a later change.

- Change BDSYNC to BDSYNC_PLUNGER at the end of mutex_exit.  This has
  no semantic change right now -- it's syncw on Octeon, sync on
  non-Octeon MP, nop on UP -- but we can relax it later to nop on
  non-Cavium MP.

- Leave LLSCSYNC in for now -- it is apparently there for a Cavium
  erratum, but I'm not sure what the erratum is, exactly, and I have
  no reference for it.  I suspect these can be safely removed, but we
  might have to double up some other syncw instructions -- Linux uses
  it only in store-release sequences, not at the head of every ll/sc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/mips/atomic/atomic_cas.S
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/mips/atomic

CVS commit: src

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:21:54 UTC 2022

Modified Files:
src/common/lib/libc/arch/mips/atomic: atomic_cas.S atomic_op_asm.h
atomic_swap.S
src/sys/arch/mips/include: asm.h
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Membar audit.

This change should be safe because it doesn't remove or weaken any
memory barriers, but does add, clarify, or strengthen barriers.

Goals:

- Make sure mutex_enter/exit and mutex_spin_enter/exit have
  acquire/release semantics.

- New macros make maintenance easier and purpose clearer:

  . SYNC_ACQ is for load-before-load/store barrier, and BDSYNC_ACQ
for a branch delay slot -- currently defined as plain sync for MP
and nothing, or nop, for UP; thus it is no weaker than SYNC and
BDSYNC as currently defined, which is syncw on Octeon, plain sync
on non-Octeon MP, and nothing/nop on UP.

It is not clear to me whether load-then-syncw or ll/sc-then-syncw
or even bare load provides load-acquire semantics on Octeon -- if
no, this will fix bugs; if yes (like it is on SPARC PSO), we can
relax SYNC_ACQ to be syncw or nothing later.

  . SYNC_REL is for load/store-before-store barrier -- currently
defined as plain sync for MP and nothing for UP.

It is not clear to me whether syncw-then-store is enough for
store-release on Octeon -- if no, we can leave this as is; if
yes, we can relax SYNC_REL to be syncw on Octeon.

  . SYNC_PLUNGER is there to flush clogged Cavium store buffers, and
BDSYNC_PLUNGER for a branch delay slot -- syncw on Octeon,
nothing or nop on non-Octeon.

=> This is not necessary (or, as far as I'm aware, sufficient)
   for acquire semantics -- it serves only to flush store buffers
   where stores might otherwise linger for hundreds of thousands
   of cycles, which would, e.g., cause spin locks to be held for
   unreasonably long durations.

  Newerish revisions of the MIPS ISA also have finer-grained sync
  variants that could be plopped in here.

Mechanism:

Insert these barriers in the right places, replacing only those where
the definition is currently equivalent, so this change is safe.

- Replace #ifdef _MIPS_ARCH_OCTEONP / syncw / #endif at the end of
  atomic_cas_* by SYNC_PLUNGER, which is `sync 4' (a.k.a. syncw) if
  __OCTEON__ and empty otherwise.

  => From what I can tell, __OCTEON__ is defined in at least as many
 contexts as _MIPS_ARCH_OCTEONP -- i.e., there are some Octeons
 with no _MIPS_ARCH_OCTEONP, but I don't know if any of them are
 relevant to us or ever saw the light of day outside Cavium; we
 seem to buid with `-march=octeonp' so this is unlikely to make a
 difference.  If it turns out that we do care, well, now there's
 a central place to make the distinction for sync instructions.

- Replace post-ll/sc SYNC by SYNC_ACQ in _atomic_cas_*, which are
  internal kernel versions used in sys/arch/mips/include/lock.h where
  it assumes they have load-acquire semantics.  Should move this to
  lock.h later, since we _don't_ define __HAVE_ATOMIC_AS_MEMBAR on
  MIPS and so the extra barrier might be costly.

- Insert SYNC_REL before ll/sc, and replace post-ll/sc SYNC by
  SYNC_ACQ, in _ucas_*, which is used without any barriers in futex
  code and doesn't mention barriers in the man page so I have to
  assume it is required to be a release/acquire barrier.

- Change BDSYNC to BDSYNC_ACQ in mutex_enter and mutex_spin_enter.
  This is necessary to provide load-acquire semantics -- unclear if
  it was provided already by syncw on Octeon, but it seems more
  likely that either (a) no sync or syncw is needed at all, or (b)
  syncw is not enough and sync is needed, since syncw is only a
  store-before-store ordering barrier.

- Insert SYNC_REL before ll/sc in mutex_exit and mutex_spin_exit.
  This is currently redundant with the SYNC already there, but
  SYNC_REL more clearly identifies the necessary semantics in case we
  want to define it differently on different systems, and having a
  sync in the middle of an ll/sc is a bit weird and possibly not a
  good idea, so I intend to (carefully) remove the redundant SYNC in
  a later change.

- Change BDSYNC to BDSYNC_PLUNGER at the end of mutex_exit.  This has
  no semantic change right now -- it's syncw on Octeon, sync on
  non-Octeon MP, nop on UP -- but we can relax it later to nop on
  non-Cavium MP.

- Leave LLSCSYNC in for now -- it is apparently there for a Cavium
  erratum, but I'm not sure what the erratum is, exactly, and I have
  no reference for it.  I suspect these can be safely removed, but we
  might have to double up some other syncw instructions -- Linux uses
  it only in store-release sequences, not at the head of every ll/sc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libc/arch/mips/atomic/atomic_cas.S
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/mips/atomic

CVS commit: src/sys/arch/mips/mips

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:21:44 UTC 2022

Modified Files:
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Make sure that mutex_spin_exit works even if !DIAGNOSTIC.

The critical store has been under #ifdef DIAGNOSTIC since, uh, 2011.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/mips/lock_stubs_llsc.S

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



CVS commit: src/sys/arch/mips/mips

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 19:21:44 UTC 2022

Modified Files:
src/sys/arch/mips/mips: lock_stubs_llsc.S

Log Message:
mips: Make sure that mutex_spin_exit works even if !DIAGNOSTIC.

The critical store has been under #ifdef DIAGNOSTIC since, uh, 2011.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/mips/lock_stubs_llsc.S

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/mips/mips/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.13 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.14
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.13	Sat Sep 26 08:21:27 2020
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Sun Feb 27 19:21:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.13 2020/09/26 08:21:27 simonb Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.14 2022/02/27 19:21:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.13 2020/09/26 08:21:27 simonb Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.14 2022/02/27 19:21:44 riastradh Exp $")
 
 #include "assym.h"
 
@@ -279,8 +279,8 @@ LEAF(llsc_mutex_spin_exit)
 	INT_L	t0, MTX_LOCK(a0)
 	beqz	t0, 2f
 	 nop
-	INT_S	zero, MTX_LOCK(a0)
 #endif
+	INT_S	zero, MTX_LOCK(a0)
 
 	/*
 	 * We need to grab this before the mutex count is incremented



CVS commit: src/usr.bin/vmstat

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 19:00:46 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
vmstat: unexport file-scope variable numdisks

There is no need to make this variable externally visible.  There are
several more variables in this file that could be unexported, leave
these for someone who knows whether vmstat.c is used by other parts of
the tree as well.

No functional change, OK mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/vmstat/vmstat.c

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

Modified files:

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.251 src/usr.bin/vmstat/vmstat.c:1.252
--- src/usr.bin/vmstat/vmstat.c:1.251	Wed Feb  9 07:51:45 2022
+++ src/usr.bin/vmstat/vmstat.c	Sun Feb 27 19:00:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.251 2022/02/09 07:51:45 wiz Exp $ */
+/* $NetBSD: vmstat.c,v 1.252 2022/02/27 19:00:46 rillig Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007, 2019, 2020
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.251 2022/02/09 07:51:45 wiz Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.252 2022/02/27 19:00:46 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -329,7 +329,7 @@ static const int vmmeter_mib[] = { CTL_V
 static const int uvmexp2_mib[] = { CTL_VM, VM_UVMEXP2 };
 static const int boottime_mib[] = { CTL_KERN, KERN_BOOTTIME };
 
-int numdisks = 2;
+static int numdisks = 2;
 
 int
 main(int argc, char *argv[])



CVS commit: src/usr.bin/vmstat

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 19:00:46 UTC 2022

Modified Files:
src/usr.bin/vmstat: vmstat.c

Log Message:
vmstat: unexport file-scope variable numdisks

There is no need to make this variable externally visible.  There are
several more variables in this file that could be unexported, leave
these for someone who knows whether vmstat.c is used by other parts of
the tree as well.

No functional change, OK mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/usr.bin/vmstat/vmstat.c

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



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 18:57:16 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_219.c msg_219.exp

Log Message:
tests/lint: test where exactly lint complains about concatenation

This only applies to traditional C and ensures that the behavior is
preserved when rearranging the C parser to evaluate string concatenation
from left to right.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_219.c \
src/tests/usr.bin/xlint/lint1/msg_219.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_219.c
diff -u src/tests/usr.bin/xlint/lint1/msg_219.c:1.3 src/tests/usr.bin/xlint/lint1/msg_219.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_219.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_219.c	Sun Feb 27 18:57:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_219.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_219.c,v 1.4 2022/02/27 18:57:16 rillig Exp $	*/
 # 3 "msg_219.c"
 
 
@@ -10,3 +10,10 @@ char concat1[] = "one";
 char concat2[] = "one" "two";			/* expect: 219 */
 char concat3[] = "one" "two" "three";		/* expect: 219 */
 char concat4[] = "one" "two" "three" "four";	/* expect: 219 */
+
+char concat4lines[] =
+	"one"
+	/* expect+1: warning: concatenated strings are illegal in traditional C [219] */
+	"two"
+	"three"
+	"four";
Index: src/tests/usr.bin/xlint/lint1/msg_219.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_219.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_219.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_219.exp:1.3	Sun Mar 28 15:36:37 2021
+++ src/tests/usr.bin/xlint/lint1/msg_219.exp	Sun Feb 27 18:57:16 2022
@@ -1,3 +1,4 @@
 msg_219.c(10): warning: concatenated strings are illegal in traditional C [219]
 msg_219.c(11): warning: concatenated strings are illegal in traditional C [219]
 msg_219.c(12): warning: concatenated strings are illegal in traditional C [219]
+msg_219.c(17): warning: concatenated strings are illegal in traditional C [219]



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 18:57:16 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_219.c msg_219.exp

Log Message:
tests/lint: test where exactly lint complains about concatenation

This only applies to traditional C and ensures that the behavior is
preserved when rearranging the C parser to evaluate string concatenation
from left to right.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_219.c \
src/tests/usr.bin/xlint/lint1/msg_219.exp

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



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 18:51:21 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_292.c msg_292.exp

Log Message:
tests/lint: demonstrate unexpected ordering of string concatenations

When lint concatenates the strings "1" "2" "3" "4", it first
concatenates "23", then "234" and finally "1234".


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_292.c \
src/tests/usr.bin/xlint/lint1/msg_292.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_292.c
diff -u src/tests/usr.bin/xlint/lint1/msg_292.c:1.2 src/tests/usr.bin/xlint/lint1/msg_292.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_292.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_292.c	Sun Feb 27 18:51:21 2022
@@ -1,7 +1,39 @@
-/*	$NetBSD: msg_292.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_292.c,v 1.3 2022/02/27 18:51:21 rillig Exp $	*/
 # 3 "msg_292.c"
 
 // Test for message: cannot concatenate wide and regular string literals [292]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+const char c_c_c_w_w_w[] =
+	"c2"
+	"c  4"
+	"c  8"
+	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
+	L"w2"
+	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
+	L"w  4"
+	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
+	L"w  8";
+/* The 15 results from 2 + 4 + 8 + '\0'. */
+/* expect+1: error: negative array dimension (-15) [20] */
+typedef int reveal_sizeof_c_c_c_w_w_w[-(int)sizeof(c_c_c_w_w_w)];
+
+const char c_w_c_w_c_w[] =
+	"c2"
+	L"w2"
+	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
+	"c  4"
+	L"w  4"
+	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
+	"c  8"
+	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
+	L"w  8";
+/*
+ * Concatenating L"w2" with "c4" fails, keeping L"w2".
+ * Concatenating L"w2" with L"w4" succeeds, resulting in L"w2w4".
+ * Concatenating L"w2w4" with "c8" fails, keeping L"w2w4".
+ * Concatenating L"w2w4" with L"w8" succeeds, resulting in L"w2w4w8".
+ * Concatenating "c2" with L"w2w4w8" fails, keeping "c2".
+ * The size of "c2" is 3.
+ */
+/* expect+1: error: negative array dimension (-3) [20] */
+typedef int reveal_sizeof_c_w_c_w_c_w[-(int)sizeof(c_w_c_w_c_w)];
Index: src/tests/usr.bin/xlint/lint1/msg_292.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_292.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_292.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_292.exp:1.2	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_292.exp	Sun Feb 27 18:51:21 2022
@@ -1 +1,8 @@
-msg_292.c(6): error: syntax error ':' [249]
+msg_292.c(11): error: cannot concatenate wide and regular string literals [292]
+msg_292.c(13): error: cannot concatenate wide and regular string literals [292]
+msg_292.c(15): error: cannot concatenate wide and regular string literals [292]
+msg_292.c(18): error: negative array dimension (-15) [20]
+msg_292.c(24): error: cannot concatenate wide and regular string literals [292]
+msg_292.c(27): error: cannot concatenate wide and regular string literals [292]
+msg_292.c(29): error: cannot concatenate wide and regular string literals [292]
+msg_292.c(39): error: negative array dimension (-3) [20]



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 18:51:21 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_292.c msg_292.exp

Log Message:
tests/lint: demonstrate unexpected ordering of string concatenations

When lint concatenates the strings "1" "2" "3" "4", it first
concatenates "23", then "234" and finally "1234".


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_292.c \
src/tests/usr.bin/xlint/lint1/msg_292.exp

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



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 18:29:14 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: ckgetopt.c debug.c emit1.c lex.c lint1.h
tree.c

Log Message:
lint: merge duplicate code for handling plain and wide strings

No functional change.  As before, the string literals "1" "2" "3" are
not concatenated from left to right, instead concatenation starts with
"23" and then proceeds to "123".


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/lint1/ckgetopt.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.409 -r1.410 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/ckgetopt.c
diff -u src/usr.bin/xlint/lint1/ckgetopt.c:1.14 src/usr.bin/xlint/lint1/ckgetopt.c:1.15
--- src/usr.bin/xlint/lint1/ckgetopt.c:1.14	Mon Nov  1 19:48:51 2021
+++ src/usr.bin/xlint/lint1/ckgetopt.c	Sun Feb 27 18:29:14 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ckgetopt.c,v 1.14 2021/11/01 19:48:51 rillig Exp $ */
+/* $NetBSD: ckgetopt.c,v 1.15 2022/02/27 18:29:14 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckgetopt.c,v 1.14 2021/11/01 19:48:51 rillig Exp $");
+__RCSID("$NetBSD: ckgetopt.c,v 1.15 2022/02/27 18:29:14 rillig Exp $");
 #endif
 
 #include 
@@ -103,10 +103,9 @@ is_getopt_condition(const tnode_t *tn, c
 	NEED(last_arg->tn_op == CVT);
 	NEED(last_arg->tn_left->tn_op == ADDR);
 	NEED(last_arg->tn_left->tn_left->tn_op == STRING);
-	NEED(last_arg->tn_left->tn_left->tn_string->st_tspec == CHAR);
+	NEED(last_arg->tn_left->tn_left->tn_string->st_char);
 
-	*out_options = xstrdup(
-	(const char *)last_arg->tn_left->tn_left->tn_string->st_cp);
+	*out_options = xstrdup(last_arg->tn_left->tn_left->tn_string->st_mem);
 	return true;
 }
 

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.7 src/usr.bin/xlint/lint1/debug.c:1.8
--- src/usr.bin/xlint/lint1/debug.c:1.7	Tue Dec 21 21:04:08 2021
+++ src/usr.bin/xlint/lint1/debug.c	Sun Feb 27 18:29:14 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.7 2021/12/21 21:04:08 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.8 2022/02/27 18:29:14 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: debug.c,v 1.7 2021/12/21 21:04:08 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.8 2022/02/27 18:29:14 rillig Exp $");
 #endif
 
 #include 
@@ -137,15 +137,14 @@ debug_node(const tnode_t *tn)
 		tn->tn_val->v_quad != 0 ? "true" : "false");
 	else if (op == CON)
 		debug_printf(", unknown value\n");
-	else if (op == STRING && tn->tn_string->st_tspec == CHAR)
+	else if (op == STRING && tn->tn_string->st_char)
 		debug_printf(", length %zu, \"%s\"\n",
-		tn->tn_string->st_len, tn->tn_string->st_cp);
-	else if (op == STRING && tn->tn_string->st_tspec == WCHAR) {
-		char *s;
-		size_t n;
-		n = MB_CUR_MAX * (tn->tn_string->st_len + 1);
-		s = xmalloc(n);
-		(void)wcstombs(s, tn->tn_string->st_wcp, n);
+		tn->tn_string->st_len,
+		(const char *)tn->tn_string->st_mem);
+	else if (op == STRING) {
+		size_t n = MB_CUR_MAX * (tn->tn_string->st_len + 1);
+		char *s = xmalloc(n);
+		(void)wcstombs(s, tn->tn_string->st_mem, n);
 		debug_printf(", length %zu, L\"%s\"",
 		tn->tn_string->st_len, s);
 		free(s);

Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.60 src/usr.bin/xlint/lint1/emit1.c:1.61
--- src/usr.bin/xlint/lint1/emit1.c:1.60	Sun Nov 28 10:01:36 2021
+++ src/usr.bin/xlint/lint1/emit1.c	Sun Feb 27 18:29:14 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.60 2021/11/28 10:01:36 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.61 2022/02/27 18:29:14 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.60 2021/11/28 10:01:36 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.61 2022/02/27 18:29:14 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -404,7 +404,7 @@ outcall(const tnode_t *tn, bool retval_u
 			}
 		} else if (arg->tn_op == ADDR &&
 			   arg->tn_left->tn_op == STRING &&
-			   arg->tn_left->tn_string->st_tspec == CHAR) {
+			   arg->tn_left->tn_string->st_char) {
 			/* constant string, write all format specifiers */
 			outchar('s');
 			outint(n);
@@ -492,9 +492,8 @@ outfstrg(strg_t *strg)
 	bool	first;
 	const char *cp;
 
-	lint_assert(strg->st_tspec == CHAR);
-
-	cp = (const char *)strg->st_cp;
+	lint_assert(strg->st_char);
+	cp = strg->st_mem;
 
 	outch

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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 18:29:14 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: ckgetopt.c debug.c emit1.c lex.c lint1.h
tree.c

Log Message:
lint: merge duplicate code for handling plain and wide strings

No functional change.  As before, the string literals "1" "2" "3" are
not concatenated from left to right, instead concatenation starts with
"23" and then proceeds to "123".


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/xlint/lint1/ckgetopt.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.102 -r1.103 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.409 -r1.410 src/usr.bin/xlint/lint1/tree.c

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



re: CVS commit: src/usr.bin/vmstat

2022-02-27 Thread matthew green
Roland Illig writes:
> Am 09.02.2022 um 08:34 schrieb matthew green:
> > Module Name:src
> > Committed By:   mrg
> > Date:   Wed Feb  9 07:34:18 UTC 2022
> >
> > Modified Files:
> > src/usr.bin/vmstat: vmstat.c
> >
> > Log Message:
> > allow the number of disks displayed in the default output
> > to be controlled.
> >
> >
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.249 -r1.250 src/usr.bin/vmstat/vmstat.c
>
> Did you omit the "static" from the variable definition on purpose?  As a
> general rule, I prefer to keep the scope of each variable as narrow as
> possible.

good idea.  feel free to fix, i usually do this :-)


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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 17:12:06 UTC 2022

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

Log Message:
lint: clean up code for handling filenames

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/xlint/lint1/mem1.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.60 src/usr.bin/xlint/lint1/mem1.c:1.61
--- src/usr.bin/xlint/lint1/mem1.c:1.60	Sun Feb 27 08:31:26 2022
+++ src/usr.bin/xlint/lint1/mem1.c	Sun Feb 27 17:12:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem1.c,v 1.60 2022/02/27 08:31:26 rillig Exp $	*/
+/*	$NetBSD: mem1.c,v 1.61 2022/02/27 17:12:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.60 2022/02/27 08:31:26 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.61 2022/02/27 17:12:06 rillig Exp $");
 #endif
 
 #include 
@@ -58,6 +58,7 @@ struct filename {
 };
 
 static struct filename *filenames;	/* null-terminated array */
+static int next_filename_id;
 
 /* Find the given filename, or return NULL. */
 static const struct filename *
@@ -114,14 +115,6 @@ transform_filename(const char *name, siz
 	return buf;
 }
 
-static int
-next_filename_id(void)
-{
-	static int next_id = 0;
-
-	return next_id++;
-}
-
 /*
  * Return a copy of the filename s with unlimited lifetime.
  * If the filename is new, write it to the output file.
@@ -133,13 +126,9 @@ record_filename(const char *s, size_t sl
 	struct filename *fn;
 	char *name;
 
-	if (s == NULL)
-		return NULL;
-
 	if ((existing_fn = search_filename(s, slen)) != NULL)
 		return existing_fn->fn_name;
 
-	/* Do not use strdup() because s is not NUL-terminated.*/
 	name = xmalloc(slen + 1);
 	(void)memcpy(name, s, slen);
 	name[slen] = '\0';
@@ -147,7 +136,7 @@ record_filename(const char *s, size_t sl
 	fn = xmalloc(sizeof(*fn));
 	fn->fn_name = name;
 	fn->fn_len = slen;
-	fn->fn_id = next_filename_id();
+	fn->fn_id = next_filename_id++;
 	fn->fn_next = filenames;
 	filenames = fn;
 



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 17:12:06 UTC 2022

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

Log Message:
lint: clean up code for handling filenames

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/xlint/lint1/mem1.c

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



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

2022-02-27 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Feb 27 15:02:58 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/linux: files.drmkms_linux

Log Message:
only build linux_acpi.c if we have acpi(4) in the kernel


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/external/bsd/drm2/linux/files.drmkms_linux

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/files.drmkms_linux
diff -u src/sys/external/bsd/drm2/linux/files.drmkms_linux:1.41 src/sys/external/bsd/drm2/linux/files.drmkms_linux:1.42
--- src/sys/external/bsd/drm2/linux/files.drmkms_linux:1.41	Sun Feb 27 14:22:21 2022
+++ src/sys/external/bsd/drm2/linux/files.drmkms_linux	Sun Feb 27 15:02:58 2022
@@ -1,11 +1,11 @@
-#   $NetBSD: files.drmkms_linux,v 1.41 2022/02/27 14:22:21 riastradh Exp $
+#   $NetBSD: files.drmkms_linux,v 1.42 2022/02/27 15:02:58 jakllsch Exp $
 
 define	drmkms_linux: i2cexec, i2c_bitbang
 
 makeoptions 	drmkms_linux	"CPPFLAGS.drmkms_linux"+="-I$S/external/bsd/common/include"
 makeoptions 	drmkms_linux	"CPPFLAGS.drmkms_linux"+="-I$S/external/bsd/drm2/include"
 
-file	external/bsd/drm2/linux/linux_acpi.c		drmkms_linux
+file	external/bsd/drm2/linux/linux_acpi.c		drmkms_linux & acpi
 file	external/bsd/drm2/linux/linux_atomic64.c	drmkms_linux
 file	external/bsd/drm2/linux/linux_backlight.c	drmkms_linux
 file	external/bsd/drm2/linux/linux_dma_buf.c		drmkms_linux



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

2022-02-27 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Feb 27 15:02:58 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/linux: files.drmkms_linux

Log Message:
only build linux_acpi.c if we have acpi(4) in the kernel


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/external/bsd/drm2/linux/files.drmkms_linux

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:24:27 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_acpi.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_acpi.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm:
nouveau_nvkm_subdev_mxm_base.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_acpi.c radeon_bios.c

Log Message:
drm: Use ACPI_FREE, not kfree, for ACPI_ALLOCATE_BUFFER result.

Most of this code is not currently enabled, but it might be enabled
soon.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c:1.4 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c:1.4	Sat Dec 18 23:44:58 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c	Sun Feb 27 14:24:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_acpi.c,v 1.4 2021/12/18 23:44:58 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_acpi.c,v 1.5 2022/02/27 14:24:26 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_acpi.c,v 1.4 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_acpi.c,v 1.5 2022/02/27 14:24:26 riastradh Exp $");
 
 #include 
 #include 
@@ -117,7 +117,7 @@ static union acpi_object *amdgpu_atif_ca
 	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
 		DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
  acpi_format_exception(status));
-		kfree(buffer.pointer);
+		ACPI_FREE(buffer.pointer);
 		return NULL;
 	}
 
@@ -206,7 +206,7 @@ static int amdgpu_atif_verify_interface(
 	amdgpu_atif_parse_functions(&atif->functions, output.function_bits);
 
 out:
-	kfree(info);
+	ACPI_FREE(info);
 	return err;
 }
 
@@ -299,7 +299,7 @@ out:
 	DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n",
 			(n->enabled ? "enabled" : "disabled"),
 			n->command_code);
-	kfree(info);
+	ACPI_FREE(info);
 	return err;
 }
 
@@ -358,7 +358,7 @@ static int amdgpu_atif_query_backlight_c
 	atif->backlight_caps.max_input_signal =
 			characteristics.max_input_signal;
 out:
-	kfree(info);
+	ACPI_FREE(info);
 	return err;
 }
 
@@ -399,7 +399,7 @@ static int amdgpu_atif_get_sbios_request
 	count = hweight32(req->pending);
 
 out:
-	kfree(info);
+	ACPI_FREE(info);
 	return count;
 }
 
@@ -530,7 +530,7 @@ static union acpi_object *amdgpu_atcs_ca
 	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
 		DRM_DEBUG_DRIVER("failed to evaluate ATCS got %s\n",
  acpi_format_exception(status));
-		kfree(buffer.pointer);
+		ACPI_FREE(buffer.pointer);
 		return NULL;
 	}
 
@@ -596,7 +596,7 @@ static int amdgpu_atcs_verify_interface(
 	amdgpu_atcs_parse_functions(&atcs->functions, output.function_bits);
 
 out:
-	kfree(info);
+	ACPI_FREE(info);
 	return err;
 }
 
@@ -646,7 +646,7 @@ int amdgpu_acpi_pcie_notify_device_ready
 	if (!info)
 		return -EIO;
 
-	kfree(info);
+	ACPI_FREE(info);
 
 	return 0;
 }
@@ -708,14 +708,14 @@ int amdgpu_acpi_pcie_performance_request
 		size = *(u16 *) info->buffer.pointer;
 		if (size < 3) {
 			DRM_INFO("ATCS buffer is too small: %zu\n", size);
-			kfree(info);
+			ACPI_FREE(info);
 			return -EINVAL;
 		}
 		size = min(sizeof(atcs_output), size);
 
 		memcpy(&atcs_output, info->buffer.pointer, size);
 
-		kfree(info);
+		ACPI_FREE(info);
 
 		switch (atcs_output.ret_val) {
 		case ATCS_REQUEST_REFUSED:

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c:1.3	Sat Dec 18 23:45:32 2021
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c	Sun Feb 27 14:24:27 2022
@@ -1,8 +1,8 @@
-/*	$NetBSD: nouveau_acpi.c,v 1.3 2021/12/18 23:45:32 riastradh Exp $	*/
+/*	$NetBSD: nouveau_acpi.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $	*/
 
 // SPDX-License-Identifier: MIT
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_acpi.c,v 1.3 2021/12/18 23:45:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_acpi.c,v 1.4 2022/02/27 14:24:27 riastradh Exp $");
 
 #include 
 #include 
@@ -417,7 +417,7 @@ static int nouve

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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:24:27 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_acpi.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_acpi.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm:
nouveau_nvkm_subdev_mxm_base.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_acpi.c radeon_bios.c

Log Message:
drm: Use ACPI_FREE, not kfree, for ACPI_ALLOCATE_BUFFER result.

Most of this code is not currently enabled, but it might be enabled
soon.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c

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



CVS commit: src/sys/kern

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:24:11 UTC 2022

Modified Files:
src/sys/kern: subr_vmem.c

Log Message:
vmem(9): Assert addresses are quantum-aligned.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/subr_vmem.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/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.106 src/sys/kern/subr_vmem.c:1.107
--- src/sys/kern/subr_vmem.c:1.106	Tue Aug 17 22:00:32 2021
+++ src/sys/kern/subr_vmem.c	Sun Feb 27 14:24:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.106 2021/08/17 22:00:32 andvar Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.107 2022/02/27 14:24:11 riastradh Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.106 2021/08/17 22:00:32 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.107 2022/02/27 14:24:11 riastradh Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -1095,6 +1095,10 @@ vmem_alloc(vmem_t *vm, vmem_size_t size,
 	error = vmem_xalloc(vm, size, 0, 0, 0, VMEM_ADDR_MIN, VMEM_ADDR_MAX,
 	flags, addrp);
 out:
+	KASSERTMSG(error || addrp == NULL ||
+	(*addrp & vm->vm_quantum_mask) == 0,
+	"vmem %s mask=0x%jx addr=0x%jx",
+	vm->vm_name, (uintmax_t)vm->vm_quantum_mask, (uintmax_t)*addrp);
 	KASSERT(error == 0 || (flags & VM_SLEEP) == 0);
 	return error;
 }
@@ -1285,6 +1289,10 @@ gotit:
 	if (addrp != NULL)
 		*addrp = btnew->bt_start;
 	VMEM_UNLOCK(vm);
+	KASSERTMSG(addrp == NULL ||
+	(*addrp & vm->vm_quantum_mask) == 0,
+	"vmem %s mask=0x%jx addr=0x%jx",
+	vm->vm_name, (uintmax_t)vm->vm_quantum_mask, (uintmax_t)*addrp);
 	return 0;
 }
 
@@ -1297,6 +1305,9 @@ vmem_free(vmem_t *vm, vmem_addr_t addr, 
 {
 
 	KASSERT(size > 0);
+	KASSERTMSG((addr & vm->vm_quantum_mask) == 0,
+	"vmem %s mask=0x%jx addr=0x%jx",
+	vm->vm_name, (uintmax_t)vm->vm_quantum_mask, (uintmax_t)addr);
 
 #if defined(QCACHE)
 	if (size <= vm->vm_qcache_max) {
@@ -1317,11 +1328,15 @@ vmem_xfree(vmem_t *vm, vmem_addr_t addr,
 	bt_t *bt;
 
 	KASSERT(size > 0);
+	KASSERTMSG((addr & vm->vm_quantum_mask) == 0,
+	"vmem %s mask=0x%jx addr=0x%jx",
+	vm->vm_name, (uintmax_t)vm->vm_quantum_mask, (uintmax_t)addr);
 
 	VMEM_LOCK(vm);
 
 	bt = bt_lookupbusy(vm, addr);
-	KASSERT(bt != NULL);
+	KASSERTMSG(bt != NULL, "vmem %s addr 0x%jx size 0x%jx",
+	vm->vm_name, (uintmax_t)addr, (uintmax_t)size);
 	KASSERT(bt->bt_start == addr);
 	KASSERT(bt->bt_size == vmem_roundup_size(vm, size) ||
 	bt->bt_size - vmem_roundup_size(vm, size) <= vm->vm_quantum_mask);



CVS commit: src/sys/kern

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:24:11 UTC 2022

Modified Files:
src/sys/kern: subr_vmem.c

Log Message:
vmem(9): Assert addresses are quantum-aligned.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/subr_vmem.c

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:23:24 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_bios.c

Log Message:
amdgpu: Make amdgpu_bios.c ACPI stuff build.


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

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c:1.5 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c:1.5	Sun Dec 19 10:59:01 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c	Sun Feb 27 14:23:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_bios.c,v 1.5 2021/12/19 10:59:01 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_bios.c,v 1.6 2022/02/27 14:23:24 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_bios.c,v 1.5 2021/12/19 10:59:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_bios.c,v 1.6 2022/02/27 14:23:24 riastradh Exp $");
 
 #include "amdgpu.h"
 #include "atom.h"
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdgpu_bios.
 #include 
 
 #include 
+#include 
 
 /*
  * BIOS.
@@ -327,7 +328,11 @@ static bool amdgpu_atrm_get_bios(struct 
 		return false;
 
 	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
+#ifdef __NetBSD__
+		dhandle = (pdev->pd_ad ? pdev->pd_ad->ad_handle : NULL);
+#else
 		dhandle = ACPI_HANDLE(&pdev->dev);
+#endif
 		if (!dhandle)
 			continue;
 
@@ -340,7 +345,12 @@ static bool amdgpu_atrm_get_bios(struct 
 
 	if (!found) {
 		while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
+#ifdef __NetBSD__
+			dhandle = (pdev->pd_ad ? pdev->pd_ad->ad_handle
+			: NULL);
+#else
 			dhandle = ACPI_HANDLE(&pdev->dev);
+#endif
 			if (!dhandle)
 continue;
 



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:23:24 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_bios.c

Log Message:
amdgpu: Make amdgpu_bios.c ACPI stuff build.


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

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:23:17 UTC 2022

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

Log Message:
radeon: Make radeon_bios.c ACPI stuff build.


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

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.8 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.9
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.8	Sat Dec 18 23:45:43 2021
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c	Sun Feb 27 14:23:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_bios.c,v 1.8 2021/12/18 23:45:43 riastradh Exp $	*/
+/*	$NetBSD: radeon_bios.c,v 1.9 2022/02/27 14:23:16 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.8 2021/12/18 23:45:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.9 2022/02/27 14:23:16 riastradh Exp $");
 
 #include 
 #include 
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_bios.
 #include "radeon.h"
 #include "radeon_reg.h"
 
+#include 
+
 /*
  * BIOS.
  */
@@ -183,7 +185,6 @@ static bool radeon_read_platform_bios(st
 #endif
 }
 
-/* XXX radeon acpi */
 #ifdef CONFIG_ACPI
 /* ATRM is used to get the BIOS on the discrete cards in
  * dual-gpu systems.
@@ -247,7 +248,11 @@ static bool radeon_atrm_get_bios(struct 
 		return false;
 
 	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
+#ifdef __NetBSD__
+		dhandle = (pdev->pd_ad ? pdev->pd_ad->ad_handle : NULL);
+#else
 		dhandle = ACPI_HANDLE(&pdev->dev);
+#endif
 		if (!dhandle)
 			continue;
 
@@ -260,7 +265,12 @@ static bool radeon_atrm_get_bios(struct 
 
 	if (!found) {
 		while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
+#ifdef __NetBSD__
+			dhandle = (pdev->pd_ad ? pdev->pd_ad->ad_handle
+			: NULL);
+#else
 			dhandle = ACPI_HANDLE(&pdev->dev);
+#endif
 			if (!dhandle)
 continue;
 



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:23:17 UTC 2022

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

Log Message:
radeon: Make radeon_bios.c ACPI stuff build.


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

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:23:08 UTC 2022

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

Log Message:
linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/external/bsd/drm2/include/linux/pci.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/pci.h
diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.52 src/sys/external/bsd/drm2/include/linux/pci.h:1.53
--- src/sys/external/bsd/drm2/include/linux/pci.h:1.52	Sun Feb 27 14:22:29 2022
+++ src/sys/external/bsd/drm2/include/linux/pci.h	Sun Feb 27 14:23:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.h,v 1.52 2022/02/27 14:22:29 riastradh Exp $	*/
+/*	$NetBSD: pci.h,v 1.53 2022/02/27 14:23:08 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -90,6 +90,12 @@ struct pci_device_id {
 
 #define	PCI_CLASS_DISPLAY_VGA		\
 	((PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA)
+CTASSERT(PCI_CLASS_DISPLAY_VGA == 0x0300);
+
+#define	PCI_CLASS_DISPLAY_OTHER		\
+	((PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_MISC)
+CTASSERT(PCI_CLASS_DISPLAY_OTHER == 0x0380);
+
 #define	PCI_CLASS_BRIDGE_ISA		\
 	((PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_ISA)
 CTASSERT(PCI_CLASS_BRIDGE_ISA == 0x0601);



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:23:08 UTC 2022

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

Log Message:
linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/external/bsd/drm2/include/linux/pci.h

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:50 UTC 2022

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

Log Message:
linux: Define acpi_size as alias for ACPI_SIZE.


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

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

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/acpi.h
diff -u src/sys/external/bsd/drm2/include/linux/acpi.h:1.8 src/sys/external/bsd/drm2/include/linux/acpi.h:1.9
--- src/sys/external/bsd/drm2/include/linux/acpi.h:1.8	Sun Feb 27 14:22:29 2022
+++ src/sys/external/bsd/drm2/include/linux/acpi.h	Sun Feb 27 14:22:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.h,v 1.8 2022/02/27 14:22:29 riastradh Exp $	*/
+/*	$NetBSD: acpi.h,v 1.9 2022/02/27 14:22:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
 
 typedef ACPI_HANDLE acpi_handle;
 typedef ACPI_OBJECT_TYPE acpi_object_type;
+typedef ACPI_SIZE acpi_size;
 typedef ACPI_STATUS acpi_status;
 
 #define	acpi_evaluate_dsm	linux_acpi_evaluate_dsm



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:50 UTC 2022

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

Log Message:
linux: Define acpi_size as alias for ACPI_SIZE.


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

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:42 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c
Added Files:
src/sys/external/bsd/drm2/include/linux: nbsd-namespace-acpi.h

Log Message:
drm: Move Linux ACPI case aliases to new nbsd-namespace-acpi.h.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
cvs rdiff -u -r0 -r1.1 \
src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.7	Sun Feb 27 14:22:21 2022
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c	Sun Feb 27 14:22:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_acpi.c,v 1.7 2022/02/27 14:22:21 riastradh Exp $	*/
+/*	$NetBSD: intel_acpi.c,v 1.8 2022/02/27 14:22:42 riastradh Exp $	*/
 
 // SPDX-License-Identifier: GPL-2.0
 /*
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.7 2022/02/27 14:22:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.8 2022/02/27 14:22:42 riastradh Exp $");
 
 #include 
 #include 
@@ -24,14 +24,7 @@ ACPI_MODULE_NAME("acpi_intel_brightness"
 
 #include 
 
-#define acpi_handle	ACPI_HANDLE
-#define	buffer		Buffer
-#define	count		Count
-#define	elements	Elements
-#define	integer		Integer
-#define	package		Package
-#define	pointer		Pointer
-#define	value		Value
+#include 
 #endif
 
 #define INTEL_DSM_REVISION_ID 1 /* For Calpella anyway... */

Added files:

Index: src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h
diff -u /dev/null src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h:1.1
--- /dev/null	Sun Feb 27 14:22:42 2022
+++ src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h	Sun Feb 27 14:22:42 2022
@@ -0,0 +1,47 @@
+/*	$NetBSD: nbsd-namespace-acpi.h,v 1.1 2022/02/27 14:22:42 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _LINUX_NBSD_NAMESPACE_ACPI_H_
+#define _LINUX_NBSD_NAMESPACE_ACPI_H_
+
+#define	buffer		Buffer
+#define	count		Count
+#define	elements	Elements
+#define	integer		Integer
+#define	length		Length
+#define	package		Package
+#define	pointer		Pointer
+#define	type		Type
+#define	value		Value
+
+#define	acpi_get_handle		AcpiGetHandle
+#define	acpi_get_table		AcpiGetTable
+#define	acpi_evaluate_object	AcpiEvaluateObject
+#define	acpi_format_exception	AcpiFormatException
+
+#endif  /* _LINUX_NBSD_NAMESPACE_ACPI_H_ */



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:42 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c
Added Files:
src/sys/external/bsd/drm2/include/linux: nbsd-namespace-acpi.h

Log Message:
drm: Move Linux ACPI case aliases to new nbsd-namespace-acpi.h.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
cvs rdiff -u -r0 -r1.1 \
src/sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:30 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.h
src/sys/external/bsd/drm2/include/linux: acpi.h pci.h

Log Message:
drm: Omit needless conditionals around #include "acpica.h".


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/acpi.h
cvs rdiff -u -r1.51 -r1.52 src/sys/external/bsd/drm2/include/linux/pci.h

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.46 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.47
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h:1.46	Sun Dec 19 11:55:24 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h	Sun Feb 27 14:22:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_drv.h,v 1.46 2021/12/19 11:55:24 riastradh Exp $	*/
+/*	$NetBSD: i915_drv.h,v 1.47 2022/02/27 14:22:29 riastradh Exp $	*/
 
 /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
  */
@@ -34,9 +34,7 @@
 
 #if defined(__NetBSD__)
 #ifdef _KERNEL_OPT
-#if defined(i386) || defined(amd64)
 #include "acpica.h"
-#endif	/* i386 || amd64 */
 #endif	/* _KERNEL_OPT */
 #if (NACPICA > 0)
 #define CONFIG_ACPI

Index: src/sys/external/bsd/drm2/include/linux/acpi.h
diff -u src/sys/external/bsd/drm2/include/linux/acpi.h:1.7 src/sys/external/bsd/drm2/include/linux/acpi.h:1.8
--- src/sys/external/bsd/drm2/include/linux/acpi.h:1.7	Sun Feb 27 14:22:21 2022
+++ src/sys/external/bsd/drm2/include/linux/acpi.h	Sun Feb 27 14:22:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.h,v 1.7 2022/02/27 14:22:21 riastradh Exp $	*/
+/*	$NetBSD: acpi.h,v 1.8 2022/02/27 14:22:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,11 +33,7 @@
 #define _LINUX_ACPI_H_
 
 #ifdef _KERNEL_OPT
-#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
 #include "acpica.h"
-#else
-#define NACPICA 0
-#endif
 #endif
 
 #if NACPICA > 0

Index: src/sys/external/bsd/drm2/include/linux/pci.h
diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.51 src/sys/external/bsd/drm2/include/linux/pci.h:1.52
--- src/sys/external/bsd/drm2/include/linux/pci.h:1.51	Sun Dec 19 12:13:16 2021
+++ src/sys/external/bsd/drm2/include/linux/pci.h	Sun Feb 27 14:22:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.h,v 1.51 2021/12/19 12:13:16 riastradh Exp $	*/
+/*	$NetBSD: pci.h,v 1.52 2022/02/27 14:22:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,11 +33,7 @@
 #define _LINUX_PCI_H_
 
 #ifdef _KERNEL_OPT
-#if defined(i386) || defined(amd64) || defined(__aarch64__)
 #include "acpica.h"
-#else	/* !(i386 || amd64) */
-#define NACPICA	0
-#endif	/* i386 || amd64 */
 #endif
 
 #include 



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:30 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.h
src/sys/external/bsd/drm2/include/linux: acpi.h pci.h

Log Message:
drm: Omit needless conditionals around #include "acpica.h".


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/acpi.h
cvs rdiff -u -r1.51 -r1.52 src/sys/external/bsd/drm2/include/linux/pci.h

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:21 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c
src/sys/external/bsd/drm2/include/linux: acpi.h
src/sys/external/bsd/drm2/linux: files.drmkms_linux
Added Files:
src/sys/external/bsd/drm2/linux: linux_acpi.c

Log Message:
drm: Move acpi_check_dsm &c. from intel_acpi.c to new linux_acpi.c.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/acpi.h
cvs rdiff -u -r1.40 -r1.41 src/sys/external/bsd/drm2/linux/files.drmkms_linux
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/linux/linux_acpi.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.6 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.6	Sun Feb 27 14:20:30 2022
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c	Sun Feb 27 14:22:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_acpi.c,v 1.6 2022/02/27 14:20:30 riastradh Exp $	*/
+/*	$NetBSD: intel_acpi.c,v 1.7 2022/02/27 14:22:21 riastradh Exp $	*/
 
 // SPDX-License-Identifier: GPL-2.0
 /*
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.6 2022/02/27 14:20:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.7 2022/02/27 14:22:21 riastradh Exp $");
 
 #include 
 #include 
@@ -32,91 +32,6 @@ ACPI_MODULE_NAME("acpi_intel_brightness"
 #define	package		Package
 #define	pointer		Pointer
 #define	value		Value
-
-static ACPI_OBJECT *
-acpi_evaluate_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, int func,
-ACPI_OBJECT *argv4)
-{
-	ACPI_OBJECT_LIST arg;
-	ACPI_OBJECT params[4];
-	ACPI_BUFFER buf;
-	ACPI_STATUS rv;
-
-	if (handle == NULL)
-		handle = ACPI_ROOT_OBJECT;
-
-	arg.Count = 4;
-	arg.Pointer = params;
-	params[0].Type = ACPI_TYPE_BUFFER;
-	params[0].Buffer.Length = 16;
-	params[0].Buffer.Pointer = (char *)__UNCONST(uuid);
-	params[1].Type = ACPI_TYPE_INTEGER;
-	params[1].Integer.Value = rev;
-	params[2].Type = ACPI_TYPE_INTEGER;
-	params[2].Integer.Value = func;
-	if (argv4 != NULL) {
-		params[3] = *argv4;
-	} else {
-		params[3].Type = ACPI_TYPE_PACKAGE;
-		params[3].Package.Count = 0;
-		params[3].Package.Elements = NULL;
-	}
-
-	buf.Pointer = NULL;
-	buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-
-	rv = AcpiEvaluateObject(handle, "_DSM", &arg, &buf);
-	if (ACPI_SUCCESS(rv))
-		return (ACPI_OBJECT *)buf.Pointer;
-	return NULL;
-}
-
-static inline ACPI_OBJECT *
-acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const guid_t *uuid, int rev,
-int func, ACPI_OBJECT *argv4, ACPI_OBJECT_TYPE type)
-{
-	ACPI_OBJECT *obj;
-
-	obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
-	if (obj != NULL && obj->Type != type) {
-		ACPI_FREE(obj);
-		obj = NULL;
-	}
-	return obj;
-}
-
-#define	ACPI_INIT_DSM_ARGV4(cnt, eles)		\
-{		\
-	.Package.Type = ACPI_TYPE_PACKAGE,	\
-	.Package.Count = (cnt),			\
-	.Package.Elements = (eles)		\
-}
-
-static bool
-acpi_check_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, uint64_t funcs)
-{
-	ACPI_OBJECT *obj;
-	uint64_t mask = 0;
-	int i;
-
-	if (funcs == 0)
-		return false;
-
-	obj = acpi_evaluate_dsm(handle, uuid, rev, 0, NULL);
-	if (obj == NULL)
-		return false;
-
-	if (obj->Type == ACPI_TYPE_INTEGER)
-		mask = obj->Integer.Value;
-	else if (obj->Type == ACPI_TYPE_BUFFER)
-		for (i = 0; i < obj->Buffer.Length && i < 8; i++)
-			mask |= (uint64_t)obj->Buffer.Pointer[i] << (i * 8);
-	ACPI_FREE(obj);
-
-	if ((mask & 0x1) == 0x1 && (mask & funcs) == funcs)
-		return true;
-	return false;
-}
 #endif
 
 #define INTEL_DSM_REVISION_ID 1 /* For Calpella anyway... */

Index: src/sys/external/bsd/drm2/include/linux/acpi.h
diff -u src/sys/external/bsd/drm2/include/linux/acpi.h:1.6 src/sys/external/bsd/drm2/include/linux/acpi.h:1.7
--- src/sys/external/bsd/drm2/include/linux/acpi.h:1.6	Sun Dec 19 11:38:04 2021
+++ src/sys/external/bsd/drm2/include/linux/acpi.h	Sun Feb 27 14:22:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.h,v 1.6 2021/12/19 11:38:04 riastradh Exp $	*/
+/*	$NetBSD: acpi.h,v 1.7 2022/02/27 14:22:21 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -44,6 +44,21 @@
 #include 
 #endif
 
+#include 
 #include 
 
+typedef ACPI_HANDLE acpi_handle;
+typedef ACPI_OBJECT_TYPE acpi_object_type;
+typedef ACPI_STATUS acpi_status;
+
+#define	acpi_evaluate_dsm	linux_acpi_evaluate_dsm
+#define	acpi_evaluate_dsm_typed	linux_acpi_evaluate_dsm_typed
+#define	acpi_check_dsm		linux_acpi_check_dsm
+
+union acpi_object *acpi_evaluate_dsm(acpi_handle, const guid_t *,
+uint64_t, uint64_t, union acpi_object *);
+unio

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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:22:21 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c
src/sys/external/bsd/drm2/include/linux: acpi.h
src/sys/external/bsd/drm2/linux: files.drmkms_linux
Added Files:
src/sys/external/bsd/drm2/linux: linux_acpi.c

Log Message:
drm: Move acpi_check_dsm &c. from intel_acpi.c to new linux_acpi.c.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/acpi.h
cvs rdiff -u -r1.40 -r1.41 src/sys/external/bsd/drm2/linux/files.drmkms_linux
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/linux/linux_acpi.c

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:20:30 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c

Log Message:
i915: Omit needless ifdefs around ACPI API.


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

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.5	Sun Feb 27 14:19:35 2022
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c	Sun Feb 27 14:20:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_acpi.c,v 1.5 2022/02/27 14:19:35 riastradh Exp $	*/
+/*	$NetBSD: intel_acpi.c,v 1.6 2022/02/27 14:20:30 riastradh Exp $	*/
 
 // SPDX-License-Identifier: GPL-2.0
 /*
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.5 2022/02/27 14:19:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.6 2022/02/27 14:20:30 riastradh Exp $");
 
 #include 
 #include 
@@ -181,11 +181,7 @@ static const char *intel_dsm_mux_type(u8
 static void intel_dsm_platform_mux_info(acpi_handle dhandle)
 {
 	int i;
-#ifdef __NetBSD__
-	ACPI_OBJECT *pkg, *connector_count;
-#else
 	union acpi_object *pkg, *connector_count;
-#endif
 
 	pkg = acpi_evaluate_dsm_typed(dhandle, &intel_dsm_guid,
 			INTEL_DSM_REVISION_ID, INTEL_DSM_FN_PLATFORM_MUX_INFO,
@@ -199,15 +195,9 @@ static void intel_dsm_platform_mux_info(
 	DRM_DEBUG_DRIVER("MUX info connectors: %lld\n",
 		  (unsigned long long)connector_count->integer.value);
 	for (i = 1; i < pkg->package.count; i++) {
-#ifdef __NetBSD__
-		ACPI_OBJECT *obj = &pkg->package.elements[i];
-		ACPI_OBJECT *connector_id = &obj->package.elements[0];
-		ACPI_OBJECT *info = &obj->package.elements[1];
-#else
 		union acpi_object *obj = &pkg->package.elements[i];
 		union acpi_object *connector_id = &obj->package.elements[0];
 		union acpi_object *info = &obj->package.elements[1];
-#endif
 		DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n",
 			  (unsigned long long)connector_id->integer.value);
 		DRM_DEBUG_DRIVER("  port id: %s\n",



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:20:30 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c

Log Message:
i915: Omit needless ifdefs around ACPI API.


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

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:19:35 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c

Log Message:
i915: Use pci_get_segment, not 0.


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

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.4 src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c:1.4	Sun Dec 19 11:38:03 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c	Sun Feb 27 14:19:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $	*/
+/*	$NetBSD: intel_acpi.c,v 1.5 2022/02/27 14:19:35 riastradh Exp $	*/
 
 // SPDX-License-Identifier: GPL-2.0
 /*
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.5 2022/02/27 14:19:35 riastradh Exp $");
 
 #include 
 #include 
@@ -268,8 +268,9 @@ intel_dsm_vga_match(const struct pci_att
 		return 0;
 
 	vga_count++;
-	struct acpi_devnode *node = acpi_pcidev_find(0 /*XXX segment*/,
-	pa->pa_bus, pa->pa_device, pa->pa_function);
+	struct acpi_devnode *node =
+	acpi_pcidev_find(pci_get_segment(pa->pa_pc),
+		pa->pa_bus, pa->pa_device, pa->pa_function);
 	if (node != NULL && intel_dsm_handle == NULL)
 		intel_dsm_handle = intel_dsm_pci_probe(node->ad_handle);
 	return 0;



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:19:35 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/display: intel_acpi.c

Log Message:
i915: Use pci_get_segment, not 0.


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

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:19:20 UTC 2022

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

Log Message:
drm: Deconditionalize pci_get_segment.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm2/linux/linux_pci.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_pci.c
diff -u src/sys/external/bsd/drm2/linux/linux_pci.c:1.20 src/sys/external/bsd/drm2/linux/linux_pci.c:1.21
--- src/sys/external/bsd/drm2/linux/linux_pci.c:1.20	Sun Dec 19 12:00:16 2021
+++ src/sys/external/bsd/drm2/linux/linux_pci.c	Sun Feb 27 14:19:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_pci.c,v 1.20 2021/12/19 12:00:16 riastradh Exp $	*/
+/*	$NetBSD: linux_pci.c,v 1.21 2022/02/27 14:19:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_pci.c,v 1.20 2021/12/19 12:00:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_pci.c,v 1.21 2022/02/27 14:19:20 riastradh Exp $");
 
 #if NACPICA > 0
 #include 
@@ -88,11 +88,7 @@ linux_pci_dev_init(struct pci_dev *pdev,
 	pdev->pd_rom_vaddr = NULL;
 	pdev->pd_dev = dev;
 #if (NACPICA > 0)
-#ifdef __HAVE_PCI_GET_SEGMENT
 	const int seg = pci_get_segment(pa->pa_pc);
-#else
-	const int seg = 0;
-#endif
 	pdev->pd_ad = acpi_pcidev_find(seg, pa->pa_bus,
 	pa->pa_device, pa->pa_function);
 #else



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:19:20 UTC 2022

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

Log Message:
drm: Deconditionalize pci_get_segment.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm2/linux/linux_pci.c

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



CVS commit: src/sys/dev/acpi

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:19:08 UTC 2022

Modified Files:
src/sys/dev/acpi: acpi_mcfg.c acpi_pci.c

Log Message:
acpi: Nix conditional pci_get_segment use.

New MI default of 0 serves.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_mcfg.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/acpi/acpi_pci.c

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

Modified files:

Index: src/sys/dev/acpi/acpi_mcfg.c
diff -u src/sys/dev/acpi/acpi_mcfg.c:1.24 src/sys/dev/acpi/acpi_mcfg.c:1.25
--- src/sys/dev/acpi/acpi_mcfg.c:1.24	Sat Aug  7 21:19:15 2021
+++ src/sys/dev/acpi/acpi_mcfg.c	Sun Feb 27 14:19:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_mcfg.c,v 1.24 2021/08/07 21:19:15 jmcneill Exp $	*/
+/*	$NetBSD: acpi_mcfg.c,v 1.25 2022/02/27 14:19:07 riastradh Exp $	*/
 
 /*-
  * Copyright (C) 2015 NONAKA Kimihiro 
@@ -28,7 +28,7 @@
 #include "opt_pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.24 2021/08/07 21:19:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.25 2022/02/27 14:19:07 riastradh Exp $");
 
 #include 
 #include 
@@ -446,12 +446,7 @@ acpimcfg_get_segment(pci_chipset_tag_t p
 	u_int segment;
 	int i;
 
-#ifdef __HAVE_PCI_GET_SEGMENT
 	segment = pci_get_segment(pc);
-#else
-	segment = 0;
-#endif
-
 	for (i = 0; i < mcfg_nsegs; i++) {
 		seg = &mcfg_segs[i];
 		if (segment == seg->ms_segment &&

Index: src/sys/dev/acpi/acpi_pci.c
diff -u src/sys/dev/acpi/acpi_pci.c:1.35 src/sys/dev/acpi/acpi_pci.c:1.36
--- src/sys/dev/acpi/acpi_pci.c:1.35	Fri Feb 11 23:19:59 2022
+++ src/sys/dev/acpi/acpi_pci.c	Sun Feb 27 14:19:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.35 2022/02/11 23:19:59 riastradh Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.36 2022/02/27 14:19:07 riastradh Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.35 2022/02/11 23:19:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.36 2022/02/27 14:19:07 riastradh Exp $");
 
 #include 
 #include 
@@ -557,11 +557,7 @@ acpi_pci_bus_get_child_devhandle(device_
 	int b, d, f;
 	u_int segment;
 
-#ifdef __HAVE_PCI_GET_SEGMENT
 	segment = pci_get_segment(args->pc);
-#else
-	segment = 0;
-#endif /* __HAVE_PCI_GET_SEGMENT */
 
 	pci_decompose_tag(args->pc, args->tag, &b, &d, &f);
 



CVS commit: src/sys/dev/acpi

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:19:08 UTC 2022

Modified Files:
src/sys/dev/acpi: acpi_mcfg.c acpi_pci.c

Log Message:
acpi: Nix conditional pci_get_segment use.

New MI default of 0 serves.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/acpi/acpi_mcfg.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/acpi/acpi_pci.c

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



CVS commit: src/sys/dev/pci

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:52 UTC 2022

Modified Files:
src/sys/dev/pci: pcivar.h

Log Message:
pci(9): Provide default definition of pci_get_segment, always zero.

pci_machdep.h can define __HAVE_PCI_GET_SEGMENT to provide a nonzero
definition.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/pcivar.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/pci/pcivar.h
diff -u src/sys/dev/pci/pcivar.h:1.116 src/sys/dev/pci/pcivar.h:1.117
--- src/sys/dev/pci/pcivar.h:1.116	Wed Sep 15 17:33:08 2021
+++ src/sys/dev/pci/pcivar.h	Sun Feb 27 14:18:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcivar.h,v 1.116 2021/09/15 17:33:08 thorpej Exp $	*/
+/*	$NetBSD: pcivar.h,v 1.117 2022/02/27 14:18:52 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -137,6 +137,14 @@ pcibus_attach_args_pc(struct pcibus_atta
 	return pba->pba_pc;
 }
 
+#ifndef __HAVE_PCI_GET_SEGMENT
+static __inline u_int
+pci_get_segment(pci_chipset_tag_t pc)
+{
+	return 0;
+}
+#endif
+
 /*
  * PCI device attach arguments.
  */



CVS commit: src/sys/dev/pci

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:52 UTC 2022

Modified Files:
src/sys/dev/pci: pcivar.h

Log Message:
pci(9): Provide default definition of pci_get_segment, always zero.

pci_machdep.h can define __HAVE_PCI_GET_SEGMENT to provide a nonzero
definition.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/pcivar.h

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:42 UTC 2022

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

Log Message:
i915: Use new rb_move to relocate the active tree.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c:1.12 src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c:1.13
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c:1.12	Tue Feb 15 18:14:18 2022
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c	Sun Feb 27 14:18:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_active.c,v 1.12 2022/02/15 18:14:18 riastradh Exp $	*/
+/*	$NetBSD: i915_active.c,v 1.13 2022/02/27 14:18:42 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_active.c,v 1.12 2022/02/15 18:14:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_active.c,v 1.13 2022/02/27 14:18:42 riastradh Exp $");
 
 #include 
 
@@ -187,10 +187,11 @@ __active_retire(struct i915_active *ref)
 	GEM_BUG_ON(rcu_access_pointer(ref->excl.fence));
 	debug_active_deactivate(ref);
 
-	root = ref->tree;
 #ifdef __NetBSD__
+	rb_move(&root, &ref->tree);
 	rb_tree_init(&ref->tree.rbr_tree, &active_rb_ops);
 #else
+	root = ref->tree;
 	ref->tree = RB_ROOT;
 #endif
 	ref->cache = NULL;



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:42 UTC 2022

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

Log Message:
i915: Use new rb_move to relocate the active tree.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:34 UTC 2022

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

Log Message:
linux: New rb_move(&to, &from) to replace `to = from'.

NetBSD rbtree(3) is not relocatable, so this extra step is needed.
Unfortunately, there's no easy way to automate detection of where we
need to apply this in ported code...


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/rbtree.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/rbtree.h
diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.17 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.18
--- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.17	Sun Feb 27 14:18:25 2022
+++ src/sys/external/bsd/drm2/include/linux/rbtree.h	Sun Feb 27 14:18:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbtree.h,v 1.17 2022/02/27 14:18:25 riastradh Exp $	*/
+/*	$NetBSD: rbtree.h,v 1.18 2022/02/27 14:18:34 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -203,6 +203,27 @@ rb_next2_postorder(const struct rb_root 
 	}
 }
 
+/*
+ * Extension to Linux API, which allows copying a struct rb_root object
+ * with `=' or `memcpy' and no additional relocation.
+ */
+static inline void
+rb_move(struct rb_root *to, struct rb_root *from)
+{
+	struct rb_node *root;
+
+	*to = *from;
+	memset(from, 0, sizeof(*from)); /* paranoia */
+	if ((root = to->rbr_tree.rbt_root) == NULL)
+		return;
+
+	/*
+	 * The root node's `parent' is a strict-aliasing-unsafe hack
+	 * pointing at the root of the tree.
+	 */
+	RB_SET_FATHER(root, (struct rb_node *)(void *)&to->rbr_tree.rbt_root);
+}
+
 #define	rbtree_postorder_for_each_entry_safe(ENTRY, TMP, ROOT, FIELD)	  \
 	for ((ENTRY) = rb_entry_safe(rb_first_postorder(ROOT),		  \
 		__typeof__(*(ENTRY)), FIELD);			  \



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:34 UTC 2022

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

Log Message:
linux: New rb_move(&to, &from) to replace `to = from'.

NetBSD rbtree(3) is not relocatable, so this extra step is needed.
Unfortunately, there's no easy way to automate detection of where we
need to apply this in ported code...


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/rbtree.h

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



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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:25 UTC 2022

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

Log Message:
linux: Actually do post-order tree traversal.

Requires breaking the rbtree(3) abstraction, but this is necessary
because the body of the loop often frees the element, so as is we had
a huge pile of use-after-free going on.

Requires changing struct interval_tree_node's rbnode member to match
the Linux name, since we now use container_of here, and radeon relies
on this.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/include/linux/interval_tree.h
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/rbtree.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/interval_tree.h
diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.12 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.13
--- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.12	Sun Dec 19 11:00:18 2021
+++ src/sys/external/bsd/drm2/include/linux/interval_tree.h	Sun Feb 27 14:18:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: interval_tree.h,v 1.12 2021/12/19 11:00:18 riastradh Exp $	*/
+/*	$NetBSD: interval_tree.h,v 1.13 2022/02/27 14:18:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 #include 
 
 struct interval_tree_node {
-	struct rb_node	itn_node;
+	struct rb_node	rb;
 	unsigned long	start;	/* inclusive */
 	unsigned long	last;	/* inclusive */
 };
@@ -81,7 +81,7 @@ interval_tree_compare_key(void *cookie, 
 static const rb_tree_ops_t interval_tree_ops = {
 	.rbto_compare_nodes = interval_tree_compare_nodes,
 	.rbto_compare_key = interval_tree_compare_key,
-	.rbto_node_offset = offsetof(struct interval_tree_node, itn_node),
+	.rbto_node_offset = offsetof(struct interval_tree_node, rb),
 };
 
 static inline void

Index: src/sys/external/bsd/drm2/include/linux/rbtree.h
diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.16 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.17
--- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.16	Mon Feb 14 19:13:04 2022
+++ src/sys/external/bsd/drm2/include/linux/rbtree.h	Sun Feb 27 14:18:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbtree.h,v 1.16 2022/02/14 19:13:04 riastradh Exp $	*/
+/*	$NetBSD: rbtree.h,v 1.17 2022/02/27 14:18:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -144,15 +144,72 @@ rb_replace_node_cached(struct rb_node *o
 }
 
 /*
- * XXX This is not actually postorder, but I can't fathom why you would
- * want postorder for an ordered tree; different insertion orders lead
- * to different traversal orders.
+ * This violates the abstraction of rbtree(3) for postorder traversal
+ * -- children first, then parents -- so it is safe for cleanup code
+ * that just frees all the nodes without removing them from the tree.
  */
-#define	rbtree_postorder_for_each_entry_safe(NODE, TMP, ROOT, FIELD)	  \
-	for ((NODE) = RB_TREE_MIN(&(ROOT)->rbr_tree);			  \
-		((NODE) != NULL &&	  \
-		((TMP) = rb_tree_iterate(&(ROOT)->rbr_tree, (NODE),	  \
-			RB_DIR_RIGHT), 1));  \
-		(NODE) = (TMP))
+static inline struct rb_node *
+rb_first_postorder(const struct rb_root *root)
+{
+	struct rb_node *node, *child;
+
+	if ((node = root->rbr_tree.rbt_root) == NULL)
+		return NULL;
+	for (;; node = child) {
+		if ((child = node->rb_left) != NULL)
+			continue;
+		if ((child = node->rb_right) != NULL)
+			continue;
+		return node;
+	}
+}
+
+static inline struct rb_node *
+rb_next2_postorder(const struct rb_root *root, struct rb_node *node)
+{
+	struct rb_node *parent, *child;
+
+	if (node == NULL)
+		return NULL;
+
+	/*
+	 * If we're at the root, there are no more siblings and no
+	 * parent, so post-order iteration is done.
+	 */
+	if (RB_ROOT_P(&root->rbr_tree, node))
+		return NULL;
+	parent = RB_FATHER(node);	/* kinda sexist, innit */
+	KASSERT(parent != NULL);
+
+	/*
+	 * If we're the right child, we've already processed the left
+	 * child (which may be gone by now), so just return the parent.
+	 */
+	if (RB_RIGHT_P(node))
+		return parent;
+
+	/*
+	 * Otherwise, move down to the leftmost child of our right
+	 * sibling -- or return the parent if there is none.
+	 */
+	if ((node = parent->rb_right) == NULL)
+		return parent;
+	for (;; node = child) {
+		if ((child = node->rb_left) != NULL)
+			continue;
+		if ((child = node->rb_right) != NULL)
+			continue;
+		return node;
+	}
+}
+
+#define	rbtree_postorder_for_each_entry_safe(ENTRY, TMP, ROOT, FIELD)	  \
+	for ((ENTRY) = rb_entry_safe(rb_first_postorder(ROOT),		  \
+		__typeof__(*(ENTRY)), FIELD);			  \
+		((ENTRY) != NULL &&	  \
+		((TMP) = rb_entry_safe(rb_next2_postorder((ROOT),	  \
+			&(ENTRY)->FIELD), __typeof__(*(ENTRY

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

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:18:25 UTC 2022

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

Log Message:
linux: Actually do post-order tree traversal.

Requires breaking the rbtree(3) abstraction, but this is necessary
because the body of the loop often frees the element, so as is we had
a huge pile of use-after-free going on.

Requires changing struct interval_tree_node's rbnode member to match
the Linux name, since we now use container_of here, and radeon relies
on this.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/include/linux/interval_tree.h
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/rbtree.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/alpha/alpha

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:17:10 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
alpha: Fix placement of membar for sending ICCB message.

While here, reduce it to membar_exit -- it's obviously not needed for
store-before-load here (although alpha doesn't have anything weaker
than the full sequential consistency `mb'), and although we do need a
store-before-load (and load-before-load) to spin waiting for the CPU
to wake up, that already happens a few lines below with alpha_mb in
the loop anyway.  So no need for membar_sync, which is just `mb'
under the hood -- deleting the membar_sync in this place can't hurt.

The membar_sync had been inserted automatically when converting from
an older style of atomic_ops(3) API.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/alpha/cpu.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/alpha/alpha/cpu.c
diff -u src/sys/arch/alpha/alpha/cpu.c:1.104 src/sys/arch/alpha/alpha/cpu.c:1.105
--- src/sys/arch/alpha/alpha/cpu.c:1.104	Wed May  5 03:54:16 2021
+++ src/sys/arch/alpha/alpha/cpu.c	Sun Feb 27 14:17:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $ */
+/* $NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -882,12 +882,13 @@ cpu_iccb_send(long cpu_id, const char *m
 
 	/*
 	 * Copy the message into the ICCB, and tell the secondary console
-	 * that it's there.
+	 * that it's there.  Ensure the buffer is initialized before we
+	 * set the rxrdy bits, as a store-release.
 	 */
 	strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg);
 	pcsp->pcs_iccb.iccb_rxlen = strlen(msg);
+	membar_exit();
 	atomic_or_ulong(&hwrpb->rpb_rxrdy, cpumask);
-	membar_sync();
 
 	/* Wait for the message to be received. */
 	for (timeout = 1; timeout != 0; timeout--) {



CVS commit: src/sys/arch/alpha/alpha

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:17:10 UTC 2022

Modified Files:
src/sys/arch/alpha/alpha: cpu.c

Log Message:
alpha: Fix placement of membar for sending ICCB message.

While here, reduce it to membar_exit -- it's obviously not needed for
store-before-load here (although alpha doesn't have anything weaker
than the full sequential consistency `mb'), and although we do need a
store-before-load (and load-before-load) to spin waiting for the CPU
to wake up, that already happens a few lines below with alpha_mb in
the loop anyway.  So no need for membar_sync, which is just `mb'
under the hood -- deleting the membar_sync in this place can't hurt.

The membar_sync had been inserted automatically when converting from
an older style of atomic_ops(3) API.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/alpha/alpha/cpu.c

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



CVS commit: src/sys/kern

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:16:43 UTC 2022

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
pool(9): Membar audit.

- Use atomic_store_release and atomic_load_consume for associating a
  freshly constructed pool_cache with its underlying pool.  The pool
  gets published in various ways before the pool cache is fully
  constructed.

  => Nix membar_sync -- no store-before-load is needed here.

- Take pool_head_lock around sysctl kern.pool TAILQ_FOREACH.  Then take
  a reference count, and drop the lock, around copyout.

  => Otherwise, pools could be partially initialized or freed while
 we're still trying to read from them -- and in the worst case,
 we might see a corrupted view of the tailq.

  => If we kept the lock around copyout, this could deadlock in memory
 allocation.

  => If we didn't take a reference count while releasing the lock, the
 pool could be destroyed while we're trying to traverse the list,
 sending us into oblivion instead of the next element.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/kern/subr_pool.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/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.280 src/sys/kern/subr_pool.c:1.281
--- src/sys/kern/subr_pool.c:1.280	Fri Dec 24 00:13:53 2021
+++ src/sys/kern/subr_pool.c	Sun Feb 27 14:16:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.280 2021/12/24 00:13:53 riastradh Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.281 2022/02/27 14:16:43 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.280 2021/12/24 00:13:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.281 2022/02/27 14:16:43 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1648,6 +1648,7 @@ pool_reclaim(struct pool *pp)
 {
 	struct pool_item_header *ph, *phnext;
 	struct pool_pagelist pq;
+	struct pool_cache *pc;
 	uint32_t curtime;
 	bool klock;
 	int rv;
@@ -1673,8 +1674,8 @@ pool_reclaim(struct pool *pp)
 		klock = false;
 
 	/* Reclaim items from the pool's cache (if any). */
-	if (pp->pr_cache != NULL)
-		pool_cache_invalidate(pp->pr_cache);
+	if ((pc = atomic_load_consume(&pp->pr_cache)) != NULL)
+		pool_cache_invalidate(pc);
 
 	if (mutex_tryenter(&pp->pr_lock) == 0) {
 		if (klock) {
@@ -1883,7 +1884,7 @@ pool_print1(struct pool *pp, const char 
 	if (skip_empty && pp->pr_nget == 0)
 		return;
 
-	if ((pc = pp->pr_cache) != NULL) {
+	if ((pc = atomic_load_consume(&pp->pr_cache)) != NULL) {
 		(*pr)("POOLCACHE");
 	} else {
 		(*pr)("POOL");
@@ -1895,7 +1896,6 @@ pool_print1(struct pool *pp, const char 
 		pp->pr_wchan, pp, pp->pr_size, pp->pr_align, pp->pr_npages,
 		pp->pr_nitems, pp->pr_nout, pp->pr_nget, pp->pr_nput,
 		pp->pr_npagealloc, pp->pr_npagefree, pp->pr_nidle);
-		
 		return;
 	}
 
@@ -2184,8 +2184,7 @@ pool_cache_bootstrap(pool_cache_t pc, si
 	if (__predict_true(!cold))
 		mutex_exit(&pool_head_lock);
 
-	membar_sync();
-	pp->pr_cache = pc;
+	atomic_store_release(&pp->pr_cache, pc);
 }
 
 /*
@@ -2224,7 +2223,7 @@ pool_cache_bootstrap_destroy(pool_cache_
 
 	/* Disassociate it from the pool. */
 	mutex_enter(&pp->pr_lock);
-	pp->pr_cache = NULL;
+	atomic_store_relaxed(&pp->pr_cache, NULL);
 	mutex_exit(&pp->pr_lock);
 
 	/* Destroy per-CPU data */
@@ -3339,6 +3338,7 @@ pool_whatis(uintptr_t addr, void (*pr)(c
 
 	TAILQ_FOREACH(pp, &pool_head, pr_poollist) {
 		struct pool_item_header *ph;
+		struct pool_cache *pc;
 		uintptr_t item;
 		bool allocated = true;
 		bool incache = false;
@@ -3373,8 +3373,8 @@ pool_whatis(uintptr_t addr, void (*pr)(c
 			allocated = pool_allocated(pp, ph, addr);
 		}
 found:
-		if (allocated && pp->pr_cache) {
-			pool_cache_t pc = pp->pr_cache;
+		if (allocated &&
+		(pc = atomic_load_consume(&pp->pr_cache)) != NULL) {
 			struct pool_cache_group *pcg;
 			int i;
 
@@ -3437,9 +3437,11 @@ pool_sysctl(SYSCTLFN_ARGS)
 	memset(&data, 0, sizeof(data));
 	error = 0;
 	written = 0;
+	mutex_enter(&pool_head_lock);
 	TAILQ_FOREACH(pp, &pool_head, pr_poollist) {
 		if (written + sizeof(data) > *oldlenp)
 			break;
+		pp->pr_refcnt++;
 		strlcpy(data.pr_wchan, pp->pr_wchan, sizeof(data.pr_wchan));
 		data.pr_pagesize = pp->pr_alloc->pa_pagesz;
 		data.pr_flags = pp->pr_roflags | pp->pr_flags;
@@ -3469,9 +3471,8 @@ pool_sysctl(SYSCTLFN_ARGS)
 		data.pr_cache_nempty = 0;
 		data.pr_cache_ncontended = 0;
 		data.pr_cache_npartial = 0;
-		if (pp->pr_cache) {
+		if ((pc = atomic_load_consume(&pp->pr_cache)) != NULL) {
 			uint32_t nfull = 0;
-			pc = pp->pr_cache;
 			data.pr_cache_meta_size = pc->pc_pcgsize;
 			for (i = 0; i < pc->pc_ncpu; ++i) {
 cc = pc->pc_cpus[i];
@@ -3492,12 +3493,19 @@ pool_sysctl(SYSCTLFN_ARGS)
 		data.pr_cache_nhit_global = data

CVS commit: src/sys/kern

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:16:43 UTC 2022

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
pool(9): Membar audit.

- Use atomic_store_release and atomic_load_consume for associating a
  freshly constructed pool_cache with its underlying pool.  The pool
  gets published in various ways before the pool cache is fully
  constructed.

  => Nix membar_sync -- no store-before-load is needed here.

- Take pool_head_lock around sysctl kern.pool TAILQ_FOREACH.  Then take
  a reference count, and drop the lock, around copyout.

  => Otherwise, pools could be partially initialized or freed while
 we're still trying to read from them -- and in the worst case,
 we might see a corrupted view of the tailq.

  => If we kept the lock around copyout, this could deadlock in memory
 allocation.

  => If we didn't take a reference count while releasing the lock, the
 pool could be destroyed while we're trying to traverse the list,
 sending us into oblivion instead of the next element.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/kern/subr_pool.c

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



CVS commit: src

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:16:33 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/lockstat: lockstat.c
src/sys/dev: lockstat.c

Log Message:
lockstat(4): KNF.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/cddl/osnet/dev/lockstat/lockstat.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/lockstat.c

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

Modified files:

Index: src/external/cddl/osnet/dev/lockstat/lockstat.c
diff -u src/external/cddl/osnet/dev/lockstat/lockstat.c:1.11 src/external/cddl/osnet/dev/lockstat/lockstat.c:1.12
--- src/external/cddl/osnet/dev/lockstat/lockstat.c:1.11	Sun Feb 27 14:16:12 2022
+++ src/external/cddl/osnet/dev/lockstat/lockstat.c	Sun Feb 27 14:16:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lockstat.c,v 1.11 2022/02/27 14:16:12 riastradh Exp $	*/
+/*	$NetBSD: lockstat.c,v 1.12 2022/02/27 14:16:32 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -26,18 +26,19 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.11 2022/02/27 14:16:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.12 2022/02/27 14:16:32 riastradh Exp $");
 
 #include 
-#include 
 #include 
+
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
 
 #define NLOCKSTAT 1
 #include 

Index: src/sys/dev/lockstat.c
diff -u src/sys/dev/lockstat.c:1.28 src/sys/dev/lockstat.c:1.29
--- src/sys/dev/lockstat.c:1.28	Sun Feb 27 14:16:12 2022
+++ src/sys/dev/lockstat.c	Sun Feb 27 14:16:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lockstat.c,v 1.28 2022/02/27 14:16:12 riastradh Exp $	*/
+/*	$NetBSD: lockstat.c,v 1.29 2022/02/27 14:16:32 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2019 The NetBSD Foundation, Inc.
@@ -41,25 +41,25 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.28 2022/02/27 14:16:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.29 2022/02/27 14:16:32 riastradh Exp $");
 
 #include 
 #include 
-#include  
-#include 
-#include 
-#include 
-#include 
+
+#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-#include 
-
 #include "ioconf.h"
 
 #ifndef __HAVE_CPU_COUNTER
@@ -353,7 +353,7 @@ lockstat_alloc(lsenable_t *le)
 	KASSERT(lockstat_baseb == NULL);
 	lockstat_sizeb = sz;
 	lockstat_baseb = lb;
-		
+
 	return (0);
 }
 



CVS commit: src

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:16:33 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/lockstat: lockstat.c
src/sys/dev: lockstat.c

Log Message:
lockstat(4): KNF.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/cddl/osnet/dev/lockstat/lockstat.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/lockstat.c

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



CVS commit: src

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:16:12 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/lockstat: lockstat.c
src/sys/dev: lockstat.c lockstat.h

Log Message:
lockstat(4): Membar audit.

- Serialize updates to lockstat_enabled, lockstat_dev_enabled, and
  lockstat_dtrace_enabled with a new __cpu_simple_lock.

- Use xc_barrier to obviate any need for additional membars in
  lockstat_event.

- Use atomic_load/store_* for access that might not be serialized by
  lockstat_lock or lockstat_enabled_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/dev/lockstat/lockstat.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/lockstat.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/lockstat.h

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

Modified files:

Index: src/external/cddl/osnet/dev/lockstat/lockstat.c
diff -u src/external/cddl/osnet/dev/lockstat/lockstat.c:1.10 src/external/cddl/osnet/dev/lockstat/lockstat.c:1.11
--- src/external/cddl/osnet/dev/lockstat/lockstat.c:1.10	Tue Feb 12 14:31:45 2019
+++ src/external/cddl/osnet/dev/lockstat/lockstat.c	Sun Feb 27 14:16:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lockstat.c,v 1.10 2019/02/12 14:31:45 rin Exp $	*/
+/*	$NetBSD: lockstat.c,v 1.11 2022/02/27 14:16:12 riastradh Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.10 2019/02/12 14:31:45 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.11 2022/02/27 14:16:12 riastradh Exp $");
 
 #include 
 #include 
@@ -72,11 +72,13 @@ lockstat_enable(void *arg, dtrace_id_t i
 
 	ASSERT(!lockstat_probemap[LS_COMPRESS(probe->lsp_probe)]);
 
-	lockstat_probemap[LS_COMPRESS(probe->lsp_probe)] = id;
 	if (lockstat_dtrace_count++ == 0) {
+		LOCKSTAT_ENABLED_UPDATE_BEGIN();
 		lockstat_dtrace_enabled = LB_DTRACE;
-		LOCKSTAT_ENABLED_UPDATE();
+		LOCKSTAT_ENABLED_UPDATE_END();
 	}
+	atomic_store_relaxed(&lockstat_probemap[LS_COMPRESS(probe->lsp_probe)],
+	id);
 
 	return 0;
 }
@@ -89,12 +91,19 @@ lockstat_disable(void *arg, dtrace_id_t 
 
 	ASSERT(lockstat_probemap[LS_COMPRESS(probe->lsp_probe)]);
 
+	atomic_store_relaxed(&lockstat_probemap[LS_COMPRESS(probe->lsp_probe)],
+	0);
 	if (--lockstat_dtrace_count == 0) {
+		LOCKSTAT_ENABLED_UPDATE_BEGIN();
 		lockstat_dtrace_enabled = 0;
-		LOCKSTAT_ENABLED_UPDATE();
-	}
+		LOCKSTAT_ENABLED_UPDATE_END();
 
-	lockstat_probemap[LS_COMPRESS(probe->lsp_probe)] = 0;
+		/*
+		 * Wait for all lockstat dtrace probe on all CPUs to
+		 * finish, now that they've been disabled.
+		 */
+		xc_barrier(0);
+	}
 }
 
 /*ARGSUSED*/
@@ -149,13 +158,6 @@ static dtrace_pops_t lockstat_pops = {
 	lockstat_destroy
 };
 
-static void
-lockstat_barrier_xc(void *arg0 __unused, void *arg1 __unused)
-{
-
-	membar_consumer();
-}
-
 typedef void (*dtrace_probe_func_t)(dtrace_id_t, uintptr_t, uintptr_t,
 uintptr_t, uintptr_t, uintptr_t);
 
@@ -169,8 +171,14 @@ lockstat_cas_probe(dtrace_probe_func_t o
 		return false;
 
 	lockstat_probe_func = new;
-	membar_producer();
-	xc_wait(xc_broadcast(0, lockstat_barrier_xc, NULL, NULL));
+
+	/*
+	 * Make sure that the probe function is initialized on all CPUs
+	 * before we enable the lockstat probe by setting
+	 * lockstat_probemap[...].
+	 */
+	xc_barrier(0);
+
 	return true;
 }
 

Index: src/sys/dev/lockstat.c
diff -u src/sys/dev/lockstat.c:1.27 src/sys/dev/lockstat.c:1.28
--- src/sys/dev/lockstat.c:1.27	Sat May 23 23:42:42 2020
+++ src/sys/dev/lockstat.c	Sun Feb 27 14:16:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lockstat.c,v 1.27 2020/05/23 23:42:42 ad Exp $	*/
+/*	$NetBSD: lockstat.c,v 1.28 2022/02/27 14:16:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2019 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.27 2020/05/23 23:42:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.28 2022/02/27 14:16:12 riastradh Exp $");
 
 #include 
 #include 
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: lockstat.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -101,6 +102,7 @@ dev_type_ioctl(lockstat_ioctl);
 
 volatile u_int	lockstat_enabled;
 volatile u_int	lockstat_dev_enabled;
+__cpu_simple_lock_t lockstat_enabled_lock;
 uintptr_t	lockstat_csstart;
 uintptr_t	lockstat_csend;
 uintptr_t	lockstat_csmask;
@@ -154,6 +156,7 @@ lockstatattach(int nunits)
 	(void)nunits;
 
 	__cpu_simple_lock_init(&lockstat_lock);
+	__cpu_simple_lock_init(&lockstat_enabled_lock);
 }
 
 /*
@@ -235,10 +238,26 @@ lockstat_start(lsenable_t *le)
 	lockstat_lockstart = le->le_lockstart;
 	lockstat_lockstart = le->le_lockstart;
 	lockstat_lockend = le->le_lockend;
-	membar_sync();
+
+	/*
+	 * Ensure everything is initialized on all CPUs, by issuing a
+	 * null xcall with the side effect of a release barrier on this
+	 * CPU and an acquire barrier on all other CPUs, before they
+	 * can witness any fl

CVS commit: src

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 14:16:12 UTC 2022

Modified Files:
src/external/cddl/osnet/dev/lockstat: lockstat.c
src/sys/dev: lockstat.c lockstat.h

Log Message:
lockstat(4): Membar audit.

- Serialize updates to lockstat_enabled, lockstat_dev_enabled, and
  lockstat_dtrace_enabled with a new __cpu_simple_lock.

- Use xc_barrier to obviate any need for additional membars in
  lockstat_event.

- Use atomic_load/store_* for access that might not be serialized by
  lockstat_lock or lockstat_enabled_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/dev/lockstat/lockstat.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/lockstat.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/lockstat.h

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



CVS commit: src/external/mit/expat/lib/libexpat

2022-02-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 27 12:27:22 UTC 2022

Modified Files:
src/external/mit/expat/lib/libexpat: expat_config.h

Log Message:
Do not assume we have a SYS_getrandom for the tools build.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/mit/expat/lib/libexpat/expat_config.h

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

Modified files:

Index: src/external/mit/expat/lib/libexpat/expat_config.h
diff -u src/external/mit/expat/lib/libexpat/expat_config.h:1.14 src/external/mit/expat/lib/libexpat/expat_config.h:1.15
--- src/external/mit/expat/lib/libexpat/expat_config.h:1.14	Sat Feb 26 18:49:42 2022
+++ src/external/mit/expat/lib/libexpat/expat_config.h	Sun Feb 27 12:27:22 2022
@@ -55,8 +55,10 @@
 /* Define to 1 if you have the  header file. */
 #define HAVE_STRING_H 1
 
+#ifndef TOOL_FCCACHE
 /* Define to 1 if you have `syscall' and `SYS_getrandom'. */
 #define HAVE_SYSCALL_GETRANDOM 1
+#endif
 
 /* Define to 1 if you have the  header file. */
 #define HAVE_SYS_PARAM_H 1



CVS commit: src/external/mit/expat/lib/libexpat

2022-02-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb 27 12:27:22 UTC 2022

Modified Files:
src/external/mit/expat/lib/libexpat: expat_config.h

Log Message:
Do not assume we have a SYS_getrandom for the tools build.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/mit/expat/lib/libexpat/expat_config.h

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



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 12:00:27 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_047.c msg_047.exp msg_313.c
msg_313.exp msg_315.c msg_315.exp msg_317.c msg_317.exp msg_319.c
msg_319.exp msg_321.c msg_321.exp

Log Message:
tests/lint: add tests for messages referring to C99


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_047.c \
src/tests/usr.bin/xlint/lint1/msg_313.c \
src/tests/usr.bin/xlint/lint1/msg_317.c \
src/tests/usr.bin/xlint/lint1/msg_319.c \
src/tests/usr.bin/xlint/lint1/msg_321.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_047.exp \
src/tests/usr.bin/xlint/lint1/msg_313.exp \
src/tests/usr.bin/xlint/lint1/msg_315.c \
src/tests/usr.bin/xlint/lint1/msg_315.exp \
src/tests/usr.bin/xlint/lint1/msg_317.exp \
src/tests/usr.bin/xlint/lint1/msg_319.exp \
src/tests/usr.bin/xlint/lint1/msg_321.exp

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_047.c
diff -u src/tests/usr.bin/xlint/lint1/msg_047.c:1.3 src/tests/usr.bin/xlint/lint1/msg_047.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_047.c:1.3	Sun Feb 27 11:40:30 2022
+++ src/tests/usr.bin/xlint/lint1/msg_047.c	Sun Feb 27 12:00:27 2022
@@ -1,7 +1,18 @@
-/*	$NetBSD: msg_047.c,v 1.3 2022/02/27 11:40:30 rillig Exp $	*/
+/*	$NetBSD: msg_047.c,v 1.4 2022/02/27 12:00:27 rillig Exp $	*/
 # 3 "msg_047.c"
 
-// Test for message: zero sized %s is a C99 feature [47]
+/* Test for message: zero sized %s is a C99 feature [47] */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -sw */
+
+struct empty {
+	/* TODO: The C99 syntax in 6.7.2.1 requires at least 1 member. */
+};
+/* expect-1: error: zero sized struct is a C99 feature [47] */
+
+struct zero_sized {
+	/* expect+2: error: zero sized array is a C99 extension [322] */
+	/* expect+1: error: zero sized array in struct is a C99 extension: dummy [39] */
+	char dummy[0];
+};
+/* expect-1: error: zero sized struct is a C99 feature [47] */
Index: src/tests/usr.bin/xlint/lint1/msg_313.c
diff -u src/tests/usr.bin/xlint/lint1/msg_313.c:1.3 src/tests/usr.bin/xlint/lint1/msg_313.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_313.c:1.3	Sun Feb 27 11:40:30 2022
+++ src/tests/usr.bin/xlint/lint1/msg_313.c	Sun Feb 27 12:00:27 2022
@@ -1,7 +1,15 @@
-/*	$NetBSD: msg_313.c,v 1.3 2022/02/27 11:40:30 rillig Exp $	*/
+/*	$NetBSD: msg_313.c,v 1.4 2022/02/27 12:00:27 rillig Exp $	*/
 # 3 "msg_313.c"
 
-// Test for message: struct or union member name in initializer is a C99 feature [313]
+/* Test for message: struct or union member name in initializer is a C99 feature [313] */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -sw */
+
+struct point {
+	int x, y;
+} p = {
+	/* expect+1: warning: struct or union member name in initializer is a C99 feature [313] */
+	.x = 3,
+	/* expect+1: warning: struct or union member name in initializer is a C99 feature [313] */
+	.y = 4,
+};
Index: src/tests/usr.bin/xlint/lint1/msg_317.c
diff -u src/tests/usr.bin/xlint/lint1/msg_317.c:1.3 src/tests/usr.bin/xlint/lint1/msg_317.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_317.c:1.3	Sun Feb 27 11:40:30 2022
+++ src/tests/usr.bin/xlint/lint1/msg_317.c	Sun Feb 27 12:00:27 2022
@@ -1,7 +1,13 @@
-/*	$NetBSD: msg_317.c,v 1.3 2022/02/27 11:40:30 rillig Exp $	*/
+/*	$NetBSD: msg_317.c,v 1.4 2022/02/27 12:00:27 rillig Exp $	*/
 # 3 "msg_317.c"
 
-// Test for message: __func__ is a C99 feature [317]
+/* Test for message: __func__ is a C99 feature [317] */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -sw */
+
+const char *
+function(void)
+{
+	/* expect+1: warning: __func__ is a C99 feature [317] */
+	return __func__;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_319.c
diff -u src/tests/usr.bin/xlint/lint1/msg_319.c:1.3 src/tests/usr.bin/xlint/lint1/msg_319.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_319.c:1.3	Sun Feb 27 11:40:30 2022
+++ src/tests/usr.bin/xlint/lint1/msg_319.c	Sun Feb 27 12:00:27 2022
@@ -1,7 +1,20 @@
-/*	$NetBSD: msg_319.c,v 1.3 2022/02/27 11:40:30 rillig Exp $	*/
+/*	$NetBSD: msg_319.c,v 1.4 2022/02/27 12:00:27 rillig Exp $	*/
 # 3 "msg_319.c"
 
-// Test for message: compound literals are a C99/GCC extension [319]
+/* Test for message: compound literals are a C99/GCC extension [319] */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -sw */
+
+/* expect+2: error: compound literals are a C99/GCC 

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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 12:00:27 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_047.c msg_047.exp msg_313.c
msg_313.exp msg_315.c msg_315.exp msg_317.c msg_317.exp msg_319.c
msg_319.exp msg_321.c msg_321.exp

Log Message:
tests/lint: add tests for messages referring to C99


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_047.c \
src/tests/usr.bin/xlint/lint1/msg_313.c \
src/tests/usr.bin/xlint/lint1/msg_317.c \
src/tests/usr.bin/xlint/lint1/msg_319.c \
src/tests/usr.bin/xlint/lint1/msg_321.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_047.exp \
src/tests/usr.bin/xlint/lint1/msg_313.exp \
src/tests/usr.bin/xlint/lint1/msg_315.c \
src/tests/usr.bin/xlint/lint1/msg_315.exp \
src/tests/usr.bin/xlint/lint1/msg_317.exp \
src/tests/usr.bin/xlint/lint1/msg_319.exp \
src/tests/usr.bin/xlint/lint1/msg_321.exp

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



CVS commit: src/sys/arch/evbppc/virtex/dev

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 11:49:28 UTC 2022

Modified Files:
src/sys/arch/evbppc/virtex/dev: if_temac.c

Log Message:
evbppc/temac(4): Mark unused functions as such.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbppc/virtex/dev/if_temac.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/evbppc/virtex/dev/if_temac.c
diff -u src/sys/arch/evbppc/virtex/dev/if_temac.c:1.18 src/sys/arch/evbppc/virtex/dev/if_temac.c:1.19
--- src/sys/arch/evbppc/virtex/dev/if_temac.c:1.18	Sun Dec  5 02:47:01 2021
+++ src/sys/arch/evbppc/virtex/dev/if_temac.c	Sun Feb 27 11:49:28 2022
@@ -1,4 +1,4 @@
-/* 	$NetBSD: if_temac.c,v 1.18 2021/12/05 02:47:01 msaitoh Exp $ */
+/* 	$NetBSD: if_temac.c,v 1.19 2022/02/27 11:49:28 riastradh Exp $ */
 
 /*
  * Copyright (c) 2006 Jachym Holecek
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.18 2021/12/05 02:47:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.19 2022/02/27 11:49:28 riastradh Exp $");
 
 
 #include 
@@ -288,14 +288,14 @@ gmi_write_4(uint32_t addr, uint32_t lo)
 	TRACEREG(("%s: %#08x <- %#08x\n", __func__, addr, lo));
 }
 
-static inline void
+static inline void __unused
 gmi_write_8(uint32_t addr, uint32_t lo, uint32_t hi)
 {
 	mtidcr(IDCR_HIF_ARG1, hi);
 	gmi_write_4(addr, lo);
 }
 
-static inline void
+static inline void __unused
 gmi_read_8(uint32_t addr, uint32_t *lo, uint32_t *hi)
 {
 	*lo = gmi_read_4(addr);



CVS commit: src/sys/arch/evbppc/virtex/dev

2022-02-27 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 27 11:49:28 UTC 2022

Modified Files:
src/sys/arch/evbppc/virtex/dev: if_temac.c

Log Message:
evbppc/temac(4): Mark unused functions as such.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbppc/virtex/dev/if_temac.c

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



CVS commit: src

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 11:40:30 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c9x_recursive_init.c decl_struct_c90.c
decl_struct_c90.exp init_c90.c init_c90.exp msg_047.c msg_049.c
msg_049.exp msg_313.c msg_317.c msg_319.c msg_321.c
src/usr.bin/xlint/lint1: cgram.y decl.c err.c main1.c tree.c
src/usr.bin/xlint/xlint: lint.1

Log Message:
lint: C99 has been released, so refer to it by its proper name


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp \
src/tests/usr.bin/xlint/lint1/msg_049.c \
src/tests/usr.bin/xlint/lint1/msg_049.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/init_c90.c \
src/tests/usr.bin/xlint/lint1/init_c90.exp \
src/tests/usr.bin/xlint/lint1/msg_047.c \
src/tests/usr.bin/xlint/lint1/msg_313.c \
src/tests/usr.bin/xlint/lint1/msg_317.c \
src/tests/usr.bin/xlint/lint1/msg_319.c \
src/tests/usr.bin/xlint/lint1/msg_321.c
cvs rdiff -u -r1.384 -r1.385 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.249 -r1.250 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.408 -r1.409 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/xlint/lint.1

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c
diff -u src/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c:1.3 src/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c:1.4
--- src/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c:1.3	Sat Feb 20 22:31:20 2021
+++ src/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c	Sun Feb 27 11:40:30 2022
@@ -1,7 +1,7 @@
-/*	$NetBSD: d_c9x_recursive_init.c,v 1.3 2021/02/20 22:31:20 rillig Exp $	*/
+/*	$NetBSD: d_c9x_recursive_init.c,v 1.4 2022/02/27 11:40:30 rillig Exp $	*/
 # 3 "d_c9x_recursive_init.c"
 
-/* C9X struct/union member init, with nested union and trailing member */
+/* C99 struct/union member init, with nested union and trailing member */
 union node {
 	void *next;
 	char *data;
Index: src/tests/usr.bin/xlint/lint1/decl_struct_c90.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.3 src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.4
--- src/tests/usr.bin/xlint/lint1/decl_struct_c90.c:1.3	Thu Jul 15 21:00:05 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_c90.c	Sun Feb 27 11:40:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_struct_c90.c,v 1.3 2021/07/15 21:00:05 rillig Exp $	*/
+/*	$NetBSD: decl_struct_c90.c,v 1.4 2022/02/27 11:40:30 rillig Exp $	*/
 # 3 "decl_struct_c90.c"
 
 /*
@@ -14,7 +14,7 @@ struct unnamed_member {
 		void *b_value;
 		void (*c_value)(void);
 	};
-	/* expect-1: warning: anonymous struct/union members is a C9X feature [49] */
+	/* expect-1: warning: anonymous struct/union members is a C11 feature [49] */
 };
 
 /*
Index: src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.3 src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.4
--- src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp:1.3	Thu Jul 15 21:00:05 2021
+++ src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp	Sun Feb 27 11:40:30 2022
@@ -1,3 +1,3 @@
-decl_struct_c90.c(16): warning: anonymous struct/union members is a C9X feature [49]
+decl_struct_c90.c(16): warning: anonymous struct/union members is a C11 feature [49]
 decl_struct_c90.c(29): error: syntax error '}' [249]
 decl_struct_c90.c(32): error: cannot recover from previous errors [224]
Index: src/tests/usr.bin/xlint/lint1/msg_049.c
diff -u src/tests/usr.bin/xlint/lint1/msg_049.c:1.3 src/tests/usr.bin/xlint/lint1/msg_049.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_049.c:1.3	Fri Aug 27 20:16:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_049.c	Sun Feb 27 11:40:30 2022
@@ -1,7 +1,7 @@
-/*	$NetBSD: msg_049.c,v 1.3 2021/08/27 20:16:50 rillig Exp $	*/
+/*	$NetBSD: msg_049.c,v 1.4 2022/02/27 11:40:30 rillig Exp $	*/
 # 3 "msg_049.c"
 
-/* Test for message: anonymous struct/union members is a C9X feature [49] */
+/* Test for message: anonymous struct/union members is a C11 feature [49] */
 
 /* lint1-flags: -sw */
 
@@ -23,5 +23,5 @@ struct {
 		int int_value;
 		void *pointer_value;
 	};
-	/* expect-1: warning: anonymous struct/union members is a C9X feature [49] */
+	/* expect-1: warning: anonymous struct/union members is a C11 feature [49] */
 } s;
Index: src/tests/usr.bin/xlint/lint1/msg_049.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_049.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_049.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_049.exp:1.3	Fri Aug 27 20:16:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_049.exp	Sun Feb 27 11:40:3

CVS commit: src

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 11:40:30 UTC 2022

Modified Files:
src/tests/usr.bin/xlint/lint1: d_c9x_recursive_init.c decl_struct_c90.c
decl_struct_c90.exp init_c90.c init_c90.exp msg_047.c msg_049.c
msg_049.exp msg_313.c msg_317.c msg_319.c msg_321.c
src/usr.bin/xlint/lint1: cgram.y decl.c err.c main1.c tree.c
src/usr.bin/xlint/xlint: lint.1

Log Message:
lint: C99 has been released, so refer to it by its proper name


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/d_c9x_recursive_init.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.c \
src/tests/usr.bin/xlint/lint1/decl_struct_c90.exp \
src/tests/usr.bin/xlint/lint1/msg_049.c \
src/tests/usr.bin/xlint/lint1/msg_049.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/init_c90.c \
src/tests/usr.bin/xlint/lint1/init_c90.exp \
src/tests/usr.bin/xlint/lint1/msg_047.c \
src/tests/usr.bin/xlint/lint1/msg_313.c \
src/tests/usr.bin/xlint/lint1/msg_317.c \
src/tests/usr.bin/xlint/lint1/msg_319.c \
src/tests/usr.bin/xlint/lint1/msg_321.c
cvs rdiff -u -r1.384 -r1.385 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.249 -r1.250 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.152 -r1.153 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.408 -r1.409 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/xlint/lint.1

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



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 11:14:42 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h tree.c

Log Message:
lint: unabbreviate two more members of sym_t

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.383 -r1.384 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.248 -r1.249 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.407 -r1.408 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.383 src/usr.bin/xlint/lint1/cgram.y:1.384
--- src/usr.bin/xlint/lint1/cgram.y:1.383	Sun Feb 27 08:31:26 2022
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Feb 27 11:14:42 2022
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.383 2022/02/27 08:31:26 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.384 2022/02/27 11:14:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.383 2022/02/27 08:31:26 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.384 2022/02/27 11:14:42 rillig Exp $");
 #endif
 
 #include 
@@ -114,7 +114,7 @@ static void
 anonymize(sym_t *s)
 {
 	for ( ; s != NULL; s = s->s_next)
-		s->s_styp = NULL;
+		s->s_sou_type = NULL;
 }
 
 #if defined(YYDEBUG) && (defined(YYBYACC) || defined(YYBISON))

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.248 src/usr.bin/xlint/lint1/decl.c:1.249
--- src/usr.bin/xlint/lint1/decl.c:1.248	Sun Feb 27 10:44:45 2022
+++ src/usr.bin/xlint/lint1/decl.c	Sun Feb 27 11:14:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.248 2022/02/27 10:44:45 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.249 2022/02/27 11:14:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.248 2022/02/27 10:44:45 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.249 2022/02/27 11:14:42 rillig Exp $");
 #endif
 
 #include 
@@ -1157,7 +1157,7 @@ declarator_1_struct_union(sym_t *dsym)
 		lint_assert(dcs->d_redeclared_symbol->s_scl == MOS ||
 		dcs->d_redeclared_symbol->s_scl == MOU);
 
-		if (dsym->s_styp == dcs->d_redeclared_symbol->s_styp) {
+		if (dsym->s_sou_type == dcs->d_redeclared_symbol->s_sou_type) {
 			/* duplicate member name: %s */
 			error(33, dsym->s_name);
 			rmsym(dcs->d_redeclared_symbol);
@@ -1513,7 +1513,7 @@ check_function_definition(sym_t *sym, bo
  * Process the name in a declarator.
  * The symbol gets one of the storage classes EXTERN, STATIC, AUTO or
  * TYPEDEF.
- * s_def and s_reg are valid after declarator_name().
+ * s_def and s_register are valid after declarator_name().
  */
 sym_t *
 declarator_name(sym_t *sym)
@@ -1534,7 +1534,7 @@ declarator_name(sym_t *sym)
 	case MOS:
 	case MOU:
 		/* Set parent */
-		sym->s_styp = dcs->d_tagtyp->t_str;
+		sym->s_sou_type = dcs->d_tagtyp->t_str;
 		sym->s_def = DEF;
 		sym->s_value.v_tspec = INT;
 		sc = dcs->d_ctx;
@@ -1568,7 +1568,7 @@ declarator_name(sym_t *sym)
 			sc = AUTO;
 		} else {
 			lint_assert(sc == REG);
-			sym->s_reg = true;
+			sym->s_register = true;
 			sc = AUTO;
 		}
 		sym->s_def = DEF;
@@ -1586,7 +1586,7 @@ declarator_name(sym_t *sym)
 		} else if (sc == AUTO || sc == STATIC || sc == TYPEDEF) {
 			sym->s_def = DEF;
 		} else if (sc == REG) {
-			sym->s_reg = true;
+			sym->s_register = true;
 			sc = AUTO;
 			sym->s_def = DEF;
 		} else {
@@ -1810,8 +1810,8 @@ complete_tag_struct_or_union(type_t *tp,
 	n = 0;
 	for (mem = fmem; mem != NULL; mem = mem->s_next) {
 		/* bind anonymous members to the structure */
-		if (mem->s_styp == NULL) {
-			mem->s_styp = sp;
+		if (mem->s_sou_type == NULL) {
+			mem->s_sou_type = sp;
 			if (mem->s_type->t_bitfield) {
 sp->sou_size_in_bits += bitfieldsize(&mem);
 if (mem == NULL)

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.140 src/usr.bin/xlint/lint1/lint1.h:1.141
--- src/usr.bin/xlint/lint1/lint1.h:1.140	Sun Feb 27 10:49:15 2022
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Feb 27 11:14:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.140 2022/02/27 10:49:15 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.141 2022/02/27 11:14:42 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -250,14 +250,15 @@ typedef	struct sym {
 	bool	s_set:1;	/* variable set, label defined */
 	bool	s_used:1;	/* variable/label used */
 	bool	s_arg:1;	/* symbol is function argument */
-	bool	s_reg:1;	/* symbol is register variable */
+	bool	s_register:1;	/* symbol is register variable */
 	bool	s_defarg:1;	/* undefined symbol in old style function
    definition */
 	bool	s_return_type_implicit_int:1;

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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 11:14:42 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h tree.c

Log Message:
lint: unabbreviate two more members of sym_t

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.383 -r1.384 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.248 -r1.249 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.407 -r1.408 src/usr.bin/xlint/lint1/tree.c

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



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

2022-02-27 Thread Martin Husemann
On Sun, Feb 27, 2022 at 11:50:15AM +0100, Martin Husemann wrote:
> On Sun, Feb 27, 2022 at 12:04:58AM +0100, Joerg Sonnenberger wrote:
> > Personally, I prefer the use of the C extension in cases like this. The
> > "portable" version is less readable...
> 
> I would prefer the type correct C++ style variant (and making lint deal
> with it, if it doesn't yet). At least gcc is happy with it.

Ah, never mind - the inline function is void already - so effectively I
agree with Jörg.

Martin


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

2022-02-27 Thread Martin Husemann
On Sun, Feb 27, 2022 at 12:04:58AM +0100, Joerg Sonnenberger wrote:
> Personally, I prefer the use of the C extension in cases like this. The
> "portable" version is less readable...

I would prefer the type correct C++ style variant (and making lint deal
with it, if it doesn't yet). At least gcc is happy with it.

Index: if_wm.c
===
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.728
diff -u -p -r1.728 if_wm.c
--- if_wm.c 26 Feb 2022 14:53:05 -  1.728
+++ if_wm.c 27 Feb 2022 10:48:11 -
@@ -10025,7 +10025,7 @@ wm_txrxintr_disable(struct wm_queue *wmq
struct wm_softc *sc = wmq->wmq_txq.txq_sc;
 
if (__predict_false(!wm_is_using_msix(sc))) {
-   return wm_legacy_intr_disable(sc);
+   return (void)wm_legacy_intr_disable(sc);
}
 
if (sc->sc_type == WM_T_82574)
@@ -10046,7 +10046,7 @@ wm_txrxintr_enable(struct wm_queue *wmq)
wm_itrs_calculate(sc, wmq);
 
if (__predict_false(!wm_is_using_msix(sc))) {
-   return wm_legacy_intr_enable(sc);
+   return (void)wm_legacy_intr_enable(sc);
}
 
/*



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 10:49:15 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: lint1.h

Log Message:
lint: remove unused enumeration details from symbol type

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/xlint/lint1/lint1.h

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



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 10:49:15 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: lint1.h

Log Message:
lint: remove unused enumeration details from symbol type

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/xlint/lint1/lint1.h

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

Modified files:

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.139 src/usr.bin/xlint/lint1/lint1.h:1.140
--- src/usr.bin/xlint/lint1/lint1.h:1.139	Sun Feb 27 10:44:45 2022
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Feb 27 10:49:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.139 2022/02/27 10:44:45 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.140 2022/02/27 10:49:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -267,7 +267,6 @@ typedef	struct sym {
 	union {
 		/* XXX: what is the difference to s_type->t_str? */
 		struct_or_union	*_s_st;
-		enumeration	*_s_et;
 		tspec_t	_s_tsp;	/* type (only for keywords) */
 		tqual_t	_s_tqu;	/* qualifier (only for keywords) */
 		struct	sym *_s_args; /* arguments in old style function
@@ -283,7 +282,6 @@ typedef	struct sym {
 } sym_t;
 
 #define	s_styp	u._s_st
-#define	s_etyp	u._s_et
 #define	s_tspec	u._s_tsp
 #define	s_tqual	u._s_tqu
 #define	s_args	u._s_args



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

2022-02-27 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb 27 10:44:45 UTC 2022

Modified Files:
src/usr.bin/xlint/lint1: decl.c func.c lex.c lint1.h tree.c

Log Message:
lint: unabbreviate some fields in sym_t

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.406 -r1.407 src/usr.bin/xlint/lint1/tree.c

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



  1   2   >