Skip to content

Commit

Permalink
Kernel config files modified to support new machine "pic32".
Browse files Browse the repository at this point in the history
Created dummy files for pic32 drivers.
  • Loading branch information
Sergey committed Apr 27, 2014
1 parent 7ec2108 commit 030bc65
Show file tree
Hide file tree
Showing 43 changed files with 11,170 additions and 112 deletions.
13 changes: 0 additions & 13 deletions sys/conf/files
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@ isofs/cd9660/cd9660_rrip.c optional cd9660
isofs/cd9660/cd9660_util.c optional cd9660
isofs/cd9660/cd9660_vfsops.c optional cd9660
isofs/cd9660/cd9660_vnops.c optional cd9660
kdb/kdb_access.c optional kadb
kdb/kdb_command.c optional kadb
kdb/kdb_ctype.c optional kadb
kdb/kdb_expr.c optional kadb
kdb/kdb_format.c optional kadb
kdb/kdb_input.c optional kadb
kdb/kdb_message.c optional kadb
kdb/kdb_output.c optional kadb
kdb/kdb_pcs.c optional kadb
kdb/kdb_print.c optional kadb
kdb/kdb_runpcs.c optional kadb
kdb/kdb_sym.c optional kadb
kdb/kdb_trap.c optional kadb
kern/init_main.c standard
kern/init_sysent.c standard
kern/kern_acct.c standard
Expand Down
56 changes: 56 additions & 0 deletions sys/mips/conf/GENERIC.pic32
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# GENERIC PIC32MZ target
#
machine "pic32"

cpu "PIC32MZ"
ident GENERIC

# Need to set locally
timezone 8 dst
maxusers 2

# Standard system options
options SWAPPAGER # swap pager (anonymous and swap space)
options VNODEPAGER # vnode pager (mapped files)
options DEVPAGER # device pager (mapped devices)
options DIAGNOSTIC # extra kernel debugging checks
options DEBUG # extra kernel debugging support
options "COMPAT_43" # compatibility with 4.3BSD binaries
options KTRACE # system call tracing support
options "NKMEMCLUSTERS=16" # 4K pages in kernel malloc pool, default 128 pages
options "NMBCLUSTERS=16" # 4K pages in network mbuf pool, default 256/512 pages

# Filesystem options
options FIFO # POSIX fifo support (in all filesystems)
options FFS # fast filesystem with user and group quotas
#options MFS # memory-based filesystem
#options NFS # Sun NFS-compatible filesystem
options UNION # Union filesystem
options KERNFS # kernel data-structure filesystem
options FDESC # user file descriptor filesystem
options PROCFS # /proc filesystem
#options UMAPFS # uid/gid remapping filesystem
#options NULLFS # null layer filesystem
#options LFS # Log-based filesystem (still experimental)
#options PORTAL # portal filesystem (still experimental)

# Networking options
options INET # Internet protocols
options "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP
#options GATEWAY # IP packet forwarding
#options MULTICAST # Multicast support
#options MROUTING # Multicast routing support

#config vmunix swap generic
config vmunix root on sd0a swap on sd0b dumps on sd0b

controller uart0
controller spi0
disk sd0 at spi0 drive 0
disk sd1 at spi0 drive 1

pseudo-device pty 4 # pseudo ptys
pseudo-device bpfilter 1 # packet filter ports
pseudo-device loop
pseudo-device ether
147 changes: 147 additions & 0 deletions sys/mips/conf/Makefile.pic32
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#
# Makefile for 4.4 BSD, pic32 target
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
# /sys/conf/``machineid''
# after which you should do
# config machineid
# Machine generic makefile changes should be made in
# /sys/conf/Makefile.``machinetype''
# after which config should be rerun for all machines of that type.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
#
# -DTRACE compile in kernel tracing hooks
# -DQUOTA compile in file system quotas


# DEBUG is set to -g by config if debugging is requested (config -g).
# PROF is set to -pg by config if profiling is requested (config -p).
AS= ${MIPS_TOOLCHAIN}as ${DEBUG}
CC= ${MIPS_TOOLCHAIN}gcc ${DEBUG} -fno-builtin
LOCALCC= gcc -m32 ${DEBUG}
CPP= cpp
LD= ${MIPS_TOOLCHAIN}gcc
LDFLAGS= -nostdlib -T $A/pic32/bootloader-max32.ld -Wl,-Map=unix.map
SIZE= ${MIPS_TOOLCHAIN}size

# source tree is located via $S relative to the compilation directory
S= ../..
A= $S/mips

INCLUDES= -I. -I$S
COPTS= ${INCLUDES} ${IDENT} -DKERNEL
CFLAGS= -O ${COPTS}

# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
# is marked as config-dependent.

NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<

DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<

PROFILE_C= ${CC} -p -c ${COPTS} $<

NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@
NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@

%OBJS

%CFILES

