Ticket #523: helenos_clean_against_1771.patch
File helenos_clean_against_1771.patch, 14.9 KB (added by , 11 years ago) |
---|
-
HelenOS.config
=== modified file 'HelenOS.config'
65 65 @ "integratorcp" Integratorcp 66 66 @ "beagleboardxm" BeagleBoard-xM 67 67 @ "beaglebone" BeagleBone 68 @ "raspberrypi" RaspberryPi 68 69 ! [PLATFORM=arm32] MACHINE (choice) 69 70 70 71 % CPU type … … 98 99 @ "arm926ej_s" ARM926EJ-S 99 100 ! [PLATFORM=arm32&MACHINE=integratorcp] PROCESSOR (choice) 100 101 102 % CPU type 103 @ "arm1176jzf_s" ARM1176JZF-S 104 ! [PLATFORM=arm32&MACHINE=raspberrypi] PROCESSOR (choice) 101 105 102 106 # Add more ARMv4 CPUs 103 107 % CPU arch … … 109 113 @ "armv5" ARMv5 110 114 ! [PLATFORM=arm32&(PROCESSOR=arm926ej_s)] PROCESSOR_ARCH (choice) 111 115 116 # Add more ARMv6 CPUs 117 % CPU type 118 @ "armv6" ARMv6 119 ! [PLATFORM=arm32&(PROCESSOR=arm1176jzf_s)] PROCESSOR_ARCH (choice) 120 112 121 # Add more ARMv7-A CPUs 113 122 % CPU arch 114 123 @ "armv7_a" ARMv7-A … … 482 491 % Support for ARM926 on-chip UART 483 492 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_ARM926_UART (y/n) 484 493 494 % Support for BCM2835 on-chip UART 495 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=raspberrypi] CONFIG_BCM2835_UART (y/n) 496 485 497 % Support for Samsung S3C24XX on-chip UART 486 498 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n) 487 499 -
boot/arch/arm32/include/arch.h
=== modified file 'boot/arch/arm32/include/arch.h'
45 45 #define BOOT_BASE 0x80000000 46 46 #elif defined MACHINE_beaglebone 47 47 #define BOOT_BASE 0x80000000 48 #elif defined MACHINE_raspberrypi 49 #define BOOT_BASE 0x80008000 48 50 #else 49 51 #define BOOT_BASE 0x00000000 50 52 #endif … … 55 57 #define PA_OFFSET 0 56 58 #elif defined MACHINE_beaglebone 57 59 #define PA_OFFSET 0 60 #elif defined MACHINE_raspberrypi 61 #define PA_OFFSET 0 58 62 #else 59 63 #define PA_OFFSET 0x80000000 60 64 #endif -
boot/arch/arm32/src/main.c
=== modified file 'boot/arch/arm32/src/main.c'
139 139 halt(); 140 140 } 141 141 142 printf("%s ", components[i - 1].name);142 printf("%s@%p ", components[i - 1].name, dest[i - 1]); 143 143 144 144 int err = inflate(components[i - 1].start, components[i - 1].size, 145 145 dest[i - 1], components[i - 1].inflated); … … 151 151 } 152 152 153 153 printf(".\n"); 154 155 printf("Booting the kernel...\n"); 156 jump_to_kernel((void *) PA2KA(BOOT_OFFSET), &bootinfo); 154 void *entry; 155 entry = (void *) PA2KA(BOOT_OFFSET); 156 printf("Booting the kernel at %p...",entry); 157 jump_to_kernel(entry, &bootinfo); 157 158 } 158 159 159 160 /** @} -
boot/arch/arm32/src/putchar.c
=== modified file 'boot/arch/arm32/src/putchar.c'
121 121 122 122 #endif 123 123 124 #ifdef MACHINE_raspberrypi 125 126 static void scons_sendb_rpi(uint8_t byte) 127 { 128 /* Wait for the uart to be ready */ 129 while (*((volatile uint8_t *) 0x20201018) & (1 << 5)); 130 /* Send the byte */ 131 *((volatile uint8_t *) 0x20201000) = byte; 132 } 133 134 #endif 135 124 136 /** Send a byte to the serial console. 125 137 * 126 138 * @param byte Byte to send. … … 139 151 #ifdef MACHINE_integratorcp 140 152 scons_sendb_icp(byte); 141 153 #endif 154 #ifdef MACHINE_raspberrypi 155 scons_sendb_rpi(byte); 156 #endif 142 157 } 143 158 144 159 /** Display a character -
kernel/arch/arm32/Makefile.inc
=== modified file 'kernel/arch/arm32/Makefile.inc'
80 80 ARCH_SOURCES += arch/$(KARCH)/src/mach/integratorcp/integratorcp.c 81 81 endif 82 82 83 ifeq ($(MACHINE),raspberrypi) 84 ARCH_SOURCES += arch/$(KARCH)/src/mach/raspberrypi/raspberrypi.c 85 endif 86 83 87 ifeq ($(MACHINE),beagleboardxm) 84 88 ARCH_SOURCES += arch/$(KARCH)/src/mach/beagleboardxm/beagleboardxm.c 85 89 endif -
kernel/arch/arm32/_link.ld.in
=== modified file 'kernel/arch/arm32/_link.ld.in'
12 12 #define KERNEL_LOAD_ADDRESS 0x80a00000 13 13 #elif defined MACHINE_beaglebone 14 14 #define KERNEL_LOAD_ADDRESS 0x80a00000 15 #elif defined MACHINE_raspberrypi 16 #define KERNEL_LOAD_ADDRESS 0x80a08000 15 17 #else 16 18 #define KERNEL_LOAD_ADDRESS 0x80a00000 17 19 #endif -
kernel/arch/arm32/include/arch/cp15.h
=== modified file 'kernel/arch/arm32/include/arch/cp15.h'
222 222 SCTLR_USPCE_WRITE_XN_EN_FLAG = 1 << 20, /* Only if virt. supported */ 223 223 SCTLR_FAST_IRQ_EN_FLAG = 1 << 21, /* Disable impl. specific feat*/ 224 224 SCTLR_UNALIGNED_EN_FLAG = 1 << 22, /* Must be 1 on armv7 */ 225 SCTLR_SUBPAGE_AP_FLAG = 1 << 23, /* ARMv6 only. Must be 1 for ARMv7-style 2nd level pagetables. */ 225 226 SCTLR_IRQ_VECTORS_EN_FLAG = 1 << 24, 226 227 SCTLR_BIG_ENDIAN_EXC_FLAG = 1 << 25, 227 228 SCTLR_NMFI_EN_FLAG = 1 << 27, -
kernel/arch/arm32/include/arch/mach/raspberrypi/raspberrypi.h
=== added directory 'kernel/arch/arm32/include/arch/mach/raspberrypi' === added file 'kernel/arch/arm32/include/arch/mach/raspberrypi/raspberrypi.h'
1 #include <arch/machine_func.h> 2 extern struct arm_machine_ops rpi_machine_ops; 3 4 extern void rpi_init(void); 5 extern void rpi_output_init(void); 6 extern void rpi_input_init(void); 7 extern void rpi_timer_irq_start(void); 8 extern void rpi_cpu_halt(void); 9 extern void rpi_irq_exception(unsigned int, istate_t *); 10 extern void rpi_get_memory_extents(uintptr_t *, size_t *); 11 extern void rpi_frame_init(void); 12 extern size_t rpi_get_irq_count(void); 13 extern const char *rpi_get_platform_name(void); 14 No newline at end of file -
kernel/arch/arm32/include/arch/mm/frame.h
=== modified file 'kernel/arch/arm32/include/arch/mm/frame.h'
60 60 #define PHYSMEM_START_ADDR 0x80000000 61 61 #define BOOT_PAGE_TABLE_ADDRESS 0x80008000 62 62 63 #elif defined MACHINE_raspberrypi 64 65 #define PHYSMEM_START_ADDR 0x80000000 66 #define BOOT_PAGE_TABLE_ADDRESS 0x80010000 67 63 68 #else 64 69 65 70 #define PHYSMEM_START_ADDR 0x00000000 -
kernel/arch/arm32/include/arch/mm/page.h
=== modified file 'kernel/arch/arm32/include/arch/mm/page.h'
45 45 #define PAGE_WIDTH FRAME_WIDTH 46 46 #define PAGE_SIZE FRAME_SIZE 47 47 48 #if (defined MACHINE_beagleboardxm) || (defined MACHINE_beaglebone) 48 #if (defined MACHINE_beagleboardxm) || (defined MACHINE_beaglebone) || (defined MACHINE_raspberrypi) 49 49 #ifndef __ASM__ 50 50 # define KA2PA(x) ((uintptr_t) (x)) 51 51 # define PA2KA(x) ((uintptr_t) (x)) -
kernel/arch/arm32/src/arm32.c
=== modified file 'kernel/arch/arm32/src/arm32.c'
49 49 #include <str.h> 50 50 #include <arch/ras.h> 51 51 #include <sysinfo/sysinfo.h> 52 #include <arch/cp15.h> 52 53 53 54 /** Performs arm32-specific initialization before main_bsp() is called. */ 54 55 void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo) … … 72 73 { 73 74 /* It is not assumed by default */ 74 75 interrupts_disable(); 76 #ifdef PROCESSOR_ARCH_armv6 77 uint32_t control_reg = SCTLR_read(); 78 control_reg |= SCTLR_SUBPAGE_AP_FLAG; //ARMv6+ subpage table format 79 SCTLR_write(control_reg); 80 #endif 75 81 } 76 82 77 /** Performs arm32 specific initialization after rmm is initialized. */83 /** Performs arm32 specific initialization after mm is initialized. */ 78 84 void arch_post_mm_init(void) 79 85 { 80 86 machine_init(); -
kernel/arch/arm32/src/mach/raspberrypi/raspberrypi.c
=== added directory 'kernel/arch/arm32/src/mach/raspberrypi' === added file 'kernel/arch/arm32/src/mach/raspberrypi/raspberrypi.c'
1 #include <arch/mach/raspberrypi/raspberrypi.h> 2 #include <genarch/drivers/bcm2835_uart/bcm2835_uart.h> 3 #include <mm/frame.h> 4 5 struct arm_machine_ops rpi_machine_ops = { 6 rpi_init, 7 rpi_timer_irq_start, 8 rpi_cpu_halt, 9 rpi_get_memory_extents, 10 rpi_irq_exception, 11 rpi_frame_init, 12 rpi_output_init, 13 rpi_input_init, 14 rpi_get_irq_count, 15 rpi_get_platform_name 16 }; 17 18 static struct { 19 bcm2835_uart_t uart; 20 } rpi; 21 22 void rpi_init(void) 23 { 24 //*((int *)(0x20200028)) = 1<<16; 25 } 26 27 void rpi_timer_irq_start(void) 28 { 29 } 30 31 void rpi_cpu_halt(void) 32 { 33 while(1); 34 } 35 36 void rpi_get_memory_extents(uintptr_t *start, size_t *size) 37 { 38 *start=PHYSMEM_START_ADDR; 39 *size=0x08000000; //128MB FIXME: should likely depend on RAM reserved for GPU use. 40 } 41 42 // FIXME: Handles interrupts. 43 void rpi_irq_exception(unsigned int exc_no, istate_t *istate) 44 { 45 } 46 47 //? 48 void rpi_frame_init(void) 49 { 50 frame_mark_unavailable(0x80000, 8); 51 } 52 53 void rpi_output_init(void) 54 { 55 if (bcm2835_uart_init(&rpi.uart, 0, 56 0, sizeof(bcm2835_uart_regs_t))) 57 stdout_wire(&rpi.uart.outdev); 58 } 59 60 void rpi_input_init(void) 61 { 62 } 63 64 size_t rpi_get_irq_count(void) 65 { 66 return 0; 67 } 68 69 const char *rpi_get_platform_name(void) 70 { 71 return "raspberrypi"; 72 } 73 No newline at end of file -
kernel/arch/arm32/src/machine_func.c
=== modified file 'kernel/arch/arm32/src/machine_func.c'
42 42 #include <arch/mach/integratorcp/integratorcp.h> 43 43 #include <arch/mach/beagleboardxm/beagleboardxm.h> 44 44 #include <arch/mach/beaglebone/beaglebone.h> 45 #include <arch/mach/raspberrypi/raspberrypi.h> 45 46 46 47 /** Pointer to machine_ops structure being used. */ 47 48 struct arm_machine_ops *machine_ops; … … 57 58 machine_ops = &bbxm_machine_ops; 58 59 #elif defined(MACHINE_beaglebone) 59 60 machine_ops = &bbone_machine_ops; 61 #elif defined(MACHINE_raspberrypi) 62 machine_ops = &rpi_machine_ops; 60 63 #else 61 64 #error Machine type not defined. 62 65 #endif -
kernel/genarch/Makefile.inc
=== modified file 'kernel/genarch/Makefile.inc'
95 95 genarch/src/drivers/arm926_uart/arm926_uart.c 96 96 endif 97 97 98 ifeq ($(CONFIG_BCM2835_UART),y) 99 GENARCH_SOURCES += \ 100 genarch/src/drivers/bcm2835_uart/bcm2835_uart.c 101 endif 102 98 103 ifeq ($(CONFIG_S3C24XX_IRQC),y) 99 104 GENARCH_SOURCES += \ 100 105 genarch/src/drivers/s3c24xx_irqc/s3c24xx_irqc.c -
kernel/genarch/include/genarch/drivers/bcm2835_uart/bcm2835_uart.h
=== added directory 'kernel/genarch/include/genarch/drivers/bcm2835_uart' === added file 'kernel/genarch/include/genarch/drivers/bcm2835_uart/bcm2835_uart.h'
1 /** @addtogroup genarch 2 * @{ 3 */ 4 /** 5 * @file 6 * @brief BCM2835 on-chip UART driver. 7 */ 8 9 #ifndef KERN_BCM2835_UART_H_ 10 #define KERN_BCM2836_UART_H_ 11 12 #include <ddi/irq.h> 13 #include <console/chardev.h> 14 #include <typedefs.h> 15 16 #define BCM2835_UART0_BASE_ADDRESS 0x20201000 17 18 /** ARM926 User Guide ch. A.1 (p. 124 in the pdf) */ 19 /*#define ARM926_UART0_IRQ 1 20 #define ARM926_UART1_IRQ 2*/ 21 22 /** PrimeCell UART TRM ch. 3.3 (p. 49 in the pdf) */ 23 typedef struct { 24 } bcm2835_uart_regs_t; 25 26 typedef struct { 27 //bcm2835_uart_regs_t *regs; 28 volatile ioport8_t *regs; 29 indev_t *indev; 30 outdev_t outdev; 31 irq_t irq; 32 } bcm2835_uart_t; 33 34 bool bcm2835_uart_init(bcm2835_uart_t *, inr_t, uintptr_t, size_t); 35 void bcm2835_uart_input_wire(bcm2835_uart_t *, indev_t *); 36 37 #endif 38 /** 39 * @} 40 */ -
kernel/genarch/src/drivers/bcm2835_uart/bcm2835_uart.c
=== added directory 'kernel/genarch/src/drivers/bcm2835_uart' === added file 'kernel/genarch/src/drivers/bcm2835_uart/bcm2835_uart.c'
1 /* 2 * Copyright (c) 2012 Jan Vesely 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** @addtogroup genarch 30 * @{ 31 */ 32 /** 33 * @file 34 * @brief ARM926 on-chip UART (PrimeCell UART, PL011) driver. 35 */ 36 37 #include <genarch/drivers/bcm2835_uart/bcm2835_uart.h> 38 #include <console/chardev.h> 39 #include <console/console.h> 40 #include <ddi/device.h> 41 #include <arch/asm.h> 42 #include <mm/slab.h> 43 #include <mm/page.h> 44 #include <mm/km.h> 45 #include <sysinfo/sysinfo.h> 46 #include <str.h> 47 #include <../../ia64/include/arch/register.h> 48 49 static volatile ioport8_t *ugly; 50 51 static void bcm2835_uart_putchar(outdev_t *dev, wchar_t ch) 52 { 53 bcm2835_uart_t *uart = dev->data; 54 //volatile ioport8_t *regs = (void*)km_map(0x20201000, PAGE_SIZE, PAGE_READ | PAGE_WRITE | PAGE_NOT_CACHEABLE); 55 //bcm2835_uart_t *uart = dev->data; 56 /* Wait for the uart to be ready */ 57 while (pio_read_8(ugly) & (1 << 5)); 58 //while (*((volatile uint8_t *) 0x20201018) & (1 << 5)); 59 //while ((pio_read_8((ioport8_t*) 0x20201018)) & (1 << 5)); 60 /* Send the byte */ 61 pio_write_8((uint8_t *) uart->regs, ch); 62 //pio_write_8((uint8_t *) 0x20201000, ch); 63 //*((volatile uint8_t *) 0x20201000) = ch; 64 } 65 66 static outdev_operations_t bcm2835_uart_ops = { 67 .write = bcm2835_uart_putchar, 68 .redraw = NULL, 69 }; 70 71 bool bcm2835_uart_init( 72 bcm2835_uart_t *uart, inr_t interrupt, uintptr_t addr, size_t size) 73 { 74 outdev_initialize("bcm2835_uart_dev", &uart->outdev, &bcm2835_uart_ops); 75 uart->outdev.data = uart; 76 uart->regs = (void*)km_map(0xA0201000, PAGE_SIZE, PAGE_NOT_CACHEABLE); 77 ugly = (volatile ioport8_t *) km_map(0xA0201018, PAGE_SIZE, PAGE_NOT_CACHEABLE); 78 return true; 79 } 80 81 void bcm2835_uart_input_wire(bcm2835_uart_t *uart, indev_t *indev) 82 { 83 } 84 85 /** @} 86 */ 87