# 9k risc-v cpu server for visionfive 2 with rv32 e24 core + 4 × rv64 u74 cores
dev +dev
	root
	cons
	arch
	env
	pipe
	proc
	mnt
	srv
	dup
#	rtc
	ssl
	tls
	cap
#	pnp		pci
	kprof
	segment
	ether		netif
	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium
	uart
	bridge		log
	sd
# needed for usb kbd input via scan codes
#	kbin
#	usb

sd +dev
# gets "error cmd 8/55/1 intr 104 stat 1e6", 25 apr 2023
#	sdmmc		sddwc
#	sdahci		pci sdscsi
#	sdnvme		pci sdscsi

uart +dev
	uarti8250

ip +dev
	tcp
	udp
	ipifc
	icmp
	icmp6
#	ipmux

link +dev
	etherdwmac4
	ethermedium
	loopbackmedium
	netdevmedium
#	usbehci		usbehcipc

misc +dev
	cache

boot cpu
	tcp

rootdir
	boot$CONF.out		boot
	/riscv64/bin/auth/factotum
	/riscv64/bin/ip/ipconfig
	/cfg/example/nvram.coll	nvram

conf
	#include "riscv64.h"

	int cpuserver = 1;
	uvlong cpuhz = 1250*MHZ;	/* cycle tick freq */
	uvlong timebase = 4*MHZ;	/* clint tick freq; from u-boot */
	Membank membanks[] = {		/* (address, size) pairs */
		PHYSMEM+2*MB,	GB-2*MB,	/* don't move Sys */
		PHYSMEM+GB,	3ULL*GB,
		PHYSMEM+4ULL*GB, 4ULL*GB,
		0,
	};
	// char defnvram[] = "#S/sdM0/nvram";
	char defnvram[] = "/boot/nvram";

	uintptr uartregs[] = { PAUart0 };
	int nuart = nelem(uartregs);
	vlong uartfreq = 24000000;	/* from dev tree */
	int prmsdelay = 40;

	/* default; normally we use the mac address that u-boot set */
	uchar ether0mac[] = { 0x6c, 0xcf, 0x39, 0x00, 0x30, 0x25, };

	Soc soc = {
		.ether	 = { (char *)0x16030000, }, // (char *)0x16040000, },
		.l2cache = (char *)0x02010000,
	//	.pci	 = (char *)0x940000000LL, /* pcie0 ecam for cfg space */
	//	.pcictl	 = (char *)0x2b000000,	/* bridge, ctrl regs */
		.pci	 = (char *)0x9c0000000LL, /* pcie1 ecam for cfg space */
		.pcictl	 = (char *)0x2c000000,	/* bridge, ctrl regs */
		.plic    = (char *)0x0c000000,	/* common */
		.wdog0   = (char *)0x13070000,	/* watchdog reset */
		.sdmmc   = (char *)0x16010000,	/* 2 sdio actually */

		.hobbled = 1,			/* mgmt core 0 has M ctxt */
		.dwuart	 = 1,			/* 8250 workaround */
		.idlewakens = 500,	/* ns. to send IPIs to wake wfi cpus */
	};
	/*
	 * irqs from the giant TRM table of global interrupts
	 * disagree with the supplied device tree (off by 3 or 5).
	 */
	Ioconf ioconfs[] = {	/* devices whose drivers vmap their regs */
		/* device tree says 7 (main) 6 (wake) 5 (lpi) */
		{ "ether", 64*KB, &soc.ether[0], Attachenable|7, 0, .xirqs = 0, },
		/* device tree says 78 77 76 */
		{ "ether", 64*KB, &soc.ether[1], Attachenable|78, 1, .xirqs = 0, },
		0
	};
	Ioconf socconf[] = { /* devices without drivers that vmap their regs */
		{ "clint", 64*KB, &soc.clint, },
		{ "l2cache", PGSZ, &soc.l2cache, },
		{ "pci",   256*MB, &soc.pci, },		/* pcie [01] ecam cfg */
		{ "pcictl", 16*MB, &soc.pcictl, },	/* pcie [01] br & ctl */
		{ "plic",  64*MB, &soc.plic, },		/* common */
		{ "uart",  PGSZ, &soc.uart, 32, },	// gt 27 dt 32
		{ "wdog",  PGSZ, &soc.wdog0, 68, },	// gt 63 dt 68
		{ "sdmmc", 64*KB, &soc.sdmmc, 74, 0, }, // gt 69 dt 74
		// { "sdmmc", 64*KB, &soc.sdmmc, 75, 1, }, // gt 70 dt 75
		0
	};

riscv64
	start
	low
	mach
	mtrap
	strap
	mch
	main
	allocb
	arch
	archjh7110
	archrv
	color
	csr
	dmamalloc
	fakepci
#	fakeptenc
	svpbmt
	fp
	fpu
	ioconf
#	kbd
	map
	memory
	mmu
#	pcieplda
	sane
	sbi
	sbicall
	sbiecall
	plic
	trap
	fakeucalloc
port
	alarm
	awaitbit
	byteserial
	chan
	ctype
	dev
	devtab
	edf
	fault
	image
#	latin1
	logpow
	page
	parse
	pgrp
	portclock
	prf
	print
	proc
	ps
	qio
	qlock
	qmalloc
	random
	rebootcmd
	segment
	sysauth
	syscall
	syscallfmt
	sysfile
	sysproc
	sysseg
	systab
	taslock
	tod
	watermarks

#
# controls which directories to look in for source files; must be relative to ..
#
dir
	ip
	port
	../9/port
