Skip to content

Commit

Permalink
Bring in support for Ingenic XBurst JZ4780 and
Browse files Browse the repository at this point in the history
X1000 systems on chips.

Imgtec CI20 and Ingenic CANNA boards supported.

Submitted by:	Alexander Kabaev <[email protected]>
Reviewed by:	Ruslan Bukin <[email protected]>
Sponsored by:	DARPA, AFRL
  • Loading branch information
bukinr committed Nov 19, 2016
1 parent 9caeb43 commit 9a8f61f
Show file tree
Hide file tree
Showing 35 changed files with 8,120 additions and 30 deletions.
30 changes: 0 additions & 30 deletions bin/dd/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/conf.h>
#include <sys/capsicum.h>
#include <sys/disklabel.h>
#include <sys/filio.h>
#include <sys/mtio.h>

#include <assert.h>
#include <capsicum_helpers.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
Expand Down Expand Up @@ -95,10 +92,6 @@ main(int argc __unused, char *argv[])
jcl(argv);
setup();

caph_cache_catpages();
if (cap_enter() == -1 && errno != ENOSYS)
err(1, "unable to enter capability mode");

(void)signal(SIGINFO, siginfo_handler);
(void)signal(SIGINT, terminate);

Expand Down Expand Up @@ -132,8 +125,6 @@ static void
setup(void)
{
u_int cnt;
cap_rights_t rights;
unsigned long cmds[] = { FIODTYPE, MTIOCTOP };

if (in.name == NULL) {
in.name = "stdin";
Expand All @@ -142,20 +133,13 @@ setup(void)
in.fd = open(in.name, O_RDONLY, 0);
if (in.fd == -1)
err(1, "%s", in.name);
if (caph_limit_stdin() == -1)
err(1, "unable to limit capability rights");
}

getfdtype(&in);

cap_rights_init(&rights, CAP_READ, CAP_SEEK);
if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS)
err(1, "unable to limit capability rights");

if (files_cnt > 1 && !(in.flags & ISTAPE))
errx(1, "files is not supported for non-tape devices");

cap_rights_set(&rights, CAP_WRITE, CAP_FTRUNCATE, CAP_IOCTL);
if (out.name == NULL) {
/* No way to check for read access here. */
out.fd = STDOUT_FILENO;
Expand All @@ -172,27 +156,13 @@ setup(void)
if (out.fd == -1) {
out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE);
out.flags |= NOREAD;
cap_rights_clear(&rights, CAP_READ);
}
if (out.fd == -1)
err(1, "%s", out.name);
if (caph_limit_stdout() == -1)
err(1, "unable to limit capability rights");
}

getfdtype(&out);

if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS)
err(1, "unable to limit capability rights");
if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 &&
errno != ENOSYS)
err(1, "unable to limit capability rights");

if (in.fd != STDERR_FILENO && out.fd != STDERR_FILENO) {
if (caph_limit_stderr() == -1)
err(1, "unable to limit capability rights");
}