# load lines for config "xxx" will be emitted as:
# xxx: ${SYSTEM_DEP} swapxxx.o
# ${SYSTEM_LD_HEAD}
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o vnode_if.o
SYSTEM_DEP= Makefile ${SYSTEM_OBJ} $S/libkern/libkern.a
SYSTEM_LD_HEAD= rm -f $@
SYSTEM_LD= -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -L$S/libkern -lkern -o vmunix; \
${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -L$S/libkern -lkern -o vmunix
SYSTEM_LD_TAIL= chmod 755 $@; ${SIZE} $@

%LOAD

$S/libkern/libkern.a:
${MAKE} -C $S/libkern all

newvers:
sh $S/conf/newvers.sh
${CC} $(CFLAGS) -c vers.c

clean:
rm -f eddep *vmunix vmunix.gdb tags *.o locore.i [a-z]*.s \
Errs errs linterrs makelinks

lint: /tmp param.c
@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
$A/pic32/Locore.c ${CFILES} $A/pic32/swapgeneric.c \
ioconf.c param.c

symbols.sort: $A/pic32/symbols.raw
grep -v '^#' $A/pic32/symbols.raw \
| sed 's/^ //' | sort -u > symbols.sort

locore.o: $A/pic32/locore.s $A/include/machAsmDefs.h \
$A/include/machConst.h $A/include/reg.h assym.h
${CPP} ${COPTS} ${PARAM} -DLOCORE $A/pic32/locore.s | \
${AS} -o locore.o

# the following is necessary because autoconf.o depends on #if GENERIC
autoconf.o: Makefile

# the following are necessary because the files depend on the types of
# cpu's included in the system configuration
clock.o machdep.o autoconf.o conf.o: Makefile

# depend on network configuration
uipc_proto.o vfs_conf.o: Makefile

assym.h: genassym
./genassym >assym.h

genassym: $A/pic32/genassym.c machine
${LOCALCC} -nostdinc -fno-builtin ${INCLUDES} -I. ${IDENT} ${PARAM} -o genassym $A/pic32/genassym.c

machine:
ln -s $A/include $@

depend: machine assym.h param.c vnode_if.h
mkdep ${COPTS} ${CFILES} ioconf.c param.c
mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} $A/pic32/genassym.c

links:
egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
sort -u | comm -23 - dontlink | \
sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
sh makelinks && rm -f dontlink

tags:
@echo "see $S/kern/Makefile for tags"

ioconf.o: ioconf.c
${CC} -c ${CFLAGS} ioconf.c

param.c: $S/conf/param.c
rm -f param.c
cp $S/conf/param.c .

param.o: param.c Makefile
${CC} -c ${CFLAGS} ${PARAM} param.c

vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src

%RULES
2 changes: 1 addition & 1 deletion sys/mips/conf/Makefile.pmax
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o vnode_if.o
SYSTEM_DEP= Makefile depend ${SYSTEM_OBJ} $S/libkern/libkern.a
SYSTEM_DEP= Makefile ${SYSTEM_OBJ} $S/libkern/libkern.a
SYSTEM_LD_HEAD= rm -f $@
SYSTEM_LD= -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -L$S/libkern -lkern -o vmunix; \
${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -L$S/libkern -lkern -o vmunix
Expand Down
1 change: 1 addition & 0 deletions sys/mips/conf/devices.pic32
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sd 0
18 changes: 18 additions & 0 deletions sys/mips/conf/files.pic32
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
mips/pic32/autoconf.c standard
mips/pic32/clock.c standard
mips/pic32/conf.c standard
mips/pic32/cons.c standard
mips/pic32/fp.s standard
mips/pic32/machdep.c standard config-dependent
mips/pic32/mem.c standard
mips/pic32/pmap.c standard
mips/pic32/procfs_machdep.c optional procfs
mips/pic32/sys_machdep.c standard
mips/pic32/trap.c standard
mips/pic32/vm_machdep.c standard
mips/dev/uart.c optional uart device-driver
mips/dev/spi.c optional spi device-driver
mips/dev/sd.c optional sd device-driver
netinet/in_cksum.c optional inet
dev/vn.c optional vn
thisisfor_in_proto.c optional hy
1 change: 0 additions & 1 deletion sys/mips/conf/files.pmax
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ mips/ultrix/ultrix_compat.c optional ultrixcompat
mips/ultrix/ultrix_syscalls.c optional ultrixcompat
mips/ultrix/ultrix_sysent.c optional ultrixcompat
netinet/in_cksum.c optional inet
netns/ns_cksum.c optional ns
dev/cd.c optional cd
dev/vn.c optional vn
thisisfor_in_proto.c optional hy
14 changes: 7 additions & 7 deletions sys/mips/dev/asc.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,23 +450,23 @@ struct driver ascdriver = {
* Return true if found and initialized ok.
*/
asc_probe(cp)
register struct pmax_ctlr *cp;
register struct mips_ctlr *cp;
{
register asc_softc_t asc;
register asc_regmap_t *regs;
int unit, id, s, i;
int bufsiz;

if ((unit = cp->pmax_unit) >= NASC)
if ((unit = cp->mips_unit) >= NASC)
return (0);
if (badaddr(cp->pmax_addr + ASC_OFFSET_53C94, 1))
if (badaddr(cp->mips_addr + ASC_OFFSET_53C94, 1))
return (0);
asc = &asc_softc[unit];

/*
* Initialize hw descriptor, cache some pointers
*/
asc->regs = (asc_regmap_t *)(cp->pmax_addr + ASC_OFFSET_53C94);
asc->regs = (asc_regmap_t *)(cp->mips_addr + ASC_OFFSET_53C94);

/*
* Set up machine dependencies.
Expand All @@ -492,8 +492,8 @@ asc_probe(cp)
*/
case DS_3MAX:
default:
asc->dmar = (volatile int *)(cp->pmax_addr + ASC_OFFSET_DMAR);
asc->buff = (u_char *)(cp->pmax_addr + ASC_OFFSET_RAM);
asc->dmar = (volatile int *)(cp->mips_addr + ASC_OFFSET_DMAR);
asc->buff = (u_char *)(cp->mips_addr + ASC_OFFSET_RAM);
bufsiz = PER_TGT_DMA_SIZE;
asc->dma_start = tb_dma_start;
asc->dma_end = tb_dma_end;
Expand Down Expand Up @@ -566,7 +566,7 @@ asc_probe(cp)
asc->st[i].dmaBufSize = bufsiz;
}
printf("asc%d at nexus0 csr 0x%x priority %d SCSI id %d\n",
unit, cp->pmax_addr, cp->pmax_pri, id);
unit, cp->mips_addr, cp->mips_pri, id);
return (1);
}

