#
#       $NetBSD: GENERIC.common,v 1.22 2025/04/01 20:16:57 nia Exp $
#
#       GENERIC common RISC-V kernel config items shared between 32 and 64
#       kernels
#

maxusers        64              # estimated number of users

options         FDT
options         MULTIPROCESSOR

# Standard system options
options         FPE             # Floating-point extension support
options         NTP             # NTP phase/frequency locked loop

options         KTRACE          # system call tracing via ktrace(1)

# Heartbeat checks
options         HEARTBEAT
options         HEARTBEAT_MAX_PERIOD_DEFAULT=15

# Note: SysV IPC parameters could be changed dynamically, see sysctl(8).
options         SYSVMSG         # System V-like message queues
options         SYSVSEM         # System V-like semaphores
options         SYSVSHM         # System V-like memory sharing

options         MODULAR         # new style module(7) framework
options         MODULAR_DEFAULT_AUTOLOAD
options         USERCONF        # userconf(4) support
#options        PIPE_SOCKETPAIR # smaller, but slower pipe(2)
options         SYSCTL_INCLUDE_DESCR    # Include sysctl descriptions in kernel

# Alternate buffer queue strategies for better responsiveness under high
# disk I/O load.
#options        BUFQ_READPRIO
options         BUFQ_PRIOCSCAN

# These options enable verbose messages for several subsystems.
# Warning, these may compile large string tables into the kernel!
#options        USBVERBOSE      # verbose USB device autoconfig messages

#
# Because gcc omits the frame pointer for any -O level, the line below
# is needed to make backtraces in DDB work.
#
makeoptions     COPTS="-O2 -fno-omit-frame-pointer"
makeoptions     COPY_SYMTAB=1
options         DDB             # in-kernel debugger
#options        DDB_COMMANDONENTER="bt" # execute command when ddb is entered
options         DDB_ONPANIC=1   # see also sysctl(7): `ddb.onpanic'
options         DDB_HISTORY_SIZE=512    # enable history editing in DDB
#options        KGDB            # remote debugger
#options        KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
#options        SYSCALL_STATS   # per syscall counts
#options        SYSCALL_TIMES   # per syscall times
#options        SYSCALL_TIMES_HASCOUNTER        # use 'broken' rdtsc (soekris)

# Compatibility options
include         "conf/compat_netbsd100.config"

# Wedge support
options         DKWEDGE_AUTODISCOVER    # Automatically add dk(4) instances
options         DKWEDGE_METHOD_GPT      # Supports GPT partitions as wedges
options         DKWEDGE_METHOD_BSDLABEL # Support disklabel entries as wedges
options         DKWEDGE_METHOD_MBR      # Support MBR partitions as wedges
options         DKWEDGE_METHOD_APPLE    # Support Apple partitions as wedges
#options        DKWEDGE_METHOD_RDB      # Support RDB partitions as wedges
#options        DKWEDGE_METHOD_TOS      # Support Atari "TOS" partitions as wedges

include         "conf/filesystems.config"

# File system options
options         FFS_EI          # FFS Endian Independent support
#options        FFS_NO_SNAPSHOT # No FFS snapshot support
options         QUOTA           # legacy UFS quotas
options         QUOTA2          # new, in-filesystem UFS quotas
#options        UFS_DIRHASH     # UFS Large Directory Hashing
options         WAPBL           # File system journaling support
#options        DISKLABEL_EI    # disklabel Endian Independent support
options         NFSSERVER       # Network File System server
options         NFS_BOOT_DHCP   # Support DHCP NFS root

# Networking options
#options        GATEWAY         # packet forwarding
options         INET            # IP + ICMP + TCP + UDP
options         INET6           # IPV6
options         IPSEC           # IP security
#options        IPSEC_DEBUG     # debug for IP security
#options        MPLS            # MultiProtocol Label Switching (needs mpls)
#options        MROUTING        # IP multicast routing
#options        PIM             # Protocol Independent Multicast
#options        NETATALK        # AppleTalk networking protocols
#options        PPP_BSDCOMP     # BSD-Compress compression support for PPP
#options        PPP_DEFLATE     # Deflate compression support for PPP
#options        PPP_FILTER      # Active filter support for PPP (requires bpf)
#options        TCP_DEBUG       # Record last TCP_NDEBUG packets with SO_DEBUG

#options        ALTQ            # Manipulate network interfaces' output queues
#options        ALTQ_BLUE       # Stochastic Fair Blue
#options        ALTQ_CBQ        # Class-Based Queueing
#options        ALTQ_CDNR       # Diffserv Traffic Conditioner
#options        ALTQ_FIFOQ      # First-In First-Out Queue
#options        ALTQ_FLOWVALVE  # RED/flow-valve (red-penalty-box)
#options        ALTQ_HFSC       # Hierarchical Fair Service Curve
#options        ALTQ_LOCALQ     # Local queueing discipline
#options        ALTQ_PRIQ       # Priority Queueing
#options        ALTQ_RED        # Random Early Detection
#options        ALTQ_RIO        # RED with IN/OUT
#options        ALTQ_WFQ        # Weighted Fair Queueing