/*
* Allocate space for the input and output buffers. If not doing
* record oriented I/O, only need a single buffer.
Expand Down
29 changes: 29 additions & 0 deletions sys/mips/conf/CANNA
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CANNA -- Kernel config for Ingenic CANNA board
#
# $FreeBSD$

include "X1000"
ident CANNA

options FDT
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=ingenic/canna.dts

#options KTR
#options KTR_CPUMASK=0x3
#options KTR_MASK=(KTR_GEN)
#options KTR_COMPILE=(KTR_GEN)
#options KTR_VERBOSE

# Uncomment for NFS root
#options BOOTP
#options BOOTP_NFSROOT
#options BOOTP_NFSV3
#options BOOTP_WIRED_TO=dme0
#options BOOTP_COMPAT
options ROOTDEVNAME=\"ufs:mmcsd0s3\"

makeoptions TRAMPLOADADDR=0x88000000

#options VERBOSE_SYSINIT
options PRINTF_BUFR_SIZE=256
31 changes: 31 additions & 0 deletions sys/mips/conf/CI20
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# CI20 -- Kernel config for Creator CI20 board
#
# $FreeBSD$

include "JZ4780"
ident CI20

options FDT
options FDT_DTB_STATIC
makeoptions FDT_DTS_FILE=ingenic/ci20.dts

#options KTR
#options KTR_CPUMASK=0x3
#options KTR_MASK=(KTR_GEN)
#options KTR_COMPILE=(KTR_GEN)
#options KTR_VERBOSE

# Uncomment for NFS root
#options BOOTP
#options BOOTP_NFSROOT
#options BOOTP_NFSV3
#options BOOTP_WIRED_TO=dme0
#options BOOTP_COMPAT

options ROOTDEVNAME=\"ufs:mmcsd0\"

makeoptions TRAMPLOADADDR=0x88000000

#options VERBOSE_SYSINIT
device dme
options PRINTF_BUFR_SIZE=256
92 changes: 92 additions & 0 deletions sys/mips/conf/JZ4780
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# JZ4780 -- Kernel config for Ingenic JZ47XX boards
#
# $FreeBSD$

ident JZ4780
machine mips mipsel
cpu CPU_XBURST
cpu CPU_MIPS4KC

makeoptions KERNLOADADDR=0x80020000
makeoptions ARCH_FLAGS="-EL -march=mips32r2"

# Don't build any modules yet.
makeoptions MODULES_OVERRIDE=""

files "../ingenic/files.jz4780"
hints "JZ4780.hints" #Default places to look for devices.

makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols

options INTRNG # Borrow interrupt code from ARM
options MIPS_NIRQ=264 # 8 cpuintc + 64 intc + 6 * 23 gpio

options DDB
options KDB
options BREAK_TO_DEBUGGER

options COMPAT_FREEBSD10

options SCHED_4BSD #4BSD scheduler
options INET #InterNETworking
options NFSCL #Network Filesystem Client
options NFS_ROOT #NFS usable as /, requires NFSCL
options NFSLOCKD #Network Lock Manager
options PSEUDOFS #Pseudo-filesystem framework
options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions

options FFS #Berkeley Fast Filesystem
options SOFTUPDATES #Enable FFS soft updates support
options UFS_ACL #Support for access control lists
options UFS_DIRHASH #Improve performance on big directories
#options ROOTDEVNAME=\"ufs:ada0\"

options GEOM_LABEL # Provides labelization
options GEOM_PART_GPT # GUID Partition Tables.
#options GEOM_RAID # Soft RAID functionality.

# Debugging for use in -current
#options DEADLKRES #Enable the deadlock resolver
options INVARIANTS #Enable calls of extra sanity checking
options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS
#options WITNESS #Enable checks to detect deadlocks and cycles
#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed

# Make an SMP-capable kernel by default
# options SMP # Symmetric MultiProcessor Kernel

device loop
device ether
#device le
device miibus
device bpf
device md
device uart
device random

device fdt_pinctrl

device clk
device regulator
device ext_resources

device gpio

device scbus
device da

device mmc
device mmcsd

# USB support
options USB_DEBUG # enable debug msgs
options USB_HOST_ALIGN=128 # L2 cache line size
device ohci # OHCI PCI->USB interface
device ehci # EHCI PCI->USB interface (USB 2.0)
device dwcotg # DesignWare HS OTG controller
device usb # USB Bus (required)
#device udbp # USB Double Bulk Pipe devices
device uhid # "Human Interface Devices"
#device ulpt # Printer
device umass # Disks/Mass storage - Requires scbus and da
device ums # Mouse
2 changes: 2 additions & 0 deletions sys/mips/conf/JZ4780.hints
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# $FreeBSD$
# device.hints
89 changes: 89 additions & 0 deletions sys/mips/conf/X1000
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# X1000 -- Kernel config for Ingenic X1000 boards
#
# $FreeBSD$

ident X1000
machine mips mipsel
cpu CPU_XBURST
cpu CPU_MIPS4KC

makeoptions KERNLOADADDR=0x80020000
makeoptions ARCH_FLAGS="-EL -march=mips32r2"

# Don't build any modules yet.
makeoptions MODULES_OVERRIDE=""

files "../ingenic/files.x1000"
hints "X1000.hints" #Default places to look for devices.

makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols

options INTRNG # Borrow interrupt code from ARM
options MIPS_NIRQ=264 # 8 cpuintc + 64 intc + 6 * 23 gpio

options DDB
options KDB
options BREAK_TO_DEBUGGER

options COMPAT_FREEBSD10

options SCHED_4BSD #4BSD scheduler
options INET #InterNETworking
options NFSCL #Network Filesystem Client
options NFS_ROOT #NFS usable as /, requires NFSCL
options NFSLOCKD #Network Lock Manager
options PSEUDOFS #Pseudo-filesystem framework
options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions

options FFS #Berkeley Fast Filesystem
options SOFTUPDATES #Enable FFS soft updates support
options UFS_ACL #Support for access control lists
options UFS_DIRHASH #Improve performance on big directories
#options ROOTDEVNAME=\"ufs:ada0\"

options GEOM_LABEL # Provides labelization
options GEOM_PART_GPT # GUID Partition Tables.
#options GEOM_RAID # Soft RAID functionality.

# Debugging for use in -current
#options DEADLKRES #Enable the deadlock resolver
options INVARIANTS #Enable calls of extra sanity checking
options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS
#options WITNESS #Enable checks to detect deadlocks and cycles
#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed

device loop
device ether
#device le
device miibus
device bpf
device md
device uart
device random

device fdt_pinctrl

device clk
device regulator
device ext_resources

device gpio

device scbus
device da

device mmc
device mmcsd

# USB support
#options USB_DEBUG # enable debug msgs
#options USB_HOST_ALIGN=128 # L2 cache line size
#device ohci # OHCI PCI->USB interface
#device ehci # EHCI PCI->USB interface (USB 2.0)
#device dwcotg # DesignWare HS OTG controller
#device usb # USB Bus (required)
#device udbp # USB Double Bulk Pipe devices
#device uhid # "Human Interface Devices"
#device ulpt # Printer
#device umass # Disks/Mass storage - Requires scbus and da
#device ums # Mouse
2 changes: 2 additions & 0 deletions sys/mips/conf/X1000.hints
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# $FreeBSD$
# device.hints
26 changes: 26 additions & 0 deletions sys/mips/ingenic/files.jz4780
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# $FreeBSD$

mips/ingenic/jz4780_dwc_fdt.c optional dwcotg
mips/ingenic/jz4780_ehci.c optional ehci
mips/ingenic/jz4780_mmc.c optional mmc
mips/ingenic/jz4780_ohci.c optional ohci
mips/ingenic/jz4780_uart.c optional uart

mips/ingenic/jz4780_clock.c standard
mips/ingenic/jz4780_clk_gen.c standard
mips/ingenic/jz4780_clk_otg.c standard
mips/ingenic/jz4780_clk_pll.c standard
mips/ingenic/jz4780_efuse.c standard
mips/ingenic/jz4780_intr.c standard
mips/ingenic/jz4780_gpio.c standard
mips/ingenic/jz4780_machdep.c standard
mips/ingenic/jz4780_nemc.c standard
mips/ingenic/jz4780_pinctrl.c standard
mips/ingenic/jz4780_timer.c standard

# SMP
mips/ingenic/jz4780_mp.c optional smp
mips/ingenic/jz4780_mpboot.S optional smp

# Custom interface between pinctrl and gpio
mips/ingenic/jz4780_gpio_if.m standard
17 changes: 17 additions & 0 deletions sys/mips/ingenic/files.x1000
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# $FreeBSD$

mips/ingenic/jz4780_mmc.c optional mmc
mips/ingenic/jz4780_uart.c optional uart

mips/ingenic/jz4780_clock.c standard
mips/ingenic/jz4780_clk_gen.c standard
mips/ingenic/jz4780_clk_otg.c standard
mips/ingenic/jz4780_clk_pll.c standard
mips/ingenic/jz4780_intr.c standard
mips/ingenic/jz4780_gpio.c standard
mips/ingenic/jz4780_machdep.c standard
mips/ingenic/jz4780_pinctrl.c standard
mips/ingenic/jz4780_timer.c standard

# Custom interface between pinctrl and gpio
mips/ingenic/jz4780_gpio_if.m standard
Loading

0 comments on commit 9a8f61f

Please sign in to comment.