Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -aburN prex-0.9.0/bsp/boot/arm/arch/elf_reloc.c prex-0.9.0-beagle/bsp/boot/arm/arch/elf_reloc.c
- --- prex-0.9.0/bsp/boot/arm/arch/elf_reloc.c 2009-10-01 12:09:22 +0000
- +++ prex-0.9.0-beagle/bsp/boot/arm/arch/elf_reloc.c 2010-08-05 10:53:42 +0000
- @@ -60,6 +60,9 @@
- ELFDBG(("R_ARM_PC24: %lx -> %lx\n",
- (long)where, (long)*where));
- break;
- + case R_ARM_V4BX:
- + /* nothing to do: bx instruction is supported */
- + break;
- default:
- ELFDBG(("Unkown relocation type=%d\n",
- ELF32_R_TYPE(rel->r_info)));
- diff -aburN prex-0.9.0/bsp/boot/arm/arch/head.S prex-0.9.0-beagle/bsp/boot/arm/arch/head.S
- --- prex-0.9.0/bsp/boot/arm/arch/head.S 2009-10-01 12:06:10 +0000
- +++ prex-0.9.0-beagle/bsp/boot/arm/arch/head.S 2010-07-26 22:32:08 +0000
- @@ -47,7 +47,7 @@
- .align
- .code 32
- -stack_end: .word (BOOTSTKTOP - KERNBASE)
- +stack_end: .word (BOOTSTKTOP - KERNOFFSET)
- start_vector:
- mov r0, #0xd3 /* Enter SVC mode, Disable IRQ,FIQ */
- diff -aburN prex-0.9.0/bsp/boot/arm/beagle/Makefile.inc prex-0.9.0-beagle/bsp/boot/arm/beagle/Makefile.inc
- --- prex-0.9.0/bsp/boot/arm/beagle/Makefile.inc 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/boot/arm/beagle/Makefile.inc 2010-01-21 15:31:00 +0000
- @@ -0,0 +1,5 @@
- +
- +SRCS:= arm/arch/head.S \
- + arm/beagle/startup.c \
- + arm/beagle/debug.c
- +
- diff -aburN prex-0.9.0/bsp/boot/arm/beagle/debug.c prex-0.9.0-beagle/bsp/boot/arm/beagle/debug.c
- --- prex-0.9.0/bsp/boot/arm/beagle/debug.c 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/boot/arm/beagle/debug.c 2010-01-21 15:31:00 +0000
- @@ -0,0 +1,97 @@
- +/*-
- + * Copyright (c) 2009, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +#include <sys/param.h>
- +#include <boot.h>
- +
- +#define L4_Per 0x49000000
- +#define L4_UART3 (L4_Per + 0x20000)
- +#define UART_BASE L4_UART3
- +#define UART_THR (*(volatile uint32_t *)(UART_BASE + 0x00))
- +#define UART_DLL (*(volatile uint32_t *)(UART_BASE + 0x00))
- +#define UART_IER (*(volatile uint32_t *)(UART_BASE + 0x04))
- +#define UART_DLH (*(volatile uint32_t *)(UART_BASE + 0x04))
- +#define UART_FCR (*(volatile uint32_t *)(UART_BASE + 0x08))
- +#define UART_LCR (*(volatile uint32_t *)(UART_BASE + 0x0C))
- +#define UART_MCR (*(volatile uint32_t *)(UART_BASE + 0x10))
- +#define UART_LSR (*(volatile uint32_t *)(UART_BASE + 0x14))
- +#define UART_MDR1 (*(volatile uint32_t *)(UART_BASE + 0x20))
- +
- +#define THRE 0x20
- +
- +#define UART_CLK 48000000
- +#define BAUD_RATE 115200
- +
- +#define MCR_DTR 0x01
- +#define MCR_RTS 0x02
- +#define LCR_8N1 0x03
- +#define LCR_BKSE 0x80 /* Bank select enable */
- +
- +#define FCR_FIFO_EN 0x01 /* Fifo enable */
- +#define FCR_RXSR 0x02 /* Receiver soft reset */
- +#define FCR_TXSR 0x04 /* Transmitter soft reset */
- +
- +#define LCRVAL LCR_8N1 /* 8 data, 1 stop, no parity */
- +#define MCRVAL (MCR_DTR | MCR_RTS) /* RTS/DTR */
- +#define FCRVAL (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR) /* Clear & enable FIFOs */
- +
- +/*
- + * Print one chracter
- + */
- +void
- +debug_putc(int c)
- +{
- +
- +#if defined(DEBUG) && defined(CONFIG_DIAG_SERIAL)
- + while ((UART_LSR & THRE) == 0) ;
- + UART_THR = c;
- +#endif
- +}
- +
- +/*
- + * Initialize debug port.
- + */
- +void
- +debug_init(void)
- +{
- +
- +#if defined(DEBUG) && defined(CONFIG_DIAG_SERIAL)
- + int baud_divisor = UART_CLK / 16 / BAUD_RATE;
- +
- + UART_IER = 0x00;
- + UART_MDR1 = 0x7;
- + UART_LCR = LCR_BKSE | LCRVAL;
- + UART_DLL = baud_divisor & 0xff;
- + UART_DLH = (baud_divisor >> 8) & 0xff;
- + UART_LCR = LCRVAL;
- + UART_MCR = MCRVAL;
- + UART_FCR = FCRVAL;
- + UART_MDR1 = 0;
- +#endif
- +}
- diff -aburN prex-0.9.0/bsp/boot/arm/beagle/startup.c prex-0.9.0-beagle/bsp/boot/arm/beagle/startup.c
- --- prex-0.9.0/bsp/boot/arm/beagle/startup.c 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/boot/arm/beagle/startup.c 2010-01-21 15:31:00 +0000
- @@ -0,0 +1,89 @@
- +/*-
- + * Copyright (c) 2009, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +#include <sys/param.h>
- +#include <sys/bootinfo.h>
- +#include <boot.h>
- +
- +#define SDRC_BASE 0x6D000000
- +#define SDRC_MCFG_0 (*(volatile uint32_t *)(SDRC_BASE + 0x80))
- +#define SDRC_MCFG_1 (*(volatile uint32_t *)(SDRC_BASE + 0xB0))
- +
- +/*
- + * Setup boot information.
- + */
- +static void
- +bootinfo_init(void)
- +{
- + struct bootinfo *bi = bootinfo;
- +
- + uint32_t size0 = 0, size1 = 0;
- +
- + /*
- + * Screen size
- + */
- + bi->video.text_x = 80;
- + bi->video.text_y = 25;
- +
- + /*
- + * SDRAM - Autodetect
- + * Should be 128 MB on RevA/B and 256MB on RevC
- + */
- +
- + size0 = SDRC_MCFG_0 >> 8;
- + size0 &= 0x3FF; /* get bank size in 2-MB chunks */
- + size0 *= 0x200000; /* compute size */
- + size1 = SDRC_MCFG_1 >> 8;
- + size1 &= 0x3FF; /* get bank size in 2-MB chunks */
- + size1 *= 0x200000; /* compute size */
- +
- + bi->ram[0].base = 0x80000000;
- + bi->ram[0].size = size0;
- + bi->ram[0].type = MT_USABLE;
- + if (size1 > 0) {
- + /*
- + * Normally, we are started from U-Boot and
- + * it should have made memory banks contiguous...
- + */
- + bi->ram[1].base = 0x80000000+size0;
- + bi->ram[1].size = size1;
- + bi->ram[1].type = MT_USABLE;
- + bi->nr_rams = 2;
- + } else {
- + bi->nr_rams = 1;
- + }
- +
- +}
- +
- +void
- +startup(void)
- +{
- +
- + bootinfo_init();
- +}
- diff -aburN prex-0.9.0/bsp/boot/common/elf.c prex-0.9.0-beagle/bsp/boot/common/elf.c
- --- prex-0.9.0/bsp/boot/common/elf.c 2009-07-28 13:45:20 +0000
- +++ prex-0.9.0-beagle/bsp/boot/common/elf.c 2010-08-05 10:56:14 +0000
- @@ -72,7 +72,8 @@
- if (nr_img == 0) {
- /* Initialize the load address */
- - load_base = (vaddr_t)ptokv(phdr->p_paddr);
- + /* load_base = (vaddr_t)ptokv(phdr->p_paddr); */
- + load_base = (paddr_t)kvtop(phdr->p_vaddr);
- if (load_base == 0) {
- DPRINTF(("Invalid load address\n"));
- return -1;
- @@ -185,7 +186,10 @@
- for (i = 0; i < nr_reloc; i++) {
- sym = &sym_table[ELF32_R_SYM(rela->r_info)];
- ELFDBG(("%s\n", strtab + sym->st_name));
- - if (sym->st_shndx != STN_UNDEF) {
- + if (sym->st_info == 0) {
- + /* Empty symbol used for R_ARM_V4BX, etc */
- + sym_val = sym->st_value;
- + } else if (sym->st_shndx != STN_UNDEF) {
- sym_val = (Elf32_Addr)sect_addr[sym->st_shndx]
- + sym->st_value;
- if (relocate_rela(rela, sym_val, target_sect) != 0)
- @@ -213,7 +217,10 @@
- for (i = 0; i < nr_reloc; i++) {
- sym = &sym_table[ELF32_R_SYM(rel->r_info)];
- ELFDBG(("%s\n", strtab + sym->st_name));
- - if (sym->st_shndx != STN_UNDEF) {
- + if (sym->st_info == 0) {
- + /* Empty symbol used for R_ARM_V4BX, etc */
- + sym_val = sym->st_value;
- + } else if (sym->st_shndx != STN_UNDEF) {
- sym_val = (Elf32_Addr)sect_addr[sym->st_shndx]
- + sym->st_value;
- if (relocate_rel(rel, sym_val, target_sect) != 0)
- diff -aburN prex-0.9.0/bsp/drv/dev/serial/Makefile.inc prex-0.9.0-beagle/bsp/drv/dev/serial/Makefile.inc
- --- prex-0.9.0/bsp/drv/dev/serial/Makefile.inc 2009-10-01 12:33:28 +0000
- +++ prex-0.9.0-beagle/bsp/drv/dev/serial/Makefile.inc 2010-01-21 15:31:00 +0000
- @@ -2,3 +2,4 @@
- SRCS-$(CONFIG_SERIAL)+= dev/serial/serial.c
- SRCS-$(CONFIG_NS16550)+= dev/serial/ns16550.c
- SRCS-$(CONFIG_PL011)+= dev/serial/pl011.c
- +SRCS-$(CONFIG_OMAP3_UART)+= dev/serial/omap3_uart.c
- diff -aburN prex-0.9.0/bsp/drv/dev/serial/omap3_uart.c prex-0.9.0-beagle/bsp/drv/dev/serial/omap3_uart.c
- --- prex-0.9.0/bsp/drv/dev/serial/omap3_uart.c 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/drv/dev/serial/omap3_uart.c 2010-09-26 20:04:50 +0000
- @@ -0,0 +1,285 @@
- +/*-
- + * Copyright (c) 2009, Kohsuke Ohtani
- + * Copyright (c) 2009-2010, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +/*
- + * omap3_uart.c - OMAP3 integrated UART device driver
- + */
- +
- +#include <driver.h>
- +#include <tty.h>
- +#include <serial.h>
- +
- +/* #define DEBUG_OMAP3_UART 1 */
- +
- +#ifdef DEBUG_OMAP3_UART
- +#define DPRINTF(a) printf a
- +#else
- +#define DPRINTF(a)
- +#endif
- +
- +#define UART_BASE CONFIG_OMAP3_UART_BASE
- +#define UART_IRQ CONFIG_OMAP3_UART_IRQ
- +
- +#define UART_CLK 48000000
- +#define BAUD_RATE 115200
- +
- +#ifdef CONFIG_MMU
- +#define INTCPS_ILR(a) (0xa8200100 + (0x04*a))
- +#else
- +#define INTCPS_ILR(a) (0x48200100 + (0x04*a))
- +#endif
- +
- +/* Register offsets UART in OMAP35 SoC */
- +#define UART_RHR (UART_BASE + 0x00) /* receive buffer register */
- +#define UART_THR (UART_BASE + 0x00) /* transmit holding register */
- +#define UART_IER (UART_BASE + 0x04) /* interrupt enable register */
- +#define UART_FCR (UART_BASE + 0x08) /* FIFO control register */
- +#define UART_IIR (UART_BASE + 0x08) /* interrupt identification register */
- +#define UART_LCR (UART_BASE + 0x0C) /* line control register */
- +#define UART_MCR (UART_BASE + 0x10) /* modem control register */
- +#define UART_LSR (UART_BASE + 0x14) /* line status register */
- +#define UART_MSR (UART_BASE + 0x18) /* mode definition register */
- +#define UART_MDR1 (UART_BASE + 0x20) /* modem status register */
- +#define UART_DLL (UART_BASE + 0x00) /* divisor latch LSB (LCR[7] = 1) */
- +#define UART_DLH (UART_BASE + 0x04) /* divisor latch MSB (LCR[7] = 1) */
- +
- +/* Interrupt enable register */
- +#define IER_RDA 0x01 /* enable receive data available */
- +#define IER_THRE 0x02 /* enable transmitter holding register empty */
- +#define IER_RLS 0x04 /* enable recieve line status */
- +#define IER_RMS 0x08 /* enable receive modem status */
- +
- +/* Interrupt identification register */
- +#define IIR_MSR 0x00 /* modem status change */
- +#define IIR_IP 0x01 /* 0 when interrupt pending */
- +#define IIR_TXB 0x02 /* transmitter holding register empty */
- +#define IIR_RXB 0x04 /* received data available */
- +#define IIR_LSR 0x06 /* line status change */
- +#define IIR_RXTO 0x0C /* receive data timeout */
- +#define IIR_MASK 0x0E /* mask off just the meaningful bits */
- +
- +/* line status register */
- +#define LSR_RCV_FIFO 0x80
- +#define LSR_TSRE 0x40 /* Transmitter empty: byte sent */
- +#define LSR_TXRDY 0x20 /* Transmitter buffer empty */
- +#define LSR_BI 0x10 /* Break detected */
- +#define LSR_FE 0x08 /* Framing error: bad stop bit */
- +#define LSR_PE 0x04 /* Parity error */
- +#define LSR_OE 0x02 /* Overrun, lost incoming byte */
- +#define LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */
- +#define LSR_RCV_MASK 0x1f /* Mask for incoming data or error */
- +
- +/* Bit definitions for line control */
- +#define LCR_BITS_MASK 0x03
- +#define LCR_STB2 0x04
- +#define LCR_PEN 0x08
- +#define LCR_EPS 0x10
- +#define LCR_SPS 0x20
- +#define LCR_BREAK 0x40
- +#define LCR_DLAB 0x80
- +
- +/* Bit definitions for modem control */
- +#define MCR_DTR 0x01
- +#define MCR_RTS 0x02
- +#define MCR_CDSTSCH 0x08
- +#define MCR_LOOPBACK 0x10
- +#define MCR_XON 0x20
- +#define MCR_TCRTLR 0x40
- +#define MCR_CLKSEL 0x80
- +
- +/* Bit definitions for fifo control register */
- +#define FCR_ENABLE 0x01
- +#define FCR_RXCLR 0x02
- +#define FCR_TXCLR 0x04
- +#define FCR_DMA 0x08
- +
- +/* Mode settings for mode definition register 1 */
- +#define MDR1_ENABLE 0x00
- +#define MDR1_AUTOBAUD 0x02
- +#define MDR1_DISABLE 0x07
- +
- +/* Forward functions */
- +static void omap3_uart_xmt_char(struct serial_port *, char);
- +static char omap3_uart_rcv_char(struct serial_port *);
- +static void omap3_uart_set_poll(struct serial_port *, int);
- +static int omap3_uart_isr(void *);
- +static void omap3_uart_start(struct serial_port *);
- +static void omap3_uart_stop(struct serial_port *);
- +static int omap3_uart_init(struct driver *);
- +
- +
- +struct driver omap3_uart_driver = {
- + /* name */ "omap3_uart",
- + /* devops */ NULL,
- + /* devsz */ 0,
- + /* flags */ 0,
- + /* probe */ NULL,
- + /* init */ omap3_uart_init,
- + /* unload */ NULL,
- +};
- +
- +static struct serial_ops omap3_uart_ops = {
- + /* xmt_char */ omap3_uart_xmt_char,
- + /* rcv_char */ omap3_uart_rcv_char,
- + /* set_poll */ omap3_uart_set_poll,
- + /* start */ omap3_uart_start,
- + /* stop */ omap3_uart_stop,
- +};
- +
- +
- +static struct serial_port omap3_uart_port;
- +
- +
- +static void
- +omap3_uart_xmt_char(struct serial_port *sp, char c)
- +{
- + struct tty *tp = sp->tty;
- + struct tty_queue *tq = &tp->t_outq;
- +
- +#define ttyq_empty(q) ((q)->tq_count == 0)
- +
- + while (!(bus_read_16(UART_LSR) & LSR_TXRDY))
- + ;
- + bus_write_16(UART_THR, (uint32_t)c);
- +
- + if(ttyq_empty(tq))
- + serial_xmt_done(sp);
- +
- +}
- +
- +static char
- +omap3_uart_rcv_char(struct serial_port *sp)
- +{
- + char c;
- +
- +
- + while (!(bus_read_16(UART_LSR) & LSR_RXRDY))
- + ;
- + c = bus_read_16(UART_RHR) & 0xff;
- + return c;
- +}
- +
- +static void
- +omap3_uart_set_poll(struct serial_port *sp, int on)
- +{
- +
- + if (on) {
- + /* Disable interrupt for polling mode. */
- + bus_write_16(UART_IER, 0x00);
- + } else {
- + /* enable interrupt again */
- + bus_write_16(UART_IER, IER_RDA|IER_RLS);
- + }
- +}
- +
- +static int
- +omap3_uart_isr(void *arg)
- +{
- + struct serial_port *sp = arg;
- + char c;
- +
- + switch ( bus_read_16(UART_IIR) & IIR_MASK) {
- + case IIR_LSR: /* Line status change */
- + if( bus_read_16(UART_LSR) & (LSR_BI|LSR_FE|LSR_PE|LSR_OE) ) {
- + /*
- + * Status error
- + * Read whatever happens to be in the buffer to "eat" the
- + * spurious data associated with break, parity error, etc.
- + */
- + bus_read_16(UART_RHR);
- + }
- + /* Read LSR again to clear interrupt */
- + bus_read_16(UART_LSR);
- + break;
- + case IIR_RXTO: /* Receive data timeout */
- + /*
- + * "Eat" the spurious data (same as above).
- + * This also clears the interrupt.
- + */
- + bus_read_16(UART_RHR);
- + break;
- + case IIR_RXB: /* Received data available */
- + c = bus_read_16(UART_RHR) & 0xff; /* Read pending data */
- + serial_rcv_char(sp, c);
- + break;
- + case IIR_TXB: /* Transmitter holding register empty */
- + bus_read_16(UART_IIR); /* Clear interrupt */
- + serial_xmt_done(sp);
- + break;
- + default:
- + break;
- + }
- + return 0;
- +}
- +
- +static void
- +omap3_uart_start(struct serial_port *sp)
- +{
- + int baud_divisor = UART_CLK / 16 / BAUD_RATE;
- +
- + bus_write_16(UART_IER, 0x00);
- + bus_write_16(UART_MDR1, MDR1_DISABLE);
- + bus_write_16(UART_LCR, LCR_DLAB|LCR_BITS_MASK);
- + bus_write_16(UART_DLL, baud_divisor & 0xff);
- + bus_write_16(UART_DLH, (baud_divisor >> 8) & 0xff);
- + bus_write_16(UART_LCR, LCR_BITS_MASK);
- + bus_write_16(UART_MCR, MCR_DTR|MCR_RTS);
- + bus_write_16(UART_FCR, FCR_RXCLR|FCR_TXCLR);
- + bus_write_16(UART_MDR1, MDR1_ENABLE);
- +
- + DPRINTF(("Installing UART IRQ\n"));
- +
- + /* Install interrupt handler */
- + sp->irq = irq_attach(UART_IRQ, IPL_COMM, 0, omap3_uart_isr,
- + IST_NONE, sp);
- +
- + /* Enable interrupts */
- + bus_write_32(INTCPS_ILR(UART_IRQ), ((NIPLS-IPL_COMM)<<2));
- + bus_write_16(UART_IER, IER_RDA|IER_RLS);
- + DPRINTF(("UART interrupt enabled\n"));
- +}
- +
- +static void
- +omap3_uart_stop(struct serial_port *sp)
- +{
- +
- + /* Disable interrupts */
- + bus_write_16(UART_IER, 0x00);
- + /* Disable UART */
- + bus_write_16(UART_MDR1, MDR1_DISABLE);
- +}
- +
- +static int
- +omap3_uart_init(struct driver *self)
- +{
- +
- + serial_attach(&omap3_uart_ops, &omap3_uart_port);
- + return 0;
- +}
- diff -aburN prex-0.9.0/bsp/hal/arm/arch/cpufunc.S prex-0.9.0-beagle/bsp/hal/arm/arch/cpufunc.S
- --- prex-0.9.0/bsp/hal/arm/arch/cpufunc.S 2009-10-01 12:28:48 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/arch/cpufunc.S 2010-09-26 19:15:28 +0000
- @@ -1,5 +1,6 @@
- /*-
- * Copyright (c) 2008, Kohsuke Ohtani
- + * Copyright (c) 2010, Richard Pandion
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- @@ -68,8 +69,9 @@
- * Set TTB
- */
- ENTRY(set_ttb)
- + mov r1,#0
- mcr p15, 0, r0, c2, c0, 0 /* load new TTB */
- - mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */
- + mcr p15, 0, r1, c8, c7, 0 /* invalidate I+D TLBs */
- nop
- nop
- nop
- @@ -79,11 +81,32 @@
- * Switch TTB for context switch
- */
- ENTRY(switch_ttb)
- - mcr p15, 0, r0, c7, c5, 0 /* flush I cache */
- - mcr p15, 0, r0, c7, c6, 0 /* flush D cache */
- - mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */
- - mcr p15, 0, r0, c2, c0, 0 /* set the new TTB */
- - mcr p15, 0, r0, c8, c7, 0 /* and flush the I+D tlbs */
- +#ifdef __beagle__
- + mrc p15, 1, r1, c0, c0, 0 /* read CSIDR */
- + ldr r2, =0x7fff
- + ands r2, r2, r1, lsr #13 /* extract number of sets */
- +1:
- + mov r1, #0 /* start with way #1 */
- + orr r1, r1, r2, lsl #6 /* set the set number */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + add r1, r1, #0x40000000 /* then way #2 */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + add r1, r1, #0x40000000 /* now way #3 */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + add r1, r1, #0x40000000 /* end with way #4 */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + subs r2, r2, #1 /* decrement the set */
- + bge 1b
- + mov r1,#0
- + mcr p15, 0, r1, c7, c5, 0 /* flush I cache */
- +#else
- + mov r1,#0
- + mcr p15, 0, r1, c7, c5, 0 /* flush I cache */
- + mcr p15, 0, r1, c7, c6, 0 /* flush D cache */
- +#endif
- + mcr p15, 0, r1, c7, c10, 4 /* drain the write buffer */
- + mcr p15, 0, r0, c2, c0, 0 /* load new TTB */
- + mcr p15, 0, r1, c8, c7, 0 /* invalidate I+D TLBs */
- nop
- nop
- nop
- @@ -93,7 +116,11 @@
- * Flush TLB
- */
- ENTRY(flush_tlb)
- - mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */
- + mov r1,#0
- + mcr p15, 0, r1, c8, c7, 0 /* invalidate I+D TLBs */
- + nop
- + nop
- + nop
- mov pc, lr
- #endif /* !CONFIG_MMU */
- @@ -102,9 +129,30 @@
- * Flush all cache
- */
- ENTRY(flush_cache)
- - mcr p15, 0, r0, c7, c5, 0 /* flush I cache */
- - mcr p15, 0, r0, c7, c6, 0 /* flush D cache */
- - mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */
- +#ifdef __beagle__
- + mrc p15, 1, r1, c0, c0, 0 /* read CSIDR */
- + ldr r2, =0x7fff
- + ands r2, r2, r1, lsr #13 /* extract number of sets */
- +1:
- + mov r1, #0 /* start with way #1 */
- + orr r1, r1, r2, lsl #6 /* set the set number */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + add r1, r1, #0x40000000 /* then way #2 */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + add r1, r1, #0x40000000 /* now way #3 */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + add r1, r1, #0x40000000 /* end with way #4 */
- + mcr p15, 0, r1, c7, c14, 2 /* clean & invalidate by set/way */
- + subs r2, r2, #1 /* decrement the set */
- + bge 1b
- + mov r1,#0
- + mcr p15, 0, r1, c7, c5, 0 /* flush I cache */
- +#else
- + mov r1,#0
- + mcr p15, 0, r1, c7, c5, 0 /* flush I cache */
- + mcr p15, 0, r1, c7, c6, 0 /* flush D cache */
- +#endif
- + mcr p15, 0, r1, c7, c10, 4 /* drain write buffer */
- mov pc, lr
- .end
- diff -aburN prex-0.9.0/bsp/hal/arm/arch/locore.S prex-0.9.0-beagle/bsp/hal/arm/arch/locore.S
- --- prex-0.9.0/bsp/hal/arm/arch/locore.S 2009-07-29 09:52:52 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/arch/locore.S 2010-09-26 19:15:46 +0000
- @@ -1,5 +1,6 @@
- /*-
- * Copyright (c) 2005-2007, Kohsuke Ohtani
- + * Copyright (c) 2010, Richard Pandion
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- @@ -47,9 +48,7 @@
- * Kernel start point
- */
- ENTRY(kernel_start)
- -#ifdef CONFIG_MMU
- b reset_entry /* Relative jump */
- -#endif
- vector_start:
- /*
- * Exception vector
- @@ -62,7 +61,7 @@
- ldr pc, swi_target /* 0x08 mode: svc */
- ldr pc, prefetch_target /* 0x0c mode: abort */
- ldr pc, abort_target /* 0x10 mode: abort */
- - nop /* 0x14 reserved */
- + ldr pc, unused_target /* 0x14 unused */
- ldr pc, irq_target /* 0x18 mode: irq */
- ldr pc, fiq_target /* 0x1c mode: fiq */
- @@ -71,6 +70,7 @@
- swi_target: .word syscall_entry
- prefetch_target: .word prefetch_entry
- abort_target: .word abort_entry
- +unused_target: .word unused_entry
- irq_target: .word interrupt_entry
- fiq_target: .word fiq_entry
- @@ -118,31 +118,50 @@
- #ifdef CONFIG_MMU
- /*
- - * Setup control register
- + * Setup control register with default values
- */
- - mov r0, #CTL_DEFAULT
- +#ifdef __beagle__
- + ldr r1, =(CTL_AFE | CTL_TRE | CTL_ICACHE | CTL_BPRD | CTL_CACHE | CTL_MMU)
- + mrc p15, 0, r0, c1, c0, 0
- + bic r0, r0, r1
- mcr p15, 0, r0, c1, c0, 0
- + /*
- + * Disable L2 cache and set cache level to 0
- + */
- + mrc p15, 0, r0, c1, c0, 1 /* Read auxiliary control register */
- + ldr r1,=(AUXCTL_L2EN)
- + bic r0, r0, r1 /* Disable L2 cache */
- + mcr p15, 0, r0, c1, c0, 1 /* Load auxiliary control register... */
- + mrc p15, 0, r0, c1, c0, 1 /* ...and read it back */
- + ldr r0, =0x0
- + mcr p15, 2, r0, c0, c0, 0 /* set cache level to 0 in CSSR */
- +#else
- + ldr r0, =(CTL_32BP | CTL_32BD | CTL_LABT)
- + mcr p15, 0, r0, c1, c0, 0
- +#endif
- /*
- - * Initialize page table
- - * The physical address 0-4M is mapped on virtual address 2G.
- + * Initialize boot page directory
- */
- - mov r1, #BOOT_PGD_PHYS /* Clear page directory */
- - mov r2, #(BOOT_PGD_PHYS + 0x4000) /* +16k */
- - mov r0, #0
- + ldr r1, =BOOT_PGD_PHYS /* Page directory base address */
- + add r2, r1, #0x4000 /* 16k in size */
- + ldr r0, =0x0
- 1:
- str r0, [r1], #4
- teq r1, r2
- bne 1b
- - mov r1, #(BOOT_PGD_PHYS + 0x2000) /* Set PTE0 address in pgd */
- - mov r0, #BOOT_PTE0_PHYS /* WBUF/CACHE/SYSTEM attribute */
- - orr r0, r0, #0x03
- - str r0, [r1]
- -
- - mov r1, #BOOT_PTE0_PHYS /* Fill boot page table entry */
- - add r2, r1, #0x1000
- - mov r0, #0x1e
- + /*
- + * Initialize boot page table entries for 4 sections of 1 MB each
- + * (to map first 4 MB of RAM - see below)
- + */
- + ldr r1, =BOOT_PTE0_PHYS /* Page table entry base address */
- + add r2, r1, #0x1000 /* 4K in size (1k per section x 4 sections) */
- +#ifdef __beagle__
- + ldr r0, =(RAMBASE | 0x1a) /* We map from RAMBASE */
- +#else
- + ldr r0, =(RAMBASE | 0x55a) /* We map from RAMBASE */
- +#endif
- 1:
- str r0, [r1], #4
- add r0, r0, #0x1000
- @@ -150,44 +169,44 @@
- bne 1b
- /*
- - * Enable paging
- - * The physical address 0-4M is temporarily mapped to virtial
- - * address 0-4M. This is needed to enable paging.
- - */
- - mov r1, #BOOT_PGD_PHYS /* Set PTE0 address in pgd */
- - mov r0, #BOOT_PTE0_PHYS /* WBUF/CACHE/SYSTEM attribute */
- - orr r0, r0, #0x03
- + * Map first 4 MB of RAM on KERNBASE virtual address
- + * Also map 1:1. This is required to enable paging
- + */
- + ldr r1, =(BOOT_PGD_PHYS + (KERNBASE >> 18))
- + ldr r2, =(BOOT_PGD_PHYS + (RAMBASE >> 18))
- + ldr r0, =(BOOT_PTE0_PHYS | 0x01)
- + str r0, [r1], #4
- + str r0, [r2], #4
- + add r0, r0, #0x400
- + str r0, [r1], #4
- + str r0, [r2], #4
- + add r0, r0, #0x400
- + str r0, [r1], #4
- + str r0, [r2], #4
- + add r0, r0, #0x400
- str r0, [r1]
- + str r0, [r2], #4
- - mov r0, #0
- - mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */
- - mcr p15, 0, r0, c8, c7, 0 /* flush I,D TLBs */
- - mov r1, #BOOT_PGD_PHYS
- - mcr p15, 0, r1, c2, c0, 0 /* load page table pointer */
- - mov r0, #-1
- - mcr p15, 0, r0, c3, c0 /* load domain access register */
- - mrc p15, 0, r0, c1, c0, 0
- - orr r0, r0, #0x1000 /* I-cache enable */
- - orr r0, r0, #0x003d /* Write buffer, mmu */
- - mcr p15, 0, r0, c1, c0, 0
- + mcr p15, 0, r0, c7, c10, 4 /* Drain the write buffer */
- + ldr r1, =BOOT_PGD_PHYS
- + mcr p15, 0, r1, c2, c0, 0 /* Load page table pointer */
- + mcr p15, 0, r0, c8, c7, 0 /* Flush I,D TLBs */
- + ldr r0, =0x55555555 /* AP is defined in page table entries */
- + mcr p15, 0, r0, c3, c0 /* Load domain access register */
- + mrc p15, 0, r0, c1, c0, 0 /* Read control register */
- + ldr r1, =(CTL_ICACHE | CTL_BPRD | CTL_CACHE | CTL_MMU)
- + orr r0, r0, r1 /* Enable MMU, caches and branch prediction */
- + ldr r1, =(CTL_AFLT)
- + bic r0, r0, r1 /* Disable alignment checks */
- + mcr p15, 0, r0, c1, c0, 0 /* Load control register... */
- + mrc p15, 0, r0, c1, c0, 0 /* ...and read it back */
- /*
- - * Reload PC register for virutal address.
- + * Reload PC register for virtual address.
- */
- ldr pc, reload_pc_target /* Reset pc here */
- reload_pc:
- - /*
- - * Unmap 0-4M.
- - * Since the first page must be accessible for exception
- - * vector, we have to map it later.
- - */
- - mov r1, #BOOT_PGD_PHYS /* Set PTE0 address in pgd */
- - add r1, r1, #KERNBASE
- - mov r0, #0
- - str r0, [r1]
- - mcr p15, 0, r0, c8, c7, 0 /* flush I,D TLBs */
- -
- #endif /* !CONFIG_MMU */
- /*
- @@ -418,6 +437,9 @@
- nop /* Instruction gap for ldm^ */
- movs pc, lr /* Exit, with restoring cpsr */
- +ENTRY(unused_entry)
- + b unused_entry /* Not support... */
- +
- ENTRY(fiq_entry)
- b fiq_entry /* Not support... */
- diff -aburN prex-0.9.0/bsp/hal/arm/arch/mmu.c prex-0.9.0-beagle/bsp/hal/arm/arch/mmu.c
- --- prex-0.9.0/bsp/hal/arm/arch/mmu.c 2009-10-01 12:28:56 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/arch/mmu.c 2010-09-27 05:51:24 +0000
- @@ -1,5 +1,6 @@
- /*-
- * Copyright (c) 2008-2009, Kohsuke Ohtani
- + * Copyright (c) 2010, Richard Pandion
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- @@ -126,19 +127,16 @@
- pte_flag = 0;
- break;
- case PG_READ:
- - pte_flag = (uint32_t)(PTE_PRESENT | PTE_WBUF | PTE_CACHE |
- - PTE_USER_RO);
- + pte_flag = (uint32_t)(PTE_PRESENT | PTE_CACHE | PTE_USER_RO);
- break;
- case PG_WRITE:
- - pte_flag = (uint32_t)(PTE_PRESENT | PTE_WBUF | PTE_CACHE |
- - PTE_USER_RW);
- + pte_flag = (uint32_t)(PTE_PRESENT | PTE_CACHE | PTE_USER_RW);
- break;
- case PG_SYSTEM:
- - pte_flag = (uint32_t)(PTE_PRESENT | PTE_WBUF | PTE_CACHE |
- - PTE_SYSTEM);
- + pte_flag = (uint32_t)(PTE_PRESENT | PTE_CACHE | PTE_SYSTEM);
- break;
- case PG_IOMEM:
- - pte_flag = (uint32_t)(PTE_PRESENT | PTE_SYSTEM);
- + pte_flag = (uint32_t)(PTE_PRESENT | PTE_WBUF | PTE_SYSTEM);
- break;
- default:
- panic("mmu_map");
- @@ -199,7 +197,7 @@
- memcpy(&pgd[i], &boot_pgd[i], (size_t)(L1TBL_SIZE - i * 4));
- /* Map vector page (address 0) */
- - mmu_map(pgd, 0, 0, PAGE_SIZE, PG_SYSTEM);
- + mmu_map(pgd, CONFIG_RAM_BASE, CONFIG_ARM_VECTORS, PAGE_SIZE, PG_SYSTEM);
- return pgd;
- }
- @@ -278,10 +276,14 @@
- mmu_premap(paddr_t phys, vaddr_t virt)
- {
- pte_t pte = (pte_t)BOOT_PTE1;
- + int pte_index;
- - memset(pte, 0, L2TBL_SIZE);
- boot_pgd[PAGE_DIR(virt)] = (uint32_t)kvtop(pte) | PDE_PRESENT;
- - pte[PAGE_TABLE(virt)] = (uint32_t)phys | PTE_PRESENT | PTE_SYSTEM;
- + for (pte_index = 0; pte_index < L2TBL_SIZE ; pte_index++) {
- + pte[pte_index] = (uint32_t)phys | PTE_PRESENT | PTE_WBUF | PTE_SYSTEM;
- + phys += 0x1000;
- + }
- +
- flush_tlb();
- }
- @@ -320,6 +322,6 @@
- /*
- * Map vector page.
- */
- - if (mmu_map(boot_pgd, 0, CONFIG_ARM_VECTORS, PAGE_SIZE, PG_SYSTEM))
- + if (mmu_map(boot_pgd, CONFIG_RAM_BASE, CONFIG_ARM_VECTORS, PAGE_SIZE, PG_SYSTEM))
- panic("mmu_init");
- }
- diff -aburN prex-0.9.0/bsp/hal/arm/beagle/Makefile.inc prex-0.9.0-beagle/bsp/hal/arm/beagle/Makefile.inc
- --- prex-0.9.0/bsp/hal/arm/beagle/Makefile.inc 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/beagle/Makefile.inc 2010-07-07 23:02:06 +0000
- @@ -0,0 +1,17 @@
- +
- +SRCS:= arm/arch/locore.S \
- + arm/beagle/locore_beagle.S \
- + arm/arch/cpufunc.S \
- + arm/arch/cpu.c \
- + arm/arch/trap.c \
- + arm/arch/context.c \
- + arm/beagle/interrupt.c \
- + arm/beagle/clock.c \
- + arm/beagle/machdep.c
- +
- +ifeq ($(CONFIG_MMU),y)
- +SRCS+= arm/arch/mmu.c
- +endif
- +ifeq ($(DEBUG),1)
- +SRCS+= arm/beagle/diag.c
- +endif
- diff -aburN prex-0.9.0/bsp/hal/arm/beagle/clock.c prex-0.9.0-beagle/bsp/hal/arm/beagle/clock.c
- --- prex-0.9.0/bsp/hal/arm/beagle/clock.c 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/beagle/clock.c 2010-09-26 19:16:36 +0000
- @@ -0,0 +1,127 @@
- +/*-
- + * Copyright (c) 2009-2010, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +/*
- + * clock.c - clock driver
- + */
- +
- +#include <kernel.h>
- +#include <timer.h>
- +#include <irq.h>
- +#include <cpufunc.h>
- +#include <sys/ipl.h>
- +
- +#include "platform.h"
- +
- +/* Interrupt vector for timer (GPTIMER2) */
- +#define CLOCK_IRQ 38
- +
- +/* The clock rate per second - 32Khz */
- +/* We are using the 32 Khz clock in order to get accurate 1 ms tick rate */
- +#define CLOCK_RATE 32768L
- +
- +/* The initial counter value */
- +#define TIMER_COUNT (CLOCK_RATE / HZ)
- +
- +/* PRCM registers for timer */
- +#define CM_FCLKEN_PER (*(volatile uint32_t *)(PER_CM_BASE + 0x00))
- +#define CM_ICLKEN_PER (*(volatile uint32_t *)(PER_CM_BASE + 0x10))
- +#define CM_CLKSEL_PER (*(volatile uint32_t *)(PER_CM_BASE + 0x40))
- +
- +/* Timer 2 registers (32 bit regs) */
- +#define TIDR (*(volatile uint32_t *)(TIMER_BASE + 0x00)) /* r */
- +#define TIOCP_CFG (*(volatile uint32_t *)(TIMER_BASE + 0x10)) /* rw */
- +#define TISTAT (*(volatile uint32_t *)(TIMER_BASE + 0x14)) /* r */
- +#define TISR (*(volatile uint32_t *)(TIMER_BASE + 0x18)) /* rw */
- +#define TIER (*(volatile uint32_t *)(TIMER_BASE + 0x1C)) /* rw */
- +#define TWER (*(volatile uint32_t *)(TIMER_BASE + 0x20)) /* rw */
- +#define TCLR (*(volatile uint32_t *)(TIMER_BASE + 0x24)) /* rw */
- +#define TCRR (*(volatile uint32_t *)(TIMER_BASE + 0x28)) /* rw */
- +#define TLDR (*(volatile uint32_t *)(TIMER_BASE + 0x2C)) /* rw */
- +#define TTGR (*(volatile uint32_t *)(TIMER_BASE + 0x30)) /* rw */
- +#define TWPS (*(volatile uint32_t *)(TIMER_BASE + 0x34)) /* r */
- +#define TMAR (*(volatile uint32_t *)(TIMER_BASE + 0x38)) /* rw */
- +#define TCAR1 (*(volatile uint32_t *)(TIMER_BASE + 0x3c)) /* r */
- +#define TSICR (*(volatile uint32_t *)(TIMER_BASE + 0x40)) /* rw */
- +#define TCAR2 (*(volatile uint32_t *)(TIMER_BASE + 0x44)) /* r */
- +#define TPIR (*(volatile uint32_t *)(TIMER_BASE + 0x48)) /* rw */
- +#define TNIR (*(volatile uint32_t *)(TIMER_BASE + 0x4C)) /* rw */
- +
- +#define INTCPS_ILR(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x100 + (0x04*a)))
- +
- +/*
- + * Clock interrupt service routine.
- + * No H/W reprogram is required.
- + */
- +static int
- +clock_isr(void *arg)
- +{
- +
- + splhigh();
- + timer_handler();
- + TISR = 0x02; /* Clear GPT2 interrupt pending flag */
- + spl0();
- +
- + return INT_DONE;
- +}
- +
- +/*
- + * Initialize clock H/W chip.
- + * Setup clock tick rate and install clock ISR.
- + */
- +void
- +clock_init(void)
- +{
- + irq_t clock_irq;
- +
- + /* Setup PRCM so that GPT2 uses 32Khz clock now */
- + CM_CLKSEL_PER &= 0xFE; /* GPT2 clock = 32K_FCLK */
- + CM_ICLKEN_PER |= 0x10; /* Enable Interface clock on GPT2 */
- + CM_FCLKEN_PER |= 0x10; /* Enable Functional clock on GPT2 */
- +
- + TIOCP_CFG = 0x02; /* Now, reset GPT2 */
- + while (TISTAT != 0x01) ;
- +
- + TCLR &= 0xFFFFFF00; /* Stop GPT2 and disable all timing modes */
- + TPIR = 232000; /* Positive increment value for accurate 1 ms tick */
- + TNIR = -768000; /* Negative increment value for accurate 1 ms tick */
- + TLDR = 0xFFFFFFE0; /* Load value for 1 ms tick */
- + TCRR = 0xFFFFFFE0; /* Current value = Load value */
- +
- + /* Install ISR */
- + clock_irq = irq_attach(CLOCK_IRQ, IPL_CLOCK, 0, clock_isr,
- + IST_NONE, NULL);
- +
- + /* Enable overflow interrupt in auto-reload mode */
- + INTCPS_ILR(CLOCK_IRQ) = ((NIPLS-IPL_CLOCK)<<2);
- + TIER = 0x02; /* Enable overflow interrupt */
- + TCLR |= 0x03; /* Start timer in auto-reload mode */
- +
- + DPRINTF(("Clock rate: %d ticks/sec\n", CONFIG_HZ));
- +}
- diff -aburN prex-0.9.0/bsp/hal/arm/beagle/diag.c prex-0.9.0-beagle/bsp/hal/arm/beagle/diag.c
- --- prex-0.9.0/bsp/hal/arm/beagle/diag.c 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/beagle/diag.c 2010-09-26 19:16:46 +0000
- @@ -0,0 +1,75 @@
- +/*-
- + * Copyright (c) 2009-2010, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +/*
- + * diag.c - diagnostic message support
- + */
- +
- +#include <sys/bootinfo.h>
- +#include <kernel.h>
- +#include <cpufunc.h>
- +
- +#include "platform.h"
- +
- +#define UART_THR (*(volatile uint32_t *)(UART_BASE + 0x00))
- +#define UART_LSR (*(volatile uint32_t *)(UART_BASE + 0x14))
- +
- +/* Flag register */
- +#define THRE 0x20 /* Transmit FIFO full */
- +
- +static void
- +serial_putc(int c)
- +{
- +
- + while ((UART_LSR & THRE) == 0) ;
- + UART_THR = (uint32_t)c;
- +}
- +
- +void
- +diag_puts(char *buf)
- +{
- +
- + while (*buf) {
- + if (*buf == '\n')
- + serial_putc('\r');
- + serial_putc(*buf++);
- + }
- +}
- +
- +/*
- + * Init
- + */
- +void
- +diag_init(void)
- +{
- +
- +#ifdef CONFIG_MMU
- + mmu_premap(0x49000000, L4_Per);
- +#endif
- +}
- diff -aburN prex-0.9.0/bsp/hal/arm/beagle/interrupt.c prex-0.9.0-beagle/bsp/hal/arm/beagle/interrupt.c
- --- prex-0.9.0/bsp/hal/arm/beagle/interrupt.c 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/beagle/interrupt.c 2010-09-26 19:16:54 +0000
- @@ -0,0 +1,216 @@
- +/*-
- + * Copyright (c) 2009-2010, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +/*
- + * interrupt.c - interrupt handling routines
- + */
- +
- +#include <sys/ipl.h>
- +#include <kernel.h>
- +#include <hal.h>
- +#include <irq.h>
- +#include <cpufunc.h>
- +#include <context.h>
- +#include <locore.h>
- +
- +#include "platform.h"
- +
- +/* MPU INTC Registers */
- +#define INTCPS_SYSCONFIG (*(volatile uint32_t *)(MPU_INTC_BASE + 0x010))
- +#define INTCPS_SYSSTATUS (*(volatile uint32_t *)(MPU_INTC_BASE + 0x014))
- +#define INTCPS_SIR_IRQ (*(volatile uint32_t *)(MPU_INTC_BASE + 0x040))
- +#define INTCPS_SIR_FIQ (*(volatile uint32_t *)(MPU_INTC_BASE + 0x044))
- +#define INTCPS_CONTROL (*(volatile uint32_t *)(MPU_INTC_BASE + 0x048))
- +#define INTCPS_PROTECTION (*(volatile uint32_t *)(MPU_INTC_BASE + 0x04C))
- +#define INTCPS_IDLE (*(volatile uint32_t *)(MPU_INTC_BASE + 0x050))
- +#define INTCPS_IRQ_PRIORITY (*(volatile uint32_t *)(MPU_INTC_BASE + 0x060))
- +#define INTCPS_FIQ_PRIORITY (*(volatile uint32_t *)(MPU_INTC_BASE + 0x064))
- +#define INTCPS_THRESHOLD (*(volatile uint32_t *)(MPU_INTC_BASE + 0x068))
- +#define INTCPS_ITR(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x080 + (0x20*a)))
- +#define INTCPS_MIR(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x084 + (0x20*a)))
- +#define INTCPS_MIR_CLEAR(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x088 + (0x20*a)))
- +#define INTCPS_MIR_SET(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x08C + (0x20*a)))
- +#define INTCPS_ISR_SET(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x090 + (0x20*a)))
- +#define INTCPS_ISR_CLEAR(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x094 + (0x20*a)))
- +#define INTCPS_PENDING_IRQ(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x098 + (0x20*a)))
- +#define INTCPS_PENDING_FIQ(a) (*(volatile uint32_t *)(MPU_INTC_BASE + 0x09C + (0x20*a)))
- +
- +
- +/*
- + * Interrupt Priority Level
- + *
- + * Each interrupt has its logical priority level, with 0 being
- + * the lowest priority. While some ISR is running, all lower
- + * priority interrupts are masked off.
- + */
- +volatile int irq_level;
- +
- +/*
- + * Interrupt mapping table. As the number of interrupts on the
- + * Beagle is > 32, we need a 2 dimensions array for the mask table
- + */
- +static int ipl_table[NIRQS]; /* vector -> level */
- +static uint32_t mask_table[NIPLS][NIRQS>>5]; /* level -> mask */
- +
- +/*
- + * Set mask for current ipl
- + */
- +static void
- +update_mask(void)
- +{
- + int i;
- + uint32_t mask;
- +
- + for (i = 0; i < (NIRQS>>5); i++) {
- + mask = mask_table[irq_level][i];
- + INTCPS_MIR(i) = ~mask;
- + }
- +}
- +
- +/*
- + * Unmask interrupt in INTC for specified irq.
- + * The interrupt mask table is also updated.
- + * Assumes CPU interrupt is disabled in caller.
- + */
- +void
- +interrupt_unmask(int vector, int level)
- +{
- + int i;
- + uint32_t unmask = (uint32_t)1 << (vector & 0x1f);
- +
- + /* Save level mapping */
- + ipl_table[vector] = level;
- +
- + /*
- + * Unmask the target interrupt for all
- + * lower interrupt levels.
- + */
- + for (i = 0; i < level; i++)
- + mask_table[i][vector>>5] |= unmask;
- +
- + update_mask();
- +}
- +
- +/*
- + * Mask interrupt in INTC for specified irq.
- + * Interrupt must be disabled when this routine is called.
- + */
- +void
- +interrupt_mask(int vector)
- +{
- + int i, level;
- + uint32_t mask = (uint32_t)~(1 << (vector & 0x1f));
- +
- + level = ipl_table[vector];
- +
- + for (i = 0; i < level; i++)
- + mask_table[i][vector>>5] &= mask;
- +
- + ipl_table[vector] = IPL_NONE;
- +
- + update_mask();
- +}
- +
- +/*
- + * Setup interrupt mode.
- + * Select whether an interrupt trigger is edge or level.
- + */
- +void
- +interrupt_setup(int vector, int mode)
- +{
- + /* nop */
- +}
- +
- +/*
- + * Common interrupt handler.
- + */
- +void
- +interrupt_handler(void)
- +{
- + uint32_t bits, threshold, priority;
- + int vector, old_ipl, new_ipl;
- +
- + threshold = INTCPS_THRESHOLD;
- + priority = INTCPS_IRQ_PRIORITY & 0x3f;
- + INTCPS_THRESHOLD = priority;
- +
- + bits = INTCPS_SIR_IRQ; /* Get interrupt source */
- + if (bits >= NIRQS) /* Ignore spurious interrupts */
- + goto out;
- + vector = bits & 0x7f; /* Get device firing the interrupt */
- +
- + /* Adjust interrupt level */
- + old_ipl = irq_level;
- + new_ipl = ipl_table[vector];
- + if (new_ipl > old_ipl) /* Ignore spurious interrupt */
- + irq_level = new_ipl;
- + update_mask();
- +
- + INTCPS_CONTROL = 0x01; /* Allow new IRQ on INTC side */
- + mpu_intc_sync(); /* Data synchronization barrier */
- +
- + /* Allow another interrupt that has higher priority */
- + splon();
- +
- + /* Dispatch interrupt */
- + irq_handler(vector);
- +
- + sploff();
- +
- + /* Restore interrupt level */
- + irq_level = old_ipl;
- + update_mask();
- +out:
- + INTCPS_THRESHOLD = threshold;
- + return;
- +}
- +
- +/*
- + * Initialize interrupt controllers.
- + * All interrupts will be masked off.
- + */
- +void
- +interrupt_init(void)
- +{
- + int i,j;
- +
- + irq_level = IPL_NONE;
- +
- + for (i = 0; i < NIRQS; i++)
- + ipl_table[i] = IPL_NONE;
- +
- + for (i = 0; i < NIPLS; i++)
- + for (j = 0; j < (NIRQS>>5); j++)
- + mask_table[i][j] = 0;
- +
- + INTCPS_SYSCONFIG = 0x02; /* Reset interrupt controller. This also masks all interrupts */
- +
- + while (INTCPS_SYSSTATUS != 0x01) ;
- +
- +}
- diff -aburN prex-0.9.0/bsp/hal/arm/beagle/locore_beagle.S prex-0.9.0-beagle/bsp/hal/arm/beagle/locore_beagle.S
- --- prex-0.9.0/bsp/hal/arm/beagle/locore_beagle.S 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/beagle/locore_beagle.S 2010-09-26 19:17:00 +0000
- @@ -0,0 +1,77 @@
- +/*-
- + * Copyright (c) 2009-2010, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +/*
- + * locore_machdep.S for TI OMAP3 SoC
- + */
- +
- +#include <conf/config.h>
- +#include <machine/asm.h>
- +
- + .section ".text","ax"
- + .code 32
- +
- +/*
- + * Data synchronization barrier for MPU INTC
- + */
- +ENTRY(mpu_intc_sync)
- + mov r0, #0
- + mcr p15, 0, r0, c7, c10, 4
- + mov pc, lr
- +
- +/*
- + * Default exception vectors at 0x4020ffc8 (SRAM)
- + * Use VBAR control register to change it
- + */
- +ENTRY(set_vbar)
- + mcr p15, 0, r0, c12, c0, 0
- + mov pc, lr
- +
- +/*
- + * Reset system.
- + */
- +ENTRY(machine_reset)
- + /*
- + * Set MMU off...
- + */
- + mrc p15, 0, r0, c1, c0, 0
- + bic r0, r0, #0x01
- + mcr p15, 0, r0, c1, c0, 0
- +
- + /*
- + * ...then use control register to initiate reset command
- + */
- + ldr r0, =0x48307250
- + ldr r1, =0x02
- + str r1,[r0]
- + /* NOTREACHED */
- +1:
- + b 1b
- +
- + .end
- diff -aburN prex-0.9.0/bsp/hal/arm/beagle/machdep.c prex-0.9.0-beagle/bsp/hal/arm/beagle/machdep.c
- --- prex-0.9.0/bsp/hal/arm/beagle/machdep.c 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/beagle/machdep.c 2010-09-26 19:17:06 +0000
- @@ -0,0 +1,168 @@
- +/*-
- + * Copyright (c) 2009-2010, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +/*
- + * machdep.c - machine-dependent routines for Beagle Board
- + */
- +
- +#include <machine/syspage.h>
- +#include <sys/power.h>
- +#include <sys/bootinfo.h>
- +#include <kernel.h>
- +#include <page.h>
- +#include <mmu.h>
- +#include <cpu.h>
- +#include <cpufunc.h>
- +#include <locore.h>
- +
- +#include "platform.h"
- +
- +#ifdef CONFIG_MMU
- +/*
- + * Virtual and physical address mapping
- + *
- + * { virtual, physical, size, type }
- + */
- +struct mmumap mmumap_table[] =
- +{
- + /*
- + * Q1 :
- + * Boot ROM (112 KB)
- + * SRAM ( 64 KB)
- + * L4 Interconnects ( 17 MB)
- + * SGX ( 64 KB)
- + * L4 Emulation ( 8 MB)
- + * IVA2.2 SS ( 48 MB)
- + * L3 control regs ( 16 MB)
- + * SMS, SRDC, GPMC
- + * control regs ( 48 MB)
- + */
- + { 0xa0000000, 0x40000000, 0x0001C000, VMT_ROM },
- + { 0xa0200000, 0x40200000, 0x00010000, VMT_RAM },
- + { 0xa8000000, 0x48000000, 0x01100000, VMT_IO },
- + { 0xb0000000, 0x50000000, 0x00010000, VMT_IO },
- + { 0xb4000000, 0x54000000, 0x00800000, VMT_IO },
- + { 0xbC000000, 0x5C000000, 0x03000000, VMT_IO },
- + { 0xc8000000, 0x68000000, 0x01000000, VMT_IO },
- + { 0xcC000000, 0x6C000000, 0x03000000, VMT_IO },
- +
- + /*
- + * Q2: SDRAM (512 MB)
- + * Although Q2 is 1 GB in size we only map 512 MB
- + * as this is the max ram size on the Beagle Board
- + */
- + { 0x80000000, 0x80000000, 0x20000000, VMT_RAM },
- +
- + { 0,0,0,0 }
- +};
- +#endif
- +
- +/*
- + * Idle
- + */
- +void
- +machine_idle(void)
- +{
- +
- + cpu_idle();
- +}
- +
- +/*
- + * Set system power
- + */
- +void
- +machine_powerdown(int state)
- +{
- +
- + splhigh();
- +
- + DPRINTF(("Power down machine\n"));
- +
- + switch (state) {
- + case PWR_OFF:
- + for (;;)
- + cpu_idle();
- + /* NOTREACHED */
- + break;
- + case PWR_REBOOT:
- + machine_reset();
- + /* NOTREACHED */
- + break;
- + }
- +}
- +
- +/*
- + * Return pointer to the boot information.
- + */
- +void
- +machine_bootinfo(struct bootinfo **bip)
- +{
- +
- + *bip = (struct bootinfo *)BOOTINFO;
- +}
- +
- +void
- +machine_abort(void)
- +{
- +
- + for (;;)
- + cpu_idle();
- +}
- +
- +/*
- + * Machine-dependent startup code
- + */
- +void
- +machine_startup(void)
- +{
- +
- + /*
- + * Initialize CPU and basic hardware.
- + */
- + cpu_init();
- + cache_init();
- +
- + /*
- + * Reserve system pages.
- + */
- + page_reserve(kvtop(SYSPAGE), SYSPAGESZ);
- +
- + /*
- + * Setup vector page.
- + */
- + vector_copy((vaddr_t)ptokv(CONFIG_ARM_VECTORS));
- + set_vbar((vaddr_t)ptokv(CONFIG_ARM_VECTORS));
- +
- +#ifdef CONFIG_MMU
- + /*
- + * Initialize MMU
- + */
- + mmu_init(mmumap_table);
- +#endif
- +}
- diff -aburN prex-0.9.0/bsp/hal/arm/beagle/platform.h prex-0.9.0-beagle/bsp/hal/arm/beagle/platform.h
- --- prex-0.9.0/bsp/hal/arm/beagle/platform.h 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/beagle/platform.h 2010-09-26 19:17:14 +0000
- @@ -0,0 +1,65 @@
- +/*
- + * Copyright (c) 2009-2010, Richard Pandion
- + * All rights reserved.
- + *
- + * Redistribution and use in source and binary forms, with or without
- + * modification, are permitted provided that the following conditions
- + * are met:
- + * 1. Redistributions of source code must retain the above copyright
- + * notice, this list of conditions and the following disclaimer.
- + * 2. Redistributions in binary form must reproduce the above copyright
- + * notice, this list of conditions and the following disclaimer in the
- + * documentation and/or other materials provided with the distribution.
- + * 3. Neither the name of the author nor the names of any co-contributors
- + * may be used to endorse or promote products derived from this software
- + * without specific prior written permission.
- + *
- + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- + * SUCH DAMAGE.
- + */
- +
- +#ifndef _BEAGLE_PLATFORM_H
- +#define _BEAGLE_PLATFORM_H
- +
- +/* number of interrupt vectors */
- +#define NIRQS 96
- +
- +#ifdef CONFIG_MMU
- +/* base address for L4 Peripherals registers */
- +#define L4_Per 0xa9000000
- +/* base address for L4 Core registers */
- +#define L4_Core 0xa8000000
- +#else
- +/* base address for L4 Peripherals registers */
- +#define L4_Per 0x49000000
- +/* base address for L4 Core registers */
- +#define L4_Core 0x48000000
- +#endif
- +
- +#define L4_PRCM_CM (L4_Core + 0x4000)
- +#define L4_MPU_INTC (L4_Core + 0x200000)
- +
- +#define L4_UART3 (L4_Per + 0x20000)
- +#define L4_GPTIMER2 (L4_Per + 0x32000)
- +
- +#define UART_BASE L4_UART3
- +#define TIMER_BASE L4_GPTIMER2
- +#define MPU_INTC_BASE L4_MPU_INTC
- +#define PER_CM_BASE (L4_PRCM_CM + 0x1000)
- +
- +__BEGIN_DECLS
- +void mpu_intc_sync(void);
- +void set_vbar(vaddr_t);
- +void machine_reset(void);
- +__END_DECLS
- +
- +#endif /* !_BEAGLE_PLATFORM_H */
- diff -aburN prex-0.9.0/bsp/hal/arm/include/cpu.h prex-0.9.0-beagle/bsp/hal/arm/include/cpu.h
- --- prex-0.9.0/bsp/hal/arm/include/cpu.h 2009-07-09 10:42:02 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/include/cpu.h 2010-09-26 19:19:46 +0000
- @@ -1,5 +1,6 @@
- /*-
- * Copyright (c) 2005-2008, Kohsuke Ohtani
- + * Copyright (c) 2010, Richard Pandion
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- @@ -55,23 +56,31 @@
- #endif
- /*
- - * Contorl register CP15 register 1
- + * Control register CP15 register 1
- */
- -#define CTL_MMU 0x000000001 /* M: MMU/Protection unit enable */
- -#define CTL_AFLT 0x000000002 /* A: Alignment fault enable */
- -#define CTL_CACHE 0x000000004 /* C: Cache enable */
- -#define CTL_WBUF 0x000000008 /* W: Write buffer enable */
- -#define CTL_32BP 0x000000010 /* P: 32-bit exception handlers */
- -#define CTL_32BD 0x000000020 /* D: 32-bit addressing */
- -#define CTL_LABT 0x000000040 /* L: Late abort enable */
- -#define CTL_BIGEND 0x000000080 /* B: Big-endian mode */
- -#define CTL_SYSP 0x000000100 /* S: System protection bit */
- -#define CTL_ROMP 0x000000200 /* R: ROM protection bit */
- -#define CTL_BPRD 0x000000800 /* Z: Branch prediction enable */
- -#define CTL_ICACHE 0x000001000 /* I: Instruction cache enable */
- -#define CTL_HIVEC 0x000002000 /* V: Vector relocation */
- -
- -#define CTL_DEFAULT (CTL_32BP | CTL_32BD | CTL_LABT)
- +#define CTL_MMU 0x00000001 /* M: MMU/Protection unit enable */
- +#define CTL_AFLT 0x00000002 /* A: Alignment fault enable */
- +#define CTL_CACHE 0x00000004 /* C: Cache enable */
- +#define CTL_WBUF 0x00000008 /* W: Write buffer enable */
- +#define CTL_32BP 0x00000010 /* P: 32-bit exception handlers */
- +#define CTL_32BD 0x00000020 /* D: 32-bit addressing */
- +#define CTL_LABT 0x00000040 /* L: Late abort enable */
- +#define CTL_BIGEND 0x00000080 /* B: Big-endian mode */
- +#define CTL_SYSP 0x00000100 /* S: System protection bit */
- +#define CTL_ROMP 0x00000200 /* R: ROM protection bit */
- +#define CTL_BPRD 0x00000800 /* Z: Branch prediction enable */
- +#define CTL_ICACHE 0x00001000 /* I: Instruction cache enable */
- +#define CTL_HIVEC 0x00002000 /* V: Vector relocation */
- +
- +#ifdef __beagle__
- +/* Useful ARMv7 specific flags */
- +#define CTL_AFE 0x20000000 /* AFE: Access flag enable */
- +#define CTL_TRE 0x10000000 /* TRE: TEX remap enable */
- +#define AUXCTL_L2EN 0x00000002 /* L2EN: L2 cache enable */
- +#define AUXCTL_ASA 0x00000010 /* ASA: Speculative access enable */
- +#define AUXCTL_IBE 0x00000040 /* IBE: */
- +#define AUXCTL_BTB 0x00000080 /* BTB: */
- +#endif
- #ifndef __ASSEMBLY__
- diff -aburN prex-0.9.0/bsp/hal/arm/include/mmu.h prex-0.9.0-beagle/bsp/hal/arm/include/mmu.h
- --- prex-0.9.0/bsp/hal/arm/include/mmu.h 2009-10-01 12:28:54 +0000
- +++ prex-0.9.0-beagle/bsp/hal/arm/include/mmu.h 2010-09-26 19:20:12 +0000
- @@ -1,5 +1,6 @@
- /*-
- * Copyright (c) 2005-2008, Kohsuke Ohtani
- + * Copyright (c) 2010, Richard Pandion
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- @@ -36,25 +37,36 @@
- typedef uint32_t *pte_t; /* page table entry */
- #define L1TBL_SIZE 0x4000
- -#define L2TBL_SIZE 0x1000
- +#define L2TBL_SIZE 0x400
- /*
- * Page directory entry (L1)
- */
- -#define PDE_PRESENT 0x00000003
- -#define PDE_ADDRESS 0xfffff000
- +#define PDE_PRESENT 0x00000001
- +#define PDE_ADDRESS 0xfffffc00
- /*
- * Page table entry (L2)
- */
- +#ifdef __beagle__
- #define PTE_PRESENT 0x00000002
- #define PTE_WBUF 0x00000004
- #define PTE_CACHE 0x00000008
- #define PTE_SYSTEM 0x00000010
- #define PTE_USER_RO 0x00000020
- #define PTE_USER_RW 0x00000030
- -#define PTE_ATTR_MASK 0x00000030
- -#define PTE_ADDRESS 0xfffffc00
- +#define PTE_ATTR_MASK 0x00000ff0
- +#define PTE_ADDRESS 0xfffff000
- +#else
- +#define PTE_PRESENT 0x00000002
- +#define PTE_WBUF 0x00000004
- +#define PTE_CACHE 0x00000008
- +#define PTE_SYSTEM 0x00000550
- +#define PTE_USER_RO 0x00000aa0
- +#define PTE_USER_RW 0x00000ff0
- +#define PTE_ATTR_MASK 0x00000ff0
- +#define PTE_ADDRESS 0xfffff000
- +#endif
- /*
- * Virtual and physical address translation
- diff -aburN prex-0.9.0/conf/arm/beagle prex-0.9.0-beagle/conf/arm/beagle
- --- prex-0.9.0/conf/arm/beagle 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/conf/arm/beagle 2010-07-31 21:17:34 +0000
- @@ -0,0 +1,131 @@
- +#
- +# Prex system configuration file
- +#
- +
- +#
- +# Make options
- +#
- +#makeoptions CFLAGS+= -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a8 -fno-math-errno -fno-tree-vectorize
- +makeoptions CFLAGS+= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- +makeoptions ASLAGS+= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- +#
- +# Memory address
- +#
- +memory RAM_BASE 0x80000000 # Start of ram
- +memory LOADER_TEXT 0x80300000 # Start of boot loader
- +memory KERNEL_TEXT 0x80080000 # Start of kernel
- +memory BOOTIMG_BASE 0x80302000 # Location of boot image
- +memory SYSPAGE_BASE 0x80000000 # Location of system page
- +
- +#
- +# Tunable paramters
- +#
- +options HZ=1000 # Ticks/second of the clock
- +options TIME_SLICE=50 # Context switch ratio (msec)
- +options OPEN_MAX=16 # Max open files per process
- +options BUF_CACHE=32 # Blocks for buffer cache
- +options FS_THREADS=4 # Number of file system threads
- +
- +#
- +# Platform settings
- +#
- +#options ARMV7-A # Processor core
- +options MMU # Memory management unit
- +options CACHE # Cache memory
- +#options FPU # Floating point unit
- +#options ROMBOOT # Boot from ROM
- +options BOOTDISK # Disk for /boot directory
- +
- +#
- +# General setup
- +#
- +options POSIX # POSIX support
- +options CMDBOX # Core utilities
- +#options TINY # Optimize for size
- +
- +#
- +# Kernel hacking
- +#
- +#options KD # Kernel debugger
- +#options AUDIT # Security auditing
- +
- +#
- +# Diagnostic options
- +#
- +options DIAG_SERIAL # Diagnostic via serial port
- +
- +#
- +# File systems
- +#
- +options FIFOFS # FIFO & Pipe
- +options DEVFS # Device file system
- +options RAMFS # RAM file system
- +options ARFS # Archive file system
- +#options FATFS # FAT file system
- +
- +#
- +# Power management
- +#
- +#options PM # Power management
- +#options PM_POWERSAVE # Power policy: Battery optimized
- +#options PM_PERFORMANCE # Power policy: Parformance optimized
- +
- +#
- +# Device drivers (initialization order)
- +#
- +device pm # Power management
- +device cons # System console
- +device serial # Logical serial
- +device omap3_uart # OMAP3_UART serial port (P:serial)
- +device null # NULL device
- +device zero # Zero device
- +device ramdisk # RAM disk
- +
- +#
- +# Hardware configuations
- +#
- +#options ARM_VECTORS=0x4020FFC8
- +options ARM_VECTORS=0x80000000
- +options OMAP3_UART_BASE=0xa9020000
- +options OMAP3_UART_IRQ=74
- +
- +
- +#
- +# Command box
- +#
- +command cat
- +command clear
- +command cp
- +command date
- +command dmesg
- +command echo
- +command free
- +command head
- +command hostname
- +command kill
- +command ls
- +command mkdir
- +command more
- +command mv
- +command nice
- +command printenv
- +command ps
- +command pwd
- +command rm
- +command rmdir
- +command sh
- +command sleep
- +command sync
- +#command test
- +command touch
- +command uname
- +
- +#
- +# Adminisrative tools
- +#
- +command diskutil
- +command install
- +command pmctrl
- +command ktrace
- +command lock
- +command debug
- diff -aburN prex-0.9.0/conf/arm/beagle-nommu prex-0.9.0-beagle/conf/arm/beagle-nommu
- --- prex-0.9.0/conf/arm/beagle-nommu 1970-01-01 00:00:00 +0000
- +++ prex-0.9.0-beagle/conf/arm/beagle-nommu 2010-07-20 16:07:22 +0000
- @@ -0,0 +1,131 @@
- +#
- +# Prex system configuration file
- +#
- +
- +#
- +# Make options
- +#
- +#makeoptions CFLAGS+= -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a8 -fno-math-errno -fno-tree-vectorize
- +makeoptions CFLAGS+= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- +makeoptions ASLAGS+= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
- +#
- +# Memory address
- +#
- +memory RAM_BASE 0x80000000 # Start of ram
- +memory LOADER_TEXT 0x80300000 # Start of boot loader
- +memory KERNEL_TEXT 0x80080000 # Start of kernel
- +memory BOOTIMG_BASE 0x80302000 # Location of boot image
- +memory SYSPAGE_BASE 0x80000000 # Location of system page
- +
- +#
- +# Tunable paramters
- +#
- +options HZ=1000 # Ticks/second of the clock
- +options TIME_SLICE=50 # Context switch ratio (msec)
- +options OPEN_MAX=16 # Max open files per process
- +options BUF_CACHE=32 # Blocks for buffer cache
- +options FS_THREADS=4 # Number of file system threads
- +
- +#
- +# Platform settings
- +#
- +#options ARMV7-A # Processor core
- +#options MMU # Memory management unit
- +options CACHE # Cache memory
- +#options FPU # Floating point unit
- +#options ROMBOOT # Boot from ROM
- +options BOOTDISK # Disk for /boot directory
- +
- +#
- +# General setup
- +#
- +options POSIX # POSIX support
- +options CMDBOX # Core utilities
- +#options TINY # Optimize for size
- +
- +#
- +# Kernel hacking
- +#
- +#options KD # Kernel debugger
- +#options AUDIT # Security auditing
- +
- +#
- +# Diagnostic options
- +#
- +options DIAG_SERIAL # Diagnostic via serial port
- +
- +#
- +# File systems
- +#
- +options FIFOFS # FIFO & Pipe
- +options DEVFS # Device file system
- +options RAMFS # RAM file system
- +options ARFS # Archive file system
- +#options FATFS # FAT file system
- +
- +#
- +# Power management
- +#
- +#options PM # Power management
- +#options PM_POWERSAVE # Power policy: Battery optimized
- +#options PM_PERFORMANCE # Power policy: Parformance optimized
- +
- +#
- +# Device drivers (initialization order)
- +#
- +device pm # Power management
- +device cons # System console
- +device serial # Logical serial
- +device omap3_uart # OMAP3_UART serial port (P:serial)
- +device null # NULL device
- +device zero # Zero device
- +device ramdisk # RAM disk
- +
- +#
- +# Hardware configuations
- +#
- +#options ARM_VECTORS=0x4020FFC8
- +options ARM_VECTORS=0x80000000
- +options OMAP3_UART_BASE=0x49020000
- +options OMAP3_UART_IRQ=74
- +
- +
- +#
- +# Command box
- +#
- +command cat
- +command clear
- +command cp
- +command date
- +command dmesg
- +command echo
- +command free
- +command head
- +command hostname
- +command kill
- +command ls
- +command mkdir
- +command more
- +command mv
- +command nice
- +command printenv
- +command ps
- +command pwd
- +command rm
- +command rmdir
- +command sh
- +command sleep
- +command sync
- +#command test
- +command touch
- +command uname
- +
- +#
- +# Adminisrative tools
- +#
- +command diskutil
- +command install
- +command pmctrl
- +command ktrace
- +command lock
- +command debug
- diff -aburN prex-0.9.0/conf/arm/integrator prex-0.9.0-beagle/conf/arm/integrator
- --- prex-0.9.0/conf/arm/integrator 2009-09-24 09:51:40 +0000
- +++ prex-0.9.0-beagle/conf/arm/integrator 2010-09-27 16:33:36 +0000
- @@ -11,6 +11,7 @@
- #
- # Memory address
- #
- +memory RAM_BASE 0x00000000 # Start of RAM
- memory LOADER_TEXT 0x00010000 # Start of boot loader
- memory KERNEL_TEXT 0x80080000 # Start of kernel
- memory BOOTIMG_BASE 0x80012000 # Location of boot image
- diff -aburN prex-0.9.0/conf/arm/integrator-nommu prex-0.9.0-beagle/conf/arm/integrator-nommu
- --- prex-0.9.0/conf/arm/integrator-nommu 2009-09-24 09:51:38 +0000
- +++ prex-0.9.0-beagle/conf/arm/integrator-nommu 2010-09-24 16:36:04 +0000
- @@ -11,6 +11,7 @@
- #
- # Memory address
- #
- +memory RAM_BASE 0x00000000 # Start of RAM
- memory LOADER_TEXT 0x00010000 # Start of boot loader
- memory KERNEL_TEXT 0x00080000 # Start of kernel
- memory BOOTIMG_BASE 0x00012000 # Location of boot image
- diff -aburN prex-0.9.0/conf/etc/fstab prex-0.9.0-beagle/conf/etc/fstab
- --- prex-0.9.0/conf/etc/fstab 2009-10-01 12:31:56 +0000
- +++ prex-0.9.0-beagle/conf/etc/fstab 2010-01-21 15:31:00 +0000
- @@ -6,7 +6,7 @@
- /dev/ram0 /boot arfs
- none /dev devfs
- none /mnt/fifo fifofs
- -/dev/fd0 /mnt/floppy fatfs
- +#/dev/fd0 /mnt/floppy fatfs
- #/dev/mtd0 /bin ffs
- #/dev/mtd1 /etc ffs
- diff -aburN prex-0.9.0/configure prex-0.9.0-beagle/configure
- --- prex-0.9.0/configure 2009-10-01 12:18:40 +0000
- +++ prex-0.9.0-beagle/configure 2010-07-14 15:52:44 +0000
- @@ -185,17 +185,6 @@
- objdump="gobjdump"
- ;;
- CYGWIN*|MINGW*)
- - case "$arch" in
- - x86)
- - prefix="i386-elf-"
- - ;;
- - ppc)
- - prefix="powerpc-elf-"
- - ;;
- - *)
- - prefix="$arch-elf-"
- - ;;
- - esac
- ;;
- esac
- diff -aburN prex-0.9.0/include/arm/elf.h prex-0.9.0-beagle/include/arm/elf.h
- --- prex-0.9.0/include/arm/elf.h 2009-06-28 23:46:40 +0000
- +++ prex-0.9.0-beagle/include/arm/elf.h 2010-08-05 10:56:38 +0000
- @@ -39,5 +39,6 @@
- #define R_ARM_PLT32 27
- #define R_ARM_CALL 28
- #define R_ARM_JUMP24 29
- +#define R_ARM_V4BX 40
- #endif /* !_ARM_ELF_H */
- diff -aburN prex-0.9.0/include/arm/memory.h prex-0.9.0-beagle/include/arm/memory.h
- --- prex-0.9.0/include/arm/memory.h 2009-10-01 12:03:56 +0000
- +++ prex-0.9.0-beagle/include/arm/memory.h 2010-07-24 08:52:52 +0000
- @@ -33,11 +33,13 @@
- #include <conf/config.h>
- #ifdef CONFIG_MMU
- -#define KERNBASE 0x80000000 /* offset of kernel address space */
- +#define KERNBASE CONFIG_SYSPAGE_BASE /* base address of kernel address space */
- +#define KERNOFFSET (KERNBASE - CONFIG_RAM_BASE) /* offset of kernel address space from RAM base */
- #define PAGE_SIZE 4096 /* bytes per page */
- -#define USERLIMIT 0x80000000 /* upper limit on user address space */
- +#define USERLIMIT CONFIG_SYSPAGE_BASE /* upper limit on user address space */
- #else
- -#define KERNBASE 0 /* offset of kernel address space */
- +#define KERNBASE 0 /* base address of kernel address space */
- +#define KERNOFFSET 0 /* offset of kernel address space from RAM base */
- #define PAGE_SIZE 1024 /* bytes per page */
- #define USERLIMIT 0xffffffff /* upper limit on user address space */
- #endif
- diff -aburN prex-0.9.0/include/arm/syspage.h prex-0.9.0-beagle/include/arm/syspage.h
- --- prex-0.9.0/include/arm/syspage.h 2009-05-14 12:23:00 +0000
- +++ prex-0.9.0-beagle/include/arm/syspage.h 2010-07-23 19:24:12 +0000
- @@ -81,9 +81,10 @@
- #define BOOT_PTE0 (SYSPAGE + 0x8000)
- #define BOOT_PTE1 (SYSPAGE + 0x9000)
- -#define BOOT_PGD_PHYS 0x4000
- -#define BOOT_PTE0_PHYS 0x8000
- -#define BOOT_PTE1_PHYS 0x9000
- +#define RAMBASE CONFIG_RAM_BASE
- +#define BOOT_PGD_PHYS (RAMBASE + 0x4000)
- +#define BOOT_PTE0_PHYS (RAMBASE + 0x8000)
- +#define BOOT_PTE1_PHYS (RAMBASE + 0x9000)
- #define INTSTKSZ 0x1000
- #define SYSSTKSZ 0x1000
- diff -aburN prex-0.9.0/include/sys/param.h prex-0.9.0-beagle/include/sys/param.h
- --- prex-0.9.0/include/sys/param.h 2009-10-01 12:17:30 +0000
- +++ prex-0.9.0-beagle/include/sys/param.h 2010-09-24 16:37:20 +0000
- @@ -68,7 +68,11 @@
- #define MAXEVTNAME 12 /* max event name */
- #define HZ CONFIG_HZ /* ticks per second */
- +#ifdef __beagle__
- +#define MAXIRQS 96 /* max number of irq line */
- +#else
- #define MAXIRQS 32 /* max number of irq line */
- +#endif
- #define PASSWORD_LEN 4 /* fixed length, not counting NULL */
- /*
- @@ -124,9 +128,9 @@
- #define user_area(a) 1
- #endif
- -/* Address translation between physical address and kernel viritul address */
- -#define ptokv(pa) (void *)((paddr_t)(pa) + KERNBASE)
- -#define kvtop(va) ((paddr_t)(va) - KERNBASE)
- +/* Address translation between physical address and kernel virtual address */
- +#define ptokv(pa) (void *)((paddr_t)(pa) + KERNOFFSET)
- +#define kvtop(va) ((paddr_t)(va) - KERNOFFSET)
- /*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- diff -aburN prex-0.9.0/sys/sync/sem.c prex-0.9.0-beagle/sys/sync/sem.c
- --- prex-0.9.0/sys/sync/sem.c 2009-10-01 12:34:20 +0000
- +++ prex-0.9.0-beagle/sys/sync/sem.c 2010-07-14 17:13:44 +0000
- @@ -77,7 +77,7 @@
- * whether the semaphore is already allocated.
- */
- sched_lock();
- - if (sem_valid(s)) {
- + if (s && sem_valid(s)) {
- /*
- * Semaphore already exists.
- */
- diff -aburN prex-0.9.0/usr/arch/arm/elf_reloc.c prex-0.9.0-beagle/usr/arch/arm/elf_reloc.c
- --- prex-0.9.0/usr/arch/arm/elf_reloc.c 2009-07-17 10:40:32 +0000
- +++ prex-0.9.0-beagle/usr/arch/arm/elf_reloc.c 2010-08-05 10:59:04 +0000
- @@ -56,6 +56,9 @@
- *where = (*where & 0xff000000) | (tmp & 0x00ffffff);
- /* printf("R_ARM_PC24: %x -> %x\n", where, *where); */
- break;
- + case R_ARM_V4BX:
- + /* nothing to do: bx instruction is supported */
- + break;
- default:
- #ifdef DEBUG
- syslog(LOG_ERR, "relocation fail type=%d\n", ELF32_R_TYPE(rel->r_info));
- diff -aburN prex-0.9.0/usr/sbin/init/init.c prex-0.9.0-beagle/usr/sbin/init/init.c
- --- prex-0.9.0/usr/sbin/init/init.c 2009-10-01 12:19:28 +0000
- +++ prex-0.9.0-beagle/usr/sbin/init/init.c 2010-09-28 12:57:12 +0000
- @@ -87,7 +87,7 @@
- dup(0); /* stderr */
- sys_log("init: running boot script\n");
- - execl(cmdbox, sh, runcom);
- + execl(cmdbox, sh, runcom, NULL);
- sys_panic("init: no shell");
- }
- diff -aburN prex-0.9.0/usr/server/exec/exec_elf.c prex-0.9.0-beagle/usr/server/exec/exec_elf.c
- --- prex-0.9.0/usr/server/exec/exec_elf.c 2009-07-17 10:55:58 +0000
- +++ prex-0.9.0-beagle/usr/server/exec/exec_elf.c 2010-08-05 11:01:38 +0000
- @@ -116,7 +116,10 @@
- for (i = 0; i < nr_reloc; i++) {
- sym = &sym_table[ELF32_R_SYM(rela->r_info)];
- - if (sym->st_shndx != STN_UNDEF) {
- + if (sym->st_info == 0) {
- + /* Empty symbol used for R_ARM_V4BX, etc */
- + sym_val = sym->st_value;
- + } else if (sym->st_shndx != STN_UNDEF) {
- sym_val = (Elf32_Addr)sect_addr[sym->st_shndx]
- + sym->st_value;
- if (relocate_rela(rela, sym_val, target_sect) != 0)
- @@ -139,7 +142,10 @@
- for (i = 0; i < nr_reloc; i++) {
- sym = &sym_table[ELF32_R_SYM(rel->r_info)];
- - if (sym->st_shndx != STN_UNDEF) {
- + if (sym->st_info == 0) {
- + /* Empty symbol used for R_ARM_V4BX, etc */
- + sym_val = sym->st_value;
- + } else if (sym->st_shndx != STN_UNDEF) {
- sym_val = (Elf32_Addr)sect_addr[sym->st_shndx]
- + sym->st_value;
- if (relocate_rel(rel, sym_val, target_sect) != 0)
Advertisement
Add Comment
Please, Sign In to add comment