# These options enable verbose messages for several subsystems.
# Warning, these may compile large string tables into the kernel!

# Kernel root file system and dump configuration.
config          netbsd  root on ? type ?

#
# Device configuration
#

mainbus0        at root
simplebus*      at fdt? pass 0

# CPUs
cpus*           at fdt? pass 0
cpu*            at fdt? pass 0

intc*           at cpu? pass 1

# Fixed Clocks
fclock*         at fdt? pass 1

# System Controller
syscon*         at fdt? pass 1          # Generic System Controller

# Core-level Interrupt Control block
#clint0         at fdt? pass 2

# Platform-Level Interrupt Controller
plic*           at fdt? pass 2

# UART
com*            at fdt?                 # UART

# Firmware devices
qemufwcfg*      at fdt?                 # QEMU Firmware Configuration device

# RTC devices
gfrtc*          at fdt?                 # Google Goldfish RTC

# PCIE
pcihost*        at fdt?                 # Generic PCI host controller
pci*            at pcibus?
ppb*            at pci? dev ? function ?
pci*            at ppb?

# USB
xhci*           at fdt?                 # XHCI
xhci*           at pci?                 # XHCI
usb*            at usbus?
include "dev/usb/usbdevices.config"
midi*           at midibus?
pseudo-device   sequencer               # MIDI sequencer

# NVMe
nvme*           at pci? dev ? function ?
ld*             at nvme? nsid ?

# Audio
audio*          at audiobus?
auich*          at pci? dev ? function ?        # Intel AC'97 Audio (QEMU)
eap*            at pci? dev ? function ?        # Ensoniq AudioPCI (QEMU)

# I2C controllers
dwiic*          at fdt?                 # Designware I2C
iic*            at i2cbus?

# I2C devices
#axppmic*       at iic?                 # X-Powers AXP Power Management IC
#axpreg*        at axppmic?

# Virtio devices
virtio*         at fdt?                 # Virtio MMIO device

include "dev/virtio/virtio.config"
no vio9p*       at virtio?              # XXX ?
no viomb*       at virtio?              # XXX ?
no vioscsi*     at virtio?              # XXX ?

# Pseudo-Devices
# network pseudo-devices
pseudo-device   bpfilter                # Berkeley packet filter
pseudo-device   bridge                  # simple inter-network bridging
pseudo-device   carp                    # Common Address Redundancy Protocol
pseudo-device   gif                     # IPv[46] over IPv[46] tunnel (RFC 1933)
pseudo-device   gre                     # generic L3 over IP tunnel
pseudo-device   ipsecif                 # interface for routing-based ipsec
pseudo-device   loop                    # network loopback
pseudo-device   npf                     # NPF packet filter
pseudo-device   ppp                     # Point-to-Point Protocol
pseudo-device   pppoe                   # PPP over Ethernet (RFC 2516)
pseudo-device   swcrypto                # software crypto implementation
pseudo-device   tun                     # network tunneling over tty
pseudo-device   tap                     # virtual Ethernet
pseudo-device   vether                  # Virtual Ethernet for bridge
pseudo-device   vlan                    # IEEE 802.1q encapsulation

# miscellaneous pseudo-devices
pseudo-device   clockctl                # user control of clock subsystem
pseudo-device   crypto                  # /dev/crypto device
pseudo-device   lockstat                # lock profiling
pseudo-device   ksyms                   # /dev/ksyms
pseudo-device   openfirm                # /dev/openfirm
pseudo-device   pad                     # pseudo audio device
pseudo-device   pty                     # pseudo-terminals
#options        RND_COM
pseudo-device   swwdog                  # software watchdog timer -- swwdog(4)


# disk/mass storage pseudo-devices
#pseudo-device  md                      # memory disk device (ramdisk)
#options        MEMORY_DISK_HOOKS       # enable root ramdisk
#options        MEMORY_DISK_DYNAMIC     # loaded via kernel module(7)

pseudo-device   vnd                     # disk-like interface to files
options         VND_COMPRESSION         # compressed vnd(4)

# userland interface to drivers, including autoconf and properties retrieval
pseudo-device   drvctl

options         PAX_MPROTECT=0          # PaX mprotect(2) restrictions
options         PAX_ASLR=0              # PaX Address Space Layout Randomization

# Pull in optional local configuration - always at end
cinclude        "arch/riscv/conf/GENERIC.local"