Changeset 26e7d6d in mainline for kernel/arch
- Timestamp:
- 2011-09-19T16:31:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a347a11
- Parents:
- 3842a955 (diff), 086290d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/arch
- Files:
-
- 45 added
- 4 deleted
- 90 edited
- 7 moved
-
abs32le/include/istate.h (modified) (1 diff)
-
abs32le/include/mm/frame.h (modified) (2 diffs)
-
abs32le/include/mm/page.h (modified) (2 diffs)
-
abs32le/src/userspace.c (modified) (1 diff)
-
amd64/Makefile.inc (modified) (2 diffs)
-
amd64/include/asm.h (modified) (7 diffs)
-
amd64/include/context.h (modified) (2 diffs)
-
amd64/include/istate.h (modified) (1 diff)
-
amd64/include/mm/frame.h (modified) (2 diffs)
-
amd64/include/mm/page.h (modified) (2 diffs)
-
amd64/src/userspace.c (modified) (1 diff)
-
arm32/include/istate.h (modified) (1 diff)
-
arm32/include/mainpage.h (deleted)
-
arm32/include/mm/frame.h (modified) (2 diffs)
-
arm32/include/mm/page.h (modified) (2 diffs)
-
arm32/include/regutils.h (modified) (2 diffs)
-
arm32/src/arm32.c (modified) (1 diff)
-
arm32/src/mach/gta02/gta02.c (modified) (3 diffs)
-
arm32/src/mach/integratorcp/integratorcp.c (modified) (2 diffs)
-
arm32/src/mach/testarm/testarm.c (modified) (1 diff)
-
arm32/src/ras.c (modified) (1 diff)
-
ia32/Makefile.inc (modified) (1 diff)
-
ia32/include/asm.h (modified) (9 diffs)
-
ia32/include/atomic.h (modified) (1 diff)
-
ia32/include/boot/boot.h (modified) (1 diff)
-
ia32/include/context.h (modified) (2 diffs)
-
ia32/include/cycle.h (modified) (2 diffs)
-
ia32/include/elf.h (modified) (2 diffs)
-
ia32/include/istate.h (modified) (1 diff)
-
ia32/include/mm/frame.h (modified) (2 diffs)
-
ia32/include/mm/page.h (modified) (2 diffs)
-
ia32/src/asm.S (modified) (1 diff)
-
ia32/src/boot/boot.S (modified) (10 diffs)
-
ia32/src/boot/vesa_real.inc (modified) (1 diff)
-
ia32/src/cpu/cpu.c (modified) (1 diff)
-
ia32/src/drivers/vesa.c (modified) (1 diff)
-
ia32/src/proc/scheduler.c (modified) (1 diff)
-
ia32/src/smp/smp.c (modified) (1 diff)
-
ia32/src/syscall.c (modified) (2 diffs)
-
ia32/src/userspace.c (modified) (1 diff)
-
ia64/include/bootinfo.h (modified) (3 diffs)
-
ia64/include/elf.h (modified) (2 diffs)
-
ia64/include/istate.h (modified) (1 diff)
-
ia64/include/mm/frame.h (modified) (2 diffs)
-
ia64/include/mm/page.h (modified) (2 diffs)
-
ia64/include/register.h (modified) (2 diffs)
-
ia64/src/drivers/ski.c (modified) (5 diffs)
-
ia64/src/ia64.c (modified) (2 diffs)
-
ia64/src/mm/frame.c (modified) (1 diff)
-
mips32/Makefile.inc (modified) (1 diff)
-
mips32/include/context_offset.h (modified) (1 diff)
-
mips32/include/cp0.h (modified) (2 diffs)
-
mips32/include/cycle.h (modified) (1 diff)
-
mips32/include/debug.h (modified) (1 diff)
-
mips32/include/istate.h (modified) (1 diff)
-
mips32/include/mm/frame.h (modified) (2 diffs)
-
mips32/include/mm/page.h (modified) (2 diffs)
-
mips32/include/stack.h (modified) (1 diff)
-
mips32/src/cache.c (modified) (1 diff)
-
mips32/src/cpu/cpu.c (modified) (1 diff)
-
mips32/src/fpu_context.c (modified) (2 diffs)
-
mips32/src/mips32.c (modified) (2 diffs)
-
mips32/src/mm/as.c (modified) (1 diff)
-
mips32/src/mm/tlb.c (modified) (2 diffs)
-
mips32/src/start.S (modified) (1 diff)
-
mips64/Makefile.inc (added)
-
mips64/_link.ld.in (added)
-
mips64/include/arch.h (moved) (moved from uspace/lib/c/include/devman_obsolete.h ) (3 diffs)
-
mips64/include/asm.h (added)
-
mips64/include/asm/boot.h (added)
-
mips64/include/asm/regname.h (added)
-
mips64/include/atomic.h (added)
-
mips64/include/barrier.h (added)
-
mips64/include/cache.h (added)
-
mips64/include/context.h (added)
-
mips64/include/context_offset.h (added)
-
mips64/include/cp0.h (added)
-
mips64/include/cpu.h (moved) (moved from uspace/lib/c/include/ipc/mouse.h ) (3 diffs)
-
mips64/include/cycle.h (added)
-
mips64/include/debug.h (added)
-
mips64/include/debugger.h (moved) (moved from uspace/drv/ohci/batch.h ) (2 diffs)
-
mips64/include/drivers/msim.h (moved) (moved from uspace/srv/hid/fb/msim.h ) (3 diffs)
-
mips64/include/elf.h (added)
-
mips64/include/exception.h (added)
-
mips64/include/faddr.h (added)
-
mips64/include/fpu_context.h (added)
-
mips64/include/interrupt.h (moved) (moved from kernel/arch/sparc64/include/drivers/fhc.h ) (3 diffs)
-
mips64/include/istate.h (added)
-
mips64/include/mm/as.h (added)
-
mips64/include/mm/asid.h (added)
-
mips64/include/mm/frame.h (added)
-
mips64/include/mm/page.h (added)
-
mips64/include/mm/tlb.h (added)
-
mips64/include/proc/task.h (moved) (moved from uspace/srv/hid/adb_mouse/adb_mouse.h ) (3 diffs)
-
mips64/include/proc/thread.h (added)
-
mips64/include/smp/dorder.h (added)
-
mips64/include/stack.h (added)
-
mips64/include/types.h (added)
-
mips64/src/asm.S (added)
-
mips64/src/cache.c (added)
-
mips64/src/context.S (added)
-
mips64/src/cpu (added)
-
mips64/src/ddi (added)
-
mips64/src/debug (added)
-
mips64/src/debugger.c (added)
-
mips64/src/exception.c (added)
-
mips64/src/fpu_context.c (added)
-
mips64/src/interrupt.c (added)
-
mips64/src/mips64.c (added)
-
mips64/src/mm/as.c (added)
-
mips64/src/mm/frame.c (added)
-
mips64/src/mm/page.c (moved) (moved from uspace/lib/c/generic/ns_obsolete.c ) (3 diffs)
-
mips64/src/mm/tlb.c (added)
-
mips64/src/smp/dorder.c (added)
-
mips64/src/smp/smp.c (added)
-
mips64/src/start.S (added)
-
ppc32/include/asm.h (modified) (1 diff)
-
ppc32/include/context_offset.h (modified) (2 diffs)
-
ppc32/include/cpu.h (modified) (2 diffs)
-
ppc32/include/exception.h (modified) (1 diff)
-
ppc32/include/istate.h (modified) (1 diff)
-
ppc32/include/mm/frame.h (modified) (2 diffs)
-
ppc32/include/mm/page.h (modified) (2 diffs)
-
ppc32/include/msr.h (added)
-
ppc32/src/asm.S (modified) (1 diff)
-
ppc32/src/exception.S (modified) (1 diff)
-
ppc32/src/ppc32.c (modified) (1 diff)
-
sparc64/Makefile.inc (modified) (1 diff)
-
sparc64/include/barrier.h (modified) (1 diff)
-
sparc64/include/drivers/sgcn.h (deleted)
-
sparc64/include/elf.h (modified) (2 diffs)
-
sparc64/include/istate.h (modified) (1 diff)
-
sparc64/include/mm/page.h (modified) (2 diffs)
-
sparc64/include/mm/sun4u/frame.h (modified) (2 diffs)
-
sparc64/include/mm/sun4v/frame.h (modified) (2 diffs)
-
sparc64/include/mm/sun4v/page.h (modified) (2 diffs)
-
sparc64/include/sun4v/regdef.h (modified) (2 diffs)
-
sparc64/src/console.c (modified) (3 diffs)
-
sparc64/src/drivers/fhc.c (deleted)
-
sparc64/src/drivers/kbd.c (modified) (4 diffs)
-
sparc64/src/drivers/niagara.c (modified) (6 diffs)
-
sparc64/src/drivers/scr.c (modified) (1 diff)
-
sparc64/src/drivers/sgcn.c (deleted)
-
sparc64/src/smp/sun4u/smp.c (modified) (1 diff)
-
sparc64/src/smp/sun4v/smp.c (modified) (1 diff)
-
sparc64/src/sun4v/start.S (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/abs32le/include/istate.h
r3842a955 r26e7d6d 36 36 #define KERN_abs32le_ISTATE_H_ 37 37 38 #include <trace.h> 39 38 40 #ifdef KERNEL 39 41 40 #include <typedefs.h>41 42 #include <verify.h> 42 #include <trace.h>43 43 44 44 #else /* KERNEL */ 45 45 46 #include <sys/types.h>47 48 #define NO_TRACE49 46 #define REQUIRES_EXTENT_MUTABLE(arg) 50 47 #define WRITES(arg) -
kernel/arch/abs32le/include/mm/frame.h
r3842a955 r26e7d6d 39 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 #ifdef KERNEL42 43 41 #include <typedefs.h> 44 42 … … 46 44 extern void physmem_print(void); 47 45 48 #endif /* KERNEL */49 50 46 #endif 51 47 -
kernel/arch/abs32le/include/mm/page.h
r3842a955 r26e7d6d 41 41 #define PAGE_WIDTH FRAME_WIDTH 42 42 #define PAGE_SIZE FRAME_SIZE 43 44 #ifdef KERNEL45 43 46 44 #define KA2PA(x) (((uintptr_t) (x)) - UINT32_C(0x80000000)) … … 178 176 extern void page_fault(unsigned int, istate_t *); 179 177 180 #endif /* KERNEL */181 182 178 #endif 183 179 -
kernel/arch/abs32le/src/userspace.c
r3842a955 r26e7d6d 36 36 #include <typedefs.h> 37 37 #include <arch.h> 38 #include < proc/uarg.h>38 #include <abi/proc/uarg.h> 39 39 #include <mm/as.h> 40 41 40 42 41 void userspace(uspace_arg_t *kernel_uarg) -
kernel/arch/amd64/Makefile.inc
r3842a955 r26e7d6d 41 41 # is fixed. 42 42 # 43 # IfGCC generates a code for tail call, instead of generating ..43 # When GCC generates a code for tail call, instead of generating .. 44 44 # 45 45 # jmp *fnc … … 48 48 # 49 49 # jmp *$fnc 50 # 51 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48385 for reference. 50 52 # 51 53 -
kernel/arch/amd64/include/asm.h
r3842a955 r26e7d6d 41 41 #include <trace.h> 42 42 43 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 44 43 45 /** Return base address of current stack. 44 46 * … … 87 89 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 88 90 { 89 uint8_t val; 90 91 asm volatile ( 92 "inb %w[port], %b[val]\n" 93 : [val] "=a" (val) 94 : [port] "d" (port) 95 ); 96 97 return val; 91 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 92 uint8_t val; 93 94 asm volatile ( 95 "inb %w[port], %b[val]\n" 96 : [val] "=a" (val) 97 : [port] "d" (port) 98 ); 99 100 return val; 101 } else 102 return (uint8_t) *port; 98 103 } 99 104 … … 108 113 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 109 114 { 110 uint16_t val; 111 112 asm volatile ( 113 "inw %w[port], %w[val]\n" 114 : [val] "=a" (val) 115 : [port] "d" (port) 116 ); 117 118 return val; 115 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 116 uint16_t val; 117 118 asm volatile ( 119 "inw %w[port], %w[val]\n" 120 : [val] "=a" (val) 121 : [port] "d" (port) 122 ); 123 124 return val; 125 } else 126 return (uint16_t) *port; 119 127 } 120 128 … … 129 137 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 130 138 { 131 uint32_t val; 132 133 asm volatile ( 134 "inl %w[port], %[val]\n" 135 : [val] "=a" (val) 136 : [port] "d" (port) 137 ); 138 139 return val; 139 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 140 uint32_t val; 141 142 asm volatile ( 143 "inl %w[port], %[val]\n" 144 : [val] "=a" (val) 145 : [port] "d" (port) 146 ); 147 148 return val; 149 } else 150 return (uint32_t) *port; 140 151 } 141 152 … … 150 161 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val) 151 162 { 152 asm volatile ( 153 "outb %b[val], %w[port]\n" 154 :: [val] "a" (val), 155 [port] "d" (port) 156 ); 163 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 164 asm volatile ( 165 "outb %b[val], %w[port]\n" 166 :: [val] "a" (val), [port] "d" (port) 167 ); 168 } else 169 *port = val; 157 170 } 158 171 … … 167 180 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val) 168 181 { 169 asm volatile ( 170 "outw %w[val], %w[port]\n" 171 :: [val] "a" (val), 172 [port] "d" (port) 173 ); 182 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 183 asm volatile ( 184 "outw %w[val], %w[port]\n" 185 :: [val] "a" (val), [port] "d" (port) 186 ); 187 } else 188 *port = val; 174 189 } 175 190 … … 184 199 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val) 185 200 { 186 asm volatile ( 187 "outl %[val], %w[port]\n" 188 :: [val] "a" (val), 189 [port] "d" (port) 190 ); 201 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 202 asm volatile ( 203 "outl %[val], %w[port]\n" 204 :: [val] "a" (val), [port] "d" (port) 205 ); 206 } else 207 *port = val; 191 208 } 192 209 -
kernel/arch/amd64/include/context.h
r3842a955 r26e7d6d 36 36 #define KERN_amd64_CONTEXT_H_ 37 37 38 #ifdef KERNEL39 40 38 #include <typedefs.h> 41 39 … … 52 50 (c)->rbp = 0; \ 53 51 } while (0) 54 55 #endif /* KERNEL */56 52 57 53 /* We include only registers that must be preserved -
kernel/arch/amd64/include/istate.h
r3842a955 r26e7d6d 36 36 #define KERN_amd64_ISTATE_H_ 37 37 38 #ifdef KERNEL39 40 #include <typedefs.h>41 38 #include <trace.h> 42 43 #else /* KERNEL */44 45 #include <sys/types.h>46 47 #define NO_TRACE48 49 #endif /* KERNEL */50 39 51 40 /** This is passed to interrupt handlers */ -
kernel/arch/amd64/include/mm/frame.h
r3842a955 r26e7d6d 39 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 #ifdef KERNEL42 41 #ifndef __ASM__ 43 42 … … 49 48 50 49 #endif /* __ASM__ */ 51 #endif /* KERNEL */52 50 53 51 #endif -
kernel/arch/amd64/include/mm/page.h
r3842a955 r26e7d6d 50 50 #define PAGE_WIDTH FRAME_WIDTH 51 51 #define PAGE_SIZE FRAME_SIZE 52 53 #ifdef KERNEL54 52 55 53 #ifndef __ASM__ … … 231 229 #endif /* __ASM__ */ 232 230 233 #endif /* KERNEL */234 235 231 #endif 236 232 -
kernel/arch/amd64/src/userspace.c
r3842a955 r26e7d6d 38 38 #include <typedefs.h> 39 39 #include <arch.h> 40 #include < proc/uarg.h>40 #include <abi/proc/uarg.h> 41 41 #include <mm/as.h> 42 43 42 44 43 /** Enter userspace -
kernel/arch/arm32/include/istate.h
r3842a955 r26e7d6d 35 35 #define KERN_arm32_ISTATE_H_ 36 36 37 #include <trace.h> 38 39 #ifdef KERNEL 40 37 41 #include <arch/regutils.h> 38 42 39 #ifdef KERNEL 40 #include <typedefs.h> 41 #include <trace.h> 42 #else 43 #include <sys/types.h> 44 #define NO_TRACE 45 #endif 43 #else /* KERNEL */ 44 45 #include <libarch/regutils.h> 46 47 #endif /* KERNEL */ 46 48 47 49 /** Struct representing CPU state saved when an exception occurs. */ -
kernel/arch/arm32/include/mm/frame.h
r3842a955 r26e7d6d 40 40 #define FRAME_SIZE (1 << FRAME_WIDTH) 41 41 42 #ifdef KERNEL43 42 #ifndef __ASM__ 44 43 … … 69 68 70 69 #endif /* __ASM__ */ 71 #endif /* KERNEL */72 70 73 71 #endif -
kernel/arch/arm32/include/mm/page.h
r3842a955 r26e7d6d 52 52 # define PA2KA(x) ((x) + 0x80000000) 53 53 #endif 54 55 #ifdef KERNEL56 54 57 55 /* Number of entries in each level. */ … … 320 318 #endif /* __ASM__ */ 321 319 322 #endif /* KERNEL */323 324 320 #endif 325 321 -
kernel/arch/arm32/include/regutils.h
r3842a955 r26e7d6d 30 30 * @{ 31 31 */ 32 /** 32 /** 33 33 * @file 34 34 * @brief Utilities for convenient manipulation with ARM registers. … … 38 38 #define KERN_arm32_REGUTILS_H_ 39 39 40 #define STATUS_REG_IRQ_DISABLED_BIT (1 << 7)41 #define STATUS_REG_MODE_MASK 0x1f40 #define STATUS_REG_IRQ_DISABLED_BIT (1 << 7) 41 #define STATUS_REG_MODE_MASK 0x1f 42 42 43 #define CP15_R1_HIGH_VECTORS_BIT (1 << 13) 44 43 #define CP15_R1_HIGH_VECTORS_BIT (1 << 13) 45 44 46 45 /* ARM Processor Operation Modes */ 47 #define USER_MODE 0x1048 #define FIQ_MODE 0x1149 #define IRQ_MODE0x1250 #define SUPERVISOR_MODE0x1351 #define ABORT_MODE0x1752 #define UNDEFINED_MODE0x1b53 #define SYSTEM_MODE0x1f46 #define USER_MODE 0x10 47 #define FIQ_MODE 0x11 48 #define IRQ_MODE 0x12 49 #define SUPERVISOR_MODE 0x13 50 #define ABORT_MODE 0x17 51 #define UNDEFINED_MODE 0x1b 52 #define SYSTEM_MODE 0x1f 54 53 55 54 /* [CS]PRS manipulation macros */ 56 #define GEN_STATUS_READ(nm,reg) \ 57 static inline uint32_t nm## _status_reg_read(void) \ 58 { \ 59 uint32_t retval; \ 60 asm volatile( \ 61 "mrs %[retval], " #reg \ 62 : [retval] "=r" (retval) \ 63 ); \ 64 return retval; \ 65 } 55 #define GEN_STATUS_READ(nm, reg) \ 56 static inline uint32_t nm## _status_reg_read(void) \ 57 { \ 58 uint32_t retval; \ 59 \ 60 asm volatile ( \ 61 "mrs %[retval], " #reg \ 62 : [retval] "=r" (retval) \ 63 ); \ 64 \ 65 return retval; \ 66 } 66 67 67 #define GEN_STATUS_WRITE(nm, reg,fieldname, field) \68 static inline void nm## _status_reg_ ##fieldname## _write(uint32_t value) \69 { \70 asm volatile( \71 "msr " #reg "_" #field ", %[value]" \72 :: [value] "r" (value) \73 ); \74 }68 #define GEN_STATUS_WRITE(nm, reg, fieldname, field) \ 69 static inline void nm## _status_reg_ ##fieldname## _write(uint32_t value) \ 70 { \ 71 asm volatile ( \ 72 "msr " #reg "_" #field ", %[value]" \ 73 :: [value] "r" (value) \ 74 ); \ 75 } 75 76 77 /** Return the value of CPSR (Current Program Status Register). */ 78 GEN_STATUS_READ(current, cpsr); 76 79 77 /** Returns the value of CPSR (Current Program Status Register). */ 78 GEN_STATUS_READ(current, cpsr) 79 80 81 /** Sets control bits of CPSR. */ 80 /** Set control bits of CPSR. */ 82 81 GEN_STATUS_WRITE(current, cpsr, control, c); 83 82 84 85 /** Returns the value of SPSR (Saved Program Status Register). */ 86 GEN_STATUS_READ(saved, spsr) 87 83 /** Return the value of SPSR (Saved Program Status Register). */ 84 GEN_STATUS_READ(saved, spsr); 88 85 89 86 #endif -
kernel/arch/arm32/src/arm32.c
r3842a955 r26e7d6d 37 37 #include <config.h> 38 38 #include <genarch/fb/fb.h> 39 #include < genarch/fb/visuals.h>39 #include <abi/fb/visuals.h> 40 40 #include <sysinfo/sysinfo.h> 41 41 #include <console/console.h> -
kernel/arch/arm32/src/mach/gta02/gta02.c
r3842a955 r26e7d6d 39 39 #include <mm/page.h> 40 40 #include <genarch/fb/fb.h> 41 #include < genarch/fb/visuals.h>41 #include <abi/fb/visuals.h> 42 42 #include <genarch/drivers/s3c24xx_uart/s3c24xx_uart.h> 43 43 #include <genarch/drivers/s3c24xx_irqc/s3c24xx_irqc.h> … … 158 158 { 159 159 #ifdef CONFIG_FB 160 parea_t fb_parea;161 162 160 fb_properties_t prop = { 163 161 .addr = GTA02_FB_BASE, … … 170 168 171 169 outdev_t *fb_dev = fb_init(&prop); 172 if (fb_dev) {170 if (fb_dev) 173 171 stdout_wire(fb_dev); 174 fb_parea.pbase = GTA02_FB_BASE;175 fb_parea.frames = 150;176 fb_parea.unpriv = false;177 ddi_parea_register(&fb_parea);178 }179 172 #endif 180 173 181 174 /* Initialize serial port of the debugging console. */ 182 s3c24xx_uart_io_t *scons_io; 183 184 scons_io = (void *) hw_map(GTA02_SCONS_BASE, PAGE_SIZE); 185 gta02_scons_dev = s3c24xx_uart_init(scons_io, S3C24XX_INT_UART2); 175 gta02_scons_dev = 176 s3c24xx_uart_init(GTA02_SCONS_BASE, S3C24XX_INT_UART2); 186 177 187 178 if (gta02_scons_dev) { -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
r3842a955 r26e7d6d 48 48 #include <arch/mach/integratorcp/integratorcp.h> 49 49 #include <genarch/fb/fb.h> 50 #include < genarch/fb/visuals.h>50 #include <abi/fb/visuals.h> 51 51 #include <ddi/ddi.h> 52 52 #include <print.h> 53 53 54 54 #define SDRAM_SIZE (sdram[((*(uint32_t *)(ICP_CMCR+ICP_SDRAMCR_OFFSET) & ICP_SDRAM_MASK) >> 2)]) 55 static parea_t fb_parea;56 55 static icp_hw_map_t icp_hw_map; 57 56 static irq_t icp_timer_irq; … … 296 295 297 296 outdev_t *fbdev = fb_init(&prop); 298 if (fbdev) {297 if (fbdev) 299 298 stdout_wire(fbdev); 300 fb_parea.pbase = ICP_FB;301 fb_parea.frames = 300;302 fb_parea.unpriv = false;303 ddi_parea_register(&fb_parea);304 }305 299 #endif 306 300 } -
kernel/arch/arm32/src/mach/testarm/testarm.c
r3842a955 r26e7d6d 38 38 #include <mm/page.h> 39 39 #include <genarch/fb/fb.h> 40 #include < genarch/fb/visuals.h>40 #include <abi/fb/visuals.h> 41 41 #include <genarch/drivers/dsrln/dsrlnin.h> 42 42 #include <genarch/drivers/dsrln/dsrlnout.h> -
kernel/arch/arm32/src/ras.c
r3842a955 r26e7d6d 86 86 } 87 87 88 /** @} 89 */ -
kernel/arch/ia32/Makefile.inc
r3842a955 r26e7d6d 43 43 ## Accepted CPUs 44 44 # 45 46 ifeq ($(PROCESSOR),i486) 47 CMN2 = -march=i486 48 endif 45 49 46 50 ifeq ($(PROCESSOR),athlon_xp) -
kernel/arch/ia32/include/asm.h
r3842a955 r26e7d6d 101 101 GEN_WRITE_REG(dr7) 102 102 103 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 104 103 105 /** Byte to port 104 106 * … … 111 113 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val) 112 114 { 113 asm volatile ( 114 "outb %b[val], %w[port]\n" 115 :: [val] "a" (val), 116 [port] "d" (port) 117 ); 115 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 116 asm volatile ( 117 "outb %b[val], %w[port]\n" 118 :: [val] "a" (val), [port] "d" (port) 119 ); 120 } else 121 *port = val; 118 122 } 119 123 … … 128 132 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val) 129 133 { 130 asm volatile ( 131 "outw %w[val], %w[port]\n" 132 :: [val] "a" (val), 133 [port] "d" (port) 134 ); 134 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 135 asm volatile ( 136 "outw %w[val], %w[port]\n" 137 :: [val] "a" (val), [port] "d" (port) 138 ); 139 } else 140 *port = val; 135 141 } 136 142 … … 145 151 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val) 146 152 { 147 asm volatile ( 148 "outl %[val], %w[port]\n" 149 :: [val] "a" (val), 150 [port] "d" (port) 151 ); 153 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 154 asm volatile ( 155 "outl %[val], %w[port]\n" 156 :: [val] "a" (val), [port] "d" (port) 157 ); 158 } else 159 *port = val; 152 160 } 153 161 … … 162 170 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 163 171 { 164 uint8_t val; 165 166 asm volatile ( 167 "inb %w[port], %b[val]\n" 168 : [val] "=a" (val) 169 : [port] "d" (port) 170 ); 171 172 return val; 172 if (((void *)port) < IO_SPACE_BOUNDARY) { 173 uint8_t val; 174 175 asm volatile ( 176 "inb %w[port], %b[val]\n" 177 : [val] "=a" (val) 178 : [port] "d" (port) 179 ); 180 181 return val; 182 } else 183 return (uint8_t) *port; 173 184 } 174 185 … … 183 194 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 184 195 { 185 uint16_t val; 186 187 asm volatile ( 188 "inw %w[port], %w[val]\n" 189 : [val] "=a" (val) 190 : [port] "d" (port) 191 ); 192 193 return val; 196 if (((void *)port) < IO_SPACE_BOUNDARY) { 197 uint16_t val; 198 199 asm volatile ( 200 "inw %w[port], %w[val]\n" 201 : [val] "=a" (val) 202 : [port] "d" (port) 203 ); 204 205 return val; 206 } else 207 return (uint16_t) *port; 194 208 } 195 209 … … 204 218 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 205 219 { 206 uint32_t val; 207 208 asm volatile ( 209 "inl %w[port], %[val]\n" 210 : [val] "=a" (val) 211 : [port] "d" (port) 212 ); 213 214 return val; 220 if (((void *)port) < IO_SPACE_BOUNDARY) { 221 uint32_t val; 222 223 asm volatile ( 224 "inl %w[port], %[val]\n" 225 : [val] "=a" (val) 226 : [port] "d" (port) 227 ); 228 229 return val; 230 } else 231 return (uint32_t) *port; 215 232 } 216 233 … … 311 328 } 312 329 330 #ifndef PROCESSOR_i486 331 313 332 /** Write to MSR */ 314 333 NO_TRACE static inline void write_msr(uint32_t msr, uint64_t value) … … 335 354 return ((uint64_t) dx << 32) | ax; 336 355 } 356 357 #endif /* PROCESSOR_i486 */ 337 358 338 359 -
kernel/arch/ia32/include/atomic.h
r3842a955 r26e7d6d 121 121 asm volatile ( 122 122 "0:\n" 123 #ifndef PROCESSOR_i486 123 124 "pause\n" /* Pentium 4's HT love this instruction */ 125 #endif 124 126 "mov %[count], %[tmp]\n" 125 127 "testl %[tmp], %[tmp]\n" -
kernel/arch/ia32/include/boot/boot.h
r3842a955 r26e7d6d 43 43 #define MULTIBOOT_HEADER_FLAGS 0x00010003 44 44 45 #define MULTIBOOT_LOADER_MAGIC 0x2BADB002 46 45 47 #ifndef __ASM__ 46 48 -
kernel/arch/ia32/include/context.h
r3842a955 r26e7d6d 36 36 #define KERN_ia32_CONTEXT_H_ 37 37 38 #ifdef KERNEL39 40 38 #include <typedefs.h> 41 39 … … 57 55 } while (0) 58 56 59 #endif /* KERNEL */60 61 57 /* 62 58 * Only save registers that must be preserved across -
kernel/arch/ia32/include/cycle.h
r3842a955 r26e7d6d 40 40 NO_TRACE static inline uint64_t get_cycle(void) 41 41 { 42 #ifdef PROCESSOR_i486 43 return 0; 44 #else 42 45 uint64_t v; 43 46 … … 48 51 49 52 return v; 53 #endif 50 54 } 51 55 -
kernel/arch/ia32/include/elf.h
r3842a955 r26e7d6d 27 27 */ 28 28 29 /** @addtogroup ia32 29 /** @addtogroup ia32 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ia32_ELF_H_ 37 37 38 #define ELF_MACHINEEM_38639 #define ELF_DATA_ENCODING ELFDATA2LSB40 #define ELF_CLASS ELFCLASS3238 #define ELF_MACHINE EM_386 39 #define ELF_DATA_ENCODING ELFDATA2LSB 40 #define ELF_CLASS ELFCLASS32 41 41 42 42 #endif -
kernel/arch/ia32/include/istate.h
r3842a955 r26e7d6d 36 36 #define KERN_ia32_ISTATE_H_ 37 37 38 #ifdef KERNEL39 40 #include <typedefs.h>41 38 #include <trace.h> 42 43 #else /* KERNEL */44 45 #include <sys/types.h>46 47 #define NO_TRACE48 49 #endif /* KERNEL */50 39 51 40 typedef struct istate { -
kernel/arch/ia32/include/mm/frame.h
r3842a955 r26e7d6d 39 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 #ifdef KERNEL42 41 #ifndef __ASM__ 43 42 … … 50 49 51 50 #endif /* __ASM__ */ 52 #endif /* KERNEL */53 51 54 52 #endif -
kernel/arch/ia32/include/mm/page.h
r3842a955 r26e7d6d 42 42 #define PAGE_SIZE FRAME_SIZE 43 43 44 #ifdef KERNEL45 46 44 #ifndef __ASM__ 47 45 … … 201 199 #endif /* __ASM__ */ 202 200 203 #endif /* KERNEL */204 205 201 #endif 206 202 -
kernel/arch/ia32/src/asm.S
r3842a955 r26e7d6d 405 405 xorl %eax, %eax 406 406 cmpl $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%esp) 407 #ifdef PROCESSOR_i486 408 jz 0f 409 movl %eax, %ebp 410 0: 411 #else 407 412 cmovnzl %eax, %ebp 413 #endif 408 414 409 415 movl %ebp, ISTATE_OFFSET_EBP_FRAME(%esp) -
kernel/arch/ia32/src/boot/boot.S
r3842a955 r26e7d6d 97 97 pm_status $status_prot 98 98 99 #include "vesa_prot.inc" 100 101 #ifndef PROCESSOR_i486 102 103 pm_status $status_prot2 104 99 105 movl $(INTEL_CPUID_LEVEL), %eax 100 106 cpuid … … 105 111 cpuid 106 112 bt $(INTEL_PSE), %edx 107 jc pse_supported 113 jnc pse_unsupported 114 115 /* Map kernel and turn paging on */ 116 pm_status $status_pse 117 call map_kernel_pse 118 jmp stack_init 119 120 #endif /* PROCESSOR_i486 */ 108 121 109 122 pse_unsupported: 110 123 111 pm_error $err_pse 112 113 pse_supported: 114 115 #include "vesa_prot.inc" 116 117 /* Map kernel and turn paging on */ 118 call map_kernel 124 /* Map kernel and turn paging on */ 125 pm_status $status_non_pse 126 call map_kernel 127 128 stack_init: 119 129 120 130 /* Create the first stack frame */ … … 122 132 movl %esp, %ebp 123 133 124 pm2_status $status_prot 2134 pm2_status $status_prot3 125 135 126 136 /* Call arch_pre_main(grub_eax, grub_ebx) */ … … 140 150 jmp hlt0 141 151 142 /** Setup mapping for the kernel .152 /** Setup mapping for the kernel (PSE variant) 143 153 * 144 154 * Setup mapping for both the unmapped and mapped sections … … 146 156 * 147 157 */ 148 .global map_kernel 149 map_kernel: 158 .global map_kernel_pse 159 map_kernel_pse: 160 /* Paging features */ 150 161 movl %cr4, %ecx 151 162 orl $(1 << 4), %ecx /* PSE on */ … … 158 169 xorl %ebx, %ebx 159 170 160 floop :171 floop_pse: 161 172 movl $((1 << 7) | (1 << 1) | (1 << 0)), %eax 162 173 orl %ebx, %eax … … 169 180 incl %ecx 170 181 cmpl $512, %ecx 171 jl floop 182 jl floop_pse 172 183 173 184 movl %esi, %cr3 … … 177 188 movl %ebx, %cr0 178 189 ret 190 191 /** Setup mapping for the kernel (non-PSE variant). 192 * 193 * Setup mapping for both the unmapped and mapped sections 194 * of the kernel. For simplicity, we map the entire 4G space. 195 * 196 */ 197 .global map_kernel 198 map_kernel: 199 /* Paging features */ 200 movl %cr4, %ecx 201 andl $(~(1 << 5)), %ecx /* PAE off */ 202 movl %ecx, %cr4 203 204 call calc_kernel_end 205 call find_mem_for_pt 206 207 mov kernel_end, %esi 208 mov free_area, %ecx 209 210 cmpl %esi, %ecx 211 jbe use_kernel_end 212 213 mov %ecx, %esi 214 215 /* Align address down to 4k */ 216 andl $(~4095), %esi 217 218 use_kernel_end: 219 220 /* Align address to 4k */ 221 addl $4095, %esi 222 andl $(~4095), %esi 223 224 /* Allocate space for page tables */ 225 movl %esi, pt_loc 226 movl $ballocs, %edi 227 andl $0x7fffffff, %edi 228 229 movl %esi, (%edi) 230 addl $4, %edi 231 movl $(2 * 1024 * 1024), (%edi) 232 233 /* Fill page tables */ 234 xorl %ecx, %ecx 235 xorl %ebx, %ebx 236 237 floop_pt: 238 movl $((1 << 1) | (1 << 0)), %eax 239 orl %ebx, %eax 240 movl %eax, (%esi, %ecx, 4) 241 addl $(4 * 1024), %ebx 242 243 incl %ecx 244 cmpl $(512 * 1024), %ecx 245 246 jl floop_pt 247 248 /* Fill page directory */ 249 movl $(page_directory + 0), %esi 250 movl $(page_directory + 2048), %edi 251 xorl %ecx, %ecx 252 movl pt_loc, %ebx 253 254 floop: 255 movl $((1 << 1) | (1 << 0)), %eax 256 orl %ebx, %eax 257 258 /* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */ 259 movl %eax, (%esi, %ecx, 4) 260 261 /* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */ 262 movl %eax, (%edi, %ecx, 4) 263 addl $(4 * 1024), %ebx 264 265 incl %ecx 266 cmpl $512, %ecx 267 268 jl floop 269 270 movl %esi, %cr3 271 272 movl %cr0, %ebx 273 orl $(1 << 31), %ebx /* paging on */ 274 movl %ebx, %cr0 275 276 ret 277 278 /** Calculate unmapped address of the end of the kernel. */ 279 calc_kernel_end: 280 movl $hardcoded_load_address, %edi 281 andl $0x7fffffff, %edi 282 movl (%edi), %esi 283 andl $0x7fffffff, %esi 284 285 movl $hardcoded_ktext_size, %edi 286 andl $0x7fffffff, %edi 287 addl (%edi), %esi 288 andl $0x7fffffff, %esi 289 290 movl $hardcoded_kdata_size, %edi 291 andl $0x7fffffff, %edi 292 addl (%edi), %esi 293 andl $0x7fffffff, %esi 294 movl %esi, kernel_end 295 296 ret 297 298 /** Find free 2M (+4k for alignment) region where to store page tables */ 299 find_mem_for_pt: 300 /* Check if multiboot info is present */ 301 cmpl $MULTIBOOT_LOADER_MAGIC, grub_eax 302 je check_multiboot_map 303 304 ret 305 306 check_multiboot_map: 307 308 /* Copy address of the multiboot info to ebx */ 309 movl grub_ebx, %ebx 310 311 /* Check if memory map flag is present */ 312 movl (%ebx), %edx 313 andl $(1 << 6), %edx 314 jnz use_multiboot_map 315 316 ret 317 318 use_multiboot_map: 319 320 /* Copy address of the memory map to edx */ 321 movl 48(%ebx), %edx 322 movl %edx, %ecx 323 324 addl 44(%ebx), %ecx 325 326 /* Find a free region at least 2M in size */ 327 check_memmap_loop: 328 329 /* Is this a free region? */ 330 cmp $1, 20(%edx) 331 jnz next_region 332 333 /* Check size */ 334 cmp $0, 16(%edx) 335 jnz next_region 336 337 cmpl $(2 * 1024 * 1024 + 4 * 1024), 12(%edx) 338 jbe next_region 339 340 cmp $0, 8(%edx) 341 jz found_region 342 343 next_region: 344 345 cmp %ecx, %edx 346 jbe next_region_do 347 348 ret 349 350 next_region_do: 351 352 addl (%edx), %edx 353 addl $4, %edx 354 jmp check_memmap_loop 355 356 found_region: 357 358 /* Use end of the found region */ 359 mov 4(%edx), %ecx 360 add 12(%edx), %ecx 361 sub $(2 * 1024 * 1024), %ecx 362 mov %ecx, free_area 363 364 ret 179 365 180 366 /** Print string to EGA display (in light red) and halt. … … 521 707 grub_eax: 522 708 .long 0 523 524 709 grub_ebx: 525 710 .long 0 526 711 527 err_pse: 528 .asciz "Page Size Extension not supported. System halted." 712 pt_loc: 713 .long 0 714 kernel_end: 715 .long 0 716 free_area: 717 .long 0 529 718 530 719 status_prot: 531 720 .asciz "[prot] " 721 status_pse: 722 .asciz "[pse] " 723 status_non_pse: 724 .asciz "[non_pse] " 532 725 status_vesa_copy: 533 726 .asciz "[vesa_copy] " … … 538 731 status_prot2: 539 732 .asciz "[prot2] " 733 status_prot3: 734 .asciz "[prot3] " 540 735 status_main: 541 736 .asciz "[main] " -
kernel/arch/ia32/src/boot/vesa_real.inc
r3842a955 r26e7d6d 154 154 mov $e_vesa_init - vesa_init, %di 155 155 push %di 156 /* Write the "VBE2" signature into the info structure in order 157 * to get proper mode information. The presence of "VBE2" 158 * indicates two things: 159 * 160 * - VBE controller information structure is expected to be 161 * 512 bytes long instead of 256 bytes. 162 * - The BIOS should report VBE 3.0 information (potentially 163 * including non-standard modes in the mode list). 164 */ 165 movl $0x32454256, (%di) 156 166 int $0x10 157 167 -
kernel/arch/ia32/src/cpu/cpu.c
r3842a955 r26e7d6d 118 118 ); 119 119 } 120 120 121 #ifndef PROCESSOR_i486 121 122 if (CPU->arch.fi.bits.sep) { 122 123 /* Setup fast SYSENTER/SYSEXIT syscalls */ 123 124 syscall_setup_cpu(); 124 125 } 126 #endif 125 127 } 126 128 -
kernel/arch/ia32/src/drivers/vesa.c
r3842a955 r26e7d6d 38 38 39 39 #include <genarch/fb/fb.h> 40 #include <genarch/fb/visuals.h>41 40 #include <arch/drivers/vesa.h> 42 41 #include <console/chardev.h> -
kernel/arch/ia32/src/proc/scheduler.c
r3842a955 r26e7d6d 60 60 uintptr_t kstk = (uintptr_t) &THREAD->kstack[STACK_SIZE]; 61 61 62 #ifndef PROCESSOR_i486 62 63 if (CPU->arch.fi.bits.sep) { 63 64 /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */ 64 65 write_msr(IA32_MSR_SYSENTER_ESP, kstk - sizeof(istate_t)); 65 66 } 67 #endif 66 68 67 69 /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */ -
kernel/arch/ia32/src/smp/smp.c
r3842a955 r26e7d6d 42 42 #include <config.h> 43 43 #include <synch/waitq.h> 44 #include <synch/synch.h>45 44 #include <arch/pm.h> 46 45 #include <func.h> -
kernel/arch/ia32/src/syscall.c
r3842a955 r26e7d6d 39 39 #include <arch/pm.h> 40 40 41 #ifndef PROCESSOR_i486 42 41 43 /** Enable & setup support for SYSENTER/SYSEXIT */ 42 44 void syscall_setup_cpu(void) … … 50 52 } 51 53 54 #endif /* PROCESSOR_i486 */ 55 52 56 /** @} 53 57 */ -
kernel/arch/ia32/src/userspace.c
r3842a955 r26e7d6d 37 37 #include <typedefs.h> 38 38 #include <arch.h> 39 #include < proc/uarg.h>39 #include <abi/proc/uarg.h> 40 40 #include <mm/as.h> 41 42 41 43 42 /** Enter userspace -
kernel/arch/ia64/include/bootinfo.h
r3842a955 r26e7d6d 34 34 #define MEMMAP_ITEMS 128 35 35 36 #define EFI_MEMMAP_FREE_MEM 036 #define MEMMAP_FREE_MEM 0 37 37 38 38 /** Size of buffer for storing task name in binit_task_t. */ … … 54 54 unsigned long base; 55 55 unsigned long size; 56 } efi_memmap_item_t;56 } memmap_item_t; 57 57 58 58 typedef struct { 59 59 binit_t taskmap; 60 60 61 efi_memmap_item_t memmap[MEMMAP_ITEMS];61 memmap_item_t memmap[MEMMAP_ITEMS]; 62 62 unsigned int memmap_items; 63 63 … … 66 66 unsigned long freq_scale; 67 67 unsigned int wakeup_intno; 68 int hello_configured;69 68 } bootinfo_t; 70 69 -
kernel/arch/ia64/include/elf.h
r3842a955 r26e7d6d 27 27 */ 28 28 29 /** @addtogroup ia64 29 /** @addtogroup ia64 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ia64_ELF_H_ 37 37 38 #define ELF_MACHINEEM_IA_6439 #define ELF_DATA_ENCODING ELFDATA2LSB40 #define ELF_CLASS ELFCLASS6438 #define ELF_MACHINE EM_IA_64 39 #define ELF_DATA_ENCODING ELFDATA2LSB 40 #define ELF_CLASS ELFCLASS64 41 41 42 42 #endif -
kernel/arch/ia64/include/istate.h
r3842a955 r26e7d6d 36 36 #define KERN_ia64_ISTATE_H_ 37 37 38 #include <trace.h> 39 40 #ifdef KERNEL 41 38 42 #include <arch/register.h> 39 43 40 #ifdef KERNEL 41 #include <typedefs.h> 42 #include <trace.h> 43 #else 44 #include <sys/types.h> 45 #define NO_TRACE 46 #endif 44 #else /* KERNEL */ 45 46 #include <libarch/register.h> 47 48 #endif /* KERNEL */ 47 49 48 50 typedef struct istate { -
kernel/arch/ia64/include/mm/frame.h
r3842a955 r26e7d6d 39 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 #ifdef KERNEL42 41 #ifndef __ASM__ 43 42 … … 50 49 51 50 #endif /* __ASM__ */ 52 #endif /* KERNEL */53 51 54 52 #endif -
kernel/arch/ia64/include/mm/page.h
r3842a955 r26e7d6d 41 41 #define PAGE_SIZE FRAME_SIZE 42 42 #define PAGE_WIDTH FRAME_WIDTH 43 44 #ifdef KERNEL45 43 46 44 /** Bit width of the TLB-locked portion of kernel address space. */ … … 316 314 #endif /* __ASM__ */ 317 315 318 #endif /* KERNEL */319 320 316 #endif 321 317 -
kernel/arch/ia64/include/register.h
r3842a955 r26e7d6d 61 61 #define PSR_CPL_MASK_SHIFTED 3 62 62 63 #define PSR_RI_SHIFT 4164 #define PSR_RI_LEN 263 #define PSR_RI_SHIFT 41 64 #define PSR_RI_LEN 2 65 65 66 66 #define PFM_MASK (~0x3fffffffff) … … 145 145 #ifndef __ASM__ 146 146 147 #ifdef KERNEL148 #include <typedefs.h>149 #else150 #include <sys/types.h>151 #endif152 153 147 /** Processor Status Register. */ 154 148 typedef union { -
kernel/arch/ia64/src/drivers/ski.c
r3842a955 r26e7d6d 57 57 }; 58 58 59 static void ski_putchar(outdev_t *, const wchar_t , bool);59 static void ski_putchar(outdev_t *, const wchar_t); 60 60 61 61 static outdev_operations_t skidev_ops = { … … 99 99 static void poll_keyboard(ski_instance_t *instance) 100 100 { 101 if (silent)102 return;103 104 101 int count = POLL_LIMIT; 105 102 … … 121 118 122 119 while (true) { 123 if (!silent) 120 // TODO FIXME: 121 // This currently breaks the kernel console 122 // before we get the override from uspace. 123 if (console_override) 124 124 poll_keyboard(instance); 125 125 … … 182 182 * @param dev Character device. 183 183 * @param ch Character to be printed. 184 * @param silent Whether the output should be silenced. 185 * 186 */ 187 static void ski_putchar(outdev_t *dev, const wchar_t ch, bool silent) 188 { 189 if (!silent) { 184 * 185 */ 186 static void ski_putchar(outdev_t *dev, const wchar_t ch) 187 { 188 // TODO FIXME: 189 // This currently breaks the kernel console 190 // before we get the override from uspace. 191 if (console_override) { 190 192 if (ascii_check(ch)) { 191 193 if (ch == '\n') … … 213 215 if (!fb_exported) { 214 216 /* 215 * This is the necessary evil until the userspace driver is entirely 217 * This is the necessary evil until 218 * the userspace driver is entirely 216 219 * self-sufficient. 217 220 */ -
kernel/arch/ia64/src/ia64.c
r3842a955 r26e7d6d 50 50 #include <userspace.h> 51 51 #include <console/console.h> 52 #include < proc/uarg.h>52 #include <abi/proc/uarg.h> 53 53 #include <syscall/syscall.h> 54 54 #include <ddi/irq.h> … … 151 151 /* Set platform name. */ 152 152 #ifdef MACHINE_ski 153 platform = " pc";153 platform = "ski"; 154 154 #endif 155 155 #ifdef MACHINE_i460GX -
kernel/arch/ia64/src/mm/frame.c
r3842a955 r26e7d6d 58 58 unsigned int i; 59 59 for (i = 0; i < bootinfo->memmap_items; i++) { 60 if (bootinfo->memmap[i].type == EFI_MEMMAP_FREE_MEM) {60 if (bootinfo->memmap[i].type == MEMMAP_FREE_MEM) { 61 61 uint64_t base = bootinfo->memmap[i].base; 62 62 uint64_t size = bootinfo->memmap[i].size; -
kernel/arch/mips32/Makefile.inc
r3842a955 r26e7d6d 29 29 BFD_ARCH = mips 30 30 BFD = binary 31 GCC_CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 31 GCC_CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=32 32 32 33 33 BITS = 32 -
kernel/arch/mips32/include/context_offset.h
r3842a955 r26e7d6d 63 63 #ifdef __ASM__ 64 64 65 #ifdef KERNEL 66 65 67 #include <arch/asm/regname.h> 66 68 67 # ctx: address of the structure with saved context 69 #else /* KERNEL */ 70 71 #include <libarch/regname.h> 72 73 #endif /* KERNEL */ 74 75 /* ctx: address of the structure with saved context */ 68 76 .macro CONTEXT_SAVE_ARCH_CORE ctx:req 69 sw $s0, OFFSET_S0(\ctx)70 sw $s1, OFFSET_S1(\ctx)71 sw $s2, OFFSET_S2(\ctx)72 sw $s3, OFFSET_S3(\ctx)73 sw $s4, OFFSET_S4(\ctx)74 sw $s5, OFFSET_S5(\ctx)75 sw $s6, OFFSET_S6(\ctx)76 sw $s7, OFFSET_S7(\ctx)77 sw $s8, OFFSET_S8(\ctx)78 sw $gp, OFFSET_GP(\ctx)79 77 sw $s0, OFFSET_S0(\ctx) 78 sw $s1, OFFSET_S1(\ctx) 79 sw $s2, OFFSET_S2(\ctx) 80 sw $s3, OFFSET_S3(\ctx) 81 sw $s4, OFFSET_S4(\ctx) 82 sw $s5, OFFSET_S5(\ctx) 83 sw $s6, OFFSET_S6(\ctx) 84 sw $s7, OFFSET_S7(\ctx) 85 sw $s8, OFFSET_S8(\ctx) 86 sw $gp, OFFSET_GP(\ctx) 87 80 88 #ifndef KERNEL 81 sw $k1, OFFSET_TLS(\ctx)82 89 sw $k1, OFFSET_TLS(\ctx) 90 83 91 #ifdef CONFIG_FPU 84 mfc1 $t0, $2092 mfc1 $t0, $20 85 93 sw $t0, OFFSET_F20(\ctx) 86 87 mfc1 $t0, $2194 95 mfc1 $t0, $21 88 96 sw $t0, OFFSET_F21(\ctx) 89 90 mfc1 $t0, $2297 98 mfc1 $t0, $22 91 99 sw $t0, OFFSET_F22(\ctx) 92 93 mfc1 $t0, $23100 101 mfc1 $t0, $23 94 102 sw $t0, OFFSET_F23(\ctx) 95 96 mfc1 $t0, $24103 104 mfc1 $t0, $24 97 105 sw $t0, OFFSET_F24(\ctx) 98 99 mfc1 $t0, $25106 107 mfc1 $t0, $25 100 108 sw $t0, OFFSET_F25(\ctx) 101 102 mfc1 $t0, $26109 110 mfc1 $t0, $26 103 111 sw $t0, OFFSET_F26(\ctx) 104 105 mfc1 $t0, $27112 113 mfc1 $t0, $27 106 114 sw $t0, OFFSET_F27(\ctx) 107 108 mfc1 $t0, $28115 116 mfc1 $t0, $28 109 117 sw $t0, OFFSET_F28(\ctx) 110 111 mfc1 $t0, $29118 119 mfc1 $t0, $29 112 120 sw $t0, OFFSET_F29(\ctx) 113 121 114 mfc1 $t0, $30122 mfc1 $t0, $30 115 123 sw $t0, OFFSET_F30(\ctx) 116 124 #endif /* CONFIG_FPU */ 117 125 #endif /* KERNEL */ 118 119 sw $ra, OFFSET_PC(\ctx)120 sw $sp, OFFSET_SP(\ctx)126 127 sw $ra, OFFSET_PC(\ctx) 128 sw $sp, OFFSET_SP(\ctx) 121 129 .endm 122 130 123 # ctx: address of the structure with saved context 131 /* ctx: address of the structure with saved context */ 124 132 .macro CONTEXT_RESTORE_ARCH_CORE ctx:req 125 lw $s0, OFFSET_S0(\ctx)126 lw $s1, OFFSET_S1(\ctx)127 lw $s2, OFFSET_S2(\ctx)128 lw $s3, OFFSET_S3(\ctx)129 lw $s4, OFFSET_S4(\ctx)130 lw $s5, OFFSET_S5(\ctx)131 lw $s6, OFFSET_S6(\ctx)132 lw $s7, OFFSET_S7(\ctx)133 lw $s8, OFFSET_S8(\ctx)134 lw $gp, OFFSET_GP(\ctx)133 lw $s0, OFFSET_S0(\ctx) 134 lw $s1, OFFSET_S1(\ctx) 135 lw $s2, OFFSET_S2(\ctx) 136 lw $s3, OFFSET_S3(\ctx) 137 lw $s4, OFFSET_S4(\ctx) 138 lw $s5, OFFSET_S5(\ctx) 139 lw $s6, OFFSET_S6(\ctx) 140 lw $s7, OFFSET_S7(\ctx) 141 lw $s8, OFFSET_S8(\ctx) 142 lw $gp, OFFSET_GP(\ctx) 135 143 #ifndef KERNEL 136 lw $k1, OFFSET_TLS(\ctx)137 144 lw $k1, OFFSET_TLS(\ctx) 145 138 146 #ifdef CONFIG_FPU 139 147 lw $t0, OFFSET_F20(\ctx) 140 mtc1 $t0, $20141 148 mtc1 $t0, $20 149 142 150 lw $t0, OFFSET_F21(\ctx) 143 mtc1 $t0, $21144 151 mtc1 $t0, $21 152 145 153 lw $t0, OFFSET_F22(\ctx) 146 mtc1 $t0, $22147 154 mtc1 $t0, $22 155 148 156 lw $t0, OFFSET_F23(\ctx) 149 mtc1 $t0, $23150 157 mtc1 $t0, $23 158 151 159 lw $t0, OFFSET_F24(\ctx) 152 mtc1 $t0, $24153 160 mtc1 $t0, $24 161 154 162 lw $t0, OFFSET_F25(\ctx) 155 mtc1 $t0, $25156 163 mtc1 $t0, $25 164 157 165 lw $t0, OFFSET_F26(\ctx) 158 mtc1 $t0, $26159 166 mtc1 $t0, $26 167 160 168 lw $t0, OFFSET_F27(\ctx) 161 mtc1 $t0, $27162 169 mtc1 $t0, $27 170 163 171 lw $t0, OFFSET_F28(\ctx) 164 mtc1 $t0, $28165 172 mtc1 $t0, $28 173 166 174 lw $t0, OFFSET_F29(\ctx) 167 mtc1 $t0, $29168 175 mtc1 $t0, $29 176 169 177 lw $t0, OFFSET_F30(\ctx) 170 mtc1 $t0, $30178 mtc1 $t0, $30 171 179 #endif /* CONFIG_FPU */ 172 180 #endif /* KERNEL */ 173 174 lw $ra, OFFSET_PC(\ctx)175 lw $sp, OFFSET_SP(\ctx)181 182 lw $ra, OFFSET_PC(\ctx) 183 lw $sp, OFFSET_SP(\ctx) 176 184 .endm 177 185 178 #endif 179 186 #endif /* __ASM__ */ 180 187 181 188 #endif -
kernel/arch/mips32/include/cp0.h
r3842a955 r26e7d6d 36 36 #define KERN_mips32_CP0_H_ 37 37 38 #ifdef KERNEL39 #include <typedefs.h>40 #else41 #include <sys/types.h>42 #endif43 44 38 #define cp0_status_ie_enabled_bit (1 << 0) 45 39 #define cp0_status_exl_exception_bit (1 << 1) … … 49 43 #define cp0_status_fpu_bit (1 << 29) 50 44 51 #define cp0_status_im_shift 852 #define cp0_status_im_mask 0xff0045 #define cp0_status_im_shift 8 46 #define cp0_status_im_mask 0xff00 53 47 54 #define cp0_cause_excno(cause) ((cause >> 2) & 0x1f)55 #define cp0_cause_coperr(cause) ((cause >> 28) & 0x3)48 #define cp0_cause_excno(cause) ((cause >> 2) & 0x1f) 49 #define cp0_cause_coperr(cause) ((cause >> 28) & 0x3) 56 50 57 #define fpu_cop_id 151 #define fpu_cop_id 1 58 52 59 53 /* 60 54 * Magic value for use in msim. 61 55 */ 62 #define cp0_compare_value 10000056 #define cp0_compare_value 100000 63 57 64 #define cp0_mask_all_int() cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask)) 65 #define cp0_unmask_all_int() cp0_status_write(cp0_status_read() | cp0_status_im_mask) 66 #define cp0_mask_int(it) cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it)))) 67 #define cp0_unmask_int(it) cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it)))) 58 #define cp0_mask_all_int() \ 59 cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask)) 68 60 69 #define GEN_READ_CP0(nm,reg) static inline uint32_t cp0_ ##nm##_read(void) \ 70 { \ 71 uint32_t retval; \ 72 asm volatile ("mfc0 %0, $" #reg : "=r"(retval)); \ 73 return retval; \ 74 } 61 #define cp0_unmask_all_int() \ 62 cp0_status_write(cp0_status_read() | cp0_status_im_mask) 75 63 76 #define GEN_WRITE_CP0(nm,reg) static inline void cp0_ ##nm##_write(uint32_t val) \ 77 { \ 78 asm volatile ("mtc0 %0, $" #reg : : "r"(val) ); \ 79 } 64 #define cp0_mask_int(it) \ 65 cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it)))) 66 67 #define cp0_unmask_int(it) \ 68 cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it)))) 69 70 #define GEN_READ_CP0(nm, reg) \ 71 static inline uint32_t cp0_ ##nm##_read(void) \ 72 { \ 73 uint32_t retval; \ 74 \ 75 asm volatile ( \ 76 "mfc0 %0, $" #reg \ 77 : "=r"(retval) \ 78 ); \ 79 \ 80 return retval; \ 81 } 82 83 #define GEN_WRITE_CP0(nm, reg) \ 84 static inline void cp0_ ##nm##_write(uint32_t val) \ 85 { \ 86 asm volatile ( \ 87 "mtc0 %0, $" #reg \ 88 :: "r"(val) \ 89 ); \ 90 } 80 91 81 92 GEN_READ_CP0(index, 0); -
kernel/arch/mips32/include/cycle.h
r3842a955 r26e7d6d 27 27 */ 28 28 29 /** @addtogroup mips 229 /** @addtogroup mips32 30 30 * @{ 31 31 */ -
kernel/arch/mips32/include/debug.h
r3842a955 r26e7d6d 34 34 35 35 #ifndef KERN_mips32_DEBUG_H_ 36 #define KERN_mips 23_DEBUG_H_36 #define KERN_mips32_DEBUG_H_ 37 37 38 38 /** Enter the simulator trace mode */ -
kernel/arch/mips32/include/istate.h
r3842a955 r26e7d6d 36 36 #define KERN_mips32_ISTATE_H_ 37 37 38 #include <trace.h> 39 40 #ifdef KERNEL 41 38 42 #include <arch/cp0.h> 39 43 40 #ifdef KERNEL 41 #include <typedefs.h> 42 #include <trace.h> 43 #else 44 #include <sys/types.h> 45 #define NO_TRACE 46 #endif 44 #else /* KERNEL */ 45 46 #include <libarch/cp0.h> 47 48 #endif /* KERNEL */ 47 49 48 50 typedef struct istate { -
kernel/arch/mips32/include/mm/frame.h
r3842a955 r26e7d6d 39 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 #ifdef KERNEL42 41 #ifndef __ASM__ 43 44 #include <typedefs.h>45 42 46 43 extern void frame_arch_init(void); … … 48 45 49 46 #endif /* __ASM__ */ 50 #endif /* KERNEL */51 47 52 48 #endif -
kernel/arch/mips32/include/mm/page.h
r3842a955 r26e7d6d 49 49 # define PA2KA(x) ((x) + 0x80000000) 50 50 #endif 51 52 #ifdef KERNEL53 51 54 52 /* … … 188 186 #endif /* __ASM__ */ 189 187 190 #endif /* KERNEL */191 192 188 #endif 193 189 -
kernel/arch/mips32/include/stack.h
r3842a955 r26e7d6d 39 39 #define STACK_ALIGNMENT 8 40 40 41 #define STACK_ARG0 042 #define STACK_ARG1 443 #define STACK_ARG2 844 #define STACK_ARG3 1245 #define STACK_ARG4 1646 #define STACK_ARG5 2047 #define STACK_ARG6 2448 49 41 #endif 50 42 -
kernel/arch/mips32/src/cache.c
r3842a955 r26e7d6d 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ -
kernel/arch/mips32/src/cpu/cpu.c
r3842a955 r26e7d6d 37 37 #include <arch.h> 38 38 #include <arch/cp0.h> 39 #include <print.h> 39 #include <print.h> 40 40 41 41 struct data_t { -
kernel/arch/mips32/src/fpu_context.c
r3842a955 r26e7d6d 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 40 40 41 41 void fpu_disable(void) 42 { 42 { 43 43 #ifdef CONFIG_FPU 44 44 cp0_status_write(cp0_status_read() & ~cp0_status_fpu_bit); -
kernel/arch/mips32/src/mips32.c
r3842a955 r26e7d6d 41 41 #include <memstr.h> 42 42 #include <proc/thread.h> 43 #include < proc/uarg.h>43 #include <abi/proc/uarg.h> 44 44 #include <print.h> 45 45 #include <console/console.h> … … 52 52 #include <arch/debugger.h> 53 53 #include <genarch/fb/fb.h> 54 #include < genarch/fb/visuals.h>54 #include <abi/fb/visuals.h> 55 55 #include <genarch/drivers/dsrln/dsrlnin.h> 56 56 #include <genarch/drivers/dsrln/dsrlnout.h> -
kernel/arch/mips32/src/mm/as.c
r3842a955 r26e7d6d 61 61 /* 62 62 * Install ASID. 63 */ 63 */ 64 64 hi.value = cp0_entry_hi_read(); 65 65 66 66 hi.asid = as->asid; 67 cp0_entry_hi_write(hi.value); 67 cp0_entry_hi_write(hi.value); 68 68 } 69 69 -
kernel/arch/mips32/src/mm/tlb.c
r3842a955 r26e7d6d 73 73 tlbwi(); 74 74 } 75 75 76 76 /* 77 77 * The kernel is going to make use of some wired … … 386 386 ASSERT(pte->w || access != PF_ACCESS_WRITE); 387 387 return pte; 388 break;389 388 case AS_PF_DEFER: 390 389 *pfrc = AS_PF_DEFER; 391 390 return NULL; 392 break;393 391 case AS_PF_FAULT: 394 392 *pfrc = AS_PF_FAULT; 395 393 return NULL; 396 break;397 394 default: 398 395 panic("Unexpected rc (%d).", rc); -
kernel/arch/mips32/src/start.S
r3842a955 r26e7d6d 222 222 223 223 /* move $k0 pointer to kernel stack */ 224 lui $k0, %hi(supervisor_sp) 225 ori $k0, $k0, %lo(supervisor_sp) 224 la $k0, supervisor_sp 226 225 227 226 /* move $k0 (supervisor_sp) */ -
kernel/arch/mips64/include/arch.h
r3842a955 r26e7d6d 1 1 /* 2 * Copyright (c) 2009 Jiri Svoboda 3 * Copyright (c) 2010 Lenka Trochtova 2 * Copyright (c) 2005 Martin Decky 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup libc29 /** @addtogroup mips64 31 30 * @{ 32 31 */ … … 34 33 */ 35 34 36 #ifndef LIBC_DEVMAN_OBSOLETE_H_37 #define LIBC_DEVMAN_OBSOLETE_H_35 #ifndef KERN_mips64_ARCH_H_ 36 #define KERN_mips64_ARCH_H_ 38 37 39 #include <ipc/devman.h> 40 #include <async.h> 41 #include <bool.h> 38 #include <typedefs.h> 42 39 43 extern int devman_obsolete_get_phone(devman_interface_t, unsigned int); 44 extern void devman_obsolete_hangup_phone(devman_interface_t); 40 #define TASKMAP_MAX_RECORDS 32 41 #define CPUMAP_MAX_RECORDS 32 42 #define BOOTINFO_TASK_NAME_BUFLEN 32 45 43 46 extern int devman_obsolete_device_connect(devman_handle_t, unsigned int); 47 extern int devman_obsolete_parent_device_connect(devman_handle_t, unsigned int); 44 extern size_t cpu_count; 45 46 typedef struct { 47 void *addr; 48 size_t size; 49 char name[BOOTINFO_TASK_NAME_BUFLEN]; 50 } utask_t; 51 52 typedef struct { 53 uint32_t cpumap; 54 size_t cnt; 55 utask_t tasks[TASKMAP_MAX_RECORDS]; 56 } bootinfo_t; 57 58 extern void arch_pre_main(void *entry, bootinfo_t *bootinfo); 48 59 49 60 #endif -
kernel/arch/mips64/include/cpu.h
r3842a955 r26e7d6d 1 1 /* 2 * Copyright (c) 200 9 Jiri Svoboda2 * Copyright (c) 2003-2004 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse 30 * @brief 29 /** @addtogroup mips64 31 30 * @{ 32 31 */ … … 34 33 */ 35 34 36 #ifndef LIBC_IPC_MOUSE_H_37 #define LIBC_IPC_MOUSE_H_35 #ifndef KERN_mips64_CPU_H_ 36 #define KERN_mips64_CPU_H_ 38 37 39 #include <ipc/common.h> 38 #include <typedefs.h> 39 #include <arch/asm.h> 40 40 41 typedef enum{42 MEVENT_BUTTON = IPC_FIRST_USER_METHOD,43 MEVENT_MOVE44 } mouse_notif_t;41 typedef struct { 42 uint32_t imp_num; 43 uint32_t rev_num; 44 } cpu_arch_t; 45 45 46 46 #endif 47 47 48 /** 49 * @} 48 /** @} 50 49 */ -
kernel/arch/mips64/include/debugger.h
r3842a955 r26e7d6d 1 1 /* 2 * Copyright (c) 20 11 Jan Vesely2 * Copyright (c) 2005 Ondrej Palkovsky 3 3 * All rights reserved. 4 4 * … … 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup drvusbohci 28 29 /** @addtogroup mips64 29 30 * @{ 30 31 */ 31 32 /** @file 32 * @brief OHCI driver USB transaction structure33 33 */ 34 #ifndef DRV_OHCI_BATCH_H35 #define DRV_OHCI_BATCH_H36 34 37 #include <usbhc_iface.h> 38 #include <usb/usb.h> 39 #include <usb/host/device_keeper.h> 40 #include <usb/host/endpoint.h> 41 #include <usb/host/batch.h> 35 #ifndef KERN_mips64_DEBUGGER_H_ 36 #define KERN_mips64_DEBUGGER_H_ 42 37 43 usb_transfer_batch_t * batch_get( 44 ddf_fun_t *fun, endpoint_t *ep, char *buffer, size_t size, 45 const char *setup_buffer, size_t setup_size, 46 usbhc_iface_transfer_in_callback_t func_in, 47 usbhc_iface_transfer_out_callback_t func_out, 48 void *arg); 38 #include <arch/exception.h> 39 #include <typedefs.h> 49 40 50 bool batch_is_complete(usb_transfer_batch_t *instance); 41 #define BKPOINTS_MAX 10 51 42 52 void batch_commit(usb_transfer_batch_t *instance); 43 /** Breakpoint was shot */ 44 #define BKPOINT_INPROG (1 << 0) 53 45 54 void batch_control_write(usb_transfer_batch_t *instance); 46 /** One-time breakpoint, mandatory for j/b instructions */ 47 #define BKPOINT_ONESHOT (1 << 1) 55 48 56 void batch_control_read(usb_transfer_batch_t *instance); 49 /** 50 * Breakpoint is set on the next instruction, so that it 51 * could be reinstalled on the previous one 52 */ 53 #define BKPOINT_REINST (1 << 2) 57 54 58 void batch_interrupt_in(usb_transfer_batch_t *instance); 55 /** Call a predefined function */ 56 #define BKPOINT_FUNCCALL (1 << 3) 59 57 60 void batch_interrupt_out(usb_transfer_batch_t *instance);61 58 62 void batch_bulk_in(usb_transfer_batch_t *instance); 59 typedef struct { 60 uintptr_t address; /**< Breakpoint address */ 61 sysarg_t instruction; /**< Original instruction */ 62 sysarg_t nextinstruction; /**< Original instruction following break */ 63 unsigned int flags; /**< Flags regarding breakpoint */ 64 size_t counter; 65 void (*bkfunc)(void *, istate_t *); 66 } bpinfo_t; 63 67 64 void batch_bulk_out(usb_transfer_batch_t *instance); 68 extern bpinfo_t breakpoints[BKPOINTS_MAX]; 69 70 extern bool is_jump(sysarg_t); 71 72 extern void debugger_init(void); 73 extern void debugger_bpoint(istate_t *); 74 65 75 #endif 66 /** 67 * @}76 77 /** @} 68 78 */ -
kernel/arch/mips64/include/drivers/msim.h
r3842a955 r26e7d6d 1 1 /* 2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2008 Martin Decky 2 * Copyright (c) 2005 Ondrej Palkovsky 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup msimfb 31 * @brief HelenOS MSIM text console. 32 * @ingroup fbs 29 /** @addtogroup mips64 33 30 * @{ 34 */ 31 */ 35 32 /** @file 36 33 */ 37 34 38 #ifndef FB_MSIM_H_39 #define FB_MSIM_H_35 #ifndef KERN_mips64_MSIM_H_ 36 #define KERN_mips64_MSIM_H_ 40 37 41 extern int msim_init(void); 38 /** Address of devices. */ 39 #define MSIM_VIDEORAM 0xffffffff90000000 40 #define MSIM_KBD_ADDRESS 0xffffffff90000000 41 #define MSIM_KBD_IRQ 2 42 42 43 43 #endif … … 45 45 /** @} 46 46 */ 47 -
kernel/arch/mips64/include/interrupt.h
r3842a955 r26e7d6d 1 1 /* 2 * Copyright (c) 200 6Jakub Jermar2 * Copyright (c) 2003-2004 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup sparc6429 /** @addtogroup mips64 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef KERN_ sparc64_FHC_H_36 #define KERN_ sparc64_FHC_H_35 #ifndef KERN_mips64_INTERRUPT_H_ 36 #define KERN_mips64_INTERRUPT_H_ 37 37 38 38 #include <typedefs.h> 39 #include < genarch/ofw/ofw_tree.h>39 #include <arch/exception.h> 40 40 41 typedef struct { 42 volatile uint32_t *uart_imap; 43 } fhc_t; 41 #define IVT_ITEMS 32 42 #define IVT_FIRST 0 44 43 45 extern fhc_t *central_fhc; 44 #define VECTOR_TLB_SHOOTDOWN_IPI EXC_Int 46 45 47 extern fhc_t *fhc_init(ofw_tree_node_t *); 48 extern void fhc_enable_interrupt(fhc_t *, int); 49 extern void fhc_clear_interrupt(void *, int); 46 extern function virtual_timer_fnc; 47 extern uint32_t count_hi; 48 49 extern void interrupt_init(void); 50 50 51 51 #endif -
kernel/arch/mips64/include/proc/task.h
r3842a955 r26e7d6d 1 1 /* 2 * Copyright (c) 20 10 Jiri Svoboda2 * Copyright (c) 2006 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mouse 30 * @brief 29 /** @addtogroup mips64proc 31 30 * @{ 32 31 */ … … 34 33 */ 35 34 36 #ifndef ADB_MOUSE_H_37 #define ADB_MOUSE_H_35 #ifndef KERN_mips64_TASK_H_ 36 #define KERN_mips64_TASK_H_ 38 37 39 #include <sys/types.h> 38 typedef struct { 39 } task_arch_t; 40 40 41 #define NAME "adb_ms" 42 #define NAMESPACE "hid_in" 43 44 extern void mouse_handle_data(uint16_t); 41 #define task_create_arch(task) 42 #define task_destroy_arch(task) 45 43 46 44 #endif 47 45 48 /** 49 * @} 46 /** @} 50 47 */ -
kernel/arch/mips64/src/mm/page.c
r3842a955 r26e7d6d 1 1 /* 2 * Copyright (c) 20 11 Martin Decky2 * Copyright (c) 2003-2004 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libc29 /** @addtogroup mips64mm 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #include <a sync.h>36 #include < async_obsolete.h>37 #include < ns_obsolete.h>38 #include < kernel/ipc/ipc_methods.h>35 #include <arch/mm/page.h> 36 #include <genarch/mm/page_ht.h> 37 #include <mm/page.h> 38 #include <mm/frame.h> 39 39 40 int service_obsolete_connect(sysarg_t service, sysarg_t arg2, sysarg_t arg3)40 void page_arch_init(void) 41 41 { 42 return async_obsolete_connect_me_to(PHONE_NS, service, arg2, arg3);42 page_mapping_operations = &ht_mapping_operations; 43 43 } 44 44 45 int service_obsolete_connect_blocking(sysarg_t service, sysarg_t arg2, sysarg_t arg3) 45 /** Map device into kernel space 46 * - on mips, all devices are already mapped into kernel space, 47 * translate the physical address to uncached area 48 */ 49 uintptr_t hw_map(uintptr_t physaddr, size_t size) 46 50 { 47 return async_obsolete_connect_me_to_blocking(PHONE_NS, service, arg2, arg3);51 return physaddr + 0xffffffffa0000000; 48 52 } 49 53 -
kernel/arch/ppc32/include/asm.h
r3842a955 r26e7d6d 38 38 #include <typedefs.h> 39 39 #include <config.h> 40 #include <arch/ cpu.h>40 #include <arch/msr.h> 41 41 #include <arch/mm/asid.h> 42 42 #include <trace.h> -
kernel/arch/ppc32/include/context_offset.h
r3842a955 r26e7d6d 75 75 76 76 #ifdef __ASM__ 77 # include <arch/asm/regname.h>78 77 79 # ctx: address of the structure with saved context 78 #ifdef KERNEL 79 80 #include <arch/asm/regname.h> 81 82 #else /* KERNEL */ 83 84 #include <libarch/regname.h> 85 86 #endif /* KERNEL */ 87 88 /* ctx: address of the structure with saved context */ 80 89 .macro CONTEXT_SAVE_ARCH_CORE ctx:req 81 90 stw sp, OFFSET_SP(\ctx) … … 102 111 .endm 103 112 104 # ctx: address of the structure with saved context 113 /* ctx: address of the structure with saved context */ 105 114 .macro CONTEXT_RESTORE_ARCH_CORE ctx:req 106 115 lwz sp, OFFSET_SP(\ctx) -
kernel/arch/ppc32/include/cpu.h
r3842a955 r26e7d6d 36 36 #define KERN_ppc32_CPU_H_ 37 37 38 /* MSR bits */39 #define MSR_DR (1 << 4)40 #define MSR_IR (1 << 5)41 #define MSR_PR (1 << 14)42 #define MSR_EE (1 << 15)43 44 /* HID0 bits */45 #define HID0_STEN (1 << 24)46 #define HID0_ICE (1 << 15)47 #define HID0_DCE (1 << 14)48 #define HID0_ICFI (1 << 11)49 #define HID0_DCI (1 << 10)50 51 #ifndef __ASM__52 53 38 #include <typedefs.h> 54 39 #include <trace.h> … … 67 52 } 68 53 69 #endif /* __ASM__ */70 71 54 #endif 72 55 -
kernel/arch/ppc32/include/exception.h
r3842a955 r26e7d6d 37 37 38 38 #include <typedefs.h> 39 #include <arch/ cpu.h>39 #include <arch/msr.h> 40 40 #include <trace.h> 41 41 -
kernel/arch/ppc32/include/istate.h
r3842a955 r26e7d6d 36 36 #define KERN_ppc32_EXCEPTION_H_ 37 37 38 #include <typedefs.h>39 #include <arch/cpu.h>40 38 #include <trace.h> 39 40 #ifdef KERNEL 41 42 #include <arch/msr.h> 43 44 #else /* KERNEL */ 45 46 #include <libarch/msr.h> 47 48 #endif /* KERNEL */ 41 49 42 50 typedef struct istate { -
kernel/arch/ppc32/include/mm/frame.h
r3842a955 r26e7d6d 39 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 #ifdef KERNEL42 41 #ifndef __ASM__ 43 42 … … 63 62 64 63 #endif /* __ASM__ */ 65 #endif /* KERNEL */66 64 67 65 #endif -
kernel/arch/ppc32/include/mm/page.h
r3842a955 r26e7d6d 41 41 #define PAGE_WIDTH FRAME_WIDTH 42 42 #define PAGE_SIZE FRAME_SIZE 43 44 #ifdef KERNEL45 43 46 44 #ifndef __ASM__ … … 181 179 #endif /* __ASM__ */ 182 180 183 #endif /* KERNEL */184 185 181 #endif 186 182 -
kernel/arch/ppc32/src/asm.S
r3842a955 r26e7d6d 28 28 29 29 #include <arch/asm/regname.h> 30 #include <arch/ cpu.h>30 #include <arch/msr.h> 31 31 32 32 .text -
kernel/arch/ppc32/src/exception.S
r3842a955 r26e7d6d 28 28 29 29 #include <arch/asm/regname.h> 30 #include <arch/ cpu.h>30 #include <arch/msr.h> 31 31 #include <arch/mm/page.h> 32 32 -
kernel/arch/ppc32/src/ppc32.c
r3842a955 r26e7d6d 41 41 #include <interrupt.h> 42 42 #include <genarch/fb/fb.h> 43 #include < genarch/fb/visuals.h>43 #include <abi/fb/visuals.h> 44 44 #include <genarch/ofw/ofw_tree.h> 45 45 #include <genarch/ofw/pci.h> 46 46 #include <userspace.h> 47 47 #include <mm/page.h> 48 #include < proc/uarg.h>48 #include <abi/proc/uarg.h> 49 49 #include <console/console.h> 50 50 #include <sysinfo/sysinfo.h> -
kernel/arch/sparc64/Makefile.inc
r3842a955 r26e7d6d 84 84 arch/$(KARCH)/src/drivers/tick.c \ 85 85 arch/$(KARCH)/src/drivers/kbd.c \ 86 arch/$(KARCH)/src/drivers/sgcn.c \87 86 arch/$(KARCH)/src/drivers/pci.c \ 88 arch/$(KARCH)/src/drivers/fhc.c \89 87 arch/$(KARCH)/src/trap/$(USARCH)/interrupt.c 90 88 -
kernel/arch/sparc64/include/barrier.h
r3842a955 r26e7d6d 37 37 38 38 #include <trace.h> 39 40 #ifdef KERNEL41 42 #include <typedefs.h>43 44 #else45 46 #include <stdint.h>47 48 #endif49 39 50 40 /* -
kernel/arch/sparc64/include/elf.h
r3842a955 r26e7d6d 27 27 */ 28 28 29 /** @addtogroup sparc64 29 /** @addtogroup sparc64 30 30 * @{ 31 31 */ … … 36 36 #define KERN_sparc64_ELF_H_ 37 37 38 #define ELF_MACHINEEM_SPARCV939 #define ELF_DATA_ENCODING ELFDATA2MSB40 #define ELF_CLASS ELFCLASS6438 #define ELF_MACHINE EM_SPARCV9 39 #define ELF_DATA_ENCODING ELFDATA2MSB 40 #define ELF_CLASS ELFCLASS64 41 41 42 42 #endif -
kernel/arch/sparc64/include/istate.h
r3842a955 r26e7d6d 37 37 #define KERN_sparc64_ISTATE_H_ 38 38 39 #include <trace.h> 40 41 #ifdef KERNEL 42 39 43 #include <arch/regdef.h> 40 44 41 #ifdef KERNEL 42 #include <typedefs.h> 43 #include <trace.h> 44 #else 45 #include <sys/types.h> 46 #define NO_TRACE 47 #endif 45 #else /* KERNEL */ 46 47 #include <libarch/regdef.h> 48 49 #endif /* KERNEL */ 48 50 49 51 typedef struct istate { -
kernel/arch/sparc64/include/mm/page.h
r3842a955 r26e7d6d 54 54 #define MMU_PAGES_PER_PAGE (1 << (PAGE_WIDTH - MMU_PAGE_WIDTH)) 55 55 56 #ifdef KERNEL57 58 56 #ifndef __ASM__ 59 57 … … 77 75 #endif /* !def __ASM__ */ 78 76 79 #endif /* KERNEL */80 81 77 #endif 82 78 -
kernel/arch/sparc64/include/mm/sun4u/frame.h
r3842a955 r26e7d6d 52 52 #define FRAME_SIZE (1 << FRAME_WIDTH) 53 53 54 #ifdef KERNEL55 54 #ifndef __ASM__ 56 55 … … 80 79 81 80 #endif 82 #endif83 81 84 82 #endif -
kernel/arch/sparc64/include/mm/sun4v/frame.h
r3842a955 r26e7d6d 42 42 #define FRAME_SIZE (1 << FRAME_WIDTH) 43 43 44 #ifdef KERNEL45 44 #ifndef __ASM__ 46 45 … … 52 51 53 52 #endif 54 #endif55 53 56 54 #endif -
kernel/arch/sparc64/include/mm/sun4v/page.h
r3842a955 r26e7d6d 46 46 #define MMU_PAGES_PER_PAGE (1 << (PAGE_WIDTH - MMU_PAGE_WIDTH)) 47 47 48 #ifdef KERNEL49 50 48 #ifndef __ASM__ 51 49 … … 69 67 #endif /* !def __ASM__ */ 70 68 71 #endif /* KERNEL */72 73 69 #endif 74 70 -
kernel/arch/sparc64/include/sun4v/regdef.h
r3842a955 r26e7d6d 28 28 */ 29 29 30 /** @addtogroup sparc64 30 /** @addtogroup sparc64 31 31 * @{ 32 32 */ … … 37 37 #define KERN_sparc64_sun4v_REGDEF_H_ 38 38 39 #define PSTATE_IE_BIT (1 << 1) 40 #define PSTATE_PRIV_BIT (1 << 2) 41 #define PSTATE_PEF_BIT (1 << 4) 39 #define TSTATE_CWP_MASK 0x1f 42 40 43 #define TSTATE_PSTATE_SHIFT 8 44 #define TSTATE_PRIV_BIT (PSTATE_PRIV_BIT << TSTATE_PSTATE_SHIFT) 45 #define TSTATE_CWP_MASK 0x1f 46 #define TSTATE_IE_BIT (PSTATE_IE_BIT << TSTATE_PSTATE_SHIFT) 47 48 #define WSTATE_NORMAL(n) (n) 49 #define WSTATE_OTHER(n) ((n) << 3) 50 51 #define TSTATE_PEF_BIT (PSTATE_PEF_BIT << TSTATE_PSTATE_SHIFT) 41 #define WSTATE_NORMAL(n) (n) 42 #define WSTATE_OTHER(n) ((n) << 3) 52 43 53 44 #endif -
kernel/arch/sparc64/src/console.c
r3842a955 r26e7d6d 38 38 #include <arch/drivers/scr.h> 39 39 #include <arch/drivers/kbd.h> 40 #include <arch/drivers/sgcn.h>41 40 #include <genarch/srln/srln.h> 42 41 #include <console/chardev.h> … … 89 88 } 90 89 91 /** Initilize I/O on the Serengeti machine. */92 static void serengeti_init(void)93 {94 #ifdef CONFIG_SGCN_KBD95 sgcn_instance_t *sgcn_instance = sgcnin_init();96 if (sgcn_instance) {97 srln_instance_t *srln_instance = srln_init();98 if (srln_instance) {99 indev_t *sink = stdin_wire();100 indev_t *srln = srln_wire(srln_instance, sink);101 sgcnin_wire(sgcn_instance, srln);102 }103 }104 #endif105 106 #ifdef CONFIG_SGCN_PRN107 outdev_t *sgcndev = sgcnout_init();108 if (sgcndev)109 stdout_wire(sgcndev);110 #endif111 }112 113 90 /** 114 91 * Initialize input/output. Auto-detects the type of machine … … 127 104 prop = ofw_tree_getprop(aliases, "def-cn"); 128 105 129 if ((!prop) || (!prop->value) || (str_cmp(prop->value, "/sgcn") != 0)) {106 if ((!prop) || (!prop->value)) 130 107 standard_console_init(aliases); 131 } else {132 serengeti_init();133 }134 108 } 135 109 -
kernel/arch/sparc64/src/drivers/kbd.c
r3842a955 r26e7d6d 35 35 #include <arch/drivers/kbd.h> 36 36 #include <genarch/ofw/ofw_tree.h> 37 #include <genarch/ofw/fhc.h>38 37 #include <genarch/ofw/ebus.h> 39 38 #include <console/console.h> … … 51 50 #endif 52 51 53 #ifdef CONFIG_Z853054 #include <genarch/drivers/z8530/z8530.h>55 #endif56 57 52 #ifdef CONFIG_NS16550 58 53 #include <genarch/drivers/ns16550/ns16550.h> … … 60 55 61 56 #ifdef CONFIG_SUN_KBD 62 63 #ifdef CONFIG_Z853064 65 static bool kbd_z8530_init(ofw_tree_node_t *node)66 {67 const char *name = ofw_tree_node_name(node);68 69 if (str_cmp(name, "zs") != 0)70 return false;71 72 /*73 * Read 'interrupts' property.74 */75 ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts");76 if ((!prop) || (!prop->value)) {77 printf("z8530: Unable to find interrupts property\n");78 return false;79 }80 81 uint32_t interrupts = *((uint32_t *) prop->value);82 83 /*84 * Read 'reg' property.85 */86 prop = ofw_tree_getprop(node, "reg");87 if ((!prop) || (!prop->value)) {88 printf("z8530: Unable to find reg property\n");89 return false;90 }91 92 size_t size = ((ofw_fhc_reg_t *) prop->value)->size;93 94 uintptr_t pa;95 if (!ofw_fhc_apply_ranges(node->parent,96 ((ofw_fhc_reg_t *) prop->value), &pa)) {97 printf("z8530: Failed to determine address\n");98 return false;99 }100 101 inr_t inr;102 cir_t cir;103 void *cir_arg;104 if (!ofw_fhc_map_interrupt(node->parent,105 ((ofw_fhc_reg_t *) prop->value), interrupts, &inr, &cir,106 &cir_arg)) {107 printf("z8530: Failed to determine interrupt\n");108 return false;109 }110 111 /*112 * We need to pass aligned address to hw_map().113 * However, the physical keyboard address can114 * be pretty much unaligned, depending on the115 * underlying controller.116 */117 uintptr_t aligned_addr = ALIGN_DOWN(pa, PAGE_SIZE);118 size_t offset = pa - aligned_addr;119 120 z8530_t *z8530 = (z8530_t *)121 (hw_map(aligned_addr, offset + size) + offset);122 123 z8530_instance_t *z8530_instance = z8530_init(z8530, inr, cir, cir_arg);124 if (z8530_instance) {125 kbrd_instance_t *kbrd_instance = kbrd_init();126 if (kbrd_instance) {127 indev_t *sink = stdin_wire();128 indev_t *kbrd = kbrd_wire(kbrd_instance, sink);129 z8530_wire(z8530_instance, kbrd);130 }131 }132 133 /*134 * This is the necessary evil until the userspace drivers are135 * entirely self-sufficient.136 */137 sysinfo_set_item_val("kbd", NULL, true);138 sysinfo_set_item_val("kbd.inr", NULL, inr);139 sysinfo_set_item_val("kbd.address.kernel", NULL,140 (uintptr_t) z8530);141 sysinfo_set_item_val("kbd.address.physical", NULL, pa);142 sysinfo_set_item_val("kbd.type.z8530", NULL, true);143 144 return true;145 }146 147 #endif /* CONFIG_Z8530 */148 57 149 58 #ifdef CONFIG_NS16550 … … 243 152 void kbd_init(ofw_tree_node_t *node) 244 153 { 245 #ifdef CONFIG_Z8530246 kbd_z8530_init(node);247 #endif248 249 154 #ifdef CONFIG_NS16550 250 155 kbd_ns16550_init(node); -
kernel/arch/sparc64/src/drivers/niagara.c
r3842a955 r26e7d6d 32 32 /** 33 33 * @file 34 * @brief Niagara input/output driver based on hypervisor calls.34 * @brief Niagara input/output driver based on hypervisor calls. 35 35 */ 36 36 … … 52 52 #include <genarch/srln/srln.h> 53 53 54 /* polling interval in miliseconds */54 /* Polling interval in miliseconds */ 55 55 #define POLL_INTERVAL 10000 56 56 57 /* device instance */57 /* Device instance */ 58 58 static niagara_instance_t *instance = NULL; 59 59 60 static void niagara_putchar(outdev_t *, const wchar_t , bool);61 62 /** character device operations */60 static void niagara_putchar(outdev_t *, const wchar_t); 61 62 /** Character device operations */ 63 63 static outdev_operations_t niagara_ops = { 64 64 .write = niagara_putchar, … … 66 66 }; 67 67 68 /* 68 /** 69 69 * The driver uses hypercalls to print characters to the console. Since the 70 70 * hypercall cannot be performed from the userspace, we do this: 71 * The kernel "little brother" driver (which will be present no matter what the 72 * DDI architecture is - as we need the kernel part for the kconsole) 71 * 72 * The kernel "little brother" driver (which will be present no matter what 73 * the DDI architecture is -- as we need the kernel part for the kconsole) 73 74 * defines a shared buffer. Kernel walks through the buffer (in the same thread 74 75 * which is used for polling the keyboard) and prints any pending characters 75 * to the console (using hypercalls). The userspace fb server maps this shared 76 * buffer to its address space and output operation it does is performed using 77 * the mapped buffer. The shared buffer definition follows. 78 */ 79 #define OUTPUT_BUFFER_SIZE ((PAGE_SIZE) - 2 * 8) 76 * to the console (using hypercalls). 77 * 78 * The userspace fb server maps this shared buffer to its address space and 79 * output operation it does is performed using the mapped buffer. The shared 80 * buffer definition follows. 81 */ 82 #define OUTPUT_BUFFER_SIZE ((PAGE_SIZE) - 2 * 8) 83 80 84 static volatile struct { 81 85 uint64_t read_ptr; 82 86 uint64_t write_ptr; 83 87 char data[OUTPUT_BUFFER_SIZE]; 84 } 85 __attribute__ ((packed)) 86 __attribute__ ((aligned(PAGE_SIZE))) 87 output_buffer; 88 } __attribute__ ((packed)) __attribute__ ((aligned(PAGE_SIZE))) output_buffer; 89 90 static parea_t outbuf_parea; 88 91 89 92 /** 90 93 * Analogous to the output_buffer, see the previous definition. 91 94 */ 92 #define INPUT_BUFFER_SIZE ((PAGE_SIZE) - 2 * 8) 95 #define INPUT_BUFFER_SIZE ((PAGE_SIZE) - 2 * 8) 96 93 97 static volatile struct { 94 98 uint64_t write_ptr; 95 99 uint64_t read_ptr; 96 100 char data[INPUT_BUFFER_SIZE]; 97 } 98 __attribute__ ((packed)) 99 __attribute__ ((aligned(PAGE_SIZE))) 100 input_buffer; 101 102 103 /** Writes a single character to the standard output. */ 101 } __attribute__ ((packed)) __attribute__ ((aligned(PAGE_SIZE))) input_buffer; 102 103 static parea_t inbuf_parea; 104 105 /** Write a single character to the standard output. */ 104 106 static inline void do_putchar(const char c) { 105 /* repeat until the buffer is non-full */ 106 while (__hypercall_fast1(CONS_PUTCHAR, c) == HV_EWOULDBLOCK) 107 ; 108 } 109 110 /** Writes a single character to the standard output. */ 111 static void niagara_putchar(outdev_t *dev, const wchar_t ch, bool silent) 112 { 113 if (silent) 114 return; 115 116 do_putchar(ch); 117 if (ch == '\n') 118 do_putchar('\r'); 119 } 120 121 /** 122 * Function regularly called by the keyboard polling thread. Asks the 123 * hypervisor whether there is any unread character. If so, it picks it up 124 * and sends it to the upper layers of HelenOS. 125 * 126 * Apart from that, it also checks whether the userspace output driver has 127 * pushed any characters to the output buffer. If so, it prints them. 128 */ 129 static void niagara_poll(niagara_instance_t *instance) 130 { 131 /* print any pending characters from the shared buffer to the console */ 107 /* Repeat until the buffer is non-full */ 108 while (__hypercall_fast1(CONS_PUTCHAR, c) == HV_EWOULDBLOCK); 109 } 110 111 /** Write a single character to the standard output. */ 112 static void niagara_putchar(outdev_t *dev, const wchar_t ch) 113 { 114 if ((!outbuf_parea.mapped) || (console_override)) { 115 do_putchar(ch); 116 if (ch == '\n') 117 do_putchar('\r'); 118 } 119 } 120 121 /** Poll keyboard and print pending characters. 122 * 123 * Ask the hypervisor whether there is any unread character. If so, 124 * pick it up and send it to the indev layer. 125 * 126 * Check whether the userspace output driver has pushed any 127 * characters to the output buffer and eventually print them. 128 * 129 */ 130 static void niagara_poll(void) 131 { 132 /* 133 * Print any pending characters from the 134 * shared buffer to the console. 135 */ 136 132 137 while (output_buffer.read_ptr != output_buffer.write_ptr) { 133 138 do_putchar(output_buffer.data[output_buffer.read_ptr]); 134 139 output_buffer.read_ptr = 135 ((output_buffer.read_ptr) + 1) % OUTPUT_BUFFER_SIZE; 136 } 137 140 ((output_buffer.read_ptr) + 1) % OUTPUT_BUFFER_SIZE; 141 } 142 143 /* 144 * Read character from keyboard. 145 */ 146 138 147 uint64_t c; 139 140 /* read character from keyboard, send it to upper layers of HelenOS */141 148 if (__hypercall_fast_ret1(0, 0, 0, 0, 0, CONS_GETCHAR, &c) == HV_EOK) { 142 if (!silent) { 143 /* kconsole active, send the character to kernel */ 149 if ((!inbuf_parea.mapped) || (console_override)) { 150 /* 151 * Kernel console is active, send 152 * the character to kernel. 153 */ 144 154 indev_push_character(instance->srlnin, c); 145 155 } else { 146 /* kconsole inactive, send the character to uspace driver */ 156 /* 157 * Kernel console is inactive, send 158 * the character to uspace driver. 159 */ 147 160 input_buffer.data[input_buffer.write_ptr] = (char) c; 148 161 input_buffer.write_ptr = 149 ((input_buffer.write_ptr) + 1) % INPUT_BUFFER_SIZE;162 ((input_buffer.write_ptr) + 1) % INPUT_BUFFER_SIZE; 150 163 } 151 164 } 152 165 } 153 166 154 /** 155 * Polling thread function.156 */ 157 static void kniagarapoll(void * instance) {167 /** Polling thread function. 168 * 169 */ 170 static void kniagarapoll(void *arg) { 158 171 while (true) { 159 niagara_poll( instance);172 niagara_poll(); 160 173 thread_usleep(POLL_INTERVAL); 161 174 } 162 175 } 163 176 164 /** 165 * Initializes the input/output subsystem so that the Niagara standard 166 * input/output is used. 177 /** Initialize the input/output subsystem 178 * 167 179 */ 168 180 static void niagara_init(void) … … 172 184 173 185 instance = malloc(sizeof(niagara_instance_t), FRAME_ATOMIC); 174 175 if (instance) { 176 instance->thread = thread_create(kniagarapoll, instance, TASK, 0, 177 "kniagarapoll", true); 178 179 if (!instance->thread) { 180 free(instance); 181 instance = NULL; 182 return; 183 } 184 } 185 186 instance->thread = thread_create(kniagarapoll, NULL, TASK, 0, 187 "kniagarapoll", true); 188 189 if (!instance->thread) { 190 free(instance); 191 instance = NULL; 192 return; 193 } 194 186 195 instance->srlnin = NULL; 187 196 188 197 output_buffer.read_ptr = 0; 189 198 output_buffer.write_ptr = 0; 190 199 input_buffer.write_ptr = 0; 191 200 input_buffer.read_ptr = 0; 192 201 193 202 /* 194 203 * Set sysinfos and pareas so that the userspace counterpart of the 195 204 * niagara fb and kbd driver can communicate with kernel using shared 196 205 * buffers. 197 */198 206 */ 207 199 208 sysinfo_set_item_val("fb.kind", NULL, 5); 200 209 201 210 sysinfo_set_item_val("niagara.outbuf.address", NULL, 202 KA2PA(&output_buffer));211 KA2PA(&output_buffer)); 203 212 sysinfo_set_item_val("niagara.outbuf.size", NULL, 204 PAGE_SIZE);213 PAGE_SIZE); 205 214 sysinfo_set_item_val("niagara.outbuf.datasize", NULL, 206 OUTPUT_BUFFER_SIZE);207 215 OUTPUT_BUFFER_SIZE); 216 208 217 sysinfo_set_item_val("niagara.inbuf.address", NULL, 209 KA2PA(&input_buffer));218 KA2PA(&input_buffer)); 210 219 sysinfo_set_item_val("niagara.inbuf.size", NULL, 211 PAGE_SIZE);220 PAGE_SIZE); 212 221 sysinfo_set_item_val("niagara.inbuf.datasize", NULL, 213 INPUT_BUFFER_SIZE); 214 215 static parea_t outbuf_parea; 222 INPUT_BUFFER_SIZE); 223 216 224 outbuf_parea.pbase = (uintptr_t) (KA2PA(&output_buffer)); 217 225 outbuf_parea.frames = 1; 218 226 outbuf_parea.unpriv = false; 227 outbuf_parea.mapped = false; 219 228 ddi_parea_register(&outbuf_parea); 220 221 static parea_t inbuf_parea; 229 222 230 inbuf_parea.pbase = (uintptr_t) (KA2PA(&input_buffer)); 223 231 inbuf_parea.frames = 1; 224 232 inbuf_parea.unpriv = false; 233 inbuf_parea.mapped = false; 225 234 ddi_parea_register(&inbuf_parea); 226 235 227 236 outdev_t *niagara_dev = malloc(sizeof(outdev_t), FRAME_ATOMIC); 228 237 outdev_initialize("niagara_dev", niagara_dev, &niagara_ops); … … 230 239 } 231 240 232 /** 233 * A public function which initializes input from the Niagara console.241 /** Initialize input from the Niagara console. 242 * 234 243 */ 235 244 niagara_instance_t *niagarain_init(void) 236 245 { 237 246 niagara_init(); 238 247 239 248 if (instance) { 240 249 srln_instance_t *srln_instance = srln_init(); … … 242 251 indev_t *sink = stdin_wire(); 243 252 indev_t *srln = srln_wire(srln_instance, sink); 244 245 // wire std. input to niagara 253 246 254 instance->srlnin = srln; 247 255 thread_ready(instance->thread); 248 256 } 249 257 } 258 250 259 return instance; 251 260 } -
kernel/arch/sparc64/src/drivers/scr.c
r3842a955 r26e7d6d 39 39 #include <genarch/ofw/upa.h> 40 40 #include <genarch/fb/fb.h> 41 #include < genarch/fb/visuals.h>41 #include <abi/fb/visuals.h> 42 42 #include <console/chardev.h> 43 43 #include <console/console.h> -
kernel/arch/sparc64/src/smp/sun4u/smp.c
r3842a955 r26e7d6d 42 42 #include <macros.h> 43 43 #include <typedefs.h> 44 #include <synch/synch.h>45 44 #include <synch/waitq.h> 46 45 #include <print.h> -
kernel/arch/sparc64/src/smp/sun4v/smp.c
r3842a955 r26e7d6d 45 45 #include <func.h> 46 46 #include <typedefs.h> 47 #include <synch/synch.h>48 47 #include <synch/waitq.h> 49 48 #include <print.h> -
kernel/arch/sparc64/src/sun4v/start.S
r3842a955 r26e7d6d 30 30 #include <arch/arch.h> 31 31 #include <arch/stack.h> 32 #include <arch/regdef.h> 32 33 #include <arch/context_offset.h> 33 34 #include <arch/sun4v/regdef.h>
Note:
See TracChangeset
for help on using the changeset viewer.
