On Sun, Jun 07, 2026 at 03:11:46PM -0700, Gabriel wrote:
> Issue: Kernel does not compile if the in-kernel debugger (DDB) is disabled
> in a custom kernel.
> 
> Steps to recreate: Install the 7.9 sys release source code.
> Edit /usr/src/sys/conf/GENERIC and comment out the first option (DDB)
> Configure and compile as normal - will fail with an error when attempting to
> compile amas.c

In file included from /usr/src/sys/dev/pci/amas.c:27:
In file included from /usr/src/sys/dev/pci/amas.h:57:
In file included from /usr/src/sys/dev/pci/pcivar.h:82:
pci_machdep.h:94:19: error: declaration of 'struct cpu_info' will not be 
visible outside of this function [-Werror,-Wvisibility]

there is no need for amas.h, it can be merged into amas.c

further changes to dt_dev.c (not included) are required to build
amd64 GENERIC.MP without ddb.

Index: sys/dev/pci/amas.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/amas.c,v
diff -u -p -r1.7 amas.c
--- sys/dev/pci/amas.c  11 Mar 2022 18:00:45 -0000      1.7
+++ sys/dev/pci/amas.c  8 Jun 2026 03:24:43 -0000
@@ -22,10 +22,32 @@
  * Driver for the amd athlon/opteron 64 address map.
  * This device is integrated in 64-bit Athlon and Opteron cpus
  * and contains mappings for memory to processor nodes.
+ *
+ * The AMD cpu can access memory in two ways: interleaved and non-interleaved.
+ *
+ * In interleaved mode, 16 MB regions are rotated across each node,
+ * example for 2 nodes:
+ * - region 0 (0-16 MB) on node 0.
+ * - region 1 (16-32 MB) on node 1.
+ * - region 2 (33-48 MB) on node 0.
+ * - region 3 (48-64 MB) on node 1.
+ * ...
+ * - region 2 * N on node 0.
+ * - region 2 * N + 1 on node 1.
+ * Interleaved mode requires that each node has the same amount of physical
+ * memory.
+ *
+ * In non-interleaved mode, memory for each node is a continuous address space,
+ * example for 2 nodes:
+ * - region 0 (all memory on CPU package 0) on node 0.
+ * - region 1 (all memory on CPU package 1) on node 1.
+ * Non-interleaved mode requires either that each node has the same amount of
+ * physical memory or that memory holes are allowed between each node.
+ *
+ * Configuring memory for interleaved or non-interleaved mode is handled by
+ * the BIOS.
  */
 
-#include <dev/pci/amas.h>
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -34,8 +56,18 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcidevs.h>
 
-int amas_match(struct device*, void*, void*);
-void amas_attach(struct device*, struct device*, void*);
+struct amas_softc {
+       struct device sc_dev;
+       pcitag_t pa_tag;
+       pci_chipset_tag_t pa_pc;
+       int family;
+};
+
+int amas_match(struct device *, void *, void *);
+void amas_attach(struct device *, struct device *, void *);
+
+int amas_intl_nodes(struct amas_softc *);
+void amas_get_pagerange(struct amas_softc *, int, paddr_t *, paddr_t *);
 
 /*
  * Amas device layout:
@@ -52,6 +84,7 @@ void amas_attach(struct device*, struct 
  * extended base/limit addresses need to be shifted <<40 for memory address
  */
 
+#define AMAS_MAX_NODES         (8)
 #define AMAS_REG_BASE(node)    (0x0040 + 0x08 * (node))
 #define AMAS_REG_LIMIT(node)   (0x0044 + 0x08 * (node))
 #define AMAS_REG_EXTBASE(node) (0x0140 + 0x08 * (node))
--- sys/dev/pci/amas.h  Mon Jun  8 13:20:09 2026
+++ /dev/null   Mon Jun  8 13:25:02 2026
@@ -1,82 +0,0 @@
-/*     $OpenBSD: amas.h,v 1.1 2009/05/07 11:30:27 ariane Exp $ */
-
-/*
- * Copyright (c) 2009 Ariane van der Steldt <[email protected]>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Device: amas (AMD memory access/address switch).
- *
- * Driver for the amd athlon/opteron 64 address map.
- * This device is integrated in 64-bit Athlon and Opteron cpus
- * and contains mappings for memory to processor nodes.
- *
- * The AMD cpu can access memory in two ways: interleaved and non-interleaved.
- *
- * In interleaved mode, 16 MB regions are rotated across each node,
- * example for 2 nodes:
- * - region 0 (0-16 MB) on node 0.
- * - region 1 (16-32 MB) on node 1.
- * - region 2 (33-48 MB) on node 0.
- * - region 3 (48-64 MB) on node 1.
- * ...
- * - region 2 * N on node 0.
- * - region 2 * N + 1 on node 1.
- * Interleaved mode requires that each node has the same amount of physical
- * memory.
- *
- * In non-interleaved mode, memory for each node is a continuous address space,
- * example for 2 nodes:
- * - region 0 (all memory on CPU package 0) on node 0.
- * - region 1 (all memory on CPU package 1) on node 1.
- * Non-interleaved mode requires either that each node has the same amount of
- * physical memory or that memory holes are allowed between each node.
- *
- * Configuring memory for interleaved or non-interleaved mode is handled by
- * the BIOS.
- */
-
-#ifndef _MACHINE_AMAS_H_
-#define _MACHINE_AMAS_H_
-
-#include <sys/types.h>
-#include <sys/device.h>
-
-#include <dev/pci/pcivar.h>
-
-#ifdef _KERNEL
-
-#define AMAS_MAX_NODES (8) /* AMAS supports 8 nodes at maximum. */
-
-/* Device configuration. */
-struct amas_softc {
-       struct device sc_dev;
-       /* PCI location of this device. */
-       pcitag_t pa_tag;
-       pci_chipset_tag_t pa_pc;
-       int family;
-};
-
-/* AMAS driver. */
-extern struct cfdriver amas_cd;
-
-int amas_match(struct device*, void*, void*);
-void amas_attach(struct device*, struct device*, void*);
-
-int amas_intl_nodes(struct amas_softc*);
-void amas_get_pagerange(struct amas_softc*, int node, paddr_t*, paddr_t*);
-
-#endif /* _KERNEL */
-#endif /*  _MACHINE_AMAS_H_ */

Reply via email to