Expand Down
4 changes: 2 additions & 2 deletions sys/mips/dev/cfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ struct driver cfbdriver = {
*/
/*ARGSUSED*/
cfbprobe(cp)
register struct pmax_ctlr *cp;
register struct mips_ctlr *cp;
{
register struct pmax_fb *fp = &cfbfb;

if (!fp->initialized && !cfbinit(cp->pmax_addr))
if (!fp->initialized && !cfbinit(cp->mips_addr))
return (0);
printf("cfb0 (color display)\n");
return (1);
Expand Down
20 changes: 10 additions & 10 deletions sys/mips/dev/dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,45 +161,45 @@ struct speedtab dcspeedtab[] = {
* Return true if found and initialized ok.
*/
dcprobe(cp)
register struct pmax_ctlr *cp;
register struct mips_ctlr *cp;
{
register dcregs *dcaddr;
register struct pdma *pdp;
register struct tty *tp;
register int cntr;
int s;

if (cp->pmax_unit >= NDC)
if (cp->mips_unit >= NDC)
return (0);
if (badaddr(cp->pmax_addr, 2))
if (badaddr(cp->mips_addr, 2))
return (0);

/*
* For a remote console, wait a while for previous output to
* complete.
*/
if (major(cn_tab.cn_dev) == DCDEV && cp->pmax_unit == 0 &&
if (major(cn_tab.cn_dev) == DCDEV && cp->mips_unit == 0 &&
cn_tab.cn_screen == 0)
DELAY(10000);

/* reset chip */
dcaddr = (dcregs *)cp->pmax_addr;
dcaddr = (dcregs *)cp->mips_addr;
dcaddr->dc_csr = CSR_CLR;
MachEmptyWriteBuffer();
while (dcaddr->dc_csr & CSR_CLR)
;
dcaddr->dc_csr = CSR_MSE | CSR_TIE | CSR_RIE;

/* init pseudo DMA structures */
pdp = &dcpdma[cp->pmax_unit * 4];
tp = &dc_tty[cp->pmax_unit * 4];
pdp = &dcpdma[cp->mips_unit * 4];
tp = &dc_tty[cp->mips_unit * 4];
for (cntr = 0; cntr < 4; cntr++) {
pdp->p_addr = (void *)dcaddr;
pdp->p_arg = (int)tp;
pdp->p_fcn = dcxint;
pdp++, tp++;
}
dcsoftCAR[cp->pmax_unit] = cp->pmax_flags | 0xB;
dcsoftCAR[cp->mips_unit] = cp->mips_flags | 0xB;

if (dc_timer == 0) {
dc_timer = 1;
Expand All @@ -209,7 +209,7 @@ dcprobe(cp)
/*
* Special handling for consoles.
*/
if (cp->pmax_unit == 0) {
if (cp->mips_unit == 0) {
if (cn_tab.cn_screen) {
s = spltty();
dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR |
Expand All @@ -233,7 +233,7 @@ dcprobe(cp)
}
}
printf("dc%d at nexus0 csr 0x%x priority %d\n",
cp->pmax_unit, cp->pmax_addr, cp->pmax_pri);
cp->mips_unit, cp->mips_addr, cp->mips_pri);
return (1);
}

Expand Down
Loading

0 comments on commit 030bc65

Please sign in to comment.