Microblaze init port
Subsystems (3)
[email protected]
maintainerHello everybody,
this is first set of patches with Microblaze Linux kernel port. I tried to clean coding style and repair code with sparse.
I tried to split patches to the smallest parts as were possible. Please be patient with incorrect division - it was a lot of patches.
I personally feel the biggest pain in header files.
There are no comments in set of patches because I had no energy write it. I suppose we will discuss more about individual patches.
I create pages for this longer process at www.monstr.eu - wiki page. I will store all patches in my internal git tree till setup public git server. And on my pages will be published tarballs.
Thanks to John Williams and Steve Neuendorffer for help with clarification of individual patches.
Have a fun,
Michal Simek
www.monstr.eu
[email protected]
maintainerPATCH 10/52 Generic dts file for platforms
From: Michal Simek <[email protected]>
--- arch/microblaze/platform/generic/system.dts | 137 +++++++++++++++++++++++++++ 1 files changed, 137 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/platform/generic/system.dts
arch/microblaze/platform/generic/system.dts new file +137 -0
@@ -0,0 +1,137 @@ +/* + * (C) Copyright 2007 Michal Simek + * + * Michal SIMEK <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * CAUTION: This file is automatically generated by libgen. + * Version: Xilinx EDK 9.2 EDK_Jm.16 + * Generate by U-BOOT v4.00.b + */ + +/ { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ibm,opb"; + model = "testing"; + DDR_SDRAM_32Mx16: memory@44000000 { + device_type = "memory"; + reg = < 44000000 2000000 >; + } ; + chosen { + bootargs = "root=mtdblock0"; + } ; + cpus { + #address-cells = <1>; + #cpus = <1>; + #size-cells = <0>; + microblaze,5.00.c@0 { + clock-frequency = <3f940ab>; + d-cache-baseaddr = <44000000>; + d-cache-highaddr = <47ffffff>; + d-cache-line-size = <10>; + d-cache-size = <2000>; + device_type = "cpu"; + i-cache-baseaddr = <44000000>; + i-cache-highaddr = <47ffffff>; + i-cache-line-size = <10>; + i-cache-size = <2000>; + reg = <0>; + timebase-frequency = <3f940ab>; + xlnx,addr-tag-bits = <d>; + xlnx,allow-dcache-wr = <1>; + xlnx,allow-icache-wr = <1>; + xlnx,cache-byte-size = <2000>; + xlnx,d-lmb = <1>; + xlnx,d-opb = <1>; + xlnx,data-size = <20>; + xlnx,dcache-addr-tag = <d>; + xlnx,dcache-byte-size = <2000>; + xlnx,dcache-line-len = <4>; + xlnx,dcache-use-fsl = <1>; + xlnx,debug-enabled = <1>; + xlnx,div-zero-exception = <0>; + xlnx,dopb-bus-exception = <0>; + xlnx,dynamic-bus-sizing = <1>; + xlnx,edge-is-positive = <1>; + xlnx,fpu-exception = <0>; + xlnx,fsl-data-size = <20>; + xlnx,fsl-links = <1>; + xlnx,i-lmb = <1>; + xlnx,i-opb = <1>; + xlnx,icache-line-len = <4>; + xlnx,icache-use-fsl = <1>; + xlnx,ill-opcode-exception = <0>; + xlnx,instance = "microblaze_0"; + xlnx,interrupt-is-edge = <0>; + xlnx,iopb-bus-exception = <0>; + xlnx,number-of-pc-brk = <2>; + xlnx,number-of-rd-addr-brk = <0>; + xlnx,number-of-wr-addr-brk = <0>; + xlnx,opcode-0x0-illegal = <0>; + xlnx,pvr = <2>; + xlnx,pvr-user1 = <0>; + xlnx,pvr-user2 = <0>; + xlnx,reset-msr = <0>; + xlnx,sco = <0>; + xlnx,unaligned-exceptions = <0>; + xlnx,use-barrel = <1>; + xlnx,use-dcache = <1>; + xlnx,use-div = <1>; + xlnx,use-fpu = <0>; + xlnx,use-hw-mul = <1>; + xlnx,use-icache = <1>; + xlnx,use-msr-instr = <1>; + xlnx,use-pcmp-instr = <1>; + } ; + } ; + opb_v20 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "xlnx,opb-v20-1.10.c", "xlnx,opb-v20"; + RS232_DTE: serial@40600000 { + compatible = "xlnx,opb-uartlite-1.00.b", "xlnx,opb-uartlite", "xilinx,uartlite"; + interrupt-parent = <&opb_intc_0>; + interrupts = < 2 0 >; + reg = < 40600000 10000 >; + xlnx,baudrate = <1c200>; + xlnx,clk-freq = <3f940ab>; + xlnx,data-bits = <8>; + xlnx,odd-parity = <0>; + xlnx,use-parity = <0>; + } ; + opb_intc_0: interrupt-controller@41200000 { + #interrupt-cells = <2>; + compatible = "xlnx,opb-intc-1.00.c", "xlnx,opb-intc"; + interrupt-controller ; + reg = < 41200000 10000 >; + xlnx,num-intr-inputs = <5>; + } ; + opb_timer_0: opb-timer@41c00000 { + compatible = "xlnx,opb-timer-1.00.b", "xlnx,opb-timer"; + interrupt-parent = <&opb_intc_0>; + interrupts = < 0 0 >; + reg = < 41c00000 10000 >; + xlnx,count-width = <20>; + xlnx,gen0-assert = <1>; + xlnx,gen1-assert = <1>; + xlnx,one-timer-only = <1>; + xlnx,trig0-assert = <1>; + xlnx,trig1-assert = <1>; + } ; + } ; +} ;
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 11/52 kernel modules support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/microblaze_ksyms.c | 129 +++++++++++++++++++++++++ arch/microblaze/kernel/module.c | 149 +++++++++++++++++++++++++++++ include/asm-microblaze/module.h | 41 ++++++++ 3 files changed, 319 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/microblaze_ksyms.c create mode 100644 arch/microblaze/kernel/module.c create mode 100644 include/asm-microblaze/module.h
arch/microblaze/kernel/microblaze_ksyms.c new file +129 -0
@@ -0,0 +1,129 @@ +/* +* linux/arch/microblaze/kernel/microblazeksyms.c +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/module.h> +#include <linux/string.h> +#include <linux/cryptohash.h> +#include <linux/delay.h> +#include <linux/in6.h> +#include <linux/syscalls.h> + +#include <asm/checksum.h> +#include <asm/io.h> +#include <asm/page.h> +#include <asm/system.h> +#include <asm/uaccess.h> + +/* module handling */ +EXPORT_SYMBOL (PAGE_OFFSET ); + +/* +* floating point math emulator support. +* These symbols will never change their calling convention... +*/ +/* EXPORT_SYMBOL_ALIAS(kern_fp_enter,fp_enter); +EXPORT_SYMBOL_ALIAS(fp_printk,printk); +EXPORT_SYMBOL_ALIAS(fp_send_sig,send_sig); + +EXPORT_SYMBOL(__backtrace); */ + +/* platform dependent support */ +/* EXPORT_SYMBOL(__udelay); +EXPORT_SYMBOL(__const_udelay); */ + +/* networking */ +EXPORT_SYMBOL (csum_partial); +EXPORT_SYMBOL (csum_partial_copy); +EXPORT_SYMBOL (csum_partial_copy_from_user); +EXPORT_SYMBOL (ip_compute_csum); + +/* io */ +/*#ifndef __raw_readsb +EXPORT_SYMBOL(__raw_readsb); +#endif +#ifndef __raw_readsw +EXPORT_SYMBOL(__raw_readsw); +#endif +#ifndef __raw_readsl +EXPORT_SYMBOL(__raw_readsl); +#endif +#ifndef __raw_writesb +EXPORT_SYMBOL(__raw_writesb); +#endif +#ifndef __raw_writesw +EXPORT_SYMBOL(__raw_writesw); +#endif +#ifndef __raw_writesl +EXPORT_SYMBOL(__raw_writesl); +#endif*/ + +/* string / mem functions */ +/*EXPORT_SYMBOL(strchr); +EXPORT_SYMBOL(strrchr);*/ + +#ifdef __HAVE_ARCH_MEMSET +EXPORT_SYMBOL (memset); +#endif + +#ifdef __HAVE_ARCH_MEMCPY +EXPORT_SYMBOL (memcpy); +#endif + +#ifdef __HAVE_ARCH_MEMMOVE +EXPORT_SYMBOL (memmove); +#endif + +/* EXPORT_SYMBOL(memchr); +EXPORT_SYMBOL(__memzero); */ + +/* user mem (segment) */ +/* EXPORT_SYMBOL(__strnlen_user); +EXPORT_SYMBOL(__strncpy_from_user); */ + +/* crypto hash */ +/* EXPORT_SYMBOL(sha_transform); */ + + +/* +* libgcc functions - functions that are used internally by the +* compiler... (prototypes are not correct though, but that +* doesn't really matter since they're not versioned). +*/ +extern void __ashldi3 (void ); +EXPORT_SYMBOL (__ashldi3); +extern void __ashrdi3 (void ); +EXPORT_SYMBOL (__ashrdi3); +extern void __divsi3 (void ); +EXPORT_SYMBOL (__divsi3); +extern void __lshrdi3 (void ); +EXPORT_SYMBOL (__lshrdi3); +extern void __modsi3 (void ); +EXPORT_SYMBOL (__modsi3); +extern void __mulsi3 (void ); +EXPORT_SYMBOL (__mulsi3); +extern void __muldi3 (void ); +EXPORT_SYMBOL (__muldi3); +extern void __ucmpdi2 (void ); +EXPORT_SYMBOL (__ucmpdi2); +extern void __udivsi3 (void ); +EXPORT_SYMBOL (__udivsi3); +extern void __umodsi3 (void ); +EXPORT_SYMBOL (__umodsi3); +/*extern void fpundefinstr(void); +extern void fp_enter(void);*/ + +/* bitops */ +/* EXPORT_SYMBOL(_set_bit_le); +EXPORT_SYMBOL(_test_and_set_bit_le); +EXPORT_SYMBOL(_clear_bit_le); +EXPORT_SYMBOL(_test_and_clear_bit_le); +EXPORT_SYMBOL(_change_bit_le); +EXPORT_SYMBOL(_test_and_change_bit_le); +EXPORT_SYMBOL(_find_first_zero_bit_le); +EXPORT_SYMBOL(_find_next_zero_bit_le); +EXPORT_SYMBOL(_find_first_bit_le); +EXPORT_SYMBOL(_find_next_bit_le); */
arch/microblaze/kernel/module.c new file +149 -0
149 lines not on this page · raw message
include/asm-microblaze/module.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 12/52 lmb support
From: Michal Simek <[email protected]>
--- arch/microblaze/mm/lmb.c | 342 ++++++++++++++++++++++++++++++++++++++++++ include/asm-microblaze/lmb.h | 84 ++++++++++ 2 files changed, 426 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/mm/lmb.c create mode 100644 include/asm-microblaze/lmb.h
arch/microblaze/mm/lmb.c new file +342 -0
@@ -0,0 +1,342 @@ +/* +* Procedures for maintaining information about logical memory blocks. +* +* Peter Bergner, IBM Corp. June 2001. +* Copyright (C) 2001 Peter Bergner. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/bitops.h> +#include <asm/types.h> +#include <asm/page.h> +#include <asm/prom.h> +#include <asm/lmb.h> +#ifdef CONFIG_PPC32 +#include "mmu_decl.h" /* for __max_low_memory */ +#endif + +#define DEBUG + +#ifdef DEBUG +#define DBG(fmt...) printk(fmt) +#else +#define DBG(fmt...) +#endif + +#define LMB_ALLOC_ANYWHERE 0 + +struct lmb lmb; + +void lmb_dump_all (void ) +{ +#ifdef DEBUG +unsigned int i; + +DBG ("lmb_dump_all:\n" ); +DBG (" memory.cnt = 0x%lx\n" , lmb.memory.cnt); +DBG (" memory.size = 0x%lx\n" , lmb.memory.size); +for (i =0 ; i < lmb.memory.cnt ; i++) { +DBG (" memory.region[0x%x].base = 0x%lx\n" , + i, lmb.memory.region[i].base); +DBG (" .size = 0x%lx\n" , + lmb.memory.region[i].size); + } + +DBG ("\n reserved.cnt = 0x%lx\n" , lmb.reserved.cnt); +DBG (" reserved.size = 0x%lx\n" , lmb.reserved.size); +for (i =0 ; i < lmb.reserved.cnt ; i++) { +DBG (" reserved.region[0x%x].base = 0x%lx\n" , + i, lmb.reserved.region[i].base); +DBG (" .size = 0x%lx\n" , + lmb.reserved.region[i].size); + } +#endif /* DEBUG */ +} + +static unsigned long __init lmb_addrs_overlap (unsigned long base1, +unsigned long size1,unsigned long base2,unsigned long size2) +{ +return ((base1 < (base2+size2)) && (base2 < (base1+size1))); +} + +static long __init lmb_addrs_adjacent (unsigned long base1,unsigned long size1, +unsigned long base2,unsigned long size2) +{ +if (base2 == base1 + size1) +return 1 ; +else if (base1 == base2 + size2) +return -1 ; + +return 0 ; +} + +static long __init lmb_regions_adjacent (struct lmb_region *rgn, +unsigned long r1,unsigned long r2) +{ +unsigned long base1 = rgn->region[r1].base; +unsigned long size1 = rgn->region[r1].size; +unsigned long base2 = rgn->region[r2].base; +unsigned long size2 = rgn->region[r2].size; + +return lmb_addrs_adjacent (base1, size1, base2, size2); +} + +static void __init lmb_remove_region (struct lmb_region *rgn,unsigned long r) +{ +unsigned long i; + +for (i = r; i < rgn->cnt -1 ; i++) { + rgn->region[i].base = rgn->region[i +1 ].base; + rgn->region[i].size = rgn->region[i +1 ].size; + } + rgn->cnt--; +} + +/* Assumption: base addr of region 1 < base addr of region 2 */ +static void __init lmb_coalesce_regions (struct lmb_region *rgn, +unsigned long r1,unsigned long r2) +{ + rgn->region[r1].size += rgn->region[r2].size; +lmb_remove_region (rgn, r2); +} + +/* This routine called with relocation disabled. */ +void __init lmb_init (void ) +{ +/* Create a dummy zero size LMB which will get coalesced away later. +* This simplifies the lmb_add() code below... +*/ + lmb.memory.region[0 ].base =0 ; + lmb.memory.region[0 ].size =0 ; + lmb.memory.cnt =1 ; + +/* Ditto. */ + lmb.reserved.region[0 ].base =0 ; + lmb.reserved.region[0 ].size =0 ; + lmb.reserved.cnt =1 ; +} + +/* This routine may be called with relocation disabled. */ +void __init lmb_analyze (void ) +{ +int i; + + lmb.memory.size =0 ; + +for (i =0 ; i < lmb.memory.cnt; i++) + lmb.memory.size += lmb.memory.region[i].size; +} + +/* This routine called with relocation disabled. */ +static long __init lmb_add_region (struct lmb_region *rgn,unsigned long base, +unsigned long size) +{ +unsigned long i, coalesced =0 ; +long adjacent; + +/* First try and coalesce this LMB with another. */ +for (i =0 ; i < rgn->cnt; i++) { +unsigned long rgnbase = rgn->region[i].base; +unsigned long rgnsize = rgn->region[i].size; + +if ((rgnbase == base) && (rgnsize == size)) +/* Already have this region, so we're done */ +return 0 ; + + adjacent =lmb_addrs_adjacent (base, size, rgnbase, rgnsize); +if (adjacent >0 ) { + rgn->region[i].base -= size; + rgn->region[i].size += size; + coalesced++; +break ; + }else if (adjacent <0 ) { + rgn->region[i].size += size; + coalesced++; +break ; + } + } + +if ((i < rgn->cnt-1 ) &&lmb_regions_adjacent (rgn, i, i +1 )) { +lmb_coalesce_regions (rgn, i, i+1 ); + coalesced++; + } + +if (coalesced) +return coalesced; +if (rgn->cnt >=MAX_LMB_REGIONS ) +return -1 ; + +/* Couldn't coalesce the LMB, so add it to the sorted table. */ +for (i = rgn->cnt-1 ; i >=0 ; i--) { +if (base < rgn->region[i].base) { + rgn->region[i+1 ].base = rgn->region[i].base; + rgn->region[i+1 ].size = rgn->region[i].size; + }else { + rgn->region[i+1 ].base = base; + rgn->region[i+1 ].size = size; +break ; + } + } + rgn->cnt++; + +return 0 ; +} + +/* This routine may be called with relocation disabled. */ +long __init lmb_add (unsigned long base,unsigned long size) +{ +struct lmb_region *_rgn = &(lmb.memory); + +/* On pSeries LPAR systems, the first LMB is our RMO region. */ +if (base ==0 ) + lmb.rmo_size = size; + +return lmb_add_region (_rgn, base, size); + +} + +long __init lmb_reserve (unsigned long base,unsigned long size) +{ +struct lmb_region *_rgn = &(lmb.reserved); + +BUG_ON (0 == size); + +return lmb_add_region (_rgn, base, size); +} + +long __init lmb_overlaps_region (struct lmb_region *rgn,unsigned long base, +unsigned long size) +{ +unsigned long i; + +for (i =0 ; i < rgn->cnt; i++) { +unsigned long rgnbase = rgn->region[i].base; +unsigned long rgnsize = rgn->region[i].size; +if (lmb_addrs_overlap (base, size, rgnbase, rgnsize)) +break ; + } + +return (i < rgn->cnt) ? i :-1 ; +} + +unsigned long __init lmb_alloc (unsigned long size,unsigned long align) +{ +return lmb_alloc_base (size, align,LMB_ALLOC_ANYWHERE ); +} + +unsigned long __init lmb_alloc_base (unsigned long size,unsigned long align, +unsigned long max_addr) +{ +unsigned long alloc; + + alloc =__lmb_alloc_base (size, align, max_addr); + +if (alloc ==0 ) +panic ("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n" , + size, max_addr); + +return alloc; +} + +unsigned long __init __lmb_alloc_base (unsigned long size,unsigned long align, +unsigned long max_addr) +{ +long i, j; +unsigned long base =0 ; + +BUG_ON (0 == size); + +#ifdef CONFIG_PPC32 +/* On 32-bit, make sure we allocate lowmem */ +if (max_addr ==LMB_ALLOC_ANYWHERE ) + max_addr = __max_low_memory; +#endif +for (i = lmb.memory.cnt-1 ; i >=0 ; i--) { +unsigned long lmbbase = lmb.memory.region[i].base; +unsigned long lmbsize = lmb.memory.region[i].size; + +if (max_addr ==LMB_ALLOC_ANYWHERE ) + base =_ALIGN_DOWN (lmbbase + lmbsize - size, align); +else if (lmbbase < max_addr) { + base =min (lmbbase + lmbsize, max_addr); + base =_ALIGN_DOWN (base - size, align); + }else +continue ; + +while ((lmbbase <= base) && + ((j =lmb_overlaps_region (&lmb.reserved, base, size)) + >=0 )) + base =_ALIGN_DOWN (lmb.reserved.region[j].base - size, + align); + +if ((base !=0 ) && (lmbbase <= base)) +break ; + } + +if (i <0 ) +return 0 ; + +lmb_add_region (&lmb.reserved, base, size); + +return base; +} + +/* You must call lmb_analyze() before this. */ +unsigned long __init lmb_phys_mem_size (void ) +{ +return lmb.memory.size; +} + +unsigned long __init lmb_end_of_DRAM (void ) +{ +int idx = lmb.memory.cnt -1 ; + +return (lmb.memory.region[idx].base + lmb.memory.region[idx].size); +} + +/* You must call lmb_analyze() after this. */ +void __init lmb_enforce_memory_limit (unsigned long memory_limit) +{ +unsigned long i, limit; +struct lmb_property *p; + +if (!memory_limit) +return ; + +/* Truncate the lmb regions to satisfy the memory limit. */ + limit = memory_limit; +for (i =0 ; i < lmb.memory.cnt; i++) { +if (limit > lmb.memory.region[i].size) { + limit -= lmb.memory.region[i].size; +continue ; + } + + lmb.memory.region[i].size = limit; + lmb.memory.cnt = i +1 ; +break ; + } + +if (lmb.memory.region[0 ].size < lmb.rmo_size) + lmb.rmo_size = lmb.memory.region[0 ].size; + +/* And truncate any reserves above the limit also. */ +for (i =0 ; i < lmb.reserved.cnt; i++) { + p = &lmb.reserved.region[i]; + +if (p->base > memory_limit) + p->size =0 ; +else if ((p->base + p->size) > memory_limit) + p->size = memory_limit - p->base; + +if (p->size ==0 ) { +lmb_remove_region (&lmb.reserved, i); + i--; + } + } +}
include/asm-microblaze/lmb.h new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 13/52 PVR support, cpuinfo support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/cpu/mb.c | 115 ++++++++++++++++++++++++++++++++++++++ arch/microblaze/kernel/cpu/pvr.c | 83 +++++++++++++++++++++++++++ 2 files changed, 198 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/cpu/mb.c create mode 100644 arch/microblaze/kernel/cpu/pvr.c
arch/microblaze/kernel/cpu/mb.c new file +115 -0
@@ -0,0 +1,115 @@ +/* +* arch/microblaze/kernel/cpu/mb.c +* +* CPU-version specific code +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) Michal Simek <[email protected]> +* Copyright (C) 2006 PetaLogix +*/ + +#include <linux/init.h> +#include <linux/string.h> +#include <linux/seq_file.h> +#include <linux/cpu.h> +#include <linux/initrd.h> + +#include <asm/cpuinfo.h> +#include <asm/setup.h> +#include <asm/sections.h> +#include <asm/page.h> +#include <asm/io.h> +#include <asm/bug.h> +#include <asm/param.h> + +static int show_cpuinfo (struct seq_file *m,void *v) +{ +int count =0 ; +char *fpga_family ="Unknown" ; +char *cpu_ver ="Unknown" ; +int i; + +/* Denormalised to get the fpga family string */ +for (i =0 ; family_string_lookup[i].s !=NULL ; i++) { +if (cpuinfo->fpga_family_code == family_string_lookup[i].k) { + fpga_family = family_string_lookup[i].s; +break ; + } + } + +/* Denormalised to get the hw version string */ +for (i =0 ; cpu_ver_lookup[i].s !=NULL ; i++) { +if (cpuinfo->ver_code == cpu_ver_lookup[i].k) { + cpu_ver = cpu_ver_lookup[i].s; +break ; + } + } + + count =seq_printf (m, +"CPU-Family: MicroBlaze\n" +"FPGA-Arch: %s\n" +"CPU-Ver: %s\n" +"CPU-MHz: %d.%02d\n" +"BogoMips: %lu.%02lu\n" , + fpga_family, + cpu_ver, + cpuinfo->cpu_clock_freq / +1000000 , + cpuinfo->cpu_clock_freq % +1000000 , + loops_per_jiffy / (500000 /HZ ), + (loops_per_jiffy / (5000 /HZ )) %100 ); + + count +=seq_printf (m, +"HW-Div:\t\t%s\n" +"HW-Shift:\t%s\n" , + cpuinfo->use_divider ?"yes" :"no" , + cpuinfo->use_barrel ?"yes" :"no" ); + +if (cpuinfo->use_icache) + count +=seq_printf (m, +"Icache:\t\t%ukB\n" , + cpuinfo->icache_size >>10 ); +else + count +=seq_printf (m,"Icache:\t\tno\n" ); + +if (cpuinfo->use_dcache) + count +=seq_printf (m, +"Dcache:\t\t%ukB\n" , + cpuinfo->dcache_size >>10 ); +else + count +=seq_printf (m,"Dcache:\t\tno\n" ); + + count +=seq_printf (m, +"HW-Debug:\t%s\n" , + cpuinfo->hw_debug ?"yes" :"no" ); + +return 0 ; +} + +static void *c_start (struct seq_file *m,loff_t *pos) +{ +int i = *pos; + +return i <NR_CPUS ? (void *) (i +1 ) :NULL ; +} + +static void *c_next (struct seq_file *m,void *v,loff_t *pos) +{ + ++*pos; +return c_start (m, pos); +} + +static void c_stop (struct seq_file *m,void *v) +{ +} + +struct seq_operations cpuinfo_op = { + .start = c_start, + .next = c_next, + .stop = c_stop, + .show = show_cpuinfo, +};
arch/microblaze/kernel/cpu/pvr.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 14/52 defconfig file
From: Michal Simek <[email protected]>
--- arch/microblaze/defconfig | 449 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 449 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/defconfig
arch/microblaze/defconfig new file +449 -0
@@ -0,0 +1,449 @@ +# +# Automatically generated make config: don't edit +# Linux kernel version: 2.6.24-rc5 +# Fri Dec 21 12:18:34 2007 +# +CONFIG_MICROBLAZE=y +# CONFIG_MMU is not set +# CONFIG_SWAP is not set +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_ARCH_HAS_ILOG2_U32 is not set +# CONFIG_ARCH_HAS_ILOG2_U64 is not set +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_HARDIRQS=y +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +# CONFIG_PCI is not set +CONFIG_UID16=y +CONFIG_DEFCONFIG_LIST="arch/$ARCH/defconfig" + +# +# General setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +# CONFIG_SYSVIPC is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_IKCONFIG is not set +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_CGROUPS is not set +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_FAIR_USER_SCHED=y +# CONFIG_FAIR_CGROUP_SCHED is not set +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_SYSCTL=y +CONFIG_EMBEDDED=y +CONFIG_SYSCTL_SYSCALL=y +# CONFIG_KALLSYMS is not set +# CONFIG_HOTPLUG is not set +CONFIG_PRINTK=y +# CONFIG_BUG is not set +CONFIG_ELF_CORE=y +# CONFIG_BASE_FULL is not set +# CONFIG_FUTEX is not set +CONFIG_ANON_INODES=y +# CONFIG_EPOLL is not set +CONFIG_SIGNALFD=y +CONFIG_EVENTFD=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLAB=y +# CONFIG_SLUB is not set +# CONFIG_SLOB is not set +CONFIG_TINY_SHMEM=y +CONFIG_BASE_SMALL=1 +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_KMOD is not set +CONFIG_BLOCK=y +# CONFIG_LBD is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_LSF is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +CONFIG_IOSCHED_AS=y +CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y +# CONFIG_DEFAULT_AS is not set +# CONFIG_DEFAULT_DEADLINE is not set +CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_NOOP is not set +CONFIG_DEFAULT_IOSCHED="cfq" + +# +# Platform options +# +CONFIG_PLATFORM_GENERIC=y +CONFIG_ALLOW_EDIT_AUTO=y + +# +# Automatic platform settings from Kconfig.auto +# +CONFIG_KERNEL_BASE_ADDR=0x44000000 +CONFIG_XILINX_ERAM_SIZE=0x02000000 + +# +# Definitions for MICROBLAZE0 +# +CONFIG_XILINX_MICROBLAZE0_FAMILY="spartan3e" +CONFIG_XILINX_MICROBLAZE0_HW_VER="5.00.c" +CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1 +CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1 +CONFIG_XILINX_MICROBLAZE0_USE_DIV=1 +CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=1 +CONFIG_XILINX_MICROBLAZE0_USE_FPU=0 + +# +# Processor type and features +# +# CONFIG_PREEMPT is not set +# CONFIG_XILINX_UNCACHED_SHADOW is not set +# CONFIG_LARGE_ALLOCS is not set + +# +# Boot options +# +CONFIG_CMDLINE="root=/dev/mtdblock0" +CONFIG_CMDLINE_FORCE=y +CONFIG_OF=y +CONFIG_OF_DEVICE=y +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +# CONFIG_SPARSEMEM_STATIC is not set +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_RESOURCES_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_VIRT_TO_BUS=y + +# +# Exectuable file formats +# +CONFIG_BINFMT_FLAT=y +# CONFIG_BINFMT_ZFLAT is not set +# CONFIG_BINFMT_SHARED_FLAT is not set +# CONFIG_BINFMT_MISC is not set + +# +# Networking +# +# CONFIG_NET is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +# CONFIG_SYS_HYPERVISOR is not set +CONFIG_MTD=y +# CONFIG_MTD_DEBUG is not set +CONFIG_MTD_CONCAT=y +CONFIG_MTD_PARTITIONS=y +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_MTD_OOPS is not set + +# +# RAM/ROM/Flash chip drivers +# +CONFIG_MTD_CFI=y +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_GEN_PROBE=y +# CONFIG_MTD_CFI_ADV_OPTIONS is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_CFI_AMDSTD=y +# CONFIG_MTD_CFI_STAA is not set +CONFIG_MTD_CFI_UTIL=y +CONFIG_MTD_RAM=y +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +# CONFIG_MTD_PHYSMAP is not set +CONFIG_MTD_UCLINUX=y +# CONFIG_MTD_PLATRAM is not set + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOC2001PLUS is not set +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set + +# +# UBI - Unsorted block images +# +# CONFIG_MTD_UBI is not set +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_COW_COMMON is not set +# CONFIG_BLK_DEV_LOOP is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=8192 +CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 +# CONFIG_CDROM_PKTCDVD is not set +CONFIG_MISC_DEVICES=y +# CONFIG_EEPROM_93CX6 is not set +# CONFIG_IDE is not set + +# +# SCSI device support +# +# CONFIG_RAID_ATTRS is not set +# CONFIG_SCSI is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_PHONE is not set + +# +# Input device support +# +# CONFIG_INPUT is not set + +# +# Hardware I/O ports +# +# CONFIG_SERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +# CONFIG_VT is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_UARTLITE_CONSOLE=y +CONFIG_SERIAL_UARTLITE=y +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_I2C is not set + +# +# SPI support +# +# CONFIG_SPI is not set +# CONFIG_SPI_MASTER is not set +# CONFIG_W1 is not set +# CONFIG_POWER_SUPPLY is not set +# CONFIG_HWMON is not set +# CONFIG_WATCHDOG is not set + +# +# Sonics Silicon Backplane +# +CONFIG_SSB_POSSIBLE=y +# CONFIG_SSB is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_SM501 is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set +CONFIG_DAB=y + +# +# Graphics support +# +# CONFIG_VGASTATE is not set +CONFIG_VIDEO_OUTPUT_CONTROL=y +# CONFIG_FB is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set + +# +# Display device support +# +# CONFIG_DISPLAY_SUPPORT is not set + +# +# Sound +# +# CONFIG_SOUND is not set +CONFIG_USB_SUPPORT=y +# CONFIG_USB_ARCH_HAS_HCD is not set +# CONFIG_USB_ARCH_HAS_OHCI is not set +# CONFIG_USB_ARCH_HAS_EHCI is not set + +# +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' +# + +# +# USB Gadget Support +# +# CONFIG_USB_GADGET is not set +# CONFIG_MMC is not set +# CONFIG_NEW_LEDS is not set +# CONFIG_RTC_CLASS is not set + +# +# Userspace I/O +# +# CONFIG_UIO is not set + +# +# File systems +# +# CONFIG_EXT2_FS is not set +# CONFIG_EXT3_FS is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_FS_POSIX_ACL is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +CONFIG_ROMFS_FS=y +# CONFIG_INOTIFY is not set +# CONFIG_QUOTA is not set +# CONFIG_DNOTIFY is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_SYSFS=y +# CONFIG_TMPFS is not set +# CONFIG_HUGETLB_PAGE is not set + +# +# Miscellaneous filesystems +# +# CONFIG_HFSPLUS_FS is not set +# CONFIG_JFFS2_FS is not set +CONFIG_CRAMFS=y +# CONFIG_VXFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +# CONFIG_NLS is not set + +# +# Kernel hacking +# +# CONFIG_PRINTK_TIME is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +# CONFIG_ENABLE_MUST_CHECK is not set +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_SAMPLES is not set +CONFIG_EARLY_PRINTK=y +CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS=0x40600000 + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITY is not set +# CONFIG_CRYPTO is not set + +# +# Library routines +# +# CONFIG_CRC_CCITT is not set +# CONFIG_CRC16 is not set +# CONFIG_CRC_ITU_T is not set +# CONFIG_CRC32 is not set +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_DMA=y
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 15/52 assembler files head.S, entry.S, ...
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/entry.S | 597 ++++++++++++++++++++++++++++++++ arch/microblaze/kernel/head.S | 40 +++ arch/microblaze/kernel/syscall_table.S | 328 ++++++++++++++++++ arch/microblaze/kernel/vmlinux.lds.S | 145 ++++++++ 4 files changed, 1110 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/entry.S create mode 100644 arch/microblaze/kernel/head.S create mode 100644 arch/microblaze/kernel/syscall_table.S create mode 100644 arch/microblaze/kernel/vmlinux.lds.S
arch/microblaze/kernel/entry.S new file +597 -0
@@ -0,0 +1,597 @@ +/* + * arch/microblaze/kernel/entry.S + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2006 Atmark Techno, Inc. + */ + +#include <linux/linkage.h> +#include <asm/thread_info.h> +#include <asm/errno.h> +#include <asm/asm-offsets.h> +#include <asm/registers.h> +#include <asm/unistd.h> +#include <asm/percpu.h> +#include <asm/signal.h> + +#define PER_CPU(var) per_cpu__##var + +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR + .macro disable_irq + msrclr r0, MSR_IE + .endm + + .macro enable_irq + msrset r0, MSR_IE + .endm + + .macro clear_bip + msrclr r0, MSR_BIP + .endm +#else + .macro disable_irq + mfs r11, rmsr + andi r11, r11, ~MSR_IE + mts rmsr, r11 + .endm + + .macro enable_irq + mfs r11, rmsr + ori r11, r11, MSR_IE + mts rmsr, r11 + .endm + + .macro clear_bip + mfs r11, rmsr + andi r11, r11, ~MSR_BIP + mts rmsr, r11 + .endm +#endif + +ENTRY(_interrupt) + swi r1, r0, PER_CPU(ENTRY_SP) /* save the current sp */ + swi r11, r0, PER_CPU(R11_SAVE) /* temporarily save r11 */ + lwi r11, r0, PER_CPU(KM) /* load mode indicator */ + beqid r11, 1f + nop + brid 2f /* jump over */ + addik r1, r1, (-PT_SIZE) /* room for pt_regs (delay slot) */ +1: /* switch to kernel stack */ + lwi r1, r0, PER_CPU(CURRENT_SAVE) /* get the saved current */ + lwi r1, r1, TS_THREAD_INFO /* get the thread info */ + /* calculate kernel stack pointer */ + addik r1, r1, THREAD_SIZE - PT_SIZE +2: + swi r11, r1, PT_MODE /* store the mode */ + lwi r11, r0, PER_CPU(R11_SAVE) /* reload r11 */ + swi r2, r1, PT_R2 + swi r3, r1, PT_R3 + swi r4, r1, PT_R4 + swi r5, r1, PT_R5 + swi r6, r1, PT_R6 + swi r7, r1, PT_R7 + swi r8, r1, PT_R8 + swi r9, r1, PT_R9 + swi r10, r1, PT_R10 + swi r11, r1, PT_R11 + swi r12, r1, PT_R12 + swi r13, r1, PT_R13 + swi r14, r1, PT_R14 + swi r14, r1, PT_PC + swi r15, r1, PT_R15 + swi r16, r1, PT_R16 + swi r17, r1, PT_R17 + swi r18, r1, PT_R18 + swi r19, r1, PT_R19 + swi r20, r1, PT_R20 + swi r21, r1, PT_R21 + swi r22, r1, PT_R22 + swi r23, r1, PT_R23 + swi r24, r1, PT_R24 + swi r25, r1, PT_R25 + swi r26, r1, PT_R26 + swi r27, r1, PT_R27 + swi r28, r1, PT_R28 + swi r29, r1, PT_R29 + swi r30, r1, PT_R30 + swi r31, r1, PT_R31 + /* special purpose registers */ + mfs r11, rmsr + swi r11, r1, PT_MSR + mfs r11, rear + swi r11, r1, PT_EAR + mfs r11, resr + swi r11, r1, PT_ESR + mfs r11, rfsr + swi r11, r1, PT_FSR + /* reload original stack pointer and save it */ + lwi r11, r0, PER_CPU(ENTRY_SP) + swi r11, r1, PT_R1 + /* update mode indicator we are in kernel mode */ + addik r11, r0, 1 + swi r11, r0, PER_CPU(KM) + /* restore r31 */ + lwi r31, r0, PER_CPU(CURRENT_SAVE) + /* prepare the link register, the argument and jump */ + la r15, r0, ret_from_intr - 8 + addk r6, r0, r15 + braid do_IRQ + add r5, r0, r1 + +ret_from_intr: + lwi r11, r1, PT_MODE + bneid r11, 3f + + lwi r6, r31, TS_THREAD_INFO /* get thread info */ + lwi r19, r6, TI_FLAGS /* get flags in thread info */ + /* do an extra work if any bits are set */ + + andi r11, r19, _TIF_NEED_RESCHED + beqi r11, 1f + bralid r15, schedule + nop +1: andi r11, r19, _TIF_SIGPENDING + beqid r11, no_intr_reshed + addk r5, r1, r0 + addk r7, r0, r0 + bralid r15, do_signal + addk r6, r0, r0 + +no_intr_reshed: + /* save mode indicator */ + lwi r11, r1, PT_MODE +3: + swi r11, r0, PER_CPU(KM) + + /* save r31 */ + swi r31, r0, PER_CPU(CURRENT_SAVE) +restore_context: + /* special purpose registers */ + lwi r11, r1, PT_FSR + mts rfsr, r11 + lwi r11, r1, PT_ESR + mts resr, r11 + lwi r11, r1, PT_EAR + mts rear, r11 + lwi r11, r1, PT_MSR + mts rmsr, r11 + + lwi r31, r1, PT_R31 + lwi r30, r1, PT_R30 + lwi r29, r1, PT_R29 + lwi r28, r1, PT_R28 + lwi r27, r1, PT_R27 + lwi r26, r1, PT_R26 + lwi r25, r1, PT_R25 + lwi r24, r1, PT_R24 + lwi r23, r1, PT_R23 + lwi r22, r1, PT_R22 + lwi r21, r1, PT_R21 + lwi r20, r1, PT_R20 + lwi r19, r1, PT_R19 + lwi r18, r1, PT_R18 + lwi r17, r1, PT_R17 + lwi r16, r1, PT_R16 + lwi r15, r1, PT_R15 + lwi r14, r1, PT_PC + lwi r13, r1, PT_R13 + lwi r12, r1, PT_R12 + lwi r11, r1, PT_R11 + lwi r10, r1, PT_R10 + lwi r9, r1, PT_R9 + lwi r8, r1, PT_R8 + lwi r7, r1, PT_R7 + lwi r6, r1, PT_R6 + lwi r5, r1, PT_R5 + lwi r4, r1, PT_R4 + lwi r3, r1, PT_R3 + lwi r2, r1, PT_R2 + lwi r1, r1, PT_R1 + rtid r14, 0 + nop + +ENTRY(_reset) + brai 0; + +ENTRY(_user_exception) + swi r1, r0, PER_CPU(ENTRY_SP) /* save the current sp */ + swi r11, r0, PER_CPU(R11_SAVE) /* temporarily save r11 */ + lwi r11, r0, PER_CPU(KM) /* load mode indicator */ + beqid r11, 1f /* Already in kernel mode? */ + nop + brid 2f /* jump over */ + addik r1, r1, (-PT_SIZE) /* Room for pt_regs (delay slot) */ +1: /* Switch to kernel stack */ + lwi r1, r0, PER_CPU(CURRENT_SAVE) /* get the saved current */ + lwi r1, r1, TS_THREAD_INFO /* get the thread info */ + /* calculate kernel stack pointer */ + addik r1, r1, THREAD_SIZE - PT_SIZE + swi r11, r0, PER_CPU(R11_SAVE) /* temporarily save r11 */ + lwi r11, r0, PER_CPU(KM) /* load mode indicator */ +2: + swi r11, r1, PT_MODE /* store the mode */ + lwi r11, r0, PER_CPU(R11_SAVE) /* reload r11 */ + /* save them on stack */ + swi r2, r1, PT_R2 + swi r3, r1, PT_R3 /* r3: _always_ in clobber list; see unistd.h */ + swi r4, r1, PT_R4 /* r4: _always_ in clobber list; see unistd.h */ + swi r5, r1, PT_R5 + swi r6, r1, PT_R6 + swi r7, r1, PT_R7 + swi r8, r1, PT_R8 + swi r9, r1, PT_R9 + swi r10, r1, PT_R10 + swi r11, r1, PT_R11 + /* r12: _always_ in clobber list; see unistd.h */ + swi r12, r1, PT_R12 + swi r13, r1, PT_R13 + /* r14: _always_ in clobber list; see unistd.h */ + swi r14, r1, PT_R14 + /* but we want to return to the next inst. */ + addik r14, r14, 0x4 + swi r14, r1, PT_PC /* increment by 4 and store in pc */ + swi r15, r1, PT_R15 + swi r16, r1, PT_R16 + swi r17, r1, PT_R17 + swi r18, r1, PT_R18 + swi r19, r1, PT_R19 + swi r20, r1, PT_R20 + swi r21, r1, PT_R21 + swi r22, r1, PT_R22 + swi r23, r1, PT_R23 + swi r24, r1, PT_R24 + swi r25, r1, PT_R25 + swi r26, r1, PT_R26 + swi r27, r1, PT_R27 + swi r28, r1, PT_R28 + swi r29, r1, PT_R29 + swi r30, r1, PT_R30 + swi r31, r1, PT_R31 + + disable_irq + nop /* make sure IE bit is in effect */ + clear_bip /* once IE is in effect it is safe to clear BIP */ + nop + + /* special purpose registers */ + mfs r11, rmsr + swi r11, r1, PT_MSR + mfs r11, rear + swi r11, r1, PT_EAR + mfs r11, resr + swi r11, r1, PT_ESR + mfs r11, rfsr + swi r11, r1, PT_FSR + /* reload original stack pointer and save it */ + lwi r11, r0, PER_CPU(ENTRY_SP) + swi r11, r1, PT_R1 + /* update mode indicator we are in kernel mode */ + addik r11, r0, 1 + swi r11, r0, PER_CPU(KM) + /* restore r31 */ + lwi r31, r0, PER_CPU(CURRENT_SAVE) + /* re-enable interrupts now we are in kernel mode */ + enable_irq + + /* See if the system call number is valid. */ + addi r11, r12, -NR_syscalls + bgei r11, 1f /* return to user if not valid */ + /* Figure out which function to use for this system call. */ + /* Note Microblaze barrel shift is optional, so don't rely on it */ + add r12, r12, r12 /* convert num -> ptr */ + add r12, r12, r12 + lwi r12, r12, sys_call_table /* Get function pointer */ + la r15, r0, ret_to_user-8 /* set return address */ + bra r12 /* Make the system call. */ + bri 0 /* won't reach here */ +1: + brid ret_to_user /* jump to syscall epilogue */ + addi r3, r0, -ENOSYS /* set errno in delay slot */ + +/* + * Debug traps are like a system call, but entered via brki r14, 0x60 + * All we need to do is send the SIGTRAP signal to current, ptrace and do_signal + * will handle the rest + */ +ENTRY(_debug_exception) + swi r1, r0, PER_CPU(ENTRY_SP) /* save the current sp */ + lwi r1, r0, PER_CPU(CURRENT_SAVE) /* get the saved current */ + lwi r1, r1, TS_THREAD_INFO /* get the thread info */ + addik r1, r1, THREAD_SIZE - PT_SIZE /* get the kernel stack */ + swi r11, r0, PER_CPU(R11_SAVE) /* temporarily save r11 */ + lwi r11, r0, PER_CPU(KM) /* load mode indicator */ +//save_context: + swi r11, r1, PT_MODE /* store the mode */ + lwi r11, r0, PER_CPU(R11_SAVE) /* reload r11 */ + /* save them on stack */ + swi r2, r1, PT_R2 + swi r3, r1, PT_R3 /* r3: _always_ in clobber list; see unistd.h */ + swi r4, r1, PT_R4 /* r4: _always_ in clobber list; see unistd.h */ + swi r5, r1, PT_R5 + swi r6, r1, PT_R6 + swi r7, r1, PT_R7 + swi r8, r1, PT_R8 + swi r9, r1, PT_R9 + swi r10, r1, PT_R10 + swi r11, r1, PT_R11 + /* r12: _always_ in clobber list; see unistd.h */ + swi r12, r1, PT_R12 + swi r13, r1, PT_R13 + /* r14: _always_ in clobber list; see unistd.h */ + swi r14, r1, PT_R14 + swi r14, r1, PT_PC /* Will return to interrupted instruction */ + swi r15, r1, PT_R15 + swi r16, r1, PT_R16 + swi r17, r1, PT_R17 + swi r18, r1, PT_R18 + swi r19, r1, PT_R19 + swi r20, r1, PT_R20 + swi r21, r1, PT_R21 + swi r22, r1, PT_R22 + swi r23, r1, PT_R23 + swi r24, r1, PT_R24 + swi r25, r1, PT_R25 + swi r26, r1, PT_R26 + swi r27, r1, PT_R27 + swi r28, r1, PT_R28 + swi r29, r1, PT_R29 + swi r30, r1, PT_R30 + swi r31, r1, PT_R31 + + disable_irq + nop /* make sure IE bit is in effect */ + clear_bip /* once IE is in effect it is safe to clear BIP */ + nop + + /* special purpose registers */ + mfs r11, rmsr + swi r11, r1, PT_MSR + mfs r11, rear + swi r11, r1, PT_EAR + mfs r11, resr + swi r11, r1, PT_ESR + mfs r11, rfsr + swi r11, r1, PT_FSR + /* reload original stack pointer and save it */ + lwi r11, r0, PER_CPU(ENTRY_SP) + swi r11, r1, PT_R1 + /* update mode indicator we are in kernel mode */ + addik r11, r0, 1 + swi r11, r0, PER_CPU(KM) + /* restore r31 */ + lwi r31, r0, PER_CPU(CURRENT_SAVE) + /* re-enable interrupts now we are in kernel mode */ + enable_irq + + addi r5, r0, SIGTRAP /* sending the trap signal */ + add r6, r0, r31 /* to current */ + bralid r15, send_sig + add r7, r0, r0 /* 3rd param zero */ + + /* Restore r3/r4 to work around how ret_to_user works */ + lwi r3, r1, PT_R3 + lwi r4, r1, PT_R4 + bri ret_to_user + +ENTRY(_break) + bri 0 + +/* struct task_struct *_switch_to(struct thread_info *prev, + struct thread_info *next); */ +ENTRY(_switch_to) + /* prepare return value */ + addk r3, r0, r31 + + /* save registers in cpu_context */ + /* use r11 and r12, volatile registers, as temp register */ + addik r11, r5, TI_CPU_CONTEXT + swi r1, r11, CC_SP + swi r2, r11, CC_R2 + /* skip volatile registers. + * they are saved on stack when we jumped to _switch_to() */ + /* dedicated registers */ + swi r13, r11, CC_R13 + swi r14, r11, CC_R14 + swi r15, r11, CC_R15 + swi r16, r11, CC_R16 + swi r17, r11, CC_R17 + swi r18, r11, CC_R18 + /* save non-volatile registers */ + swi r19, r11, CC_R19 + swi r20, r11, CC_R20 + swi r21, r11, CC_R21 + swi r22, r11, CC_R22 + swi r23, r11, CC_R23 + swi r24, r11, CC_R24 + swi r25, r11, CC_R25 + swi r26, r11, CC_R26 + swi r27, r11, CC_R27 + swi r28, r11, CC_R28 + swi r29, r11, CC_R29 + swi r30, r11, CC_R30 + /* special purpose registers */ + mfs r12, rmsr + swi r12, r11, CC_MSR + mfs r12, rear + swi r12, r11, CC_EAR + mfs r12, resr + swi r12, r11, CC_ESR + mfs r12, rfsr + swi r12, r11, CC_FSR + + /* update r31, the current */ + lwi r31, r6, TI_TASK + swi r31, r0, PER_CPU(CURRENT_SAVE) + + /* get new process' cpu context and restore */ + addik r11, r6, TI_CPU_CONTEXT + + /* special purpose registers */ + lwi r12, r11, CC_FSR + mts rfsr, r12 + lwi r12, r11, CC_ESR + mts resr, r12 + lwi r12, r11, CC_EAR + mts rear, r12 + lwi r12, r11, CC_MSR + mts rmsr, r12 + /* non-volatile registers */ + lwi r30, r11, CC_R30 + lwi r29, r11, CC_R29 + lwi r28, r11, CC_R28 + lwi r27, r11, CC_R27 + lwi r26, r11, CC_R26 + lwi r25, r11, CC_R25 + lwi r24, r11, CC_R24 + lwi r23, r11, CC_R23 + lwi r22, r11, CC_R22 + lwi r21, r11, CC_R21 + lwi r20, r11, CC_R20 + lwi r19, r11, CC_R19 + /* dedicated registers */ + lwi r18, r11, CC_R18 + lwi r17, r11, CC_R17 + lwi r16, r11, CC_R16 + lwi r15, r11, CC_R15 + lwi r14, r11, CC_R14 + lwi r13, r11, CC_R13 + /* skip volatile registers */ + lwi r2, r11, CC_R2 + lwi r1, r11, CC_SP + + rtsd r15, 8 + nop + +ENTRY(ret_from_fork) + addk r5, r0, r3 + addk r6, r0, r1 + brlid r15, schedule_tail + nop + swi r31, r1, PT_R31 /* save r31 in user context. */ + /* will soon be restored to r31 in ret_to_user */ + addk r3, r0, r0 + brid ret_to_user + nop + +work_pending: + andi r11, r19, _TIF_NEED_RESCHED + beqi r11, 1f + bralid r15, schedule + nop +1: andi r11, r19, _TIF_SIGPENDING + beqi r11, no_work_pending + addk r5, r1, r0 + addik r7, r0, 1 + bralid r15, do_signal + addk r6, r0, r0 + bri no_work_pending + +ENTRY(ret_to_user) + disable_irq + + swi r4, r1, PT_R4 /* return val */ + swi r3, r1, PT_R3 /* return val */ + + lwi r6, r31, TS_THREAD_INFO /* get thread info */ + lwi r19, r6, TI_FLAGS /* get flags in thread info */ + bnei r19, work_pending /* do an extra work if any bits are set */ +no_work_pending: + disable_irq + + /* save r31 */ + swi r31, r0, PER_CPU(CURRENT_SAVE) + /* save mode indicator */ + lwi r18, r1, PT_MODE + swi r18, r0, PER_CPU(KM) +//restore_context: + /* special purpose registers */ + lwi r18, r1, PT_FSR + mts rfsr, r18 + lwi r18, r1, PT_ESR + mts resr, r18 + lwi r18, r1, PT_EAR + mts rear, r18 + lwi r18, r1, PT_MSR + mts rmsr, r18 + + lwi r31, r1, PT_R31 + lwi r30, r1, PT_R30 + lwi r29, r1, PT_R29 + lwi r28, r1, PT_R28 + lwi r27, r1, PT_R27 + lwi r26, r1, PT_R26 + lwi r25, r1, PT_R25 + lwi r24, r1, PT_R24 + lwi r23, r1, PT_R23 + lwi r22, r1, PT_R22 + lwi r21, r1, PT_R21 + lwi r20, r1, PT_R20 + lwi r19, r1, PT_R19 + lwi r18, r1, PT_R18 + lwi r17, r1, PT_R17 + lwi r16, r1, PT_R16 + lwi r15, r1, PT_R15 + lwi r14, r1, PT_PC + lwi r13, r1, PT_R13 + lwi r12, r1, PT_R12 + lwi r11, r1, PT_R11 + lwi r10, r1, PT_R10 + lwi r9, r1, PT_R9 + lwi r8, r1, PT_R8 + lwi r7, r1, PT_R7 + lwi r6, r1, PT_R6 + lwi r5, r1, PT_R5 + lwi r4, r1, PT_R4 /* return val */ + lwi r3, r1, PT_R3 /* return val */ + lwi r2, r1, PT_R2 + lwi r1, r1, PT_R1 + + rtid r14, 0 + nop + +sys_vfork_wrapper: + brid sys_vfork + addk r5, r1, r0 + +sys_clone_wrapper: + brid sys_clone + addk r7, r1, r0 + +sys_execve_wrapper: + brid sys_execve + addk r8, r1, r0 + +sys_sigreturn_wrapper: + brid sys_sigreturn + addk r5, r1, r0 + +sys_rt_sigreturn_wrapper: + brid sys_rt_sigreturn + addk r5, r1, r0 + +sys_sigsuspend_wrapper: + brid sys_rt_sigsuspend + addk r6, r1, r0 + +sys_rt_sigsuspend_wrapper: + brid sys_rt_sigsuspend + addk r7, r1, r0 + + /* Interrupt vector table */ + .section .init.ivt, "ax" + .org 0x0 + brai _reset + brai _user_exception + brai _interrupt + brai _break + brai _hw_exception_handler + .org 0x60 + brai _debug_exception + +.section .rodata,"a" +#include "syscall_table.S" + +syscall_table_size=(.-sys_call_table)
arch/microblaze/kernel/head.S new file +40 -0
@@ -0,0 +1,40 @@ +/* + * arch/microblaze/kernel/head.S + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2007 Michal Simek <[email protected]> + * Copyright (C) 2006 Atmark Techno, Inc. + */ + +#include <linux/linkage.h> +#include <asm/thread_info.h> + + .text +ENTRY(_start) + mfs r1, rmsr + andi r1, r1, ~2 + mts rmsr, r1 + + /* Initialize small data anchors */ + la r13, r0, _KERNEL_SDA_BASE_ + la r2, r0, _KERNEL_SDA2_BASE_ + + /* Initialize stack pointer */ + la r1, r0, init_thread_union + THREAD_SIZE - 4 + + /* Initialize r31 with current task address */ + la r31, r0, init_task + + /* Call platform dependent initialize function. + * Please see $(ARCH)/mach-$(SUBARCH)/setup.c for + * the function. */ + la r8, r0, machine_early_init + brald r15, r8 + nop + + la r15, r0, machine_halt + braid start_kernel + nop
arch/microblaze/kernel/syscall_table.S new file +328 -0
328 lines not on this page · raw message
arch/microblaze/kernel/vmlinux.lds.S new file +145 -0
145 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 16/52 supported function for memory - kernel/lib
From: Michal Simek <[email protected]>
--- arch/microblaze/lib/memcpy.c | 159 +++++++++++++++++++++++++++++++++++++ arch/microblaze/lib/memmove.c | 174 +++++++++++++++++++++++++++++++++++++++++ arch/microblaze/lib/memset.c | 83 +++++++++++++++++++ 3 files changed, 416 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/lib/memcpy.c create mode 100644 arch/microblaze/lib/memmove.c create mode 100644 arch/microblaze/lib/memset.c
arch/microblaze/lib/memcpy.c new file +159 -0
@@ -0,0 +1,159 @@ +/* Filename: memcpy.c +* +* Reasonably optimised generic C-code for memcpy on Microblaze +* This is generic C code to do efficient, alignment-aware memcpy. +* +* It is based on demo code originally Copyright 2001 by Intel Corp, taken from +* http://www.embedded.com/showArticle.jhtml?articleID=19205567 +* +* Attempts were made, unsuccesfully, to contact the original +* author of this code (Michael Morrow, Intel). Below is the original +* copyright notice. +* +* This software has been developed by Intel Corporation. +* Intel specifically disclaims all warranties, express or +* implied, and all liability, including consequential and +* other indirect damages, for the use of this program, including +* liability for infringement of any proprietary rights, +* and including the warranties of merchantability and fitness +* for a particular purpose. Intel does not assume any +* responsibility for and errors which may appear in this program +* not any responsibility to update it. +*/ + +#include <linux/types.h> +#include <linux/stddef.h> +#include <linux/compiler.h> + +#include <asm/string.h> +#include <asm/system.h> + +/* Macro's for bytebliting unaligned data blocks */ + +/* Big-endian MACROS */ + +#define BYTE_BLIT_INIT (s, h, o) \ + (h) = *((unsigned *)(s))++ << (o) + +#define BYTE_BLIT_STEP (d, s, h, o) \ + { register unsigned _v_; _v_ = *((unsigned *)(s))++; \ + *((unsigned *)(d))++ = (h) | _v_ >> (32-(o)); \ + (h) = _v_ << (o); \ + } + +void *memcpy (void *d,const void *s,__kernel_size_t c) +{ +#if 1 +/* This code was put into place as we transitioned from gcc3 to gcc4. +* gcc4 does not support the syntax *((char *)d)++ which causes the +* original code below to break. Short of fixing up the original code, +* a simpler byte oriented code was put into place. +*/ +/* Simple, byte oriented memcpy. */ +const char *src = s; +char *dst = d; + +while (c--) *dst++ = *src++; + +return d; + +#else +/* The following code tries to optimize the copy by using unsigned +* alignment. This will work fine if both source and destination are +* aligned on the same boundary. However, if they are aligned on +* different boundaries shifts will be necessary. This might result in +* bad performance on MicroBlaze systems without a barrel shifter. +*/ +void *r = d; + +if (c >=4 ) { +unsigned x, a, h, align; + +/* Align the destination to a word boundry. */ +/* This is done in an endian independant manner. */ +switch ((unsigned ) d &3 ) { +case 1 : + *((char *) d)++ = *((char *) s)++; + c--; +case 2 : + *((char *) d)++ = *((char *) s)++; + c--; +case 3 : + *((char *) d)++ = *((char *) s)++; + c--; + } +/* Choose a copy scheme based on the source */ +/* alignment relative to destination. */ +switch ((unsigned ) s &3 ) { +case 0x0 :/* Both byte offsets are aligned */ + +for (; c >=4 ; c -=4 ) + *((unsigned *) d)++ = *((unsigned *) s)++; + +break ; + +case 0x1 :/* Unaligned - Off by 1 */ +/* Word align the source */ + a = (unsigned ) s & ~3 ; + +/* Load the holding buffer */ +BYTE_BLIT_INIT (a, h,8 ); + +for (; c >=4 ; c -=4 ) +BYTE_BLIT_STEP (d, a, h,8 ); + +/* Realign the source */ + (unsigned ) s = a -3 ; +break ; + +case 0x2 :/* Unaligned - Off by 2 */ +/* Word align the source */ + a = (unsigned ) s & ~3 ; + +/* Load the holding buffer */ +BYTE_BLIT_INIT (a, h,16 ); + +for (; c >=4 ; c -=4 ) +BYTE_BLIT_STEP (d, a, h,16 ); + +/* Realign the source */ + (unsigned ) s = a -2 ; +break ; + +case 0x3 :/* Unaligned - Off by 3 */ +/* Word align the source */ + a = (unsigned ) s & ~3 ; + +/* Load the holding buffer */ +BYTE_BLIT_INIT (a, h,24 ); + +for (; c >=4 ; c -=4 ) +BYTE_BLIT_STEP (d, a, h,24 ); + +/* Realign the source */ + (unsigned ) s = a -1 ; +break ; + } + + } + +/* Finish off any remaining bytes */ +/* simple fast copy, ... unless a cache boundry is crossed */ +switch (c) { +case 3 : + *((char *) d)++ = *((char *) s)++; +case 2 : + *((char *) d)++ = *((char *) s)++; +case 1 : + *((char *) d)++ = *((char *) s)++; + } + +return r; +#endif +} + + +void *cacheable_memcpy (void *d,const void *s,__kernel_size_t c) +{ +return memcpy (d, s, c); +}
arch/microblaze/lib/memmove.c new file +174 -0
174 lines not on this page · raw message
arch/microblaze/lib/memset.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 17/52 checksum support
From: Michal Simek <[email protected]>
--- arch/microblaze/lib/checksum.c | 159 +++++++++++++++++++++++++++++++++++++ include/asm-microblaze/checksum.h | 101 +++++++++++++++++++++++ 2 files changed, 260 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/lib/checksum.c create mode 100644 include/asm-microblaze/checksum.h
arch/microblaze/lib/checksum.c new file +159 -0
@@ -0,0 +1,159 @@ +/* +* INET An implementation of the TCP/IP protocol suite for the LINUX +* operating system. INET is implemented using the BSD Socket +* interface as the means of communication with the user level. +* +* IP/TCP/UDP checksumming routines +* +* Authors: Jorge Cwik, <[email protected]> +* Arnt Gulbrandsen, <[email protected]> +* Tom May, <[email protected]> +* Andreas Schwab, <[email protected]> +* Lots of code moved from tcp.c and ip.c; see those files +* for more names. +* +* 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek: +* Fixed some nasty bugs, causing some horrible crashes. +* A: At some points, the sum (%0) was used as +* length-counter instead of the length counter +* (%1). Thanks to Roman Hodek for pointing this out. +* B: GCC seems to mess up if one uses too many +* data-registers to hold input values and one tries to +* specify d0 and d1 as scratch registers. Letting gcc choose these +* registers itself solves the problem. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access +kills, so most of the assembly has to go. */ + +#include <net/checksum.h> +#include <asm/checksum.h> + +static inline unsigned short from32to16 (unsigned long x) +{ +/* add up 16-bit and 16-bit for 16+c bit */ + x = (x &0xffff ) + (x >>16 ); +/* add up carry.. */ + x = (x &0xffff ) + (x >>16 ); +return x; +} + +static unsigned long do_csum (const unsigned char *buff,int len) +{ +int odd, count; +unsigned long result =0 ; + +if (len <=0 ) + goto out; + odd =1 & (unsigned long ) buff; +if (odd) { + result = *buff; + len--; + buff++; + } + count = len >>1 ;/* nr of 16-bit words.. */ +if (count) { +if (2 & (unsigned long ) buff) { + result += *(unsigned short *) buff; + count--; + len -=2 ; + buff +=2 ; + } + count >>=1 ;/* nr of 32-bit words.. */ +if (count) { +unsigned long carry =0 ; +do { +unsigned long w = *(unsigned long *) buff; + count--; + buff +=4 ; + result += carry; + result += w; + carry = (w > result); + }while (count); + result += carry; + result = (result &0xffff ) + (result >>16 ); + } +if (len &2 ) { + result += *(unsigned short *) buff; + buff +=2 ; + } + } +if (len &1 ) + result += (*buff <<8 ); + result =from32to16 (result); +if (odd) + result = ((result >>8 ) &0xff ) | ((result &0xff ) <<8 ); +out: +return result; +} + +/* +* This is a version of ip_compute_csum() optimized for IP headers, +* which always checksum on 4 octet boundaries. +*/ +unsigned short ip_fast_csum (unsigned char *iph,unsigned int ihl) +{ +return ~do_csum (iph, ihl*4 ); +} + +/* +* computes the checksum of a memory block at buff, length len, +* and adds in "sum" (32-bit) +* +* returns a 32-bit number suitable for feeding into itself +* or csum_tcpudp_magic +* +* this function must be called with even lengths, except +* for the last fragment, which may be odd +* +* it's best to have buff aligned on a 32-bit boundary +*/ +unsigned int csum_partial (const unsigned char *buff,int len,unsigned int sum) +{ +unsigned int result =do_csum (buff, len); + +/* add in old sum, and carry.. */ + result += sum; +if (sum > result) + result +=1 ; +return result; +} + +/* +* this routine is used for miscellaneous IP-like checksums, mainly +* in icmp.c +*/ +unsigned short ip_compute_csum (const unsigned char *buff,int len) +{ +return ~do_csum (buff, len); +} + +/* +* copy from fs while checksumming, otherwise like csum_partial +*/ + +unsigned int +csum_partial_copy_from_user (const char *src,char *dst,int len,int sum, +int *csum_err) +{ +if (csum_err) + *csum_err =0 ; +memcpy (dst, src, len); +return csum_partial (dst, len, sum); +} + +/* +* copy from ds while checksumming, otherwise like csum_partial +*/ + +unsigned int +csum_partial_copy (const char *src,char *dst,int len,int sum) +{ +memcpy (dst, src, len); +return csum_partial (dst, len, sum); +}
include/asm-microblaze/checksum.h new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 18/52 early_printk support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/early_printk.c | 115 +++++++++++++++++++++++++++++++++ 1 files changed, 115 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/early_printk.c
arch/microblaze/kernel/early_printk.c new file +115 -0
@@ -0,0 +1,115 @@ +/* +* arch/microblaze/kernel/early_printk.c +* +* Copyright (C) 2007 Michal Simek <[email protected]> +* Copyright (C) 2003-2006 Yasushi SHOJI <[email protected]> +* +* Early printk support for Microblaze. +* +* Once we got some system without uart light, we need to refactor. +*/ + +#include <linux/console.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/string.h> +#include <linux/tty.h> +#include <asm/io.h> +#include <asm/processor.h> +#include <asm/fcntl.h> +#include <asm/setup.h> + +#ifdef CONFIG_EARLY_PRINTK +#define BASE_ADDR ((unsigned char *)CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS) + +#define RX_FIFO BASE_ADDR +#define TX_FIFO ((unsigned long *)(BASE_ADDR + 4)) +#define STATUS ((unsigned long *)(BASE_ADDR + 8)) +#define CONTROL ((unsigned long *)(BASE_ADDR + 12)) + +static void early_printk_putc (char c) +{ +while (ioread32 (STATUS ) & (1 <<3 )); +iowrite32 ((c &0xff ),TX_FIFO ); +} + +static void early_printk_write (struct console *unused, +const char *s,unsigned n) +{ +while (*s && n-- >0 ) { +early_printk_putc (*s); +if (*s =='\n' ) +early_printk_putc ('\r' ); + s++; + } +} + +static struct console early_serial_console = { + .name ="earlyser" , + .write = early_printk_write, + .flags =CON_PRINTBUFFER , + .index =-1 , +}; + +/* Direct interface for emergencies */ +static struct console *early_console = &early_serial_console; +static int early_console_initialized; + +void early_printk (const char *fmt, ...) +{ +char buf[512 ]; +int n; +va_list ap; + +if (early_console_initialized) { +va_start (ap, fmt); + n =vscnprintf (buf,512 , fmt, ap); + early_console->write (early_console, buf, n); +va_end (ap); + } +} + +static int __initdata keep_early; + +int __init setup_early_printk (char *opt) +{ +char *space; +char buf[256 ]; + +if (early_console_initialized) +return 1 ; + +strlcpy (buf, opt,sizeof (buf)); + space =strchr (buf,' ' ); +if (space) + *space =0 ; + +if (strstr (buf,"keep" )) + keep_early =1 ; + + early_console = &early_serial_console; + early_console_initialized =1 ; +register_console (early_console); +return 0 ; +} +#if 0 +static void __init disable_early_printk (void ) +{ +if (!early_console_initialized || !early_console) +return ; +if (!keep_early) { +printk (KERN_INFO "disabling early console\n" ); +unregister_console (early_console); + early_console_initialized =0 ; + }else +printk (KERN_INFO "keeping early console\n" ); +} +#endif + +__setup ("earlyprintk=" , setup_early_printk); + +#else +void early_printk (const char *fmt, ...) +{ +} +#endif
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 19/52 uaccess files
From: Michal Simek <[email protected]>
--- arch/microblaze/lib/uaccess.c | 43 +++++++++++++ include/asm-microblaze/uaccess.h | 126 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/lib/uaccess.c create mode 100644 include/asm-microblaze/uaccess.h
arch/microblaze/lib/uaccess.c new file +43 -0
@@ -0,0 +1,43 @@ +/* +* arch/microblaze/lib/uaccess.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/string.h> +#include <asm/uaccess.h> + +#include <asm/bug.h> + +long strnlen_user (const char *s,long n) +{ +return strlen (s) +1 ; +} + +#define __do_strncpy_from_user (dst, src, count, res) \ + do { \ + char *tmp; \ + strncpy(dst, src, count); \ + for (tmp = dst; *tmp && count > 0; tmp++, count--) \ + ; \ + res = (tmp - dst); \ + } while (0) + +long __strncpy_from_user (char *dst,const char *src,long count) +{ +long res; +__do_strncpy_from_user (dst, src, count, res); +return res; +} + +long strncpy_from_user (char *dst,const char *src,long count) +{ +long res = -EFAULT ; +if (access_ok (VERIFY_READ , src,1 )) +__do_strncpy_from_user (dst, src, count, res); +return res; +}
include/asm-microblaze/uaccess.h new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 20/52 heartbeat file
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/heartbeat.c | 40 ++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/heartbeat.c
arch/microblaze/kernel/heartbeat.c new file +40 -0
@@ -0,0 +1,40 @@ +/* +* arch/microblaze/kernel/heartbeat.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/sched.h> +#include <asm/page.h> +#include <asm/io.h> +#include <asm/setup.h> + +void heartbeat (void ) +{ +#if 0 +static unsigned int cnt, period, dist; + +if (cnt ==0 || cnt == dist) { +iowrite32 (1 ,CONFIG_XILINX_LEDS_4BIT_BASEADDR ); + }else if (cnt ==7 || cnt == dist +7 ) { +iowrite32 (0 ,CONFIG_XILINX_LEDS_4BIT_BASEADDR ); + } + +if (++cnt > period) { + cnt =0 ; + +/* +* The hyperbolic function below modifies the heartbeat period +* length in dependency of the current (5min) load. It goes +* through the points f(0)=126, f(1)=86, f(5)=51, f(inf)->30. +*/ + period = ((672 <<FSHIFT ) / (5 * avenrun[0 ] + + (7 <<FSHIFT ))) +30 ; + dist = period /4 ; + } +#endif +}
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 21/52 setup.c - system setting
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/setup.c | 170 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 170 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/setup.c
arch/microblaze/kernel/setup.c new file +170 -0
@@ -0,0 +1,170 @@ +/* +* arch/microblaze/kernel/setup.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/init.h> +#include <linux/string.h> +#include <linux/seq_file.h> +#include <linux/cpu.h> +#include <linux/initrd.h> +#include <linux/console.h> + +#include <asm/setup.h> +#include <asm/sections.h> +#include <asm/page.h> +#include <asm/io.h> +#include <asm/bug.h> +#include <asm/param.h> +#include <asm/cache.h> +#include <asm/cacheflush.h> +#include <asm/entry.h> +#include <asm/cpuinfo.h> + +#include <asm/system.h> +#include <asm/prom.h> +#include <asm/pgtable.h> + +DEFINE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */ +DEFINE_PER_CPU(unsigned int, KM); /* Kernel/user mode */ +DEFINE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */ +DEFINE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */ +DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ + +char command_line[COMMAND_LINE_SIZE ]; +static char default_command_line[COMMAND_LINE_SIZE ]__initdata =CONFIG_CMDLINE ; + +void __init setup_arch (char **cmdline_p) +{ +console_verbose (); + +unflatten_device_tree (); +/* NOTE I think that this function is not necessary to call */ +/* irq_early_init(); */ +setup_cpuinfo (); + +__flush_icache_all (); +__enable_icache (); + +__flush_dcache_all (); +__enable_dcache (); + + panic_timeout =120 ; + +setup_memory (); +paging_init (); + +#ifdef CONFIG_VT +#if defined(CONFIG_XILINX_CONSOLE ) + conswitchp = &xil_con; +#elif defined(CONFIG_DUMMY_CONSOLE ) + conswitchp = &dummy_con; +#endif +#endif +} + +#ifdef CONFIG_MTD_UCLINUX_EBSS +/* Handle both romfs and cramfs types, without generating unnecessary +code (ie no point checking for CRAMFS if it's not even enabled) */ +inline unsigned get_romfs_len (unsigned *addr) +{ +#ifdef CONFIG_ROMFS_FS +if (memcmp (&addr[0 ],"-rom1fs-" ,8 ) ==0 )/* romfs */ +return be32_to_cpu (addr[2 ]); +#endif + +#ifdef CONFIG_CRAMFS +if (addr[0 ] ==le32_to_cpu (0x28cd3d45 ))/* cramfs */ +return le32_to_cpu (addr[1 ]); +#endif +return 0 ; +} +#endif /* CONFIG_MTD_UCLINUX_EBSS */ + +void __init machine_early_init (const char *cmdline,unsigned int ram, +unsigned int fdt) +{ +unsigned long *src, *dst = (unsigned long *)0x0 ; +early_printk ("Ramdisk addr 0x%08x, FDT 0x%08x\n" , ram, fdt); + +#ifdef CONFIG_MTD_UCLINUX_EBSS + { +int size; +unsigned int romfs_base; + romfs_base = (ram ? ram : (unsigned int )&__init_end); +/* if CONFIG_MTD_UCLINUX_EBSS is defined, assume ROMFS is at the +* end of kernel, which is ROMFS_LOCATION defined above. */ + size =PAGE_ALIGN (get_romfs_len ((unsigned *)romfs_base)); +early_printk ("Found romfs @ 0x%08x (0x%08x)\n" , + romfs_base, size); +early_printk ("#### klimit %p ####\n" , klimit); +BUG_ON (size <0 );/* What else can we do? */ + +/* Use memmove to handle likely case of memory overlap */ +early_printk ("Moving 0x%08x bytes from 0x%08x to 0x%08x\n" , + size, romfs_base, &_ebss); +memmove (&_ebss, (int *)romfs_base, size); + +/* update klimit */ + klimit +=PAGE_ALIGN (size); +early_printk ("New klimit: 0x%08x\n" , klimit); + } +#endif + +memset (__bss_start,0 , __bss_stop-__bss_start); +memset (_ssbss,0 , _esbss-_ssbss); + +printk (KERN_NOTICE "Found FDT at 0x%08x\n" , fdt); +early_init_devtree ((void *)fdt); + +/* Copy command line passed from bootloader, or use default +if none provided, or forced */ +#ifndef CONFIG_CMDLINE_FORCE +if (cmdline && cmdline[0 ] !='\0' ) +strlcpy (command_line, cmdline,COMMAND_LINE_SIZE ); + else +#endif +strlcpy (command_line, default_command_line,COMMAND_LINE_SIZE ); + +for (src = __ivt_start; src < __ivt_end; src++, dst++) + *dst = *src; + +/* Initialize global data */ +per_cpu (KM ,0 ) =0x1 ;/* We start in kernel mode */ +per_cpu (CURRENT_SAVE ,0 ) = (unsigned long )current; + +} + +void machine_restart (char *cmd) +{ +printk (KERN_NOTICE "Machine restart...\n" ); +dump_stack (); +while (1 ) + ; +} + +void machine_shutdown (void ) +{ +printk (KERN_NOTICE "Machine shutdown...\n" ); +while (1 ) + ; +} + +void machine_halt (void ) +{ +printk (KERN_NOTICE "Machine halt...\n" ); +while (1 ) + ; +} + +void machine_power_off (void ) +{ +printk (KERN_NOTICE "Machine power off...\n" ); +while (1 ) + ; +}
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 22/52 asm-offsets
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/asm-offsets.c | 118 ++++++++++++++++++++++++++++++++++ 1 files changed, 118 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/asm-offsets.c
arch/microblaze/kernel/asm-offsets.c new file +118 -0
@@ -0,0 +1,118 @@ +/* +* arch/microblaze/kernel/asm-offset.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2007 PetaLogix +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/stddef.h> +#include <linux/sched.h> +#include <linux/kernel_stat.h> +#include <linux/ptrace.h> +#include <linux/hardirq.h> +#include <linux/thread_info.h> + +#define DEFINE (sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val)) +#define BLANK () asm volatile("\n->" : :) + +int main (int argc,char *argv[]) +{ +/* struct pt_regs */ +DEFINE (PT_SIZE ,sizeof (struct pt_regs )); +DEFINE (PT_MSR , offsetof(struct pt_regs , msr)); +DEFINE (PT_EAR , offsetof(struct pt_regs , ear)); +DEFINE (PT_ESR , offsetof(struct pt_regs , esr)); +DEFINE (PT_FSR , offsetof(struct pt_regs , fsr)); +DEFINE (PT_PC , offsetof(struct pt_regs , pc)); +DEFINE (PT_R0 , offsetof(struct pt_regs , r0)); +DEFINE (PT_R1 , offsetof(struct pt_regs , r1)); +DEFINE (PT_R2 , offsetof(struct pt_regs , r2)); +DEFINE (PT_R3 , offsetof(struct pt_regs , r3)); +DEFINE (PT_R4 , offsetof(struct pt_regs , r4)); +DEFINE (PT_R5 , offsetof(struct pt_regs , r5)); +DEFINE (PT_R6 , offsetof(struct pt_regs , r6)); +DEFINE (PT_R7 , offsetof(struct pt_regs , r7)); +DEFINE (PT_R8 , offsetof(struct pt_regs , r8)); +DEFINE (PT_R9 , offsetof(struct pt_regs , r9)); +DEFINE (PT_R10 , offsetof(struct pt_regs , r10)); +DEFINE (PT_R11 , offsetof(struct pt_regs , r11)); +DEFINE (PT_R12 , offsetof(struct pt_regs , r12)); +DEFINE (PT_R13 , offsetof(struct pt_regs , r13)); +DEFINE (PT_R14 , offsetof(struct pt_regs , r14)); +DEFINE (PT_R15 , offsetof(struct pt_regs , r15)); +DEFINE (PT_R16 , offsetof(struct pt_regs , r16)); +DEFINE (PT_R17 , offsetof(struct pt_regs , r17)); +DEFINE (PT_R18 , offsetof(struct pt_regs , r18)); +DEFINE (PT_R19 , offsetof(struct pt_regs , r19)); +DEFINE (PT_R20 , offsetof(struct pt_regs , r20)); +DEFINE (PT_R21 , offsetof(struct pt_regs , r21)); +DEFINE (PT_R22 , offsetof(struct pt_regs , r22)); +DEFINE (PT_R23 , offsetof(struct pt_regs , r23)); +DEFINE (PT_R24 , offsetof(struct pt_regs , r24)); +DEFINE (PT_R25 , offsetof(struct pt_regs , r25)); +DEFINE (PT_R26 , offsetof(struct pt_regs , r26)); +DEFINE (PT_R27 , offsetof(struct pt_regs , r27)); +DEFINE (PT_R28 , offsetof(struct pt_regs , r28)); +DEFINE (PT_R29 , offsetof(struct pt_regs , r29)); +DEFINE (PT_R30 , offsetof(struct pt_regs , r30)); +DEFINE (PT_R31 , offsetof(struct pt_regs , r31)); +DEFINE (PT_MODE , offsetof(struct pt_regs , kernel_mode)); +BLANK (); + +/* Magic offsets for PTRACE PEEK/POKE etc */ +DEFINE (PT_TEXT_ADDR ,sizeof (struct pt_regs ) +1 ); +DEFINE (PT_TEXT_LEN ,sizeof (struct pt_regs ) +2 ); +DEFINE (PT_DATA_ADDR ,sizeof (struct pt_regs ) +3 ); +BLANK (); + +/* struct task_struct */ +DEFINE (TS_THREAD_INFO , offsetof(struct task_struct , stack)); + +/* struct thread_info */ +DEFINE (TI_TASK , offsetof(struct thread_info , task)); +DEFINE (TI_EXEC_DOMAIN , offsetof(struct thread_info , exec_domain)); +DEFINE (TI_FLAGS , offsetof(struct thread_info , flags)); +DEFINE (TI_STATUS , offsetof(struct thread_info , status)); +DEFINE (TI_CPU , offsetof(struct thread_info , cpu)); +DEFINE (TI_PRE_COUNT , offsetof(struct thread_info , preempt_count)); +DEFINE (TI_ADDR_LIMIT , offsetof(struct thread_info , addr_limit)); +DEFINE (TI_RESTART_BLOCK , offsetof(struct thread_info , restart_block)); +DEFINE (TI_CPU_CONTEXT , offsetof(struct thread_info , cpu_context)); +BLANK (); + +/* struct cpu_context */ +DEFINE (CC_SP , offsetof(struct cpu_context , sp));/* r1 */ +DEFINE (CC_R2 , offsetof(struct cpu_context , r2)); +/* dedicated registers */ +DEFINE (CC_R13 , offsetof(struct cpu_context , r13)); +DEFINE (CC_R14 , offsetof(struct cpu_context , r14)); +DEFINE (CC_R15 , offsetof(struct cpu_context , r15)); +DEFINE (CC_R16 , offsetof(struct cpu_context , r16)); +DEFINE (CC_R17 , offsetof(struct cpu_context , r17)); +DEFINE (CC_R18 , offsetof(struct cpu_context , r18)); +/* non-volatile registers */ +DEFINE (CC_R19 , offsetof(struct cpu_context , r19)); +DEFINE (CC_R20 , offsetof(struct cpu_context , r20)); +DEFINE (CC_R21 , offsetof(struct cpu_context , r21)); +DEFINE (CC_R22 , offsetof(struct cpu_context , r22)); +DEFINE (CC_R23 , offsetof(struct cpu_context , r23)); +DEFINE (CC_R24 , offsetof(struct cpu_context , r24)); +DEFINE (CC_R25 , offsetof(struct cpu_context , r25)); +DEFINE (CC_R26 , offsetof(struct cpu_context , r26)); +DEFINE (CC_R27 , offsetof(struct cpu_context , r27)); +DEFINE (CC_R28 , offsetof(struct cpu_context , r28)); +DEFINE (CC_R29 , offsetof(struct cpu_context , r29)); +DEFINE (CC_R30 , offsetof(struct cpu_context , r30)); +/* special purpose registers */ +DEFINE (CC_MSR , offsetof(struct cpu_context , msr)); +DEFINE (CC_EAR , offsetof(struct cpu_context , ear)); +DEFINE (CC_ESR , offsetof(struct cpu_context , esr)); +DEFINE (CC_FSR , offsetof(struct cpu_context , fsr)); +BLANK (); + +return 0 ; +}
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 23/52 process and init task function
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/init_task.c | 31 +++++++++ arch/microblaze/kernel/process.c | 129 ++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/init_task.c create mode 100644 arch/microblaze/kernel/process.c
arch/microblaze/kernel/init_task.c new file +31 -0
@@ -0,0 +1,31 @@ +/* +* arch/microblaze/kernel/init_task.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/module.h> +#include <linux/sched.h> +#include <linux/init_task.h> +#include <linux/fs.h> +#include <linux/mqueue.h> + +#include <asm/pgtable.h> + +static struct fs_struct init_fs =INIT_FS ; +static struct files_struct init_files =INIT_FILES ; +static struct signal_struct init_signals =INIT_SIGNALS (init_signals); +static struct sighand_struct init_sighand =INIT_SIGHAND (init_sighand); +struct mm_struct init_mm =INIT_MM (init_mm); +EXPORT_SYMBOL (init_mm); + +union thread_union init_thread_union + __attribute__((__section__(".data.init_task"))) = +{ INIT_THREAD_INFO(init_task) }; + +struct task_struct init_task =INIT_TASK (init_task); +EXPORT_SYMBOL (init_task);
arch/microblaze/kernel/process.c new file +129 -0
129 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 24/52 time support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/time.c | 90 ++++++++++++++++++++++++++++++++++++++++ include/asm-microblaze/delay.h | 28 ++++++++++++ include/asm-microblaze/timex.h | 21 +++++++++ 3 files changed, 139 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/time.c create mode 100644 include/asm-microblaze/delay.h create mode 100644 include/asm-microblaze/timex.h
arch/microblaze/kernel/time.c new file +90 -0
@@ -0,0 +1,90 @@ +/* +* arch/microblaze/kernel/time.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/param.h> +#include <linux/jiffies.h> +#include <linux/time.h> +#include <linux/hrtimer.h> +#include <asm/bug.h> +#include <asm/setup.h> + +void time_init (void ) +{ +system_timer_init (); +} + +int do_settimeofday (struct timespec *tv) +{ +if ((unsigned long )tv->tv_nsec >=NSEC_PER_SEC ) +return -EINVAL ; + +write_seqlock_irq (&xtime_lock); + +/* This is revolting. We need to set the xtime.tv_nsec +* correctly. However, the value in this location is +* is value at the last tick. +* Discover what correction gettimeofday +* would have done, and then undo it! +*/ +#if 0 + tv->tv_nsec -=mach_gettimeoffset () *1000 ; +#endif + +while (tv->tv_nsec <0 ) { + tv->tv_nsec +=NSEC_PER_SEC ; + tv->tv_sec--; + } + + xtime.tv_sec = tv->tv_sec; + xtime.tv_nsec = tv->tv_nsec; + + time_adjust =0 ; + time_status |=STA_UNSYNC ; + time_maxerror =NTP_PHASE_LIMIT ; + time_esterror =NTP_PHASE_LIMIT ; + +write_sequnlock_irq (&xtime_lock); +clock_was_set (); +return 0 ; +} +EXPORT_SYMBOL (do_settimeofday); + +/* +* This version of gettimeofday has near microsecond resolution. +*/ +void do_gettimeofday (struct timeval *tv) +{ +unsigned long seq; +unsigned long usec, sec; +/* unsigned long max_ntp_tick = tick_usec - tickadj; */ + +do { + seq =read_seqbegin (&xtime_lock); + usec =do_gettimeoffset (); + sec = xtime.tv_sec; + usec += (xtime.tv_nsec /1000 ); + }while (read_seqretry (&xtime_lock, seq)); + +while (usec >=1000000 ) { + usec -=1000000 ; + sec++; + } + + tv->tv_sec = sec; + tv->tv_usec = usec; +} +EXPORT_SYMBOL (do_gettimeofday); + +unsigned long long sched_clock (void ) +{ +return (unsigned long long )jiffies * (1000000000 /HZ ); +}
include/asm-microblaze/delay.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* include/asm-microblaze/delay.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_DELAY_H +#define _ASM_DELAY_H + +extern inline void __delay (unsigned long loops) +{ + asmvolatile ("# __delay \n\t" \ +"1: addi %0, %0, -1 \t\n" \ +"bneid %0, 1b \t\n" \ +"nop \t\n" + :"=r" (loops) + :"0" (loops)); +} + +static inline void udelay (unsigned long usec) +{ +} + +#endif /* _ASM_DELAY_H */
include/asm-microblaze/timex.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* include/asm-microblaze/timex.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +* FIXME -- need review +*/ + +#ifndef _ASM_TIMEX_H +#define _ASM_TIMEX_H + +#define CLOCK_TICK_RATE 1000/* Timer input freq. */ + +typedef unsigned long cycles_t ; + +#define get_cycles () (0) + +#endif /* _ASM_TIMEX_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 25/52 ptrace support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/ptrace.c | 212 +++++++++++++++++++++++++++++++++++++++ include/asm-microblaze/ptrace.h | 70 +++++++++++++ 2 files changed, 282 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/ptrace.c create mode 100644 include/asm-microblaze/ptrace.h
arch/microblaze/kernel/ptrace.c new file +212 -0
@@ -0,0 +1,212 @@ +/* +* arch/microblaze/kernel/ptrace.c -- `ptrace' system call +* +* Copyright (C) 2007 PetaLogix +* Copyright (C) 2004-07 John Williams <[email protected]> +* +* derived from arch/v850/kernel/ptrace.c +* +* Copyright (C) 2002,03 NEC Electronics Corporation +* Copyright (C) 2002,03 Miles Bader <[email protected]> +* +* Derived from arch/mips/kernel/ptrace.c: +* +* Copyright (C) 1992 Ross Biro +* Copyright (C) Linus Torvalds +* Copyright (C) 1994, 95, 96, 97, 98, 2000 Ralf Baechle +* Copyright (C) 1996 David S. Miller +* Kevin D. Kissell, [email protected] and Carsten Langgaard, [email protected] +* Copyright (C) 1999 MIPS Technologies, Inc. +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file COPYING in the main directory of this +* archive for more details. +*/ + +#include <linux/kernel.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/smp_lock.h> +#include <linux/ptrace.h> +#include <linux/signal.h> + +#include <asm/errno.h> +#include <asm/ptrace.h> +#include <asm/processor.h> +#include <asm/uaccess.h> +#include <asm/asm-offsets.h> + +#if 0 +#define DBPRINTK (...) printk(__VA_ARGS__) +#else +#define DBPRINTK (...) +#endif + +/* Returns the address where the register at REG_OFFS in P is stashed away. */ +static microblaze_reg_t *reg_save_addr (unsigned reg_offs, +struct task_struct *t) +{ +struct pt_regs *regs; + +/* +* Three basic cases: +* +* (1) A register normally saved before calling the scheduler, is +* available in the kernel entry pt_regs structure at the top +* of the kernel stack. The kernel trap/irq exit path takes +* care to save/restore almost all registers for ptrace'd +* processes. +* +* (2) A call-clobbered register, where the process P entered the +* kernel via [syscall] trap, is not stored anywhere; that's +* OK, because such registers are not expected to be preserved +* when the trap returns anyway (so we don't actually bother to +* test for this case). +* +* (3) A few registers not used at all by the kernel, and so +* normally never saved except by context-switches, are in the +* context switch state. +*/ + +/* Register saved during kernel entry (or not available). */ + regs =task_pt_regs (t); + +return (microblaze_reg_t *)((char *)regs + reg_offs); +} + +long arch_ptrace (struct task_struct *child,long request,long addr,long data) +{ +int rval; + +switch (request) { +unsigned long val, copied; + +case PTRACE_PEEKTEXT :/* read word at location addr. */ +case PTRACE_PEEKDATA : +DBPRINTK ("PEEKTEXT/PEEKDATA at %08lX\n" , addr); + copied =access_process_vm (child, addr, &val,sizeof (val),0 ); + rval = -EIO ; +if (copied !=sizeof (val)) +break ; + rval =put_user (val, (unsigned long *)data); + goto out; + +case PTRACE_POKETEXT :/* write the word at location addr. */ +case PTRACE_POKEDATA : +DBPRINTK ("POKETEXT/POKEDATA to %08lX\n" , addr); + rval =0 ; +if (access_process_vm (child, addr, &data,sizeof (data),1 ) + ==sizeof (data)) +break ; + rval = -EIO ; + goto out; + +/* Read/write the word at location ADDR in the registers. */ +case PTRACE_PEEKUSR : +case PTRACE_POKEUSR : +DBPRINTK ("PEEKUSR/POKEUSR : 0x%08lx\n" , addr); + rval =0 ; +if (addr >=PT_SIZE && request ==PTRACE_PEEKUSR ) { +/* Special requests that don't actually correspond +to offsets in struct pt_regs. */ +if (addr ==PT_TEXT_ADDR ) { + val = child->mm->start_code; + }else if (addr ==PT_DATA_ADDR ) { + val = child->mm->start_data; + }else if (addr ==PT_TEXT_LEN ) { + val = child->mm->end_code + - child->mm->start_code; + }else { + rval = -EIO ; + } + }else if (addr >=0 && addr <PT_SIZE && (addr &0x3 ) ==0 ) { +microblaze_reg_t *reg_addr =reg_save_addr (addr, child); +if (request ==PTRACE_PEEKUSR ) { + val = *reg_addr; + }else { + *reg_addr = data; + } + }else + rval = -EIO ; + +if (rval ==0 && request ==PTRACE_PEEKUSR ) + rval =put_user (val, (unsigned long *)data); + goto out; + +/* Continue and stop at next (return from) syscall */ +case PTRACE_SYSCALL : +DBPRINTK ("PTRACE_SYSCALL\n" ); +case PTRACE_SINGLESTEP : +DBPRINTK ("PTRACE_SINGLESTEP\n" ); +/* Restart after a signal. */ +case PTRACE_CONT : +DBPRINTK ("PTRACE_CONT\n" ); + rval = -EIO ; +if (!valid_signal (data)) +break ; + +if (request ==PTRACE_SYSCALL ) +set_tsk_thread_flag (child,TIF_SYSCALL_TRACE ); +else +clear_tsk_thread_flag (child,TIF_SYSCALL_TRACE ); + + child->exit_code = data; +DBPRINTK ("wakeup_process\n" ); +wake_up_process (child); + rval =0 ; +break ; + +/* +* make the child exit. Best I can do is send it a sigkill. +* perhaps it should be put in the status that it wants to +* exit. +*/ +case PTRACE_KILL : +DBPRINTK ("PTRACE_KILL\n" ); + rval =0 ; +if (child->exit_state ==EXIT_ZOMBIE )/* already dead */ +break ; + child->exit_code =SIGKILL ; +wake_up_process (child); +break ; + +case PTRACE_DETACH :/* detach a process that was attached. */ +DBPRINTK ("PTRACE_DETACH\n" ); + rval =ptrace_detach (child, data); +break ; + +default : + rval = -EIO ; + goto out; + } + out: +return rval; +} + +#if 0 +static asmlinkage void syscall_trace(void) +{ +if (!test_thread_flag (TIF_SYSCALL_TRACE )) +return ; +if (!(current->ptrace &PT_PTRACED )) +return ; +/* The 0x80 provides a way for the tracing parent to distinguish +between a syscall stop and SIGTRAP delivery */ +ptrace_notify (SIGTRAP | ((current->ptrace &PT_TRACESYSGOOD ) + ?0x80 :0 )); +/* +* this isn't the same as continuing with a signal, but it will do +* for normal use. strace only continues with a signal if the +* stopping signal is not SIGTRAP. -brl +*/ +if (current->exit_code) { +send_sig (current->exit_code, current,1 ); + current->exit_code =0 ; + } +} +#endif + +void ptrace_disable (struct task_struct *child) +{ +/* nothing to do */ +}
include/asm-microblaze/ptrace.h new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 26/52 IPC support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/sys_microblaze.c | 331 +++++++++++++++++++++++++++++++ include/asm-microblaze/ipc.h | 18 ++ include/asm-microblaze/ipcbuf.h | 38 ++++ 3 files changed, 387 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/sys_microblaze.c create mode 100644 include/asm-microblaze/ipc.h create mode 100644 include/asm-microblaze/ipcbuf.h
arch/microblaze/kernel/sys_microblaze.c new file +331 -0
@@ -0,0 +1,331 @@ +/* +* arch/microblaze/kernel/sys_microblaze.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +* Copyright (C) 2007 PetaLogix +* +* Authors: +* John Williams <[email protected]> +* Yasushi SHOJI <[email protected]> +* Tetsuya OHKAWA <[email protected]> +*/ + +#include <linux/errno.h> +#include <linux/mm.h> +#include <linux/smp.h> +#include <linux/smp_lock.h> +#include <linux/syscalls.h> +#include <linux/sem.h> +#include <linux/msg.h> +#include <linux/shm.h> +#include <linux/stat.h> +#include <linux/mman.h> +#include <linux/sys.h> +#include <linux/ipc.h> +#include <linux/utsname.h> +#include <linux/file.h> +#include <linux/module.h> +#include <linux/err.h> +#include <linux/fs.h> + +#include <asm/uaccess.h> +#include <linux/ipc.h> +#include <asm/semaphore.h> +#include <asm/unistd.h> + +/* +* sys_ipc() is the de-multiplexer for the SysV IPC calls.. +* +* This is really horribly ugly. +*/ +int +sys_ipc (uint call,int first,int second,int third,void *ptr,long fifth) +{ +int version, ret; + + version = call >>16 ;/* hack for backward compatibility */ + call &=0xffff ; + + ret = -EINVAL ; +switch (call) { +case SEMOP : + ret =sys_semop (first, (struct sembuf *)ptr, second); +break ; +case SEMGET : + ret =sys_semget (first, second, third); +break ; +case SEMCTL : + { +union semun fourth; + +if (!ptr) +break ; +if ((ret =access_ok (VERIFY_READ , ptr, +sizeof (long )) ?0 : -EFAULT ) + || (ret =get_user (fourth.__pad, (void **)ptr))) +break ; + ret =sys_semctl (first, second, third, fourth); +break ; + } +case MSGSND : + ret =sys_msgsnd (first, (struct msgbuf *) ptr, second, third); +break ; +case MSGRCV : +switch (version) { +case 0 : { +struct ipc_kludge tmp; + +if (!ptr) +break ; +if ((ret =access_ok (VERIFY_READ , ptr, +sizeof (tmp)) ?0 : -EFAULT ) + || (ret =copy_from_user (&tmp, + (struct ipc_kludge *) ptr, +sizeof (tmp)))) +break ; + ret =sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, + third); +break ; + } +default : + ret =sys_msgrcv (first, (struct msgbuf *) ptr, + second, fifth, third); +break ; + } +break ; +case MSGGET : + ret =sys_msgget ((key_t ) first, second); +break ; +case MSGCTL : + ret =sys_msgctl (first, second, (struct msqid_ds *) ptr); +break ; +case SHMAT : +switch (version) { +default : { +ulong raddr; + +if ((ret =access_ok (VERIFY_WRITE , (ulong *) third, +sizeof (ulong)) ?0 : -EFAULT )) +break ; + ret =do_shmat (first, (char *) ptr, second, &raddr); +if (ret) +break ; + ret =put_user (raddr, (ulong *) third); +break ; + } +case 1 :/* iBCS2 emulator entry point */ +if (!segment_eq (get_fs (),get_ds ())) +break ; + ret =do_shmat (first, (char *) ptr, second, + (ulong *) third); +break ; + } +break ; +case SHMDT : + ret =sys_shmdt ((char *)ptr); +break ; +case SHMGET : + ret =sys_shmget (first, second, third); +break ; +case SHMCTL : + ret =sys_shmctl (first, second, (struct shmid_ds *) ptr); +break ; + } + +return ret; +} + +long execve (const char *filename,char **argv,char **envp) +{ +struct pt_regs regs; +int ret; + +memset (®s,0 ,sizeof (struct pt_regs )); +local_save_flags (regs.msr); + ret =do_execve ((char *)filename, (char __user *__user *)argv, + (char __user *__user *)envp, ®s); + +if (ret <0 ) + goto out; + +/* +* Save argc to the register structure for userspace. +*/ + regs.r5 = ret;/* FIXME */ + +/* +* We were successful. We won't be returning to our caller, but +* instead to user space by manipulating the kernel stack. +*/ + asmvolatile ("addk r5, r0, %0 \n\t" +"addk r6, r0, %1 \n\t" +/* copy regs to top of stack */ +"brlid r15, memmove \n\t" +"addik r7, r0, %2 \n\t" +"brid ret_to_user \n\t" +/* reposition stack pointer */ +"addk r1, r0, r3 \n\t" + : + :"r" (task_pt_regs (current)), +"r" (®s), +"i" (sizeof (regs)) + :"r1" ,"r3" ,"r5" ,"r6" ,"r7" ,"r15" ,"memory" ); + +out: +return ret; +} +EXPORT_SYMBOL (execve); + +asmlinkage int sys_vfork(struct pt_regs *regs) +{ +return do_fork (CLONE_VFORK |CLONE_VM |SIGCHLD , regs->r1, + regs,0 ,NULL ,NULL ); +} + +asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs) +{ +if (!stack) + stack = regs->r1; +return do_fork (flags, stack, regs,0 ,NULL ,NULL ); +} + +asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv, +char __user *__user *envp,struct pt_regs *regs) +{ +int error; +char *filename; + + filename =getname (filenamei); + error =PTR_ERR (filename); +if (IS_ERR (filename)) + goto out; + error =do_execve (filename, argv, envp, regs); +putname (filename); +out: +return error; +} + +asmlinkage int sys_pipe(unsigned long __user *fildes) +{ +int fd[2 ]; +int error; + + error =do_pipe (fd); +if (!error) { +if (copy_to_user (fildes, fd,2 *sizeof (int ))) + error = -EFAULT ; + } +return error; +} + +static inline unsigned long +do_mmap2 (unsigned long addr,size_t len, +unsigned long prot,unsigned long flags, +unsigned long fd,unsigned long pgoff) +{ +struct file *file =NULL ; +int ret = -EBADF ; + + flags &= ~(MAP_EXECUTABLE |MAP_DENYWRITE ); +if (!(flags &MAP_ANONYMOUS )) +if (!(file =fget (fd))) { +printk (KERN_INFO "no fd in mmap\r\n" ); + goto out; + } + +down_write (¤t->mm->mmap_sem); + ret =do_mmap_pgoff (file, addr, len, prot, flags, pgoff); +up_write (¤t->mm->mmap_sem); +if (file) +fput (file); +out: +return ret; +} + +unsigned long sys_mmap2 (unsigned long addr,size_t len, +unsigned long prot,unsigned long flags, +unsigned long fd,unsigned long pgoff) +{ +return do_mmap2 (addr, len, prot, flags, fd, pgoff); +} + +unsigned long sys_mmap (unsigned long addr,size_t len, +unsigned long prot,unsigned long flags, +unsigned long fd,off_t offset) +{ +int err = -EINVAL ; + +if (offset & ~PAGE_MASK ) { +printk (KERN_INFO "no pagemask in mmap\r\n" ); + goto out; + } + + err =do_mmap2 (addr, len, prot, flags, fd, offset >>PAGE_SHIFT ); +out: +return err; +} + +int sys_uname (struct old_utsname *name) +{ +int err = -EFAULT ; + +down_read (&uts_sem); +if (name && !copy_to_user (name,utsname (),sizeof (*name))) + err =0 ; +up_read (&uts_sem); +return err; +} + +int sys_olduname (struct oldold_utsname *name) +{ +int error; + +if (!name) +return -EFAULT ; +if (!access_ok (VERIFY_WRITE , name,sizeof (struct oldold_utsname ))) +return -EFAULT ; + +down_read (&uts_sem); + error =__copy_to_user (&name->sysname,utsname ()->sysname, + __OLD_UTS_LEN); + error -=__put_user (0 , name->sysname + __OLD_UTS_LEN); + error -=__copy_to_user (&name->nodename,utsname ()->nodename, + __OLD_UTS_LEN); + error -=__put_user (0 , name->nodename + __OLD_UTS_LEN); + error -=__copy_to_user (&name->release,utsname ()->release, + __OLD_UTS_LEN); + error -=__put_user (0 , name->release + __OLD_UTS_LEN); + error -=__copy_to_user (&name->version,utsname ()->version, + __OLD_UTS_LEN); + error -=__put_user (0 , name->version + __OLD_UTS_LEN); + error -=__copy_to_user (&name->machine,utsname ()->machine, + __OLD_UTS_LEN); + error =__put_user (0 , name->machine + __OLD_UTS_LEN); +up_read (&uts_sem); + + error = error ? -EFAULT :0 ; +return error; +} + +/* +* Do a system call from kernel instead of calling sys_execve so we +* end up with proper pt_regs. +*/ +int kernel_execve (const char *filename,char *const argv[],char *const envp[]) +{ + register const char *__a __asm__("r5") = filename; + register const void *__b __asm__("r6") = argv; + register const void *__c __asm__("r7") = envp; + register unsigned long __syscall __asm__("r12") = __NR_execve; + registerunsigned long __ret __asm__("r3" ); + __asm__ __volatile__ ("brki r14, 0x8" + :"=r" (__ret),"=r" (__syscall) + :"1" (__syscall),"r" (__a),"r" (__b),"r" (__c) + :"r4" ,"r8" ,"r9" , +"r10" ,"r11" ,"r14" ,"cc" ,"memory" ); +return __ret; +}
include/asm-microblaze/ipc.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* include/asm-microblaze/ipc.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_IPC_H +#define _ASM_IPC_H + +#include <asm-generic/ipc.h> + +#endif /* _ASM_IPC_H */ + +
include/asm-microblaze/ipcbuf.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* include/asm-microblaze/ipcbuf.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_IPCBUF_H +#define _ASM_IPCBUF_H + +/* +* The user_ipc_perm structure for m68k architecture. +* Note extra padding because this structure is passed back and forth +* between kernel and user space. +* +* Pad space is left for: +* - 32-bit mode_t and seq +* - 2 miscellaneous 32-bit values +*/ + +struct ipc64_perm { +__kernel_key_t key; +__kernel_uid32_t uid; +__kernel_gid32_t gid; +__kernel_uid32_t cuid; +__kernel_gid32_t cgid; +__kernel_mode_t mode; +unsigned short __pad1; +unsigned short seq; +unsigned short __pad2; +unsigned long __unused1; +unsigned long __unused2; +}; + +#endif /* _ASM_IPCBUF_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 27/52 traps support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/traps.c | 88 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/traps.c
arch/microblaze/kernel/traps.c new file +88 -0
@@ -0,0 +1,88 @@ +/* +* arch/microblaze/kernel/traps.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/kernel.h> +#include <linux/kallsyms.h> +#include <linux/module.h> +#include <linux/sched.h> + +#include <asm/exceptions.h> +#include <asm/system.h> + +void trap_init (void ) +{ +initialize_exception_handlers (); +__enable_hw_exceptions (); +} + +void __bad_xchg (volatile void *ptr,int size) +{ +printk (KERN_INFO "xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n" , +__builtin_return_address (0 ), ptr, size); +BUG (); +} +EXPORT_SYMBOL (__bad_xchg); + +static int kstack_depth_to_print =24 ; + +void show_trace (struct task_struct *task,unsigned long *stack) +{ +unsigned long addr; + +if (!stack) + stack = (unsigned long *)&stack; + +printk (KERN_INFO "Call Trace: " ); +#ifdef CONFIG_KALLSYMS +printk (KERN_INFO "\n" ); +#endif +while (!kstack_end (stack)) { + addr = *stack++; +if (__kernel_text_address (addr)) { +printk (KERN_INFO "[<%08lx>] " , addr); +print_symbol ("%s\n" , addr); + } + } +printk (KERN_INFO "\n" ); +} + +void show_stack (struct task_struct *task,unsigned long *sp) +{ +unsigned long *stack; +int i; + +if (sp ==NULL ) { +if (task) + sp = (unsigned long *) ((struct thread_info *) + (task->stack))->cpu_context.sp; +else + sp = (unsigned long *)&sp; + } + + stack = sp; + +printk (KERN_INFO "\nStack:\n " ); + +for (i =0 ; i < kstack_depth_to_print; i++) { +if (kstack_end (sp)) +break ; +if (i && ((i %8 ) ==0 )) +printk ("\n " ); +printk ("%08lx " , *sp++); + } +printk ("\n" ); +show_trace (task, stack); +} + +void dump_stack (void ) +{ +show_stack (NULL ,NULL ); +} +EXPORT_SYMBOL (dump_stack);
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 28/52 support for a.out
From: Michal Simek <[email protected]>
--- include/asm-microblaze/a.out.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/a.out.h
include/asm-microblaze/a.out.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* include/asm-microblaze/a.out.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_A_OUT_H +#define _ASM_A_OUT_H + +#endif /* _ASM_A_OUT_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 29/52 memory inicialization, MMU, TLB
From: Michal Simek <[email protected]>
--- arch/microblaze/mm/init.c | 188 ++++++++++++++++++++++++++++++++++ include/asm-microblaze/mmu.h | 19 ++++ include/asm-microblaze/mmu_context.h | 24 +++++ include/asm-microblaze/tlb.h | 18 ++++ include/asm-microblaze/tlbflush.h | 22 ++++ 5 files changed, 271 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/mm/init.c create mode 100644 include/asm-microblaze/mmu.h create mode 100644 include/asm-microblaze/mmu_context.h create mode 100644 include/asm-microblaze/tlb.h create mode 100644 include/asm-microblaze/tlbflush.h
arch/microblaze/mm/init.c new file +188 -0
@@ -0,0 +1,188 @@ +/* +* arch/microblaze/mm/init.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2007 Michal Simek <[email protected]> +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#include <linux/autoconf.h> +#include <linux/init.h> +#include <linux/mm.h> +#include "../../../mm/internal.h" +#include <linux/swap.h> +#include <linux/bootmem.h> +#include <linux/pfn.h> +#include <asm/sections.h> + +#include <asm/lmb.h> +#include <asm/uaccess.h> +#include <asm/system.h> +#include <asm/pgtable.h> + +#undef DEBUG + +#ifdef DEBUG +#define DBG(fmt...) printk(fmt) +#else +#define DBG(fmt...) +#endif + +char *klimit = _end; +static unsigned int memory_start; +static unsigned int memory_end; +unsigned int PAGE_OFFSET ; + +void __init setup_memory (void ) +{ +int i; +unsigned int start, end; +unsigned long map_size; +unsigned long start_pfn =0 ; +unsigned long end_pfn =0 ; + +/* Find main memory where is the kernel */ +for (i =0 ; i < lmb.memory.cnt; i++) { + start_pfn = lmb.memory.region[i].base >>PAGE_SHIFT ; + end_pfn = start_pfn +lmb_size_pages (&lmb.memory, i); +if ((start_pfn <= (((int )_text) >>PAGE_SHIFT )) && + (((int )_text >>PAGE_SHIFT ) <= end_pfn)) { + memory_end = (end_pfn <<PAGE_SHIFT ) -1 ; +PAGE_OFFSET = memory_start = start_pfn <<PAGE_SHIFT ; +DBG ("%s: Main mem: 0x%x-0x%x\n" , __FUNCTION__, + memory_start, memory_end); +break ; + } + } +/* +* start_pfn - start page - starting point +* end_pfn - first unused page +* memory_start - base physical address of main memory +* memory_end - end physical address of main memory +* PAGE_OFFSET - moving of first page +* +* Kernel: +* start: base phys address of kernel - page align +* end: base phys address of kernel - page align +* +* min_low_pfn - the first page (mm/bootmem.c - node_boot_start) +* max_low_pfn +* max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn) +* num_physpages - number of all pages +* +*/ + +/* reservation of region where is the kernel */ + start =PFN_DOWN ((int )_text) <<PAGE_SHIFT ; + end =PAGE_ALIGN ((unsigned long )klimit); +lmb_reserve (start, end - start); +DBG ("%s: kernel addr 0x%08x-0x%08x\n" , __FUNCTION__, start, end); + +/* calculate free pages, etc. */ + min_low_pfn =PFN_UP (start_pfn <<PAGE_SHIFT ); + max_mapnr =PFN_DOWN ((end_pfn <<PAGE_SHIFT )); + max_low_pfn = max_mapnr - min_low_pfn; + num_physpages = max_mapnr - min_low_pfn +1 ; +printk (KERN_INFO "%s: max_mapnr: %#lx\n" , __FUNCTION__, max_mapnr); +printk (KERN_INFO "%s: min_low_pfn: %#lx\n" , __FUNCTION__, min_low_pfn); +printk (KERN_INFO "%s: max_low_pfn: %#lx\n" , __FUNCTION__, max_low_pfn); + +/* add place for data pages */ + map_size =init_bootmem_node (NODE_DATA (0 ),PFN_UP (end), + min_low_pfn, max_mapnr); +lmb_reserve (PFN_UP (end) <<PAGE_SHIFT , map_size); + +/* free bootmem is whole main memory */ +free_bootmem (start_pfn <<PAGE_SHIFT , + ((end_pfn - start_pfn) <<PAGE_SHIFT ) -1 ); + +/* reserve allocate blocks */ +for (i =1 ; i < lmb.reserved.cnt; i++) { +DBG ("reserved %d - 0x%08x-0x%08x\n" , i, + (u32 ) lmb.reserved.region[i].base, + (u32 )lmb_size_bytes (&lmb.reserved, i)); +reserve_bootmem (lmb.reserved.region[i].base, +lmb_size_bytes (&lmb.reserved, i) -1 ); + } +} + +void paging_init (void ) +{ +int i; +unsigned long zones_size[MAX_NR_ZONES ]; + +/* we can DMA to/from any address. put all page into +* ZONE_DMA. */ + zones_size[ZONE_NORMAL ] = max_low_pfn; + +/* every other zones are empty */ +for (i =1 ; i <MAX_NR_ZONES ; i++) + zones_size[i] =0 ; + +free_area_init_node (0 ,NODE_DATA (0 ), zones_size, +NODE_DATA (0 )->bdata->node_boot_start >>PAGE_SHIFT ,NULL ); +} + +void free_init_pages (char *what,unsigned long begin,unsigned long end) +{ +unsigned long addr; + +for (addr = begin; addr < end; addr +=PAGE_SIZE ) { +ClearPageReserved (virt_to_page (addr)); +init_page_count (virt_to_page (addr)); +memset ((void *)addr,0xcc ,PAGE_SIZE ); +free_page (addr); + totalram_pages++; + } +printk (KERN_INFO "Freeing %s: %ldk freed\n" , what, (end - begin) >>10 ); +} + +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem (unsigned long start,unsigned long end) +{ +int pages =0 ; +for (; start < end; start +=PAGE_SIZE ) { +ClearPageReserved (virt_to_page (start)); +set_page_count (virt_to_page (start),1 ); +free_page (start); + totalram_pages++; + pages++; + } +printk (KERN_NOTICE "Freeing initrd memory: %dk freed\n" , pages); +} +#endif + +void free_initmem (void ) +{ +free_init_pages ("unused kernel memory" , + (unsigned long )(&__init_begin), + (unsigned long )(&__init_end)); +} + +/* FIXME from arch/powerpc/mm/mem.c*/ +void show_mem (void ) +{ +printk (KERN_NOTICE "%s\n" , __FUNCTION__); +} + +void __init mem_init (void ) +{ + high_memory = (void *)(memory_end); + +/* this will put all memory onto the freelists */ + totalram_pages +=free_all_bootmem (); + +printk (KERN_INFO "Memory: %luk/%luk available\n" , + (unsigned long )nr_free_pages () << (PAGE_SHIFT -10 ), + num_physpages << (PAGE_SHIFT -10 )); +} + +/* Check against bounds of physical memory */ +int ___range_ok (unsigned long addr,unsigned long size) +{ +return ((addr < memory_start) || + ((addr + size) >= memory_end)); +}
include/asm-microblaze/mmu.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* include/asm-microblaze/mmu.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_MMU_H +#define _ASM_MMU_H + +typedef struct { +struct vm_list_struct *vmlist; +unsigned long end_brk; +}mm_context_t ; + +#endif /* _ASM_MMU_H */
include/asm-microblaze/mmu_context.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* include/asm-microblaze/mmu_context.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_MMU_CONTEXT_H +#define _ASM_MMU_CONTEXT_H + +#define init_new_context (tsk, mm) ({ 0; }) + +#define enter_lazy_tlb (mm, tsk) do {} while (0) +#define change_mm_context (old, ctx, _pml4) do {} while (0) +#define destroy_context (mm) do {} while (0) +#define deactivate_mm (tsk, mm) do {} while (0) +#define switch_mm (prev, next, tsk) do {} while (0) +#define activate_mm (prev, next) do {} while (0) + + +#endif /* _ASM_MMU_CONTEXT_H */
include/asm-microblaze/tlb.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* include/asm-microblaze/tlb.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_TLB_H +#define _ASM_TLB_H + +#define tlb_flush (tlb) do {} while (0) + +#include <asm-generic/tlb.h> + +#endif /* _ASM_TLB_H */
include/asm-microblaze/tlbflush.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* include/asm-microblaze/tlbflush.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_TLBFLUSH_H +#define _ASM_TLBFLUSH_H + +#define flush_tlb () BUG() +#define flush_tlb_all () BUG() +#define flush_tlb_mm (mm) BUG() +#define flush_tlb_page (vma, addr) BUG() +#define flush_tlb_range (mm, start, end) BUG() +#define flush_tlb_pgtables (mm, start, end) BUG() +#define flush_tlb_kernel_range (start, end) BUG() + +#endif /* _ASM_TLBFLUSH_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 30/52 consistent allocation & page.h, ...
From: Michal Simek <[email protected]>
--- arch/microblaze/mm/consistent.c | 176 ++++++++++++++++++++++++++++++++++++ include/asm-microblaze/page.h | 117 ++++++++++++++++++++++++ include/asm-microblaze/segment.h | 42 +++++++++ include/asm-microblaze/unaligned.h | 16 ++++ 4 files changed, 351 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/mm/consistent.c create mode 100644 include/asm-microblaze/page.h create mode 100644 include/asm-microblaze/segment.h create mode 100644 include/asm-microblaze/unaligned.h
arch/microblaze/mm/consistent.c new file +176 -0
@@ -0,0 +1,176 @@ +/* +* Microblaze support for cache consistent memory. +* Copyright (C) 2005 John Williams <[email protected]> +* +* based on +* +* PowerPC version derived from arch/arm/mm/consistent.c +* Copyright (C) 2001 Dan Malek ([email protected]) +* +* linux/arch/arm/mm/consistent.c +* +* Copyright (C) 2000 Russell King +* +* Consistent memory allocators. Used for DMA devices that want to +* share uncached memory with the processor core. +* My crufty no-MMU approach is simple. In the HW platform we can optionally +* mirror the DDR up above the processor cacheable region. So, memory accessed +* in this mirror region will not be cached. It's alloced from the same +* pool as normal memory, but the handle we return is shifted up into the +* uncached region. This will no doubt cause big problems if memory allocated +* here is not also freed properly. --JW +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/autoconf.h> +#include <linux/module.h> +#include <linux/signal.h> +#include <linux/sched.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/string.h> +#include <linux/types.h> +#include <linux/ptrace.h> +#include <linux/mman.h> +#include <linux/mm.h> +#include <linux/swap.h> +#include <linux/stddef.h> +#include <linux/vmalloc.h> +#include <linux/init.h> +#include <linux/delay.h> +#include <linux/bootmem.h> +#include <linux/highmem.h> +#include <linux/pci.h> +#include <linux/interrupt.h> + +#include <asm/pgalloc.h> +#include <asm/io.h> +#include <asm/hardirq.h> +#include <asm/mmu_context.h> +#include <asm/mmu.h> +#include <asm/uaccess.h> +#include <asm/pgtable.h> +#include <asm/dma-mapping.h> + +#include "../../../mm/internal.h" /* set_page_count */ + +void *consistent_alloc (gfp_t gfp,size_t size,dma_addr_t *dma_handle) +{ +struct page *page, *end, *free; +unsigned long order; +void *ret, *virt; + +if (in_interrupt ()) +BUG (); + + size =PAGE_ALIGN (size); + order =get_order (size); + + page =alloc_pages (gfp, order); +if (!page) + goto no_page; + +/* +* We could do with a page_to_phys and page_to_bus here. +*/ + virt =page_address (page); +/* *dma_handle = virt_to_bus(virt); */ + ret =ioremap (virt_to_phys (virt), size); +if (!ret) + goto no_remap; + +/* Here's the magic! Note if the uncached shadow is not implemented, +it's up to the calling code to also test that condition and make +other arranegments, such as manually flushing the cache and so on. +*/ +#ifdef CONFIG_XILINX_UNCACHED_SHADOW + ret = (void *)((unsigned ) ret |UNCACHED_SHADOW_MASK ); +#endif +/* For !MMU, dma_handle is same as physical (shadowed) address */ + *dma_handle = (dma_addr_t )ret; + +/* +* free wasted pages. We skip the first page since we know +* that it will have count = 1 and won't require freeing. +* We also mark the pages in use as reserved so that +* remap_page_range works. +*/ + page =virt_to_page (virt); + free = page + (size >>PAGE_SHIFT ); + end = page + (1 << order); + +for (; page < end; page++) { +set_page_count (page,1 ); +if (page >= free) +__free_page (page); +else +SetPageReserved (page); + } + +return ret; +no_remap: +__free_pages (page, order); +no_page: +return NULL ; +} + +/* +* free page(s) as defined by the above mapping. +*/ +void consistent_free (void *vaddr) +{ +if (in_interrupt ()) +BUG (); + +/* Clear SHADOW_MASK bit in address, and free as per usual */ +#ifdef CONFIG_XILINX_UNCACHED_SHADOW + vaddr = (void *)((unsigned )vaddr & ~UNCACHED_SHADOW_MASK ); +#endif +vfree (vaddr); +} + +/* +* make an area consistent. +*/ +void consistent_sync (void *vaddr,size_t size,int direction) +{ +unsigned long start; +unsigned long end; + + start = (unsigned long )vaddr; + +/* Convert start address back down to unshadowed memory region */ +#ifdef CONFIG_XILINX_UNCACHED_SHADOW + start &=UNCACHED_SHADOW_MASK ; +#endif + end = start+size; + +switch (direction) { +case PCI_DMA_NONE : +BUG (); +case PCI_DMA_FROMDEVICE :/* invalidate only */ +flush_dcache_range (start, end); +break ; +case PCI_DMA_TODEVICE :/* writeback only */ +flush_dcache_range (start, end); +break ; +case PCI_DMA_BIDIRECTIONAL :/* writeback and invalidate */ +flush_dcache_range (start, end); +break ; + } +} + +/* +* consistent_sync_page makes memory consistent. identical +* to consistent_sync, but takes a struct page instead of a +* virtual address +*/ +void consistent_sync_page (struct page *page,unsigned long offset, +size_t size,int direction) +{ +unsigned long start = (unsigned long )page_address (page) + offset; +consistent_sync ((void *)start, size, direction); +}
include/asm-microblaze/page.h new file +117 -0
117 lines not on this page · raw message
include/asm-microblaze/segment.h new file +42 -0
42 lines not on this page · raw message
include/asm-microblaze/unaligned.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/unaligned.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_UNALIGNED_H +#define _ASM_UNALIGNED_H + +#include <asm-generic/unaligned.h> + +#endif /* _ASM_UNALIGNED_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 31/52 pci header files
From: Michal Simek <[email protected]>
--- include/asm-microblaze/pci-bridge.h | 146 +++++++++++++++++++++++++++++++++++ include/asm-microblaze/pci.h | 139 +++++++++++++++++++++++++++++++++ 2 files changed, 285 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/pci-bridge.h create mode 100644 include/asm-microblaze/pci.h
include/asm-microblaze/pci-bridge.h new file +146 -0
@@ -0,0 +1,146 @@ +/* +* include/asm-microblaze/pci-bridge.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_PCI_BRIDGE_H +#define _ASM_PCI_BRIDGE_H +#ifdef __KERNEL__ + +#include <linux/ioport.h> +#include <linux/pci.h> + +struct device_node ; +struct pci_controller ; + +/* +* pci_io_base returns the memory address at which you can access +* the I/O space for PCI bus number `bus' (or NULL on error). +*/ +extern void __iomem *pci_bus_io_base (unsigned int bus); +extern unsigned long pci_bus_io_base_phys (unsigned int bus); +extern unsigned long pci_bus_mem_base_phys (unsigned int bus); + +/* Allocate a new PCI host bridge structure */ +extern struct pci_controller *pcibios_alloc_controller (void ); + +/* Helper function for setting up resources */ +extern void pci_init_resource (struct resource *res,unsigned long start, +unsigned long end,int flags,char *name); + +/* Get the PCI host controller for a bus */ +extern struct pci_controller *pci_bus_to_hose (int bus); + +/* Get the PCI host controller for an OF device */ +extern struct pci_controller +*pci_find_hose_for_OF_device (struct device_node *node); + +/* Fill up host controller resources from the OF node */ +extern void +pci_process_bridge_OF_ranges (struct pci_controller *hose, +struct device_node *dev,int primary); + +/* +* Structure of a PCI controller (host bridge) +*/ +struct pci_controller { +int index;/* PCI domain number */ +struct pci_controller *next; +struct pci_bus *bus; +void *arch_data; + +int first_busno; +int last_busno; +int bus_offset; + +void __iomem *io_base_virt; +unsigned long io_base_phys; + +/* Some machines (PReP) have a non 1:1 mapping of +* the PCI memory space in the CPU bus space +*/ +unsigned long pci_mem_offset; + +struct pci_ops *ops; +volatile unsigned int __iomem *cfg_addr; +volatile void __iomem *cfg_data; +/* +* If set, indirect method will set the cfg_type bit as +* needed to generate type 1 configuration transactions. +*/ +int set_cfg_type; + +/* Currently, we limit ourselves to 1 IO range and 3 mem +* ranges since the common pci_bus structure can't handle more +*/ +struct resource io_resource; +struct resource mem_resources[3 ]; +int mem_resource_count; + +/* Host bridge I/O and Memory space +* Used for BAR placement algorithms +*/ +struct resource io_space; +struct resource mem_space; +}; + +/* These are used for config access before all the PCI probing +has been done. */ +int early_read_config_byte (struct pci_controller *hose,int bus,int dev_fn, +int where,u8 *val); +int early_read_config_word (struct pci_controller *hose,int bus,int dev_fn, +int where,u16 *val); +int early_read_config_dword (struct pci_controller *hose,int bus,int dev_fn, +int where,u32 *val); +int early_write_config_byte (struct pci_controller *hose,int bus,int dev_fn, +int where,u8 val); +int early_write_config_word (struct pci_controller *hose,int bus,int dev_fn, +int where,u16 val); +int early_write_config_dword (struct pci_controller *hose,int bus,int dev_fn, +int where,u32 val); + +extern void setup_indirect_pci_nomap (struct pci_controller *hose, +void __iomem *cfg_addr,void __iomem *cfg_data); +extern void setup_indirect_pci (struct pci_controller *hose, +u32 cfg_addr,u32 cfg_data); +extern void setup_grackle (struct pci_controller *hose); + +extern unsigned char common_swizzle (struct pci_dev *,unsigned char *); + +/* +* The following code swizzles for exactly one bridge. The routine +* common_swizzle below handles multiple bridges. But there are a +* some boards that don't follow the PCI spec's suggestion so we +* break this piece out separately. +*/ +static inline unsigned char bridge_swizzle (unsigned char pin, +unsigned char idsel) +{ +return (((pin-1 ) + idsel) %4 ) +1 ; +} + +/* +* The following macro is used to lookup irqs in a standard table +* format for those PPC systems that do not already have PCI +* interrupts properly routed. +*/ +/* FIXME - double check this */ +#define PCI_IRQ_TABLE_LOOKUP \ +({ long _ctl_ = -1; \ + if (idsel >= min_idsel && idsel <= max_idsel && pin <= irqs_per_slot) \ + _ctl_ = pci_irq_table[idsel - min_idsel][pin-1]; \ + _ctl_; }) + +/* +* Scan the buses below a given PCI host bridge and assign suitable +* resources to all devices found. +*/ +extern int pciauto_bus_scan (struct pci_controller *,int ); + +#endif /* __KERNEL__ */ +#endif /* _ASM_PCI_BRIDGE_H */
include/asm-microblaze/pci.h new file +139 -0
139 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 32/52 includes SHM*, msgbuf
From: Michal Simek <[email protected]>
--- include/asm-microblaze/msgbuf.h | 41 +++++++++++++++++++++++++++++ include/asm-microblaze/shmbuf.h | 52 +++++++++++++++++++++++++++++++++++++ include/asm-microblaze/shmparam.h | 16 +++++++++++ 3 files changed, 109 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/msgbuf.h create mode 100644 include/asm-microblaze/shmbuf.h create mode 100644 include/asm-microblaze/shmparam.h
include/asm-microblaze/msgbuf.h new file +41 -0
@@ -0,0 +1,41 @@ +/* +* include/asm-microblaze/msgbuf.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_MSGBUF_H +#define _ASM_MSGBUF_H + +/* +* The msqid64_ds structure for m68k architecture. +* Note extra padding because this structure is passed back and forth +* between kernel and user space. +* +* Pad space is left for: +* - 64-bit time_t to solve y2038 problem +* - 2 miscellaneous 32-bit values +*/ + +struct msqid64_ds { +struct ipc64_perm msg_perm; +__kernel_time_t msg_stime;/* last msgsnd time */ +unsigned long __unused1; +__kernel_time_t msg_rtime;/* last msgrcv time */ +unsigned long __unused2; +__kernel_time_t msg_ctime;/* last change time */ +unsigned long __unused3; +unsigned long msg_cbytes;/* current number of bytes on queue */ +unsigned long msg_qnum;/* number of messages in queue */ +unsigned long msg_qbytes;/* max number of bytes on queue */ +__kernel_pid_t msg_lspid;/* pid of last msgsnd */ +__kernel_pid_t msg_lrpid;/* last receive pid */ +unsigned long __unused4; +unsigned long __unused5; +}; + +#endif /* _ASM_MSGBUF_H */
include/asm-microblaze/shmbuf.h new file +52 -0
52 lines not on this page · raw message
include/asm-microblaze/shmparam.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/shmparam.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SHMPARAM_H +#define _ASM_SHMPARAM_H + +#define SHMLBA PAGE_SIZE/* attach addr a multiple of this */ + +#endif /* _ASM_SHMPARAM_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 33/52 bug headers files
From: Michal Simek <[email protected]>
--- include/asm-microblaze/bug.h | 17 +++++++++++++++++ include/asm-microblaze/bugs.h | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/bug.h create mode 100644 include/asm-microblaze/bugs.h
include/asm-microblaze/bug.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* include/asm-microblaze/bug.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_BUG_H +#define _ASM_BUG_H + +#include <linux/kernel.h> +#include <asm-generic/bug.h> + +#endif /* _ASM_BUG_H */
include/asm-microblaze/bugs.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* include/asm-microblaze/bugs.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_BUGS_H +#define _ASM_BUGS_H + +static inline void check_bugs (void ) +{ +/* nothing to do */ +} + +#endif /* _ASM_BUGS_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 34/52 definitions of types
From: Michal Simek <[email protected]>
--- include/asm-microblaze/posix_types.h | 75 ++++++++++++++++++++++++++++++++++ include/asm-microblaze/types.h | 64 +++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/posix_types.h create mode 100644 include/asm-microblaze/types.h
include/asm-microblaze/posix_types.h new file +75 -0
@@ -0,0 +1,75 @@ +/* +* include/asm-microblaze/posix_types.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_POSIX_TYPES_H +#define _ASM_POSIX_TYPES_H + +/* +* This file is generally used by user-level software, so you need to +* be a little careful about namespace pollution etc. Also, we cannot +* assume GCC is being used. +*/ + +typedef unsigned long __kernel_ino_t ; +typedef unsigned short __kernel_mode_t ; +typedef unsigned short __kernel_nlink_t ; +typedef long __kernel_off_t ; +typedef int __kernel_pid_t ; +typedef unsigned short __kernel_ipc_pid_t ; +typedef unsigned short __kernel_uid_t ; +typedef unsigned short __kernel_gid_t ; +typedef unsigned int __kernel_size_t ; +typedef int __kernel_ssize_t ; +typedef int __kernel_ptrdiff_t ; +typedef long __kernel_time_t ; +typedef long __kernel_suseconds_t ; +typedef long __kernel_clock_t ; +typedef int __kernel_timer_t ; +typedef int __kernel_clockid_t ; +typedef int __kernel_daddr_t ; +typedef char *__kernel_caddr_t ; +typedef unsigned short __kernel_uid16_t ; +typedef unsigned short __kernel_gid16_t ; +typedef unsigned int __kernel_uid32_t ; +typedef unsigned int __kernel_gid32_t ; + +typedef unsigned short __kernel_old_uid_t ; +typedef unsigned short __kernel_old_gid_t ; +typedef unsigned short __kernel_old_dev_t ; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t ; +#endif + +typedef struct { +#if defined(__KERNEL__) || defined(__USE_ALL) +int val[2 ]; +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ +int __val[2 ]; +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ +}__kernel_fsid_t ; + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ <2 ) + +#undef __FD_SET +#define __FD_SET (d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) + +#undef __FD_CLR +#define __FD_CLR (d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) + +#undef __FD_ISSET +#define __FD_ISSET (d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d))) + +#undef __FD_ZERO +#define __FD_ZERO (fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) + +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ + +#endif /* _ASM_POSIX_TYPES_H */
include/asm-microblaze/types.h new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 35/52 ioctl support
From: Michal Simek <[email protected]>
--- include/asm-microblaze/ioctl.h | 84 +++++++++++++++++++++++++++++++++++ include/asm-microblaze/ioctls.h | 93 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/ioctl.h create mode 100644 include/asm-microblaze/ioctls.h
include/asm-microblaze/ioctl.h new file +84 -0
@@ -0,0 +1,84 @@ +/* +* include/asm-microblaze/ioctl.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _MICROBLAZE_IOCTL_H +#define _MICROBLAZE_IOCTL_H + +/* +* this was copied from the alpha as it's a bit cleaner there. +* -- Cort +*/ + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 13 +#define _IOC_DIRBITS 3 + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* +* Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. +* And this turns out useful to catch old ioctl numbers in header +* files for us. +*/ +#define _IOC_NONE 1U +#define _IOC_READ 2U +#define _IOC_WRITE 4U + +#define _IOC (dir, type, nr, size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +/* provoke compile error for invalid uses of size argument */ +extern unsigned int __invalid_size_argument_for_IOC; +#define _IOC_TYPECHECK (t) \ + ((sizeof(t) == sizeof(t[1]) && \ + sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ + sizeof(t) : __invalid_size_argument_for_IOC) + +/* used to create numbers */ +#define _IO (type, nr) _IOC(_IOC_NONE, (type), (nr), 0) +#define _IOR (type, nr, size) \ + _IOC(_IOC_READ, (type), (nr), (_IOC_TYPECHECK(size))) +#define _IOW (type, nr, size) \ + _IOC(_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size))) +#define _IOWR (type, nr, size) \ + _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size))) +#define _IOR_BAD (type, nr, size) \ + _IOC(_IOC_READ, (type), (nr), sizeof(size)) +#define _IOW_BAD (type, nr, size) \ + _IOC(_IOC_WRITE, (type), (nr), sizeof(size)) +#define _IOWR_BAD (type, nr, size) \ + _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), sizeof(size)) + +/* used to decode them.. */ +#define _IOC_DIR (nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) +#define _IOC_TYPE (nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) +#define _IOC_NR (nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) +#define _IOC_SIZE (nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) + +/* various drivers, such as the pcmcia stuff, need these... */ +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) + +#endif /* _MICROBLAZE_IOCTL_H */
include/asm-microblaze/ioctls.h new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 36/52 io.h IO operations
From: Michal Simek <[email protected]>
--- include/asm-microblaze/io.h | 210 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 210 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/io.h
include/asm-microblaze/io.h new file +210 -0
@@ -0,0 +1,210 @@ +/* +* include/asm-microblaze/io.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_IO_H +#define _ASM_IO_H + +#include <asm/byteorder.h> +#include <asm/page.h> + +static inline unsigned char __raw_readb (const volatile void *addr) +{ +return *(volatile unsigned char __force *)addr; +} +static inline unsigned short __raw_readw (const volatile void *addr) +{ +return *(volatile unsigned short __force *)addr; +} +static inline unsigned int __raw_readl (const volatile void *addr) +{ +return *(volatile unsigned int __force *)addr; +} +static inline unsigned long __raw_readq (const volatile void *addr) +{ +return *(volatile unsigned long __force *)addr; +} +static inline void __raw_writeb (unsigned char v,volatile void *addr) +{ + *(volatile unsigned char __force *)addr = v; +} +static inline void __raw_writew (unsigned short v,volatile void *addr) +{ + *(volatile unsigned short __force *)addr = v; +} +static inline void __raw_writel (unsigned int v,volatile void *addr) +{ + *(volatile unsigned int __force *)addr = v; +} +static inline void __raw_writeq (unsigned long v,volatile void *addr) +{ + *(volatile unsigned long __force *)addr = v; +} + +/* +* read (readb, readw, readl, readq) and write (writeb, writew, +* writel, writeq) accessors are for PCI and thus littel endian. +* Linux 2.4 for Microblaze had this wrong. +*/ +static inline unsigned char readb (const volatile void *addr) +{ +return *(volatile unsigned char __force *)addr; +} +static inline unsigned short readw (const volatile void *addr) +{ +return le16_to_cpu (*(volatile unsigned short __force *)addr); +} +static inline unsigned int readl (const volatile void *addr) +{ +return le32_to_cpu (*(volatile unsigned int __force *)addr); +} +static inline void writeb (unsigned char v,volatile void *addr) +{ + *(volatile unsigned char __force *)addr = v; +} +static inline void writew (unsigned short v,volatile void *addr) +{ + *(volatile unsigned short __force *)addr =cpu_to_le16 (v); +} +static inline void writel (unsigned int v,volatile void __iomem *addr) +{ + *(volatile unsigned int __force *)addr =cpu_to_le32 (v); +} + +/* ioread and iowrite variants. thease are for now same as __raw_ +* variants of accessors. we might check for endianess in the feature +*/ +#define ioread8 (addr) __raw_readb((u8 *)(addr)) +#define ioread16 (addr) __raw_readw((u16 *)(addr)) +#define ioread32 (addr) __raw_readl((u32 *)(addr)) +#define iowrite8 (v, addr) __raw_writeb((u8)(v), (u8 *)(addr)) +#define iowrite16 (v, addr) __raw_writew((u16)(v), (u16 *)(addr)) +#define iowrite32 (v, addr) __raw_writel((u32)(v), (u32 *)(addr)) + +/* These are the definitions for the x86 IO instructions +* inb/inw/inl/outb/outw/outl, the "string" versions +* insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions +* inb_p/inw_p/... +* The macros don't do byte-swapping. +*/ +#define inb (port) readb((u8 *)((port))) +#define outb (val, port) writeb((val), (u8 *)((unsigned long)(port))) +#define inw (port) readw((u16 *)((port))) +#define outw (val, port) writew((val), (u16 *)((unsigned long)(port))) +#define inl (port) readl((u32 *)((port))) +#define outl (val, port) writel((val), (u32 *)((unsigned long)(port))) + +#define inb_p (port) inb((port)) +#define outb_p (val, port) outb((val), (port)) +#define inw_p (port) inw((port)) +#define outw_p (val, port) outw((val), (port)) +#define inl_p (port) inl((port)) +#define outl_p (val, port) outl((val), (port)) + +#define memset_io (a, b, c) memset((void *)(a), (b), (c)) +#define memcpy_fromio (a, b, c) memcpy((a), (void *)(b), (c)) +#define memcpy_toio (a, b, c) memcpy((void *)(a), (b), (c)) + +/** +* virt_to_phys - map virtual addresses to physical +* @address: address to remap +* +* The returned physical address is the physical (CPU) mapping for +* the memory address given. It is only valid to use this function on +* addresses directly mapped or allocated via kmalloc. +* +* This function does not give bus mappings for DMA transfers. In +* almost all conceivable cases a device driver should not be using +* this function +*/ +static inline unsigned long __iomem virt_to_phys (volatile void *address) +{ +return __pa ((unsigned long )address); +} + +#define virt_to_bus virt_to_phys + +/** +* phys_to_virt - map physical address to virtual +* @address: address to remap +* +* The returned virtual address is a current CPU mapping for +* the memory address given. It is only valid to use this function on +* addresses that have a kernel mapping +* +* This function does not handle bus mappings for DMA transfers. In +* almost all conceivable cases a device driver should not be using +* this function +*/ +static inline void *phys_to_virt (unsigned long address) +{ +return (void *)__va (address); +} + +#define bus_to_virt (a) phys_to_virt(a) + +static inline void *__ioremap (unsigned long address,unsigned long size, +unsigned long flags) +{ +return (void *)address; +} + + +#define IO_SPACE_LIMIT ~(0UL) + +#define ioremap (physaddr, size) ((void *)(unsigned long)(physaddr)) +#define iounmap (addr) ((void)0) +#define ioremap_nocache (physaddr, size) ioremap(physaddr, size) + +/* +* Convert a physical pointer to a virtual kernel pointer for /dev/mem +* access +*/ +#define xlate_dev_mem_ptr (p) __va(p) + +/* +* Convert a virtual cached pointer to an uncached pointer +*/ +#define xlate_dev_kmem_ptr (p) p + +/* +* Big Endian +*/ +#define out_be32 (a, v) __raw_writel((v), (a)) +#define out_be16 (a, v) __raw_writew((v), (a)) + +#define in_be32 (a) __raw_readl(a) +#define in_be16 (a) __raw_readw(a) + +/* +* Little endian +*/ + +#define out_le32 (a, v) __raw_writel(__cpu_to_le32(v), (a)); +#define out_le16 (a, v) __raw_writew(__cpu_to_le16(v), (a)) + +#define in_le32 (a) __le32_to_cpu(__raw_readl(a)) +#define in_le16 (a) __le16_to_cpu(__raw_readw(a)) + +/* Byte ops */ +#define out_8 (a, v) __raw_writeb((v), (a)) +#define in_8 (a) __raw_readb(a) + +/* FIXME */ +static inline void __iomem *ioport_map (unsigned long port,unsigned int len) +{ +return (void __iomem *) (port); +} + +static inline void ioport_unmap (void __iomem *addr) +{ +/* Nothing to do */ +} + +#endif /* _ASM_IO_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 37/52 headers for executables format FLAT, ELF
From: Michal Simek <[email protected]>
--- include/asm-microblaze/elf.h | 24 +++++++++++ include/asm-microblaze/flat.h | 93 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/elf.h create mode 100644 include/asm-microblaze/flat.h
include/asm-microblaze/elf.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* include/asm-microblaze/elf.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_ELF_H +#define _ASM_ELF_H + +#define EM_XILINX_MICROBLAZE 0xbaab +#define ELF_ARCH EM_XILINX_MICROBLAZE + +#define elf_check_arch (x) ((x)->e_machine == EM_XILINX_MICROBLAZE) + +/* +* These are used to set parameters in the core dumps. +*/ +#define ELF_CLASS ELFCLASS32 + +#endif /* _ASM_ELF_H */
include/asm-microblaze/flat.h new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 38/52 dma support
From: Michal Simek <[email protected]>
--- include/asm-microblaze/dma-mapping.h | 124 ++++++++++++++++++++++++++++++++++ include/asm-microblaze/dma.h | 21 ++++++ include/asm-microblaze/scatterlist.h | 21 ++++++ 3 files changed, 166 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/dma-mapping.h create mode 100644 include/asm-microblaze/dma.h create mode 100644 include/asm-microblaze/scatterlist.h
include/asm-microblaze/dma-mapping.h new file +124 -0
@@ -0,0 +1,124 @@ +/* +* include/asm-microblaze/dma-mapping.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_DMA_MAPPING_H +#define _ASM_DMA_MAPPING_H + +#include <asm/io.h> +#include <asm/bug.h> + +struct scatterlist ; + +#define dma_alloc_noncoherent (d, s, h, f) dma_alloc_coherent(d, s, h, f) +#define dma_free_noncoherent (d, s, v, h) dma_free_coherent(d, s, v, h) + +void *consistent_alloc (gfp_t gfp,size_t size,dma_addr_t *dma_handle); +void consistent_free (void *vaddr); +void consistent_sync (void *vaddr,size_t size,int direction); +void consistent_sync_page (struct page *page,unsigned long offset, +size_t size,int direction); + +/* FIXME */ +static inline int +dma_supported (struct device *dev,u64 mask) +{ +return 0 ; +} + +static inline dma_addr_t +dma_map_page (struct device *dev,struct page *page, +unsigned long offset,size_t size, +enum dma_data_direction direction) +{ +BUG (); +return 0 ; +} + +static inline void +dma_unmap_page (struct device *dev,dma_addr_t dma_address,size_t size, +enum dma_data_direction direction) +{ +BUG (); +} + +static inline int +dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +enum dma_data_direction direction) +{ +BUG (); +return 0 ; +} + +static inline void +dma_unmap_sg (struct device *dev,struct scatterlist *sg,int nhwentries, +enum dma_data_direction direction) +{ +BUG (); +} + +static inline void +dma_sync_single_for_cpu (struct device *dev,dma_addr_t dma_handle,size_t size, +enum dma_data_direction direction) +{ +BUG (); +} + +static inline void +dma_sync_single_for_device (struct device *dev,dma_addr_t dma_handle, +size_t size,enum dma_data_direction direction) +{ +BUG (); +} + +static inline void +dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sg,int nelems, +enum dma_data_direction direction) +{ +BUG (); +} + +static inline void +dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg,int nelems, +enum dma_data_direction direction) +{ +BUG (); +} + +static inline int +dma_mapping_error (dma_addr_t dma_addr) +{ +return 0 ; +} + +static inline void *dma_alloc_coherent (struct device *dev,size_t size, +dma_addr_t *dma_handle,int flag) +{ +return consistent_alloc (flag, size, dma_handle); +} + +static inline void dma_free_coherent (struct device *dev,size_t size, +void *vaddr,dma_addr_t dma_handle) +{ +BUG (); +} + +static inline dma_addr_t +dma_map_single (struct device *dev,void *ptr,size_t size, +enum dma_data_direction direction) +{ +BUG_ON (direction ==DMA_NONE ); + +return virt_to_bus (ptr); +} + +#define dma_unmap_single (dev, addr, size, dir) do { } while (0) + + +#endif /* _ASM_DMA_MAPPING_H */
include/asm-microblaze/dma.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* include/asm-microblaze/dma.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_DMA_H +#define _ASM_DMA_H + +/* we don't have dma address limit. define it as zero to be +* unlimited. */ +#define MAX_DMA_ADDRESS (0) + +#define ISA_DMA_THRESHOLD (0) + + +#endif /* _ASM_DMA_H */
include/asm-microblaze/scatterlist.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* include/asm-microblaze/scatterlist.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SCATTERLIST_H +#define _ASM_SCATTERLIST_H + +struct scatterlist { +unsigned long page_link; +unsigned int offset; +dma_addr_t dma_address; +unsigned int length; +}; + +#endif /* _ASM_SCATTERLIST_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 39/52 headers for irq
From: Michal Simek <[email protected]>
--- include/asm-microblaze/hardirq.h | 31 +++++++++++++++++++++++++++++++ include/asm-microblaze/hw_irq.h | 19 +++++++++++++++++++ include/asm-microblaze/irq_regs.h | 19 +++++++++++++++++++ 3 files changed, 69 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/hardirq.h create mode 100644 include/asm-microblaze/hw_irq.h create mode 100644 include/asm-microblaze/irq_regs.h
include/asm-microblaze/hardirq.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* include/asm-microblaze/hardirq.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_HARDIRQ_H +#define _ASM_HARDIRQ_H + +#include <linux/cache.h> +#include <linux/irq.h> +#include <asm/irq.h> +#include <asm/current.h> +#include <asm/ptrace.h> + +/* should be defined in each interrupt controller driver */ +extern unsigned int get_irq (struct pt_regs *regs); + +typedef struct { +unsigned int __softirq_pending; +}____cacheline_aligned irq_cpustat_t ; + +void ack_bad_irq (unsigned int irq); + +#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ + +#endif /* _ASM_HARDIRQ_H */
include/asm-microblaze/hw_irq.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* include/asm-microblaze/hw_irq.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_HW_IRQ_H +#define _ASM_HW_IRQ_H + +static inline void hw_resend_irq (struct hw_interrupt_type *h,unsigned int i) +{ +/* Nothing to do */ +} + +#endif /* _ASM_HW_IRQ_H */
include/asm-microblaze/irq_regs.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* include/asm-microblaze/irq_regs.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_IRQ_REGS_H +#define _ASM_IRQ_REGS_H + +#include <asm-generic/irq_regs.h> + +#endif /* _ASM_IRQ_REGS_H */ + + +
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 40/52 atomic.h bitops.h byteorder.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/atomic.h | 108 ++++++++++++++++++++++++++++++++++++ include/asm-microblaze/bitops.h | 29 ++++++++++ include/asm-microblaze/byteorder.h | 23 ++++++++ 3 files changed, 160 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/atomic.h create mode 100644 include/asm-microblaze/bitops.h create mode 100644 include/asm-microblaze/byteorder.h
include/asm-microblaze/atomic.h new file +108 -0
@@ -0,0 +1,108 @@ +/* +* include/asm-microblaze/atomic.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_ATOMIC_H +#define _ASM_ATOMIC_H + +#include <linux/compiler.h> /* likely */ +#include <asm/system.h> /* local_irq_XXX and friends */ + +typedef struct {volatile int counter; }atomic_t ; + +#define ATOMIC_INIT (i) { (i) } +#define atomic_read (v) ((v)->counter) +#define atomic_set (v, i) (((v)->counter) = (i)) + +#define atomic_inc (v) (atomic_add_return(1, (v))) +#define atomic_dec (v) (atomic_sub_return(1, (v))) + +#define atomic_add (i, v) (atomic_add_return(i, (v))) +#define atomic_sub (i, v) (atomic_sub_return(i, (v))) + +#define atomic_inc_return (v) (atomic_add_return(1, (v))) +#define atomic_dec_return (v) (atomic_sub_return(1, (v))) + +#define atomic_inc_and_test (v) (atomic_add_return(1, (v)) == 0) +#define atomic_dec_and_test (v) (atomic_sub_return(1, (v)) == 0) + +#define atomic_inc_not_zero (v) (atomic_add_unless((v), 1, 0)) + +#define atomic_sub_and_test (i, v) (atomic_sub_return((i), (v)) == 0) + +static inline int atomic_cmpxchg (atomic_t *v,int old,int new) +{ +int ret; +unsigned long flags; + +local_irq_save (flags); + ret = v->counter; +if (likely (ret == old)) + v->counter = new; +local_irq_restore (flags); + +return ret; +} + +static inline int atomic_add_unless (atomic_t *v,int a,int u) +{ +int c, old; + + c =atomic_read (v); +while (c != u && (old =atomic_cmpxchg ((v), c, c + a)) != c) + c = old; +return c != u; +} + +static inline void atomic_clear_mask (unsigned long mask,unsigned long *addr) +{ +unsigned long flags; + +local_irq_save (flags); + *addr &= ~mask; +local_irq_restore (flags); +} + +/** +* atomic_add_return - add and return +* @i: integer value to add +* @v: pointer of type atomic_t +* +* Atomically adds @i to @v and returns @i + @v +*/ +static __inline__int atomic_add_return (int i,atomic_t *v) +{ +unsigned long flags; +int val; + +local_irq_save (flags); + val = v->counter; + v->counter = val += i; +local_irq_restore (flags); + +return val; +} + +static inline int atomic_sub_return (int i,atomic_t *v) +{ +return atomic_add_return (-i, v); +} + +#define atomic_add_negative (a, v) (atomic_add_return((a), (v)) < 0) +#define atomic_xchg (v, new) (xchg(&((v)->counter), new)) + +/* Atomic operations are already serializing */ +#define smp_mb__before_atomic_dec () barrier() +#define smp_mb__after_atomic_dec () barrier() +#define smp_mb__before_atomic_inc () barrier() +#define smp_mb__after_atomic_inc () barrier() + +#include <asm-generic/atomic.h> + +#endif /* _ASM_ATOMIC_H */
include/asm-microblaze/bitops.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* include/asm-microblaze/auxvec.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _MICROBLAZE_BITOPS_H +#define _MICROBLAZE_BITOPS_H + +/* +* Copyright 1992, Linus Torvalds. +*/ + +#include <linux/autoconf.h> +#include <asm/byteorder.h> /* swab32 */ +#include <asm/system.h> /* save_flags */ + +/* +* clear_bit() doesn't provide any barrier for the compiler. +*/ +#define smp_mb__before_clear_bit () barrier() +#define smp_mb__after_clear_bit () barrier() +#include <asm-generic/bitops.h> + +#endif /* _MICROBLAZE_BITOPS_H */
include/asm-microblaze/byteorder.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* include/asm-microblaze/byteorder.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_BYTEORDER_H +#define _ASM_BYTEORDER_H + +#include <asm/types.h> + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__ +#endif + +#include <linux/byteorder/big_endian.h> + +#endif /* _ASM_BYTEORDER_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 41/52 headers pgalloc.h pgtable.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/pgalloc.h | 16 ++++++++++++ include/asm-microblaze/pgtable.h | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/pgalloc.h create mode 100644 include/asm-microblaze/pgtable.h
include/asm-microblaze/pgalloc.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/pgalloc.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_PGALLOC_H +#define _ASM_PGALLOC_H + +#define check_pgt_cache () do {} while (0) + +#endif /* _ASM_PGALLOC_H */
include/asm-microblaze/pgtable.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 42/52 system.h pvr.h processor.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/processor.h | 89 +++++++++++++++++ include/asm-microblaze/pvr.h | 185 ++++++++++++++++++++++++++++++++++++ include/asm-microblaze/system.h | 185 ++++++++++++++++++++++++++++++++++++ 3 files changed, 459 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/processor.h create mode 100644 include/asm-microblaze/pvr.h create mode 100644 include/asm-microblaze/system.h
include/asm-microblaze/processor.h new file +89 -0
@@ -0,0 +1,89 @@ +/* +* include/asm-microblaze/processor.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_PROCESSOR_H +#define _ASM_PROCESSOR_H + +#include <asm/ptrace.h> +#include <asm/setup.h> + +/* +* User space process size: memory size +* +* TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both +* user processes and the kernel is on the same memory region. They +* both share the memory space and that is limited by the amount of +* physical memory. thus, we set TASK_SIZE == amount of total memory. +*/ + +#define TASK_SIZE (0x81000000 - 0x80000000) + +/* +* Default implementation of macro that returns current +* instruction pointer ("program counter"). +*/ +#define current_text_addr () ({ __label__ _l; _l: &&_l; }) + +/* +* This decides where the kernel will search for a free chunk of vm +* space during mmap's. We won't be using it +*/ +#define TASK_UNMAPPED_BASE 0 + +struct task_struct ; + +/* thread_struct is gone. use thread_info instead. */ +struct thread_struct { }; +#define INIT_THREAD { } + +/* Do necessary setup to start up a newly executed thread. */ +static inline void start_thread (struct pt_regs *regs, +unsigned long pc, +unsigned long usp) +{ + regs->pc = pc; + regs->r1 = usp; + regs->kernel_mode =0 ; +} + +/* Free all resources held by a thread. */ +static inline void release_thread (struct task_struct *dead_task) +{ +} + +/* Free all resources held by a thread. */ +static inline void exit_thread (void ) +{ +} + +extern unsigned long thread_saved_pc (struct task_struct *t); + +extern unsigned long get_wchan (struct task_struct *p); + +/* FIXME */ +#define cpu_relax () do {} while (0) +#define prepare_to_copy (tsk) do {} while (0) + +/* +* create a kernel thread without removing it from tasklists +*/ +extern int kernel_thread (int (*fn)(void *),void *arg,unsigned long flags); + +/* #define task_thread_info(task) (task)->thread_info */ +/* #define task_stack_page(task) ((void*)((task)->thread_info)) */ + +#define task_pt_regs (tsk) \ + (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1) + + +#define KSTK_EIP (tsk) (0) +#define KSTK_ESP (tsk) (0) + +#endif /* _ASM_PROCESSOR_H */
include/asm-microblaze/pvr.h new file +185 -0
185 lines not on this page · raw message
include/asm-microblaze/system.h new file +185 -0
185 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 43/52 clinkage.h linkage.h sections.h kmap_types.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/clinkage.h | 29 +++++++++++++++++++++++++++++ include/asm-microblaze/kmap_types.h | 31 +++++++++++++++++++++++++++++++ include/asm-microblaze/linkage.h | 17 +++++++++++++++++ include/asm-microblaze/sections.h | 19 +++++++++++++++++++ 4 files changed, 96 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/clinkage.h create mode 100644 include/asm-microblaze/kmap_types.h create mode 100644 include/asm-microblaze/linkage.h create mode 100644 include/asm-microblaze/sections.h
include/asm-microblaze/clinkage.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* include/asm-microblaze/clinkage.h +* +* Macros to reflect C symbol-naming conventions +* +* Copyright (C) 2003 John Williams <[email protected]> +* Copyright (C) 2001,2002 NEC Corporatione +* Copyright (C) 2001,2002 Miles Bader <[email protected]> +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file COPYING in the main directory of this +* archive for more details. +* +* Written by Miles Bader <[email protected]> +* Microblaze port by John Williams +*/ + +#ifndef _MICROBLAZE_CLINKAGE_H +#define _MICROBLAZE_CLINKAGE_H + +#define __ASSEMBLY__ + +#include <linux/linkage.h> + +#define C_SYMBOL_NAME (name) name +#define C_ENTRY (name) .globl name; .align 4; name +#define C_END (name) + +#endif /* _MICROBLAZE_CLINKAGE_H */
include/asm-microblaze/kmap_types.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* include/asm-microblaze/kmap_types.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + +enum km_type { +KM_BOUNCE_READ , +KM_SKB_SUNRPC_DATA , +KM_SKB_DATA_SOFTIRQ , +KM_USER0 , +KM_USER1 , +KM_BIO_SRC_IRQ , +KM_BIO_DST_IRQ , +KM_PTE0 , +KM_PTE1 , +KM_IRQ0 , +KM_IRQ1 , +KM_SOFTIRQ0 , +KM_SOFTIRQ1 , +KM_TYPE_NR , +}; + +#endif /* _ASM_KMAP_TYPES_H */
include/asm-microblaze/linkage.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* include/asm-microblaze/linkage.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_LINKAGE_H +#define _ASM_LINKAGE_H + +#define __ALIGN .align 4 +#define __ALIGN_STR ".align 4" + +#endif /* _ASM_LINKAGE_H */
include/asm-microblaze/sections.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* include/asm-microblaze/sections.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SECTIONS_H +#define _ASM_SECTIONS_H + +#include <asm-generic/sections.h> + +extern char _ssbss[], _esbss[]; +extern unsigned long __ivt_start[], __ivt_end[]; + +#endif /* _ASM_SECTIONS_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 44/52 stats headers
From: Michal Simek <[email protected]>
--- include/asm-microblaze/stat.h | 75 +++++++++++++++++++++++++++++++++++++++ include/asm-microblaze/statfs.h | 16 ++++++++ 2 files changed, 91 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/stat.h create mode 100644 include/asm-microblaze/statfs.h
include/asm-microblaze/stat.h new file +75 -0
@@ -0,0 +1,75 @@ +/* +* include/asm-microblaze/stat.h +* +* Microblaze stat structure +* +* Copyright (C) 2001,02,03 NEC Electronics Corporation +* Copyright (C) 2001,02,03 Miles Bader <[email protected]> +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file COPYING in the main directory of this +* archive for more details. +* +* Written by Miles Bader <[email protected]> +*/ + +#ifndef _ASM_STAT_H +#define _ASM_STAT_H + +#include <asm/posix_types.h> + +struct stat { +unsigned int st_dev; +unsigned long st_ino; +unsigned int st_mode; +unsigned int st_nlink; +unsigned int st_uid; +unsigned int st_gid; +unsigned int st_rdev; +long st_size; +unsigned long st_blksize; +unsigned long st_blocks; +unsigned long st_atime; +unsigned long __unused1; +unsigned long st_mtime; +unsigned long __unused2; +unsigned long st_ctime; +unsigned long __unused3; +unsigned long __unused4; +unsigned long __unused5; +}; + +struct stat64 { +unsigned long long st_dev; +unsigned long __unused1; + +unsigned long long st_ino; + +unsigned int st_mode; +unsigned int st_nlink; + +unsigned int st_uid; +unsigned int st_gid; + +unsigned long long st_rdev; +unsigned long __unused3; + +long long st_size; +unsigned long st_blksize; + +unsigned long st_blocks;/* No. of 512-byte blocks allocated */ +unsigned long __unused4;/* future possible st_blocks high bits */ + +unsigned long st_atime; +unsigned long st_atime_nsec; + +unsigned long st_mtime; +unsigned long st_mtime_nsec; + +unsigned long st_ctime; +unsigned long st_ctime_nsec; + +unsigned long __unused8; +}; + +#endif /* _ASM_STAT_H */
include/asm-microblaze/statfs.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/statfs.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_STATFS_H +#define _ASM_STATFS_H + +#include <asm-generic/statfs.h> + +#endif /* _ASM_STATFS_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 45/52 termbits.h termios.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/termbits.h | 203 +++++++++++++++++++++++++++++++++++++ include/asm-microblaze/termios.h | 86 ++++++++++++++++ 2 files changed, 289 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/termbits.h create mode 100644 include/asm-microblaze/termios.h
include/asm-microblaze/termbits.h new file +203 -0
@@ -0,0 +1,203 @@ +/* +* include/asm-microblaze/termbits.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_TERMBITS_H +#define _ASM_TERMBITS_H + +#include <linux/posix_types.h> + +typedef unsigned char cc_t ; +typedef unsigned int speed_t ; +typedef unsigned int tcflag_t ; + +#define NCCS 19 +struct termios { +tcflag_t c_iflag;/* input mode flags */ +tcflag_t c_oflag;/* output mode flags */ +tcflag_t c_cflag;/* control mode flags */ +tcflag_t c_lflag;/* local mode flags */ +cc_t c_line;/* line discipline */ +cc_t c_cc[NCCS ];/* control characters */ +}; + +struct ktermios { +tcflag_t c_iflag;/* input mode flags */ +tcflag_t c_oflag;/* output mode flags */ +tcflag_t c_cflag;/* control mode flags */ +tcflag_t c_lflag;/* local mode flags */ +cc_t c_line;/* line discipline */ +cc_t c_cc[NCCS ];/* control characters */ +speed_t c_ispeed;/* input speed */ +speed_t c_ospeed;/* output speed */ +}; + + +/* c_cc characters */ + +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ + +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ + +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +/* c_cflag bit meaning */ + +#define CBAUD 0010017 +#define B0 0000000/* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#define CBAUDEX 0010000 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define CIBAUD 002003600000/* input baud rate (not used) */ +#define CMSPAR 010000000000/* mark or space (stick) parity */ +#define CRTSCTS 020000000000/* flow control */ + +/* c_lflag bits */ + +#define ISIG 0000001 +#define ICANON 0000002 +#define XCASE 0000004 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ + +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#endif /* _ASM_TERMBITS_H */
include/asm-microblaze/termios.h new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 46/52 sigcontext.h siginfo.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/sigcontext.h | 21 +++++++++++++++++++++ include/asm-microblaze/siginfo.h | 17 +++++++++++++++++ 2 files changed, 38 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/sigcontext.h create mode 100644 include/asm-microblaze/siginfo.h
include/asm-microblaze/sigcontext.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* include/asm-microblaze/sigcontext.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SIGCONTEXT_H +#define _ASM_SIGCONTEXT_H + +#include <asm/ptrace.h> + +struct sigcontext { +struct pt_regs regs; +unsigned long oldmask; +}; + +#endif /* _ASM_SIGCONTEXT_H */
include/asm-microblaze/siginfo.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* include/asm-microblaze/siginfo.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SIGINFO_H +#define _ASM_SIGINFO_H + +#include <linux/types.h> +#include <asm-generic/siginfo.h> + +#endif /* _ASM_SIGINFO_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 47/52 headers simple files
From: Michal Simek <[email protected]>
--- include/asm-microblaze/auxvec.h | 14 ++++++++++++++ include/asm-microblaze/cputime.h | 16 ++++++++++++++++ include/asm-microblaze/div64.h | 16 ++++++++++++++++ include/asm-microblaze/emergency-restart.h | 16 ++++++++++++++++ include/asm-microblaze/errno.h | 16 ++++++++++++++++ include/asm-microblaze/futex.h | 16 ++++++++++++++++ include/asm-microblaze/kdebug.h | 19 +++++++++++++++++++ include/asm-microblaze/local.h | 16 ++++++++++++++++ include/asm-microblaze/mutex.h | 16 ++++++++++++++++ include/asm-microblaze/namei.h | 24 ++++++++++++++++++++++++ include/asm-microblaze/percpu.h | 16 ++++++++++++++++ include/asm-microblaze/resource.h | 16 ++++++++++++++++ include/asm-microblaze/user.h | 18 ++++++++++++++++++ 13 files changed, 219 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/auxvec.h create mode 100644 include/asm-microblaze/cputime.h create mode 100644 include/asm-microblaze/div64.h create mode 100644 include/asm-microblaze/emergency-restart.h create mode 100644 include/asm-microblaze/errno.h create mode 100644 include/asm-microblaze/futex.h create mode 100644 include/asm-microblaze/kdebug.h create mode 100644 include/asm-microblaze/local.h create mode 100644 include/asm-microblaze/mutex.h create mode 100644 include/asm-microblaze/namei.h create mode 100644 include/asm-microblaze/percpu.h create mode 100644 include/asm-microblaze/resource.h create mode 100644 include/asm-microblaze/user.h
include/asm-microblaze/auxvec.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* include/asm-microblaze/auxvec.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_AUXVEC_H +#define _ASM_AUXVEC_H + +#endif /* _ASM_AUXVEC_H */
include/asm-microblaze/cputime.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/cputime.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_CPUTIME_H +#define _ASM_CPUTIME_H + +#include <asm-generic/cputime.h> + +#endif /* _ASM_CPUTIME_H */
include/asm-microblaze/div64.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/div64.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_DIV64_H +#define _ASM_DIV64_H + +#include <asm-generic/div64.h> + +#endif /* _ASM_DIV64_H */
include/asm-microblaze/emergency-restart.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/emergency-restart.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_EMERGENCY_RESTART_H +#define _ASM_EMERGENCY_RESTART_H + +#include <asm-generic/emergency-restart.h> + +#endif /* _ASM_EMERGENCY_RESTART_H */
include/asm-microblaze/errno.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/errno.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_ERRNO_H +#define _ASM_ERRNO_H + +#include <asm-generic/errno.h> + +#endif /* _ASM_ERRNO_H */
include/asm-microblaze/futex.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/futex.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_FUTEX_H +#define _ASM_FUTEX_H + +#include <asm-generic/futex.h> + +#endif /* _ASM_FUTEX_H */
include/asm-microblaze/kdebug.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* include/asm-microblaze/kdebug.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2007 Michal Simek <[email protected]> +*/ + +#ifndef _ASM_KDEBUG_H +#define _ASM_KDEBUG_H + +#include <asm-generic/kdebug.h> + +#endif /* _ASM_KDEBUG_H */ + + +
include/asm-microblaze/local.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/local.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_LOCAL_H +#define _ASM_LOCAL_H + +#include <asm-generic/local.h> + +#endif /* _ASM_LOCAL_H */
include/asm-microblaze/mutex.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/mutex.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_MUTEX_H +#define _ASM_MUTEX_H + +#include <asm-generic/mutex-dec.h> + +#endif /* _ASM_MUTEX_H */
include/asm-microblaze/namei.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* include/asm-microblaze/namei.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_NAMEI_H +#define _ASM_NAMEI_H + +#ifdef __KERNEL__ + +/* This dummy routine maybe changed to something useful +* for /usr/gnemul/ emulation stuff. +* Look at asm-sparc/namei.h for details. +*/ +#define __emul_prefix () NULL + +#endif /* __KERNEL__ */ + +#endif /* _ASM_NAMEI_H */
include/asm-microblaze/percpu.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/percpu.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_PERCPU_H +#define _ASM_PERCPU_H + +#include <asm-generic/percpu.h> + +#endif /* _ASM_PERCPU_H */
include/asm-microblaze/resource.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* include/asm-microblaze/resource.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_RESOURCE_H +#define _ASM_RESOURCE_H + +#include <asm-generic/resource.h> + +#endif /* _ASM_RESOURCE_H */
include/asm-microblaze/user.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* include/asm-microblaze/user.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +* +* Authors: +* Yasushi SHOJI <[email protected]> +* Tetsuya OHKAWA <[email protected]> +*/ + +#ifndef _ASM_USER_H +#define _ASM_USER_H + +#endif /* _ASM_USER_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 48/52 headers files entry.h current.h mman.h registers.h sembuf.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/current.h | 25 +++++++++++++++++++++++++ include/asm-microblaze/entry.h | 32 ++++++++++++++++++++++++++++++++ include/asm-microblaze/mman.h | 27 +++++++++++++++++++++++++++ include/asm-microblaze/registers.h | 26 ++++++++++++++++++++++++++ include/asm-microblaze/sembuf.h | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/current.h create mode 100644 include/asm-microblaze/entry.h create mode 100644 include/asm-microblaze/mman.h create mode 100644 include/asm-microblaze/registers.h create mode 100644 include/asm-microblaze/sembuf.h
include/asm-microblaze/current.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* include/asm-microblaze/current.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_CURRENT_H +#define _ASM_CURRENT_H + +#ifndef __ASSEMBLY__ + +/* +* Dedicate r31 to keeping the current task pointer +*/ +registerstruct task_struct *current asm("r31" ); + +#define get_current () current + +#endif + +#endif /* _ASM_CURRENT_H */
include/asm-microblaze/entry.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* include/asm-microblaze/entry.h +* +* Definitions used by low-level trap handlers +* +* Copyright (C) 2007 PetaLogix +* Copyright (C) 2007 John Williams <[email protected]> +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file COPYING in the main directory of this +* archive for more details. +* +*/ + +#ifndef _MICROBLAZE_ENTRY_H +#define _MICROBLAZE_ENTRY_H + + +#include <asm/percpu.h> +#include <asm/ptrace.h> + +/* These are per-cpu variables required in entry.S, among other +places */ + +DECLARE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */ +DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */ +DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */ +DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */ +DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ +DECLARE_PER_CPU(unsigned int, SYSCALL_SAVE); /* Saved syscall number */ + +#endif /* _MICROBLAZE_ENTRY_H */
include/asm-microblaze/mman.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* include/asm-microblaze/mman.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_MMAN_H +#define _ASM_MMAN_H + +#include <asm-generic/mman.h> + +#define MAP_GROWSDOWN 0x0100/* stack-like segment */ +#define MAP_DENYWRITE 0x0800/* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000/* mark it as an executable */ +#define MAP_LOCKED 0x2000/* pages are locked */ +#define MAP_NORESERVE 0x4000/* don't check for reservations */ +#define MAP_POPULATE 0x8000/* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000/* do not block on IO */ + +#define MCL_CURRENT 1/* lock all current mappings */ +#define MCL_FUTURE 2/* lock all future mappings */ + +#endif /* _ASM_MMAN_H */
include/asm-microblaze/registers.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* include/asm-microblaze/registers.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_REGISTERS_H +#define _ASM_REGISTERS_H + +#define MSR_BE (1<<0) +#define MSR_IE (1<<1) +#define MSR_C (1<<2) +#define MSR_BIP (1<<3) +#define MSR_FSL (1<<4) +#define MSR_ICE (1<<5) +#define MSR_DZ (1<<6) +#define MSR_DCE (1<<7) +#define MSR_EE (1<<8) +#define MSR_EIP (1<<9) +#define MSR_CC (1<<31) + +#endif /* _ASM_REGISTERS_H */
include/asm-microblaze/sembuf.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* include/asm-microblaze/sembuf.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SEMBUF_H +#define _ASM_SEMBUF_H + +/* +* The semid64_ds structure for m68k architecture. +* Note extra padding because this structure is passed back and forth +* between kernel and user space. +* +* Pad space is left for: +* - 64-bit time_t to solve y2038 problem +* - 2 miscellaneous 32-bit values +*/ + +struct semid64_ds { +struct ipc64_perm sem_perm;/* permissions .. see ipc.h */ +__kernel_time_t sem_otime;/* last semop time */ +unsigned long __unused1; +__kernel_time_t sem_ctime;/* last change time */ +unsigned long __unused2; +unsigned long sem_nsems;/* no. of semaphores in array */ +unsigned long __unused3; +unsigned long __unused4; +}; + + +#endif /* _ASM_SEMBUF_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 49/52 device.h param.h topology.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/device.h | 27 ++++++++ include/asm-microblaze/param.h | 36 +++++++++++ include/asm-microblaze/topology.h | 124 +++++++++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/device.h create mode 100644 include/asm-microblaze/param.h create mode 100644 include/asm-microblaze/topology.h
include/asm-microblaze/device.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Arch specific extensions to struct device +* +* This file is released under the GPLv2 +*/ + +#ifndef _ASM_MICROBLAZE_DEVICE_H +#define _ASM_MICROBLAZE_DEVICE_H + +struct dma_mapping_ops ; +struct device_node ; + +struct dev_archdata { +/* Optional pointer to an OF device node */ +struct device_node *of_node; + +/* DMA operations on that device */ +struct dma_mapping_ops *dma_ops; +void *dma_data; + +/* NUMA node if applicable */ +int numa_node; +}; + +#endif /* _ASM_MICROBLAZE_DEVICE_H */ + +
include/asm-microblaze/param.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* include/asm-microblaze/param.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_PARAM_H +#define _ASM_PARAM_H + +#ifdef __KERNEL__ +# define HZ 100/* internal timer frequency */ +# define USER_HZ 100/* for user interfaces in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ)/* frequnzy at which times() counts */ +#endif + +#ifndef NGROUPS +#define NGROUPS 32 +#endif + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define EXEC_PAGESIZE 4096 + +#ifndef HZ +#define HZ 100 +#endif + +#define MAXHOSTNAMELEN 64/* max length of hostname */ + +#endif /* _ASM_PARAM_H */
include/asm-microblaze/topology.h new file +124 -0
124 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 50/52 pool.h socket.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/poll.h | 37 +++++++++++++++++++++++ include/asm-microblaze/socket.h | 62 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/poll.h create mode 100644 include/asm-microblaze/socket.h
include/asm-microblaze/poll.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* include/asm-microblaze/poll.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_POLL_H +#define _ASM_POLL_H + +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 + +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 + +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#define POLLWRNORM POLLOUT +#define POLLWRBAND 0x0100 + +#define POLLMSG 0x0400 +#define POLLREMOVE 0x0800 +#define POLLRDHUP 0x2000 + +struct pollfd { +int fd; +short events; +short revents; +}; + +#endif /* _ASM_POLL_H */
include/asm-microblaze/socket.h new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 51/52 fcntl.h sockios.h ucontext.h unistd.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/fcntl.h | 104 +++++++ include/asm-microblaze/sockios.h | 23 ++ include/asm-microblaze/ucontext.h | 24 ++ include/asm-microblaze/unistd.h | 548 +++++++++++++++++++++++++++++++++++++ 4 files changed, 699 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/fcntl.h create mode 100644 include/asm-microblaze/sockios.h create mode 100644 include/asm-microblaze/ucontext.h create mode 100644 include/asm-microblaze/unistd.h
include/asm-microblaze/fcntl.h new file +104 -0
@@ -0,0 +1,104 @@ +/* +* include/asm-microblaze/fcntl.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _MICROBLAZE_FCNTL_H +#define _MICROBLAZE_FCNTL_H + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files +located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100/* not fcntl */ +#define O_EXCL 0200/* not fcntl */ +#define O_NOCTTY 0400/* not fcntl */ +#define O_TRUNC 01000/* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000/* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000/* must be a directory */ +#define O_NOFOLLOW 0100000/* don't follow links */ +#define O_LARGEFILE 0200000 +#define O_DIRECT 0400000/* direct disk access hint */ +#define O_NOATIME 01000000 +#define O_CLOEXEC 02000000 + +#define F_DUPFD 0/* dup */ +#define F_GETFD 1/* get close_on_exec */ +#define F_SETFD 2/* set/clear close_on_exec */ +#define F_GETFL 3/* get file->f_flags */ +#define F_SETFL 4/* set file->f_flags */ +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 8/* for sockets. */ +#define F_GETOWN 9/* for sockets. */ +#define F_SETSIG 10/* for sockets. */ +#define F_GETSIG 11/* for sockets. */ + +#define F_GETLK64 12/* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + +/* for F_[GET|SET]FL */ +#define FD_CLOEXEC 1/* actually anything with low bit set goes */ + +/* for posix fcntl() and lockf() */ +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +/* for old implementation of bsd flock () */ +#define F_EXLCK 4/* or 3 */ +#define F_SHLCK 8/* or 4 */ + +/* for leases */ +#define F_INPROGRESS 16 + +/* operations for bsd flock(), also used by the kernel implementation */ +#define LOCK_SH 1/* shared lock */ +#define LOCK_EX 2/* exclusive lock */ +#define LOCK_NB 4/* or'd with one of the above to prevent blocking */ +#define LOCK_UN 8/* remove lock */ + +#define LOCK_MAND 32/* This is a mandatory flock */ +#define LOCK_READ 64/* ... Which allows concurrent read operations */ +#define LOCK_WRITE 128/* ... Which allows concurrent write operations */ +#define LOCK_RW 192/* ... Which allows concurrent read & write ops */ + +#ifdef __KERNEL__ +#define F_POSIX 1 +#define F_FLOCK 2 +#define F_BROKEN 4/* broken flock() emulation */ +#endif /* __KERNEL__ */ + +struct flock { +short l_type; +short l_whence; +off_t l_start; +off_t l_len; +pid_t l_pid; +}; + +struct flock64 { +short l_type; +short l_whence; +loff_t l_start; +loff_t l_len; +pid_t l_pid; +}; + +#define F_LINUX_SPECIFIC_BASE 1024 + +#endif /* _MICROBLAZE_FCNTL_H */
include/asm-microblaze/sockios.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* include/asm-microblaze/sockios.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SOCKIOS_H +#define _ASM_SOCKIOS_H + +#include <asm/ioctl.h> + +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906/* Get stamp */ + +#endif /* _ASM_SOCKIOS_H */
include/asm-microblaze/ucontext.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* include/asm-microblaze/ucontext.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_UCONTEXT_H +#define _ASM_UCONTEXT_H + +#include <asm/sigcontext.h> + +struct ucontext { +unsigned long uc_flags; +struct ucontext *uc_link; +stack_t uc_stack; +struct sigcontext uc_mcontext; +sigset_t uc_sigmask;/* mask last for extensibility */ +}; + +#endif /* _ASM_UCONTEXT_H */
include/asm-microblaze/unistd.h new file +548 -0
548 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 52/52 setup.h string.h thread_info.h
From: Michal Simek <[email protected]>
--- include/asm-microblaze/setup.h | 36 ++++++++ include/asm-microblaze/string.h | 22 +++++ include/asm-microblaze/thread_info.h | 156 ++++++++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+), 0 deletions(-) create mode 100644 include/asm-microblaze/setup.h create mode 100644 include/asm-microblaze/string.h create mode 100644 include/asm-microblaze/thread_info.h
include/asm-microblaze/setup.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* include/asm-microblaze/setup.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_SETUP_H +#define _ASM_SETUP_H + +#include <linux/init.h> + +#define COMMAND_LINE_SIZE 256 + +int __init setup_early_printk (char *opt); +void early_printk (const char *fmt, ...); +void heartbeat (void ); + +void system_timer_init (void ); +unsigned long do_gettimeoffset (void ); +void time_init (void ); +unsigned long long sched_clock (void ); + +void __init setup_memory (void ); +void __init machine_early_init (const char *cmdline,unsigned int ram, +unsigned int fdt); + +void machine_restart (char *cmd); +void machine_shutdown (void ); +void machine_halt (void ); +void machine_power_off (void ); + +#endif /* _ASM_SETUP_H */
include/asm-microblaze/string.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* include/asm-microblaze/string.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_STRING_H +#define _ASM_STRING_H + +#define __HAVE_ARCH_MEMSET +#define __HAVE_ARCH_MEMCPY +#define __HAVE_ARCH_MEMMOVE + +extern void *memset (void *,int ,__kernel_size_t ); +extern void *memcpy (void *,const void *,__kernel_size_t ); +extern void *memmove (void *,const void *,__kernel_size_t ); + +#endif /* _ASM_STRING_H */
include/asm-microblaze/thread_info.h new file +156 -0
156 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 3/52 Cpuinfo handling
From: microblaze <[email protected]>
--- arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c | 83 +++++++++++++++++ arch/microblaze/kernel/cpu/cpuinfo-static.c | 123 +++++++++++++++++++++++++ arch/microblaze/kernel/cpu/cpuinfo.c | 93 +++++++++++++++++++ include/asm-microblaze/cpuinfo.h | 114 +++++++++++++++++++++++ 4 files changed, 413 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c create mode 100644 arch/microblaze/kernel/cpu/cpuinfo-static.c create mode 100644 arch/microblaze/kernel/cpu/cpuinfo.c create mode 100644 include/asm-microblaze/cpuinfo.h
arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c new file +83 -0
@@ -0,0 +1,83 @@ +/* +* arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c +* +* Support for MicroBlaze PVR (processor version register) +* +* (c) 2007 John Williams <[email protected]> +* (c) 2007 PetaLogix +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +*/ + +#include <linux/init.h> +#include <linux/string.h> +#include <linux/autoconf.h> +#include <asm/pvr.h> +#include <asm/cpuinfo.h> + +/* +* Helper macro to map between fields in our struct cpuinfo, and +* the PVR macros in pvr.h. +*/ + +#define CI (c, p) ci->c = PVR_##p(pvr) + +void set_cpuinfo_pvr_full (struct cpuinfo *ci) +{ +struct pvr_s pvr; +get_pvr (&pvr); + +CI (use_barrel,USE_BARREL ); +CI (use_divider,USE_DIV ); +CI (use_mult,USE_HW_MUL ); +CI (use_fpu,USE_FPU ); + +CI (use_mul_64,USE_MUL64 ); +CI (use_msr_instr,USE_MSR_INSTR ); +CI (use_pcmp_instr,USE_PCMP_INSTR ); +CI (ver_code,VERSION ); + +CI (use_icache,USE_ICACHE ); +CI (icache_tagbits,ICACHE_ADDR_TAG_BITS ); +CI (icache_write,ICACHE_ALLOW_WR ); +CI (icache_line,ICACHE_LINE_LEN ); +CI (icache_size,ICACHE_BYTE_SIZE ); +CI (icache_base,ICACHE_BASEADDR ); +CI (icache_high,ICACHE_HIGHADDR ); + +CI (use_dcache,USE_DCACHE ); +CI (dcache_tagbits,DCACHE_ADDR_TAG_BITS ); +CI (dcache_write,DCACHE_ALLOW_WR ); +CI (dcache_line,DCACHE_LINE_LEN ); +CI (dcache_size,DCACHE_BYTE_SIZE ); +CI (dcache_base,DCACHE_BASEADDR ); +CI (dcache_high,DCACHE_HIGHADDR ); + +CI (use_dopb,D_OPB ); +CI (use_iopb,I_OPB ); +CI (use_dlmb,D_LMB ); +CI (use_ilmb,I_LMB ); +CI (num_fsl,FSL_LINKS ); + +CI (irq_edge,INTERRUPT_IS_EDGE ); +CI (irq_positive,EDGE_IS_POSITIVE ); + +CI (area_optimised,AREA_OPTIMISED ); +CI (opcode_0_illegal, OPCODE_0x0_ILLEGAL); +CI (exc_unaligned,UNALIGNED_EXCEPTION ); +CI (exc_ill_opcode,ILL_OPCODE_EXCEPTION ); +CI (exc_iopb,IOPB_BUS_EXCEPTION ); +CI (exc_dopb,DOPB_BUS_EXCEPTION ); +CI (exc_div_zero,DIV_ZERO_EXCEPTION ); +CI (exc_fpu,FPU_EXCEPTION ); + +CI (hw_debug,DEBUG_ENABLED ); +CI (num_pc_brk,NUMBER_OF_PC_BRK ); +CI (num_rd_brk,NUMBER_OF_RD_ADDR_BRK ); +CI (num_wr_brk,NUMBER_OF_WR_ADDR_BRK ); + +CI (fpga_family_code,TARGET_FAMILY ); +}
arch/microblaze/kernel/cpu/cpuinfo-static.c new file +123 -0
123 lines not on this page · raw message
arch/microblaze/kernel/cpu/cpuinfo.c new file +93 -0
93 lines not on this page · raw message
include/asm-microblaze/cpuinfo.h new file +114 -0
114 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 4/52 Open firmware files
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/of_device.c | 109 +++ arch/microblaze/kernel/of_platform.c | 395 +++++++++++ arch/microblaze/kernel/prom.c | 1248 ++++++++++++++++++++++++++++++++++ arch/microblaze/kernel/prom_parse.c | 1033 ++++++++++++++++++++++++++++ include/asm-microblaze/of_device.h | 37 + include/asm-microblaze/of_platform.h | 37 + include/asm-microblaze/prom.h | 333 +++++++++ 7 files changed, 3192 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/of_device.c create mode 100644 arch/microblaze/kernel/of_platform.c create mode 100644 arch/microblaze/kernel/prom.c create mode 100644 arch/microblaze/kernel/prom_parse.c create mode 100644 include/asm-microblaze/of_device.h create mode 100644 include/asm-microblaze/of_platform.h create mode 100644 include/asm-microblaze/prom.h
arch/microblaze/kernel/of_device.c new file +109 -0
@@ -0,0 +1,109 @@ +#include <linux/string.h> +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/mod_devicetable.h> +#include <linux/slab.h> + +#include <asm/errno.h> +#include <asm/of_device.h> + +ssize_t of_device_get_modalias (struct of_device *ofdev, +char *str,ssize_t len) +{ +const char *compat; +int cplen, i; +ssize_t tsize, csize, repend; + +/* Name & Type */ + csize =snprintf (str, len,"of:N%sT%s" , + ofdev->node->name, ofdev->node->type); + +/* Get compatible property if any */ + compat =of_get_property (ofdev->node,"compatible" , &cplen); +if (!compat) +return csize; + +/* Find true end (we tolerate multiple \0 at the end */ +for (i = (cplen-1 ); i >=0 && !compat[i]; i--) + cplen--; +if (!cplen) +return csize; + cplen++; + +/* Check space (need cplen+1 chars including final \0) */ + tsize = csize + cplen; + repend = tsize; + +/* @ the limit, all is already filled */ +if (csize >= len) +return tsize; + +/* limit compat list */ +if (tsize >= len) { + cplen = len - csize -1 ; + repend = len; + } + +/* Copy and do char replacement */ +memcpy (&str[csize+1 ], compat, cplen); +for (i = csize; i < repend; i++) { +char c = str[i]; +if (c =='\0' ) + str[i] ='C' ; +else if (c ==' ' ) + str[i] ='_' ; + } + +return tsize; +} +EXPORT_SYMBOL (of_device_get_modalias); + +int of_device_uevent (struct device *dev,struct kobj_uevent_env *env) +{ +struct of_device *ofdev; +const char *compat; +int seen =0 , cplen, sl; + +if (!dev) +return -ENODEV ; + + ofdev =to_of_device (dev); + +if (add_uevent_var (env,"OF_NAME=%s" , ofdev->node->name)) +return -ENOMEM ; + +if (add_uevent_var (env,"OF_TYPE=%s" , ofdev->node->type)) +return -ENOMEM ; + +/* Since the compatible field can contain pretty much anything +* it's not really legal to split it out with commas. We split it +* up using a number of environment variables instead. */ + + compat =of_get_property (ofdev->node,"compatible" , &cplen); +while (compat && *compat && cplen >0 ) { +if (add_uevent_var (env,"OF_COMPATIBLE_%d=%s" , seen, compat)) +return -ENOMEM ; + + sl =strlen (compat) +1 ; + compat += sl; + cplen -= sl; + seen++; + } + +if (add_uevent_var (env,"OF_COMPATIBLE_N=%d" , seen)) +return -ENOMEM ; + +/* modalias is trickier, we add it in 2 steps */ +if (add_uevent_var (env,"MODALIAS=" )) +return -ENOMEM ; + sl =of_device_get_modalias (ofdev, &env->buf[env->buflen-1 ], +sizeof (env->buf) - env->buflen); +if (sl >= (sizeof (env->buf) - env->buflen)) +return -ENOMEM ; + env->buflen += sl; + +return 0 ; +} +EXPORT_SYMBOL (of_device_uevent);
arch/microblaze/kernel/of_platform.c new file +395 -0
395 lines not on this page · raw message
arch/microblaze/kernel/prom.c new file +1248 -0
1,248 lines not on this page · raw message
arch/microblaze/kernel/prom_parse.c new file +1033 -0
1,033 lines not on this page · raw message
include/asm-microblaze/of_device.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* include/asm-microblaze/of_device.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +*/ + +#ifndef _ASM_OF_DEVICE_H +#define _ASM_OF_DEVICE_H +#ifdef __KERNEL__ + +#include <linux/device.h> +#include <linux/of.h> + +/* +* The of_device is a kind of "base class" that is a superset of +* struct device for use by devices attached to an OF node and +* probed using OF properties. +*/ +struct of_device { +struct device_node *node;/* to be obsoleted */ +u64 dma_mask;/* DMA mask */ +struct device dev;/* Generic device interface */ +}; + +extern ssize_t of_device_get_modalias (struct of_device *ofdev, +char *str,ssize_t len); +extern int of_device_uevent (struct device *dev, +struct kobj_uevent_env *env); + +/* This is just here during the transition */ +#include <linux/of_device.h> + +#endif /* __KERNEL__ */ +#endif /* _ASM_OF_DEVICE_H */
include/asm-microblaze/of_platform.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* include/asm-microblaze/of_platform.h +* +* Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. +* <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* +*/ + +#ifndef _ASM_OF_PLATFORM_H +#define _ASM_OF_PLATFORM_H + +/* This is just here during the transition */ +#include <linux/of_platform.h> + +/* Platform drivers register/unregister */ +extern int of_register_platform_driver (struct of_platform_driver *drv); +extern void of_unregister_platform_driver (struct of_platform_driver *drv); + +/* Platform devices and busses creation */ +extern struct of_device *of_platform_device_create (struct device_node *np, +const char *bus_id, +struct device *parent); +/* pseudo "matches" value to not do deep probe */ +#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1) + +extern int of_platform_bus_probe (struct device_node *root, +struct of_device_id *matches, +struct device *parent); + +extern struct of_device *of_find_device_by_phandle (phandle ph); + +#endif /* _ASM_OF_PLATFORM_H */
include/asm-microblaze/prom.h new file +333 -0
141 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.4.rc4.14.g6fc74
Part of the diff is not shown here. View the raw message.
[email protected]
maintainerPATCH 5/52 Support for semaphores
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/semaphore.c | 222 ++++++++++++++++++++++++++++++++++++ include/asm-microblaze/semaphore.h | 100 ++++++++++++++++ 2 files changed, 322 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/semaphore.c create mode 100644 include/asm-microblaze/semaphore.h
arch/microblaze/kernel/semaphore.c new file +222 -0
@@ -0,0 +1,222 @@ +/* +* arch/microblaze/kernel/semaphore.c +* +* Generic semaphore code. Buyer beware. Do your own specific changes +* in <asm/semaphore-helper.h> +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2001 - 2005 Tensilica Inc. +* +* Joe Taylor <[email protected], [email protected]> +* Chris Zankel <[email protected]> +* Marc Gauthier<[email protected], [email protected]> +* Kevin Chea +*/ + +#include <linux/sched.h> +#include <linux/wait.h> +#include <linux/init.h> +#include <asm/semaphore.h> +#include <asm/errno.h> + +/* +* These two _must_ execute atomically wrt each other. +*/ + +static inline void wake_one_more (struct semaphore *sem) +{ +atomic_inc ((atomic_t *)&sem->sleepers); +} + +static inline int waking_non_zero (struct semaphore *sem) +{ +unsigned long flags; +int ret =0 ; + +spin_lock_irqsave (&semaphore_wake_lock, flags); +if (sem->sleepers >0 ) { + sem->sleepers--; + ret =1 ; + } +spin_unlock_irqrestore (&semaphore_wake_lock, flags); +return ret; +} + +/* +* waking_non_zero_interruptible: +* 1 got the lock +* 0 go to sleep +* -EINTR interrupted +* +* We must undo the sem->count down_interruptible() increment while we are +* protected by the spinlock in order to make atomic this atomic_inc() with the +* atomic_read() in wake_one_more(), otherwise we can race. -arca +*/ + +static inline int waking_non_zero_interruptible (struct semaphore *sem, +struct task_struct *tsk) { +unsigned long flags; +int ret =0 ; + +spin_lock_irqsave (&semaphore_wake_lock, flags); +if (sem->sleepers >0 ) { + sem->sleepers--; + ret =1 ; + }else if (signal_pending (tsk)) { +atomic_inc (&sem->count); + ret = -EINTR ; + } +spin_unlock_irqrestore (&semaphore_wake_lock, flags); +return ret; +} + +/* +* waking_non_zero_trylock: +* 1 failed to lock +* 0 got the lock +* +* We must undo the sem->count down_trylock() increment while we are +* protected by the spinlock in order to make atomic this atomic_inc() with the +* atomic_read() in wake_one_more(), otherwise we can race. -arca +*/ + +static inline int waking_non_zero_trylock (struct semaphore *sem) +{ +unsigned long flags; +int ret =1 ; + +spin_lock_irqsave (&semaphore_wake_lock, flags); +if (sem->sleepers <=0 ) +atomic_inc (&sem->count); +else { + sem->sleepers--; + ret =0 ; + } +spin_unlock_irqrestore (&semaphore_wake_lock, flags); +return ret; +} + +spinlock_t semaphore_wake_lock; + +/* +* Semaphores are implemented using a two-way counter: +* The "count" variable is decremented for each process +* that tries to sleep, while the "waking" variable is +* incremented when the "up()" code goes to wake up waiting +* processes. +* +* Notably, the inline "up()" and "down()" functions can +* efficiently test if they need to do any extra work (up +* needs to do something only if count was negative before +* the increment operation. +* +* waking_non_zero() (from asm/semaphore.h) must execute +* atomically. +* +* When __up() is called, the count was negative before +* incrementing it, and we need to wake up somebody. +* +* This routine adds one to the count of processes that need to +* wake up and exit. ALL waiting processes actually wake up but +* only the one that gets to the "waking" field first will gate +* through and acquire the semaphore. The others will go back +* to sleep. +* +* Note that these functions are only called when there is +* contention on the lock, and as such all this is the +* "non-critical" part of the whole semaphore business. The +* critical part is the inline stuff in <asm/semaphore.h> +* where we want to avoid any extra jumps and calls. +*/ + +void __up (struct semaphore *sem) +{ +wake_one_more (sem); +wake_up (&sem->wait); +} + +/* +* Perform the "down" function. Return zero for semaphore acquired, +* return negative for signalled out of the function. +* +* If called from __down, the return is ignored and the wait loop is +* not interruptible. This means that a task waiting on a semaphore +* using "down()" cannot be killed until someone does an "up()" on +* the semaphore. +* +* If called from __down_interruptible, the return value gets checked +* upon return. If the return value is negative then the task continues +* with the negative value in the return register (it can be tested by +* the caller). +* +* Either form may be used in conjunction with "up()". +* +*/ + +#define DOWN_VAR \ + struct task_struct *tsk = current; \ + wait_queue_t wait; \ + init_waitqueue_entry(&wait, tsk); + +#define DOWN_HEAD (task_state) \ + \ + \ + tsk->state = (task_state); \ + add_wait_queue(&sem->wait, &wait); \ + \ +/* \ +* Ok, we're set up. sem->count is known to be less than zero \ +* so we must wait. \ +* \ +* We can let go the lock for purposes of waiting. \ +* We re-acquire it after awaking so as to protect \ +* all semaphore operations. \ +* \ +* If "up()" is called before we call waking_non_zero() then \ +* we will catch it right away. If it is called later then \ +* we will have to go through a wakeup cycle to catch it. \ +* \ +* Multiple waiters contend for the semaphore lock to see \ +* who gets to gate through and who has to wait some more. \ +*/ \ +for (;;) { + +#define DOWN_TAIL (task_state) \ + tsk->state = (task_state); \ + } \ + tsk->state = TASK_RUNNING; \ + remove_wait_queue(&sem->wait, &wait); + +void __sched __down(struct semaphore *sem) { +DOWN_VAR +DOWN_HEAD (TASK_UNINTERRUPTIBLE ) + if (waking_non_zero(sem)) + break; + schedule(); + DOWN_TAIL(TASK_UNINTERRUPTIBLE) +} + +int __sched __down_interruptible(struct semaphore *sem) { + int ret = 0; +DOWN_VAR +DOWN_HEAD (TASK_INTERRUPTIBLE ) + + ret =waking_non_zero_interruptible (sem, tsk); + if (ret) { +if (ret ==1 ) +/* ret != 0 only if we get interrupted -arca */ + ret =0 ; +break ; + } +schedule (); +DOWN_TAIL (TASK_INTERRUPTIBLE) + return ret; +} + +int __down_trylock (struct semaphore *sem) +{ +return waking_non_zero_trylock (sem); +}
include/asm-microblaze/semaphore.h new file +100 -0
100 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 6/52 exception handling
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/exceptions.c | 79 +++++ arch/microblaze/kernel/hw_exception_handler.S | 395 +++++++++++++++++++++++++ include/asm-microblaze/exceptions.h | 66 ++++ 3 files changed, 540 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/exceptions.c create mode 100644 arch/microblaze/kernel/hw_exception_handler.S create mode 100644 include/asm-microblaze/exceptions.h
arch/microblaze/kernel/exceptions.c new file +79 -0
@@ -0,0 +1,79 @@ +/* +* arch/microblaze/kernel/exceptions.c - HW exception handling +* +* Copyright 2007 Xilinx, Inc. +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file COPYING in the main directory of this +* archive for more details. +* +*/ + +#include <linux/kernel.h> +#include <linux/signal.h> +#include <linux/sched.h> +#include <asm/exceptions.h> +#include <asm/entry.h> /* For KM CPU var */ + +/* Initialize_exception_handlers() - called from setup.c/trap_init() */ +void initialize_exception_handlers (void ) +{ +} + +#define MICROBLAZE_ILL_OPCODE_EXCEPTION 0x02 +#define MICROBLAZE_IOPB_BUS_EXCEPTION 0x03 +#define MICROBLAZE_DOPB_BUS_EXCEPTION 0x04 +#define MICROBLAZE_DIV_ZERO_EXCEPTION 0x05 +#define MICROBLAZE_FPU_EXCEPTION 0x06 + +static void handle_unexpected_exception (unsigned int esr, +unsigned int kernel_mode,unsigned int addr) +{ +printk (KERN_WARNING "Unexpected exception %02x in %s mode, PC=%08x\n" , + esr, kernel_mode ?"kernel" :"user" , addr); +} + +static void handle_exception (const char *message,int signal, +unsigned int kernel_mode,unsigned int addr) +{ +if (kernel_mode) { +panic ("%s in the kernel mode, PC=%08x\n" , message, addr); + }else { +force_sig (signal, current); + } +} + +asmlinkage void other_exception_handler(unsigned int esr, unsigned int addr) +{ +unsigned int kernel_mode =per_cpu (KM ,0 ); + +switch (esr) { + +case MICROBLAZE_ILL_OPCODE_EXCEPTION : +handle_exception ("Illegal instruction" ,SIGILL , + kernel_mode, addr); +break ; + +case MICROBLAZE_IOPB_BUS_EXCEPTION : +handle_exception ("Instruction bus error" ,SIGBUS , + kernel_mode, addr); +break ; + +case MICROBLAZE_DOPB_BUS_EXCEPTION : +handle_exception ("Data bus error" ,SIGBUS , kernel_mode, addr); +break ; + +case MICROBLAZE_DIV_ZERO_EXCEPTION : +handle_exception ("Divide by zero" ,SIGILL , kernel_mode, addr); +break ; + +case MICROBLAZE_FPU_EXCEPTION : +handle_exception ("FPU error" ,SIGFPE , kernel_mode, addr); +break ; + +default : +handle_unexpected_exception (esr, kernel_mode, addr); + } + +return ; +}
arch/microblaze/kernel/hw_exception_handler.S new file +395 -0
395 lines not on this page · raw message
include/asm-microblaze/exceptions.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 7/52 Signal support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/signal.c | 534 +++++++++++++++++++++++++++++++++++++++ include/asm-microblaze/signal.h | 199 +++++++++++++++ 2 files changed, 733 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/signal.c create mode 100644 include/asm-microblaze/signal.h
arch/microblaze/kernel/signal.c new file +534 -0
@@ -0,0 +1,534 @@ +/* +* arch/microblaze/kernel/signal.c -- Signal handling +* +* Copyright (C) 2003,2004 John Williams <[email protected]> +* Copyright (C) 2001 NEC Corporation +* Copyright (C) 2001 Miles Bader <[email protected]> +* Copyright (C) 1999,2000 Niibe Yutaka & Kaz Kojima +* Copyright (C) 1991,1992 Linus Torvalds +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file COPYING in the main directory of this +* archive for more details. +* +* 1997-11-28 Modified for POSIX.1b signals by Richard Henderson +* +* This file was was derived from the sh version, arch/sh/kernel/signal.c +*/ + +#include <linux/sched.h> +#include <linux/mm.h> +#include <linux/smp.h> +#include <linux/smp_lock.h> +#include <linux/kernel.h> +#include <linux/signal.h> +#include <linux/errno.h> +#include <linux/wait.h> +#include <linux/ptrace.h> +#include <linux/unistd.h> +#include <linux/stddef.h> +#include <linux/personality.h> +#include <linux/percpu.h> +#include <asm/entry.h> +#include <asm/ucontext.h> +#include <asm/uaccess.h> +#include <asm/pgtable.h> +#include <asm/pgalloc.h> +#include <asm/signal.h> + +#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) + +asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall); + +/* +* Atomically swap in the new signal mask, and wait for a signal. +*/ +asmlinkage int +sys_sigsuspend (old_sigset_t mask,struct pt_regs *regs) +{ +sigset_t saveset; + + mask &= _BLOCKABLE; +spin_lock_irq (¤t->sighand->siglock); + saveset = current->blocked; +siginitset (¤t->blocked, mask); +recalc_sigpending (); +spin_unlock_irq (¤t->sighand->siglock); + + regs->r3 = -EINTR ; +while (1 ) { + current->state =TASK_INTERRUPTIBLE ; +schedule (); +if (do_signal (regs, &saveset,1 )) +return -EINTR ; + } +} + +asmlinkage int +sys_rt_sigsuspend (sigset_t *unewset,size_t sigsetsize, +struct pt_regs *regs) +{ +sigset_t saveset, newset; + +/* XXX: Don't preclude handling different sized sigset_t's. */ +if (sigsetsize !=sizeof (sigset_t)) +return -EINVAL ; + +if (copy_from_user (&newset, unewset,sizeof (newset))) +return -EFAULT ; +sigdelsetmask (&newset, ~_BLOCKABLE); +spin_lock_irq (¤t->sighand->siglock); + saveset = current->blocked; + current->blocked = newset; +recalc_sigpending (); +spin_unlock_irq (¤t->sighand->siglock); + + regs->r3 = -EINTR ; +while (1 ) { + current->state =TASK_INTERRUPTIBLE ; +schedule (); +if (do_signal (regs, &saveset,1 )) +return -EINTR ; + } +} + +asmlinkage int +sys_sigaction (int sig,const struct old_sigaction *act, +struct old_sigaction *oact) +{ +struct k_sigaction new_ka, old_ka; +int ret; + +if (act) { +old_sigset_t mask; +if (!access_ok (VERIFY_READ , act,sizeof (*act)) || +__get_user (new_ka.sa.sa_handler, &act->sa_handler) || +__get_user (new_ka.sa.sa_restorer, &act->sa_restorer)) +return -EFAULT ; +__get_user (new_ka.sa.sa_flags, &act->sa_flags); +__get_user (mask, &act->sa_mask); +siginitset (&new_ka.sa.sa_mask, mask); + } + + ret =do_sigaction (sig, act ? &new_ka :NULL , oact ? &old_ka :NULL ); + +if (!ret && oact) { +if (!access_ok (VERIFY_WRITE , oact,sizeof (*oact)) || +__put_user (old_ka.sa.sa_handler, &oact->sa_handler) || +__put_user (old_ka.sa.sa_restorer, &oact->sa_restorer)) +return -EFAULT ; +__put_user (old_ka.sa.sa_flags, &oact->sa_flags); +__put_user (old_ka.sa.sa_mask.sig[0 ], &oact->sa_mask); + } + +return ret; +} + +asmlinkage int +sys_sigaltstack (const stack_t __user *uss,stack_t __user *uoss, +struct pt_regs *regs) +{ +return do_sigaltstack (uss, uoss, regs->r1); +} + +/* +* Do a signal return; undo the signal stack. +*/ + +struct sigframe { +struct sigcontext sc; +unsigned long extramask[_NSIG_WORDS-1 ]; +unsigned long tramp[2 ];/* signal trampoline */ +}; + +struct rt_sigframe { +struct siginfo info; +struct ucontext uc; +unsigned long tramp[2 ];/* signal trampoline */ +}; + +static int +restore_sigcontext (struct pt_regs *regs,struct sigcontext *sc,int *rval_p) +{ +unsigned int err =0 ; + +#define COPY (x) err |= __get_user(regs->x, &sc->regs.x) +COPY (r0);COPY (r1); +COPY (r2);COPY (r3);COPY (r4);COPY (r5); +COPY (r6);COPY (r7);COPY (r8);COPY (r9); +COPY (r10);COPY (r11);COPY (r12);COPY (r13); +COPY (r14);COPY (r15);COPY (r16);COPY (r17); +COPY (r18);COPY (r19);COPY (r20);COPY (r21); +COPY (r22);COPY (r23);COPY (r24);COPY (r25); +COPY (r26);COPY (r27);COPY (r28);COPY (r29); +COPY (r30);COPY (r31); +COPY (pc);COPY (ear);COPY (esr);COPY (fsr); +#undef COPY + + * rval_p = regs->r3; + +return err; +} + +asmlinkage int sys_sigreturn(struct pt_regs *regs) +{ +struct sigframe *frame = (struct sigframe *)regs->r1; +sigset_t set; +int rval; + +if (!access_ok (VERIFY_READ , frame,sizeof (*frame))) + goto badframe; + +if (__get_user (set.sig[0 ], &frame->sc.oldmask) + || (_NSIG_WORDS >1 + &&__copy_from_user (&set.sig[1 ], &frame->extramask, +sizeof (frame->extramask)))) + goto badframe; + +sigdelsetmask (&set, ~_BLOCKABLE); + +spin_lock_irq (¤t->sighand->siglock); + current->blocked = set; +recalc_sigpending (); +spin_unlock_irq (¤t->sighand->siglock); + +if (restore_sigcontext (regs, &frame->sc, &rval)) + goto badframe; +return rval; + +badframe: +force_sig (SIGSEGV , current); +return 0 ; +} + +asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) +{ +struct rt_sigframe *frame = (struct rt_sigframe *)regs->r1; +sigset_t set; +stack_t st; +int rval; + +if (!access_ok (VERIFY_READ , frame,sizeof (*frame))) + goto badframe; + +if (__copy_from_user (&set, &frame->uc.uc_sigmask,sizeof (set))) + goto badframe; + +sigdelsetmask (&set, ~_BLOCKABLE); +spin_lock_irq (¤t->sighand->siglock); + current->blocked = set; +recalc_sigpending (); +spin_unlock_irq (¤t->sighand->siglock); + +if (restore_sigcontext (regs, &frame->uc.uc_mcontext, &rval)) + goto badframe; + +if (__copy_from_user ((void *)&st, &frame->uc.uc_stack,sizeof (st))) + goto badframe; +/* It is more difficult to avoid calling this function than to +call it and ignore errors. */ +do_sigaltstack (&st,NULL , regs->r1); + +return rval; + +badframe: +force_sig (SIGSEGV , current); +return 0 ; +} + +/* +* Set up a signal frame. +*/ + +static int +setup_sigcontext (struct sigcontext *sc,struct pt_regs *regs, +unsigned long mask) +{ +int err =0 ; + +#define COPY (x) err |= __put_user(regs->x, &sc->regs.x) +COPY (r0);COPY (r1); +COPY (r2);COPY (r3);COPY (r4);COPY (r5); +COPY (r6);COPY (r7);COPY (r8);COPY (r9); +COPY (r10);COPY (r11);COPY (r12);COPY (r13); +COPY (r14);COPY (r15);COPY (r16);COPY (r17); +COPY (r18);COPY (r19);COPY (r20);COPY (r21); +COPY (r22);COPY (r23);COPY (r24);COPY (r25); +COPY (r26);COPY (r27);COPY (r28);COPY (r29); +COPY (r30);COPY (r31); +COPY (pc);COPY (ear);COPY (esr);COPY (fsr); +#undef COPY + + err |=__put_user (mask, &sc->oldmask); + +return err; +} + +/* +* Determine which stack to use.. +*/ +static inline void * +get_sigframe (struct k_sigaction *ka,struct pt_regs *regs,size_t frame_size) +{ +/* Default to using normal stack */ +unsigned long sp = regs->r1; + +if ((ka->sa.sa_flags &SA_ONSTACK ) !=0 && !on_sig_stack (sp)) + sp = current->sas_ss_sp + current->sas_ss_size; + +return (void *)((sp - frame_size) &-8UL ); +} + +static void setup_frame (int sig,struct k_sigaction *ka, +sigset_t *set,struct pt_regs *regs) +{ +struct sigframe *frame; +int err =0 ; +int signal; + + frame =get_sigframe (ka, regs,sizeof (*frame)); + +if (!access_ok (VERIFY_WRITE , frame,sizeof (*frame))) + goto give_sigsegv; + + signal =current_thread_info ()->exec_domain + &¤t_thread_info ()->exec_domain->signal_invmap + && sig <32 + ?current_thread_info ()->exec_domain->signal_invmap[sig] + : sig; + + err |=setup_sigcontext (&frame->sc, regs, set->sig[0 ]); + +if (_NSIG_WORDS >1 ) { + err |=__copy_to_user (frame->extramask, &set->sig[1 ], +sizeof (frame->extramask)); + } + +/* Set up to return from userspace. If provided, use a stub +already in userspace. */ +/* minus 8 is offset to cater for "rtsd r15,8" offset */ +if (ka->sa.sa_flags &SA_RESTORER ) { + regs->r15 = ((unsigned long )ka->sa.sa_restorer)-8 ; + }else { +/* Note, these encodings are _big endian_! */ + +/* addi r12, r0, __NR_sigreturn */ + err |=__put_user (0x31800000 | __NR_sigreturn , + frame->tramp +0 ); +/* brki r14, 0x8 */ + err |=__put_user (0xb9cc0008 , frame->tramp +1 ); + +/* Return from sighandler will jump to the tramp. +Negative 8 offset because return is rtsd r15, 8 */ + regs->r15 = ((unsigned long )frame->tramp)-8 ; + +#if 0 +flush_cache_sigtramp ((unsigned long )frame->tramp); +#endif + } + +if (err) + goto give_sigsegv; + +/* Set up registers for signal handler */ + regs->r1 = (unsigned long ) frame; +/* Signal handler args: */ + regs->r5 = signal;/* Arg 0: signum */ + regs->r6 = (unsigned long ) &frame->sc;/* arg 1: sigcontext */ + +/* Offset of 4 to handle microblaze rtid r14, 0 */ + regs->pc = (unsigned long )ka->sa.sa_handler; + +set_fs (USER_DS ); + +#ifdef DEBUG_SIG +printk (KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n" , + current->comm, current->pid, frame, regs->pc); +#endif + +return ; + +give_sigsegv: +if (sig ==SIGSEGV ) + ka->sa.sa_handler =SIG_DFL ; +force_sig (SIGSEGV , current); +} + +static void setup_rt_frame (int sig,struct k_sigaction *ka,siginfo_t *info, +sigset_t *set,struct pt_regs *regs) +{ +struct rt_sigframe *frame; +int err =0 ; +int signal; + + frame =get_sigframe (ka, regs,sizeof (*frame)); + +if (!access_ok (VERIFY_WRITE , frame,sizeof (*frame))) + goto give_sigsegv; + + signal =current_thread_info ()->exec_domain + &¤t_thread_info ()->exec_domain->signal_invmap + && sig <32 + ?current_thread_info ()->exec_domain->signal_invmap[sig] + : sig; + + err |=copy_siginfo_to_user (&frame->info, info); + +/* Create the ucontext. */ + err |=__put_user (0 , &frame->uc.uc_flags); + err |=__put_user (0 , &frame->uc.uc_link); + err |=__put_user ((void *)current->sas_ss_sp, + &frame->uc.uc_stack.ss_sp); + err |=__put_user (sas_ss_flags (regs->r1), + &frame->uc.uc_stack.ss_flags); + err |=__put_user (current->sas_ss_size, &frame->uc.uc_stack.ss_size); + err |=setup_sigcontext (&frame->uc.uc_mcontext, + regs, set->sig[0 ]); + err |=__copy_to_user (&frame->uc.uc_sigmask, set,sizeof (*set)); + +/* Set up to return from userspace. If provided, use a stub +already in userspace. */ +/* minus 8 is offset to cater for "rtsd r15,8" */ +if (ka->sa.sa_flags &SA_RESTORER ) { + regs->r15 = ((unsigned long )ka->sa.sa_restorer)-8 ; + }else { +/* addi r12, r0, __NR_sigreturn */ + err |=__put_user (0x31800000 | __NR_rt_sigreturn , + frame->tramp +0 ); +/* brki r14, 0x8 */ + err |=__put_user (0xb9cc0008 , frame->tramp +1 ); + +/* Return from sighandler will jump to the tramp. +Negative 8 offset because return is rtsd r15, 8 */ + regs->r15 = ((unsigned long )frame->tramp)-8 ; + +#if 0 +flush_cache_sigtramp ((unsigned long )frame->tramp); +#endif + } + +if (err) + goto give_sigsegv; + +/* Set up registers for signal handler */ + regs->r1 = (unsigned long ) frame; +/* Signal handler args: */ + regs->r5 = signal;/* arg 0: signum */ + regs->r6 = (unsigned long ) &frame->info;/* arg 1: siginfo */ + regs->r7 = (unsigned long ) &frame->uc;/* arg2: ucontext */ +/* Offset to handle microblaze rtid r14, 0 */ + regs->pc = (unsigned long )ka->sa.sa_handler; + +set_fs (USER_DS ); + +#ifdef DEBUG_SIG +printk (KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n" , + current->comm, current->pid, frame, regs->pc); +#endif + +return ; + +give_sigsegv: +if (sig ==SIGSEGV ) + ka->sa.sa_handler =SIG_DFL ; +force_sig (SIGSEGV , current); +} + +/* Handle restarting system calls */ +static inline void +handle_restart (struct pt_regs *regs,struct k_sigaction *ka,int has_handler) +{ +switch (regs->r3) { +case -ERESTART_RESTARTBLOCK : +case -ERESTARTNOHAND : +if (!has_handler) + goto do_restart; + regs->r3 = -EINTR ; +break ; +case -ERESTARTSYS : +if (has_handler && !(ka->sa.sa_flags &SA_RESTART )) { + regs->r3 = -EINTR ; +break ; + } +/* fallthrough */ +case -ERESTARTNOINTR : +do_restart: +/* offset of 4 bytes to re-execute trap (brki) instruction */ + regs->pc -=4 ; +break ; + } +} + +/* +* OK, we're invoking a handler +*/ + +static void +handle_signal (unsigned long sig,struct k_sigaction *ka, +siginfo_t *info,sigset_t *oldset,struct pt_regs *regs) +{ +/* Set up the stack frame */ +if (ka->sa.sa_flags &SA_SIGINFO ) +setup_rt_frame (sig, ka, info, oldset, regs); +else +setup_frame (sig, ka, oldset, regs); + +if (ka->sa.sa_flags &SA_ONESHOT ) + ka->sa.sa_handler =SIG_DFL ; + +if (!(ka->sa.sa_flags &SA_NODEFER )) { +spin_lock_irq (¤t->sighand->siglock); +sigorsets (¤t->blocked, + ¤t->blocked, &ka->sa.sa_mask); +sigaddset (¤t->blocked, sig); +recalc_sigpending (); +spin_unlock_irq (¤t->sighand->siglock); + } +} + +/* +* Note that 'init' is a special process: it doesn't get signals it doesn't +* want to handle. Thus you cannot kill init even with a SIGKILL even by +* mistake. +* +* Note that we go through the signals twice: once to check the signals that +* the kernel can handle, and then we build all the user-level signal handling +* stack-frames in one go after that. +*/ +int do_signal (struct pt_regs *regs,sigset_t *oldset,int in_syscall) +{ +siginfo_t info; +int signr; +struct k_sigaction ka; +#ifdef DEBUG_SIG +printk (KERN_INFO "do signal: %p %p %d\n" , regs, oldset, in_syscall); +printk (KERN_INFO "do signal2: %lx %lx %ld [%lx]\n" , regs->pc, regs->r1, + regs->r12,current_thread_info ()->flags); +#endif +/* +* We want the common case to go fast, which +* is why we may in certain cases get here from +* kernel mode. Just return without doing anything +* if so. +*/ +if (!user_mode (regs)) +return 1 ; + +if (!oldset) + oldset = ¤t->blocked; + + signr =get_signal_to_deliver (&info, &ka, regs,NULL ); +if (signr >0 ) { +/* Whee! Actually deliver the signal. */ +if (in_syscall) +handle_restart (regs, &ka,1 ); +handle_signal (signr, &ka, &info, oldset, regs); +return 1 ; + } + +if (in_syscall) +handle_restart (regs,NULL ,0 ); + +/* Did we come from a system call? */ +return 0 ; +}
include/asm-microblaze/signal.h new file +199 -0
199 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 8/52 Interrupt handling, timer support, supported function
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/hack.c | 88 +++++++++++++++++++++++++ arch/microblaze/kernel/intc.c | 141 ++++++++++++++++++++++++++++++++++++++++ arch/microblaze/kernel/irq.c | 88 +++++++++++++++++++++++++ arch/microblaze/kernel/timer.c | 134 ++++++++++++++++++++++++++++++++++++++ include/asm-microblaze/hack.h | 19 ++++++ include/asm-microblaze/irq.h | 34 ++++++++++ 6 files changed, 504 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/hack.c create mode 100644 arch/microblaze/kernel/intc.c create mode 100644 arch/microblaze/kernel/irq.c create mode 100644 arch/microblaze/kernel/timer.c create mode 100644 include/asm-microblaze/hack.h create mode 100644 include/asm-microblaze/irq.h
arch/microblaze/kernel/hack.c new file +88 -0
@@ -0,0 +1,88 @@ +/* +* arch/microblaze/kernel/hack.c +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2007 Michal Simek <[email protected]> +*/ + +#include <linux/interrupt.h> +#include <asm/hack.h> + +#undef DEBUG + +#ifdef DEBUG +#define DBG(fmt...) printk(fmt) +#else +#define DBG(fmt...) +#endif + +/* NOTE +* self-modified part of code for improvement of interrupt controller +* save instruction in interrupt rutine +*/ +void function_hack (const int *arr_fce,const unsigned int base) +{ +unsigned int flags =0 ; +unsigned int j, i; +unsigned int *addr =NULL ; + +local_irq_save (flags); +__disable_icache (); + +/* zero terminated array */ +for (j =0 ; arr_fce[j] !=0 ; j++) { +/* get start address of function */ + addr = (unsigned int *) arr_fce[j]; +DBG ("%s: func(%d) at 0x%x\n" , + __FUNCTION__, j, (unsigned int ) addr); +for (i =0 ;; i++) { +DBG ("%s: instruction code at %d: 0x%x\n" , + __FUNCTION__, i, addr[i]); +if (addr[i] ==0xb0001234 ) { +/* detecting of lwi or swi instruction */ +if ((addr[i+1 ] &0xec00ff00 ) ==0xe800ff00 ) { +DBG ("%s: curr instr, " +"(%d):0x%x, " +"next(%d):0x%x\n" , + __FUNCTION__, i, addr[i], i+1 , + addr[i+1 ]); + addr[i] =0xb0000000 + (base >>16 ); + addr[i+1 ] = (addr[i+1 ] &0xffff00ff ) + + (base &0xffff ); +__invalidate_icache (addr[i]); +__invalidate_icache (addr[i+1 ]); +DBG ("%s: hack instr, " +"(%d):0x%x, " +"next(%d):0x%x\n" , + __FUNCTION__, i, addr[i], i+1 , + addr[i+1 ]); + }else /* detection addik for ack */ +if ((addr[i+1 ] &0xfc00ff00 ) ==0x3000ff00 ) { +DBG ("%s: curr instr, " +"(%d):0x%x, " +"next(%d):0x%x\n" , + __FUNCTION__, i, addr[i], i+1 , + addr[i+1 ]); + addr[i] =0xb0000000 + (base >>16 ); + addr[i+1 ] = (addr[i+1 ] &0xffff00ff ) + + (base &0xffff ); +__invalidate_icache (addr[i]); +__invalidate_icache (addr[i+1 ]); +DBG ("%s: hack instr, " +"(%d):0x%x, " +"next(%d):0x%x\n" , + __FUNCTION__, i, addr[i], i+1 , + addr[i+1 ]); + } + }else if (addr[i] ==0xb60f0008 ) { +DBG ("%s: end of array %d\n" , + __FUNCTION__, i); +break ; + } + } + } +local_irq_restore (flags); +}/* end of self-modified code */
arch/microblaze/kernel/intc.c new file +141 -0
141 lines not on this page · raw message
arch/microblaze/kernel/irq.c new file +88 -0
88 lines not on this page · raw message
arch/microblaze/kernel/timer.c new file +134 -0
134 lines not on this page · raw message
include/asm-microblaze/hack.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* include/asm-microblaze/hack.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2007 Michal Simek <[email protected]> +*/ + +/* +* HACK_BASE_ADDR is constant address for hack function. +* do not change this value - it is hardcoded in hack function +* arch/microblaze/kernel/hack.c:function_hack() +*/ + +#define HACK_BASE_ADDR 0x1234ff00 + +void function_hack (const int *arr_fce,const unsigned int base);
include/asm-microblaze/irq.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* include/asm-microblaze/irq.h +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Atmark Techno, Inc. +*/ + +#ifndef _ASM_IRQ_H +#define _ASM_IRQ_H + +#include <linux/seq_file.h> +#define NR_IRQS 32 +#include <linux/irq.h> + +extern unsigned int NR_IRQ ; +extern void ledoff (void ); + +#define NO_IRQ (-1) + +static inline int irq_canonicalize (int irq) +{ +return (irq); +} + +struct pt_regs ; +extern void do_IRQ (struct pt_regs *regs); +extern void __init init_IRQ (void ); +int show_interrupts (struct seq_file *p,void *v); +irqreturn_t timer_interrupt (int irq,void *dev_id); + +#endif /* _ASM_IRQ_H */
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 9/52 cache support
From: Michal Simek <[email protected]>
--- arch/microblaze/kernel/cpu/cache.c | 256 +++++++++++++++++++++++++++++++++++ include/asm-microblaze/cache.h | 47 +++++++ include/asm-microblaze/cacheflush.h | 72 ++++++++++ 3 files changed, 375 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/kernel/cpu/cache.c create mode 100644 include/asm-microblaze/cache.h create mode 100644 include/asm-microblaze/cacheflush.h
arch/microblaze/kernel/cpu/cache.c new file +256 -0
@@ -0,0 +1,256 @@ +/* +* arch/microblaze/kernel/cpu/cache.c +* Cache control for MicroBlaze cache memories +* +* Copyright (C) 2007 Michal Simek <[email protected]> +* Copyright (C) 2007 PetaLogix +* Copyright (C) 2007 John Williams <[email protected]> +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file COPYING in the main directory of this +* archive for more details. +* +*/ + +#include <asm/cacheflush.h> +#include <asm/cache.h> +#include <asm/cpuinfo.h> + +/* Exported functions */ + +void _enable_icache (void ) +{ +if (cpuinfo->use_icache) { +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR + __asm__ __volatile__ (" \ +msrset r0, %0; \ +nop; " \ + : \ + :"i" (MSR_ICE ) \ + :"memory" ); +#else + __asm__ __volatile__ (" \ +mfs r12, rmsr; \ +ori r12, r12, %0; \ +mts rmsr, r12; \ +nop; " \ + : \ + :"i" (MSR_ICE ) \ + :"memory" ,"r12" ); +#endif + } +} + +void _disable_icache (void ) +{ +if (cpuinfo->use_icache) { +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR + __asm__ __volatile__ (" \ +msrclr r0, %0; \ +nop; " \ + : \ + :"i" (MSR_ICE ) \ + :"memory" ); +#else + __asm__ __volatile__ (" \ +mfs r12, rmsr; \ +andi r12, r12, ~%0; \ +mts rmsr, r12; \ +nop; " \ + : \ + :"i" (MSR_ICE ) \ + :"memory" ,"r12" ); +#endif + } +} + +void _invalidate_icache (unsigned int addr) +{ +if (cpuinfo->use_icache) { + __asm__ __volatile__ (" \ +wic %0, r0" \ + : \ + :"r" (addr)); + } +} + +void _enable_dcache (void ) +{ +if (cpuinfo->use_dcache) { +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR + __asm__ __volatile__ (" \ +msrset r0, %0; \ +nop; " \ + : \ + :"i" (MSR_DCE ) \ + :"memory" ); +#else + __asm__ __volatile__ (" \ +mfs r12, rmsr; \ +ori r12, r12, %0; \ +mts rmsr, r12; \ +nop; " \ + : \ + :"i" (MSR_DCE ) \ + :"memory" ,"r12" ); +#endif + } +} + +void _disable_dcache (void ) +{ +if (cpuinfo->use_dcache) { +#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR + __asm__ __volatile__ (" \ +msrclr r0, %0; \ +nop; " \ + : \ + :"i" (MSR_DCE ) \ + :"memory" ); +#else + __asm__ __volatile__ (" \ +mfs r12, rmsr; \ +andi r12, r12, ~%0; \ +mts rmsr, r12; \ +nop; " \ + : \ + :"i" (MSR_DCE ) \ + :"memory" ,"r12" ); +#endif + } +} + +void _invalidate_dcache (unsigned int addr) +{ +if (cpuinfo->use_dcache) + __asm__ __volatile__ (" \ +wdc %0, r0" \ + : \ + :"r" (addr)); +} + +void __flush_icache_all (void ) +{ +unsigned int i; +unsigned flags; + +if (cpuinfo->use_icache) { +local_irq_save (flags); +__disable_icache (); + +/* Just loop through cache size and invalidate, no need to add +CACHE_BASE address */ +for (i =0 ; i < cpuinfo->icache_size; + i += cpuinfo->icache_line) +__invalidate_icache (i); + +__enable_icache (); +local_irq_restore (flags); + } +} + +void __flush_icache_range (unsigned long start,unsigned long end) +{ +unsigned int i; +unsigned flags; +unsigned int align; + +if (cpuinfo->use_icache) { +/* +* No need to cover entire cache range, +* just cover cache footprint +*/ + end =min (start + cpuinfo->icache_size, end); + align = ~(cpuinfo->icache_line -1 ); + start &= align;/* Make sure we are aligned */ +/* Push end up to the next cache line */ + end = ((end & align) + cpuinfo->icache_line); + +local_irq_save (flags); +__disable_icache (); + +for (i = start; i < end; i += cpuinfo->icache_line) +__invalidate_icache (i); + +__enable_icache (); +local_irq_restore (flags); + } +} + +void __flush_icache_page (struct vm_area_struct *vma,struct page *page) +{ +__flush_icache_all (); +} + +void __flush_icache_user_range (struct vm_area_struct *vma, +struct page *page,unsigned long adr, +int len) +{ +__flush_icache_all (); +} + +void __flush_cache_sigtramp (unsigned long addr) +{ +__flush_icache_range (addr, addr +8 ); +} + +void __flush_dcache_all (void ) +{ +unsigned int i; +unsigned flags; + +if (cpuinfo->use_dcache) { +local_irq_save (flags); +__disable_dcache (); + +/* +* Just loop through cache size and invalidate, +* no need to add CACHE_BASE address +*/ +for (i =0 ; i < cpuinfo->dcache_size; + i += cpuinfo->dcache_line) +__invalidate_dcache (i); + +__enable_dcache (); +local_irq_restore (flags); + } +} + +void __flush_dcache_range (unsigned long start,unsigned long end) +{ +unsigned int i; +unsigned flags; +unsigned int align; + +if (cpuinfo->use_dcache) { +/* +* No need to cover entire cache range, +* just cover cache footprint +*/ + end =min (start + cpuinfo->dcache_size, end); + align = ~(cpuinfo->dcache_line -1 ); + start &= align;/* Make sure we are aligned */ +/* Push end up to the next cache line */ + end = ((end & align) + cpuinfo->dcache_line); +local_irq_save (flags); +__disable_dcache (); + +for (i = start; i < end; i += cpuinfo->dcache_line) +__invalidate_dcache (i); + +__enable_dcache (); +local_irq_restore (flags); + } +} + +void __flush_dcache_page (struct vm_area_struct *vma,struct page *page) +{ +__flush_dcache_all (); +} + +void __flush_dcache_user_range (struct vm_area_struct *vma, +struct page *page,unsigned long adr, +int len) +{ +__flush_dcache_all (); +}
include/asm-microblaze/cache.h new file +47 -0
47 lines not on this page · raw message
include/asm-microblaze/cacheflush.h new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
Re: [PATCH 03/52] [microblaze] Cpuinfo handling
In reply to [email protected]arch/microblaze/kernel/cpu/cpuinfo-static.c line 22
Quoted 4 lines · On Jan 24 2008 16:03, [email protected] wrote:
arch/microblaze/kernel/cpu/cpuinfo-static.c new file +4
-0+ +static char family_string[] =CONFIG_XILINX_MICROBLAZE0_FAMILY ; +static char cpu_ver_string[] =CONFIG_XILINX_MICROBLAZE0_HW_VER ; +
I have not checked - can mark these const?
arch/microblaze/kernel/cpu/cpuinfo.c line 21
Quoted 5 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +3
-0+ +static struct cpuinfo the_cpuinfo; +struct cpuinfo *cpuinfo = &the_cpuinfo;
Why is this indirection needed?
Quoted 1 line
+static struct
cpu_ver_keythe_cpu_ver_lookup[] = {
^const?
Quoted 6 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +6
-0+/* These key value are as per MBV field in PVR0 */ + {"5.00.a", 0x01}, + {"5.00.b", 0x02}, + {"5.00.c", 0x03}, + {"6.00.a", 0x04}, + {"6.00.b", 0x06},
arch/microblaze/kernel/cpu/cpuinfo.c line 39
Quoted 10 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +10
-0+ {"7.00.a", 0x05}, +/* FIXME There is no keycode defined in MBV for these versions */ + {"2.10.a", 0x10}, + {"3.00.a", 0x20}, + {"4.00.a", 0x30}, + {"4.00.b", 0x40}, + {NULL, 0}, +}; +struct cpu_ver_key *cpu_ver_lookup = + (struct cpu_ver_key *) the_cpu_ver_lookup;
Again an indirection. And the case, you guessed it, is redundant (check other code too).
arch/microblaze/kernel/cpu/cpuinfo.c line 44
Quoted 4 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +4
-0+/* +* FIXME Not sure if the actual key is defined by Xilinx in the PVR +*/ +static struct family_string_key the_family_string_lookup[] = {
const?
Quoted 4 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +4
-0+ {"virtex2", 0x4}, + {"virtex2pro", 0x5}, + {"spartan3", 0x6}, + {"virtex4", 0x7},
arch/microblaze/kernel/cpu/cpuinfo.c line 58
Quoted 10 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +10
-0+ {"virtex5", 0x8}, + {"spartan3e", 0x9}, + {"spartan3a", 0xa}, + {"spartan3an", 0xb}, +/* FIXME There is no key code defined for spartan2 */ + {"spartan2", 0xf0}, + {NULL, 0}, +}; +struct family_string_key *family_string_lookup = + (struct family_string_key *) the_family_string_lookup;
Dito.
arch/microblaze/kernel/cpu/cpuinfo.c
Quoted 10 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +10
-0+#ifndef _ASM_CPUINFO_H +#define _ASM_CPUINFO_H + +#include <asm/prom.h> + +extern unsigned long loops_per_jiffy; + +/* CPU Version and FPGA Family code conversion table type */ +struct cpu_ver_key { + char *s;
const char *s; if you never modify s.
arch/microblaze/kernel/cpu/cpuinfo.c
Quoted 5 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +5
-0+unsigned k; +}; + +struct family_string_key { +char *s;
Dito.
Quoted 3 lines
arch/microblaze/kernel/cpu/cpuinfo.c new file +3
-0+unsigned k; +}; +
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [microblaze-uclinux] RE: [PATCH 24/52] [microblaze] time support
OK.
I will wait for it.
Michal
Quoted 45 lines
There's also a pretty stupid one in the tree at git.xilinx.com.
Steve
-----Original Message-----
From: John Williams [mailto:[email protected]]
Sent: Thu 2/21/2008 6:13 AM
To: [email protected]
Cc: [email protected]; Stephen Neuendorffer; [email protected]
Subject: Re: [PATCH 24/52] [microblaze] time supportHi Michal,
include/asm-microblaze/delay.h line 26
Quoted 11 lines · [email protected] wrote:
include/asm-microblaze/delay.h new file +7
-0@@ -0,0 +1,28 @@ +/* +* include/asm-microblaze/delay.h +* + +static inline void udelay(unsigned long usec) +{ +} We need a proper udelay implementation. I've got a semi-reasonable one in a private branch somewhere, will dig it out and send it to you.
Cheers,
John
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.3/1306 - Release Date: 1.3.2008 05:41
Re: [PATCH 17/52] [microblaze] checksum support
In reply to [email protected]Quoted 39 lines · On Thu, 24 Jan 2008, [email protected] wrote:
From: Michal Simek <[email protected]>
Signed-off-by Michal Simek <[email protected]>--- arch/microblaze/lib/checksum.c | 159 +++++++++++++++++++++++++++++++++++++ include/asm-microblaze/checksum.h | 101 +++++++++++++++++++++++ 2 files changed, 260 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/lib/checksum.c create mode 100644 include/asm-microblaze/checksum.harch/microblaze/lib/checksum.c new file +22
-0@@ -0,0 +1,159 @@ +/* +* INET An implementation of the TCP/IP protocol suite for the LINUX +* operating system. INET is implemented using the BSD Socket +* interface as the means of communication with the user level. +* +* IP/TCP/UDP checksumming routines +* +* Authors: Jorge Cwik, <[email protected]> +* Arnt Gulbrandsen, <[email protected]> +* Tom May, <[email protected]> +* Andreas Schwab, <[email protected]> +* Lots of code moved from tcp.c and ip.c; see those files +* for more names. +* +* 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek: +* Fixed some nasty bugs, causing some horrible crashes. +* A: At some points, the sum (%0) was used as +* length-counter instead of the length counter +* (%1). Thanks to Roman Hodek for pointing this out. +* B: GCC seems to mess up if one uses too many +* data-registers to hold input values and one tries to +* specify d0 and d1 as scratch registers. Letting gcc choose these
arch/microblaze/lib/checksum.c line 32
Quoted 10 lines
arch/microblaze/lib/checksum.c new file +10
-0+* registers itself solves the problem. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access +kills, so most of the assembly has to go. */
So basically this is a copy of arch/m68knommu/lib/checksum.c, with some checkpatch.pl fixes but without the sparse fixes? Furthermore, it's just plain C, so maybe we need a common one that can be shared by multiple archs?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Michal Simek
maintainerRe: [PATCH 17/52] [microblaze] checksum support
Hi Geert,
Quoted 8 lines
So basically this is a copy of
arch/m68knommu/lib/checksum.c, with some checkpatch.pl fixes but without the sparse fixes? Furthermore, it's just plain C, so maybe we need a common one that can be shared by multiple archs?Gr{oetje,eeting}s,
Geert
I have no sparse errors and warning in checksum.c file.
Michal Simek
www.monstr.eu
Re: [PATCH 17/52] [microblaze] checksum support
Quoted 7 lines · Michal Simek
Quoted 5 lines
So basically this is a copy of
arch/m68knommu/lib/checksum.c, with some checkpatch.pl fixes but without the sparse fixes? Furthermore, it's just plain C, so maybe we need a common one that can be shared by multiple archs?I have no sparse errors and warning in
checksum.cfile.
How come csum_partial_copy_from_user() in arch/m68knommu/lib/checksum.c has a __user attribute on the src parameter, while yours doesn't?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 17/52] [microblaze] checksum support
In reply to [email protected]arch/microblaze/lib/checksum.c line 139
Quoted 5 lines · On Jan 24 2008 16:02, [email protected] wrote:
arch/microblaze/lib/checksum.c new file +5
-0+ +/* +* copy from fs while checksumming, otherwise like csum_partial +*/ +
That comment got messed up. Also, does any other CPU than x86 have a %ds and %fs register?
If it copies directly from user context, a __user annotation would be helpful.
arch/microblaze/lib/checksum.c line 152
Quoted 13 lines
arch/microblaze/lib/checksum.c new file +13
-0+unsigned int +csum_partial_copy_from_user (const char *src,char *dst,int len,int sum, +int *csum_err) +{ +if (csum_err) + *csum_err =0 ; +memcpy (dst, src, len); +return csum_partial (dst, len, sum); +} + +/* +* copy from ds while checksumming, otherwise like csum_partial +*/
Ditto.
Quoted 12 lines
arch/microblaze/lib/checksum.c new file +7
-0+ +unsigned int +csum_partial_copy (const char *src,char *dst,int len,int sum) +{ +memcpy (dst, src, len); +return csum_partial (dst, len, sum); +}include/asm-microblaze/checksum.h new file +0
-0
Re: [PATCH 16/52] [microblaze] supported function for memory - kernel/lib
In reply to [email protected]arch/microblaze/lib/memcpy.c line 2
Quoted 8 lines · On Jan 24 2008 16:02, [email protected] wrote:
arch/microblaze/lib/memcpy.c new file +2
-0@@ -0,0 +1,159 @@ +/* Filename: memcpy.c +*
Please, no such filenames in files. It is redundant and hard to keep uptodate, should things move at one point in time.
arch/microblaze/lib/memcpy.c line 42
Quoted 5 lines
arch/microblaze/lib/memcpy.c new file +5
-0+#define BYTE_BLIT_STEP (d, s, h, o) \ + { register unsigned _v_; _v_ = *((unsigned *)(s))++; \ + *((unsigned *)(d))++ = (h) | _v_ >> (32-(o)); \ + (h) = _v_ << (o); \ + }
'register' is a relict from 30 years ago. Compilers likely ignore it these days, so it can jsut be removed anyway.
arch/microblaze/lib/memcpy.c line 9
Quoted 2 lines
arch/microblaze/lib/memcpy.c new file +2
-0+/* This code was put into place as we transitioned from gcc3 to gcc4. +* gcc4 does not support the syntax *((char *)d)++ which causes the
Of course not, because (char *)d is not an lvalue - and if you ask me, it is ambiguous and bogus code.
Assuming 'd' was int*, d++ would cause it to be incremented by 4.
If you incremented 'd' with char* semantics, it would be incremented by 1. But since 'd' is still int*, you now have an unaligned pointer, which is a problem in itself. We do not need more pitfalls than C already provides.
arch/microblaze/lib/memcpy.c line 11
Quoted 2 lines
arch/microblaze/lib/memcpy.c new file +2
-0+if (c >=4 ) { +unsigned x, a, h, align;
You will be wanting to use unsigned long since you are working with pointers.
arch/microblaze/lib/memcpy.c line 84
Quoted 13 lines
arch/microblaze/lib/memcpy.c new file +13
-0+/* Align the destination to a word boundry. */ +/* This is done in an endian independant manner. */ +switch ((unsigned ) d &3 ) { +case 1 : + *((char *) d)++ = *((char *) s)++; + c--; +case 2 : + *((char *) d)++ = *((char *) s)++; + c--; +case 3 : + *((char *) d)++ = *((char *) s)++; + c--; + }
This gets my strongest NAK. Please rewrite it in a sane manner. In other words, like this:
+void *memcpy(void *v_dest, const void *v_src, __kernel_size_t c) +{
+ const char *src = v_src;
+ char *dest = v_dest;
+
+ const uint32_t *i_src;
+ uint32_t *i_dest;
+
+ if (c >= 4) {
+ unsigned x, a, h, align;
+
+ /* Align the destination to a word boundry. */
+ /* This is done in an endian independant manner. */
+ switch ((unsigned long)dest & 3) {
+ case 1:
+ *dest++ = *src++;
+ --c;
+ case 2:
+ *dest++ = *src++;
+ --c;
+ case 3:
+ *dest++ = *src++;
+ --c;
+ }
+ /* Choose a copy scheme based on the source */
+ /* alignment relative to destination. */
+ switch ((unsigned long)src & 3) {
+ case 0x0: /* Both byte offsets are aligned */
+
+ i_src = (const void *)src;
+ i_dest = (void *)dest;
+
+ for (; c >= 4; c -= 4)
+ *i_dest++ = *i_src++;
+
+ src = (const void *)i_src;
+ dest = (void *)i_dest;
+
+ break;
+
+ case 0x1: /* Unaligned - Off by 1 */
...
The BYTE_BLIT_ macros need reworking. The suggestions so far should provide everything needed.
+ }
+
+ }
+
+ /* Finish off any remaining bytes */
+ /* simple fast copy, ... unless a cache boundry is crossed */
+ switch (c) {
+ case 3:
+ *dest++ = *src++;
+ case 2:
+ *dest++ = *src++;
+ case 1:
+ *dest++ = *src++;
+ }
+
+ return r;
+#endif
+}
- and voilà, you can use it even with gcc4.
The same goes for memmove.c and memset.c.
By the way, I think you should just replace lib/string.c's memcpy, etc. (which still do per-byte copying) with this optimized variant instead, so everyone can benefit.
Re: [PATCH 12/52] [microblaze] lmb support
In reply to [email protected]arch/microblaze/mm/lmb.c line 30
Quoted 8 lines · On Jan 24 2008 16:02, [email protected] wrote:
arch/microblaze/mm/lmb.c new file +8
-0+ +#define DEBUG + +#ifdef DEBUG +#define DBG(fmt...) printk(fmt) +#else +#define DBG(fmt...) +#endif
Phew, don't reinvent the wheel - use the existing pr_debug() instead.
arch/microblaze/mm/lmb.c line 65
Quoted 4 lines
arch/microblaze/mm/lmb.c new file +4
-0+static unsigned long __init lmb_addrs_overlap (unsigned long base1, +unsigned long size1,unsigned long base2,unsigned long size2) +{ +return ((base1 < (base2+size2)) && (base2 < (base1+size1)));
return base1 < base2 + size2 && base2 < base1 + size1;
Quoted 1 line
+}
Operator precedence makes it possible; you could omit a lot of () in the code. (Also try checkpatch.pl to get to know of other style 'errors')
Re: [PATCH 11/52] [microblaze] kernel modules support
In reply to [email protected]arch/microblaze/kernel/microblaze_ksyms.c line 22
Quoted 3 lines · On Jan 24 2008 16:02, [email protected] wrote:
arch/microblaze/kernel/microblaze_ksyms.c new file +3
-0+ +/* module handling */ +EXPORT_SYMBOL (PAGE_OFFSET );
This looks really ugly. PAGE_OFFSET is usually a macro. I looked in patch 29/52 where PAGE_OFFSET is defined (unsigned int PAGE_OFFSET), which got me wondered: PAGE_OFFSET can be a runtime variable when it is a constant on most other arches?
That being said, I'd use
#define PAGE_OFFSET __page_offset
in some header file and in the .c file:
unsigned int __page_offset; EXPORT_SYMBOL(__page_offset);
that is how arch-frv and -uml seem to do it.
Quoted 1 line · On Thu, 24 Jan 2008, [email protected] wrote:
I personally feel the biggest pain in header files.
26, 32, and 48 gave false positives in raising my interest :-)
+ * The user_ipc_perm structure for m68k architecture.
+ * The msqid64_ds structure for m68k architecture.
+ * The shmid64_ds structure for m68k architecture.
+ * The semid64_ds structure for m68k architecture.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
[email protected]
maintainerPATCH 1/52 Kconfig patches
From: Michal Simek <[email protected]>
--- arch/microblaze/Kconfig | 160 +++++++++++++++++++++++++ arch/microblaze/Kconfig.debug | 22 ++++ arch/microblaze/platform/Kconfig.platform | 46 +++++++ arch/microblaze/platform/generic/Kconfig.auto | 45 +++++++ 4 files changed, 273 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/Kconfig create mode 100644 arch/microblaze/Kconfig.debug create mode 100644 arch/microblaze/platform/Kconfig.platform create mode 100644 arch/microblaze/platform/generic/Kconfig.auto
arch/microblaze/Kconfig new file +160 -0
@@ -0,0 +1,160 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/config-language.txt. + +mainmenu "Linux/Microblaze Kernel Configuration" + +config MICROBLAZE + bool + default y + +config MMU + bool + default n + +config SWAP + bool + default n + +config RWSEM_GENERIC_SPINLOCK + bool + default y + +config RWSEM_XCHGADD_ALGORITHM + bool + + +config ARCH_HAS_ILOG2_U32 + bool + default n + +config ARCH_HAS_ILOG2_U64 + bool + default n + +config GENERIC_FIND_NEXT_BIT + bool + default y + +config GENERIC_HWEIGHT + bool + default y + +config GENERIC_HARDIRQS + bool + default y + +config GENERIC_IRQ_PROBE + bool + default y + +config GENERIC_CALIBRATE_DELAY + bool + default y + +config PCI + bool + default n + +config UID16 + bool + default y + +config DEFCONFIG_LIST + string + default "arch/$ARCH/defconfig" + +source "init/Kconfig" + +source "arch/microblaze/platform/Kconfig.platform" + +menu "Processor type and features" +config PREEMPT + bool "Preemptible Kernel" + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + This allows applications to run more reliably even when the system is + under load. + + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. + +config PREEMPT_TIMES + bool "Collect preemption latency times" + depends on PREEMPT + help + Allow collection for preemption latency times. + +config XILINX_UNCACHED_SHADOW + bool "Are you using uncached shadow for RAM ?" + depends on MICROBLAZE + default y + help + This is needed to be able to allocate uncachable memory regions. + The feature requires the design to define the RAM memory controller window + to be twice as large as the actual physical memory. + +config LARGE_ALLOCS + bool "Allow allocating large blocks (> 1MB) of memory" + help + Allow the slab memory allocator to keep chains for very large + memory sizes - upto 32MB. You may need this if your system has + a lot of RAM, and you need to able to allocate very large + contiguous chunks. If unsure, say N. + +comment "Boot options" + +config CMDLINE + string "Default kernel command string" + default "" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +config CMDLINE_FORCE + bool "Force default kernel command string" + help + Set this to have arguments from the default kernel command string + override those passed by the boot loader + +config OF + bool + default y + help + Set this to turn on OF + +config OF_DEVICE + bool + default y + help + Set this to turn on OF + +endmenu + +config APM_EMULATION + bool + +source "mm/Kconfig" + +menu "Exectuable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + +source "net/Kconfig" + +source "drivers/Kconfig" + +source "fs/Kconfig" + +source "arch/microblaze/Kconfig.debug" + +source "security/Kconfig" + +source "crypto/Kconfig" + +source "lib/Kconfig"
arch/microblaze/Kconfig.debug new file +22 -0
@@ -0,0 +1,22 @@ +menu "Kernel hacking" + +source "lib/Kconfig.debug" + +config EARLY_PRINTK + bool "EARLY_PRINTK" + default y + +config EARLY_PRINTK_UARTLITE_ADDRESS + hex "Physical address where UART Lite for early printk is mapped" + depends on EARLY_PRINTK + default "0x40600000" + help + Please enter physcal address where your uart lite is mapped + +config DEBUG_BOOTMEM + depends on DEBUG_KERNEL + bool "Debug BOOTMEM initialization" + +endmenu + +
arch/microblaze/platform/Kconfig.platform new file +46 -0
46 lines not on this page · raw message
arch/microblaze/platform/generic/Kconfig.auto new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
[email protected]
maintainerPATCH 2/52 Makefiles for Microblaze cpu
From: Michal Simek <[email protected]>
--- arch/microblaze/Makefile | 66 +++++++++++++++++++++++++++++ arch/microblaze/boot/Makefile | 17 +++++++ arch/microblaze/kernel/Makefile | 14 ++++++ arch/microblaze/kernel/cpu/Makefile | 8 ++++ arch/microblaze/lib/Makefile | 5 ++ arch/microblaze/mm/Makefile | 5 ++ arch/microblaze/platform/Makefile | 3 + arch/microblaze/platform/generic/Makefile | 5 ++ 8 files changed, 123 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/Makefile create mode 100644 arch/microblaze/boot/Makefile create mode 100644 arch/microblaze/kernel/Makefile create mode 100644 arch/microblaze/kernel/cpu/Makefile create mode 100644 arch/microblaze/lib/Makefile create mode 100644 arch/microblaze/mm/Makefile create mode 100644 arch/microblaze/platform/Makefile create mode 100644 arch/microblaze/platform/generic/Makefile
arch/microblaze/Makefile new file +66 -0
@@ -0,0 +1,66 @@ +UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\" + +# What CPU vesion are we building for, and crack it open +# as major.minor.rev +CPU_VER=$(subst ",,$(CONFIG_XILINX_MICROBLAZE0_HW_VER) ) +CPU_MAJOR=$(shell echo $(CPU_VER) | cut -d '.' -f 1) +CPU_MINOR=$(shell echo $(CPU_VER) | cut -d '.' -f 2) +CPU_REV=$(shell echo $(CPU_VER) | cut -d '.' -f 3) + +export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV + +# Use cpu-related CONFIG_ vars to set compile options. + +# Work out HW multipler support. This is icky. +# 1. Spartan2 has no HW multiplers. +# 2. MicroBlaze v3.x always uses them, except in Spartan 2 +# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings +ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY))) + ifeq ($(CPU_MAJOR),3) + CPUFLAGS-1 += -mno-xl-soft-mul + else + # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul support. + CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high + CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul + endif +endif +CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div +CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift +CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP) += -mxl-pattern-compare + +CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) + +# The various CONFIG_XILINX cpu features options are integers 0/1/2... +# rather than bools y/n +CFLAGS += $(CPUFLAGS-1) +CFLAGS += $(CPUFLAGS-2) + +# r31 holds current when in kernel mode +CFLAGS += -ffixed-r31 + +LDFLAGS_BLOB := --format binary --oformat elf32-microblaze + +LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) + +head-y := arch/microblaze/kernel/head.o +libs-y += arch/microblaze/lib/ $(LIBGCC) +core-y += arch/microblaze/kernel/ arch/microblaze/mm/ +# arch/microblaze/platform/ + + +boot := arch/$(ARCH)/boot + +all: linux.bin + + +archclean: + $(Q)$(MAKE) $(clean)=$(boot) + +linux.bin linux.bin.gz: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ + + +define archhelp + echo '* linux.bin - Create raw binary' + echo ' linux.bin.gz - Create compressed raw binary' +endef
arch/microblaze/boot/Makefile new file +17 -0
@@ -0,0 +1,17 @@ +# +# arch/microblaze/boot/Makefile +# + +targets := linux.bin linux.bin.gz + +OBJCOPYFLAGS_linux.bin := -O binary + +$(obj)/linux.bin: vmlinux FORCE + $(call if_changed,objcopy) + @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' + +$(obj)/linux.bin.gz: $(obj)/linux.bin FORCE + $(call if_changed,gzip) + @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' + +clean-kernel += linux.bin linux.bin.gz
arch/microblaze/kernel/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +# +# Makefile +# + +extra-y := head.o vmlinux.lds + +obj-y += early_printk.o entry.o exceptions.o hack.o heartbeat.o \ + hw_exception_handler.o init_task.o intc.o irq.o of_device.o \ + of_platform.o process.o prom.o prom_parse.o ptrace.o semaphore.o \ + setup.o signal.o sys_microblaze.o time.o timer.o traps.o + +obj-y += cpu/ + +obj-$(CONFIG_MODULES) += microblaze_ksyms.o module.o
arch/microblaze/kernel/cpu/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# Build the appropriate CPU version support +# + +EXTRA_CFLAGS += -DCPU_MAJOR=$(CPU_MAJOR) -DCPU_MINOR=$(CPU_MINOR) \ + -DCPU_REV=$(CPU_REV) + +obj-y += cache.o cpuinfo.o cpuinfo-pvr-full.o cpuinfo-static.o mb.o pvr.o
arch/microblaze/lib/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile +# + +lib-y := checksum.o memcpy.o memmove.o memset.o uaccess.o
arch/microblaze/mm/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile +# + +obj-y := consistent.o init.o lmb.o
arch/microblaze/platform/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# +# Makefile for arch/microblaze/platform directory +#
arch/microblaze/platform/generic/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Empty Makefile to keep make clean happy +# + +
Signature · 1 line
1.5.4.rc4.14.g6fc74
Re: [PATCH 01/52] [microblaze] Kconfig patches
In reply to [email protected]Quoted 21 lines · On Thu, 24 Jan 2008 16:05:18 +0100 [email protected] wrote:
From: Michal Simek <[email protected]>
Signed-off-by Michal Simek <[email protected]>--- arch/microblaze/Kconfig | 160 +++++++++++++++++++++++++ arch/microblaze/Kconfig.debug | 22 ++++ arch/microblaze/platform/Kconfig.platform | 46 +++++++ arch/microblaze/platform/generic/Kconfig.auto | 45 +++++++ 4 files changed, 273 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/Kconfig create mode 100644 arch/microblaze/Kconfig.debug create mode 100644 arch/microblaze/platform/Kconfig.platform create mode 100644 arch/microblaze/platform/generic/Kconfig.autoarch/microblaze/Kconfig new file +0
-0
arch/microblaze/Kconfig line 2
Quoted 2 lines
arch/microblaze/Kconfig new file +2
-0@@ -0,0 +1,160 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/config-language.txt.
It's kconfig-language.txt.
arch/microblaze/Kconfig line 8
Quoted 6 lines
arch/microblaze/Kconfig new file +6
-0+ +mainmenu "Linux/Microblaze Kernel Configuration" + +config MICROBLAZE + bool + default y
The one-line form:
def_bool y
is preferred, just to be more concise, use less screen real estate... Above and many times below.
Quoted 75 lines
arch/microblaze/Kconfig new file +75
-0+config MMU + bool + default n + +config SWAP + bool + default n + +config RWSEM_GENERIC_SPINLOCK + bool + default y + +config RWSEM_XCHGADD_ALGORITHM + bool + + +config ARCH_HAS_ILOG2_U32 + bool + default n + +config ARCH_HAS_ILOG2_U64 + bool + default n + +config GENERIC_FIND_NEXT_BIT + bool + default y + +config GENERIC_HWEIGHT + bool + default y + +config GENERIC_HARDIRQS + bool + default y + +config GENERIC_IRQ_PROBE + bool + default y + +config GENERIC_CALIBRATE_DELAY + bool + default y + +config PCI + bool + default n + +config UID16 + bool + default y + +config DEFCONFIG_LIST + string + default "arch/$ARCH/defconfig" + +source "init/Kconfig" + +source "arch/microblaze/platform/Kconfig.platform" + +menu "Processor type and features" +config PREEMPT + bool "Preemptible Kernel" + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + This allows applications to run more reliably even when the system is + under load. + + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. + +config PREEMPT_TIMES + bool "Collect preemption latency times"
arch/microblaze/Kconfig line 94
Quoted 10 lines
arch/microblaze/Kconfig new file +10
-0+ depends on PREEMPT + help + Allow collection for preemption latency times. + +config XILINX_UNCACHED_SHADOW + bool "Are you using uncached shadow for RAM ?" + depends on MICROBLAZE + default y + help + This is needed to be able to allocate uncachable memory regions.
We don't seem to spell uncacheable consistently.
Kernel source tree:
uncachable - 27 times
uncacheable - 53 times
google:
uncachable - 11,900 hits uncacheable - 26,700 hits
so I would use "uncacheable".
arch/microblaze/Kconfig line 102
Quoted 8 lines
arch/microblaze/Kconfig new file +8
-0+ The feature requires the design to define the RAM memory controller window + to be twice as large as the actual physical memory. + +config LARGE_ALLOCS + bool "Allow allocating large blocks (> 1MB) of memory" + help + Allow the slab memory allocator to keep chains for very large + memory sizes - upto 32MB. You may need this if your system has
s/upto/up to/
arch/microblaze/Kconfig line 104
Quoted 2 lines
arch/microblaze/Kconfig new file +2
-0+ a lot of RAM, and you need to able to allocate very large + contiguous chunks. If unsure, say N.
Please indent config symbol help text as indicated in Documentation/CodingStyle: one tab + 2 spaces for each line of help text. (Please check all help text.)
Quoted 6 lines
arch/microblaze/Kconfig new file +6
-0+comment "Boot options" + +config CMDLINE + string "Default kernel command string" + default "" + help
arch/microblaze/Kconfig line 121
Quoted 10 lines
arch/microblaze/Kconfig new file +10
-0+ On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +config CMDLINE_FORCE + bool "Force default kernel command string" + help + Set this to have arguments from the default kernel command string + override those passed by the boot loader
End with period (".").
arch/microblaze/Kconfig line 127
Quoted 6 lines
arch/microblaze/Kconfig new file +6
-0+ +config OF + bool + default y + help + Set this to turn on OF
End with period. Is this Open Firmware?
arch/microblaze/Kconfig line 133
Quoted 5 lines
arch/microblaze/Kconfig new file +5
-0+config OF_DEVICE + bool + default y + help + Set this to turn on OF
Ditto.
Quoted 36 lines
arch/microblaze/Kconfig new file +26
-0+endmenu + +config APM_EMULATION + bool + +source "mm/Kconfig" + +menu "Exectuable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + +source "net/Kconfig" + +source "drivers/Kconfig" + +source "fs/Kconfig" + +source "arch/microblaze/Kconfig.debug" + +source "security/Kconfig" + +source "crypto/Kconfig" + +source "lib/Kconfig"arch/microblaze/Kconfig.debug new file +4
-0@@ -0,0 +1,22 @@ +menu "Kernel hacking" + +source "lib/Kconfig.debug" +
arch/microblaze/Kconfig.debug line 14
Quoted 10 lines
arch/microblaze/Kconfig.debug new file +10
-0+config EARLY_PRINTK + bool "EARLY_PRINTK" + default y + +config EARLY_PRINTK_UARTLITE_ADDRESS + hex "Physical address where UART Lite for early printk is mapped" + depends on EARLY_PRINTK + default "0x40600000" + help + Please enter physcal address where your uart lite is mapped
End with period. s/physcal/physical/
Quoted 14 lines
arch/microblaze/Kconfig.debug new file +8
-0+ +config DEBUG_BOOTMEM + depends on DEBUG_KERNEL + bool "Debug BOOTMEM initialization" + +endmenu + +arch/microblaze/platform/Kconfig.platform new file +0
-0
arch/microblaze/platform/Kconfig.platform line 9
Quoted 9 lines
arch/microblaze/platform/Kconfig.platform new file +9
-0@@ -0,0 +1,46 @@ +# +# platform selection Kconfig menu for MicroBlaze targets +# +menu "Platform options" +choice + prompt "Platform" + default PLATFORM_MICROBLAZE_AUTO + help + Choose which hardware board/platform you are targeting
End with period.
arch/microblaze/platform/Kconfig.platform line 14
Quoted 5 lines
arch/microblaze/platform/Kconfig.platform new file +5
-0+ +config PLATFORM_GENERIC + bool "Generic" + help + Choose this option for the Generic platform
end with period.
arch/microblaze/platform/Kconfig.platform line 18
Quoted 3 lines
arch/microblaze/platform/Kconfig.platform new file +3
-0+endchoice + +# This is stil a bit broken - disabling for now JW 20070504
s/stil/still/
Quoted 4 lines
arch/microblaze/platform/Kconfig.platform new file +4
-0+config ALLOW_EDIT_AUTO + bool "Permit Display/edit of Kconfig.auto platform settings" + default n + help
arch/microblaze/platform/Kconfig.platform line 32
Quoted 10 lines
arch/microblaze/platform/Kconfig.platform new file +10
-0+ Allows the editing of auto-generated platform settings from + the Kconfig.auto file. Obviously this does not change the + underlying hardware, so be very careful if you go editing + these settings. + + Also, if you enable this, and edit various Kconfig.auto + settings, YOUR CHANGES WILL BE LOST if you then disable it + again. You have been warned! + + If unsure, say no
End with period.
Quoted 21 lines
arch/microblaze/platform/Kconfig.platform new file +13
-0+# Ok, the platform is chosen. Source the kconfig.auto to get all of the +# system settings. +# If user selected CONFIG_EDIT_AUTO, these will be rendered in gory detail +# and be able to be edited +comment "Automatic platform settings from Kconfig.auto" + depends on ALLOW_EDIT_AUTO + +if PLATFORM_GENERIC=y + source "arch/microblaze/platform/generic/Kconfig.auto" +endif + +endmenu +arch/microblaze/platform/generic/Kconfig.auto new file +2
-0@@ -0,0 +1,45 @@ +# +# Platform Kconfig menu for Microblaze generic board
arch/microblaze/platform/generic/Kconfig.auto line 12
Quoted 10 lines
arch/microblaze/platform/generic/Kconfig.auto new file +10
-0+# + +config KERNEL_BASE_ADDR + hex "Physical address where Linux Kernel is" + default "0x44000000" + help + BASE Address for kernel + +config XILINX_ERAM_SIZE + hex "Size address of XILINX_RAM" if ALLOW_EDIT_AUTO && XILINX_UNCACHED_SHADOW
What is a "Size address"?
Quoted 10 lines
arch/microblaze/platform/generic/Kconfig.auto new file +10
-0+ default 0x02000000 + +comment "Definitions for MICROBLAZE0" + depends on ALLOW_EDIT_AUTO + +config XILINX_MICROBLAZE0_FAMILY + string "Targetted FPGA family" if ALLOW_EDIT_AUTO + default spartan3e + +config XILINX_MICROBLAZE0_HW_VER
arch/microblaze/platform/generic/Kconfig.auto line 32
Quoted 10 lines
arch/microblaze/platform/generic/Kconfig.auto new file +10
-0+ string "Core version number" if ALLOW_EDIT_AUTO + default 5.00.c + +config XILINX_MICROBLAZE0_USE_MSR_INSTR + int "USE_MSR_INSTR" if ALLOW_EDIT_AUTO + default 1 + +config XILINX_MICROBLAZE0_USE_BARREL + int "USE_BARREL range (0:1)" if ALLOW_EDIT_AUTO + default 1
These (above & below) look like booleans. If you really need a range, config symbols can be specified as ranges. See Documentation/kbuild/kconfig-language.txt.
arch/microblaze/platform/generic/Kconfig.auto line 45
Quoted 13 lines
arch/microblaze/platform/generic/Kconfig.auto new file +12
-0+config XILINX_MICROBLAZE0_USE_DIV + int "USE_DIV range (0:1)" if ALLOW_EDIT_AUTO + default 1 + +config XILINX_MICROBLAZE0_USE_HW_MUL + int "USE_HW_MUL range (0:1)" if ALLOW_EDIT_AUTO + default 1 + +config XILINX_MICROBLAZE0_USE_FPU + int "USE_FPU range (0:1)" if ALLOW_EDIT_AUTO + default 0 +
---
~Randy
Michal Simek
maintainerPATCH 1/52 Kconfig patches v2
From cd9e680aa7a732c1ff1188a22f2a0950f5d24e3b Mon Sep 17 00:00:00 2001
Message-Id: <cd9e680aa7a732c1ff1188a22f2a0950f5d24e3b.1201429312.git.monstr@monstr.eu>
From: Michal Simek <[email protected]>
Date: Sun, 27 Jan 2008 11:21:34 +0100
Subject: [PATCH 1/1] [microblaze] Kconfig patches v2
---
arch/microblaze/Kconfig | 140 +++++++++++++++++++++++++ arch/microblaze/Kconfig.debug | 22 ++++ arch/microblaze/platform/Kconfig.platform | 48 +++++++++ arch/microblaze/platform/generic/Kconfig.auto | 51 +++++++++ 4 files changed, 261 insertions(+), 0 deletions(-)
create mode 100644 arch/microblaze/Kconfig
create mode 100644 arch/microblaze/Kconfig.debug create mode 100644 arch/microblaze/platform/Kconfig.platform create mode 100644 arch/microblaze/platform/generic/Kconfig.auto
arch/microblaze/Kconfig new file +140 -0
@@ -0,0 +1,140 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. + +mainmenu "Linux/Microblaze Kernel Configuration" + +config MICROBLAZE + def_bool y + +config MMU + def_bool n + +config SWAP + def_bool n + +config RWSEM_GENERIC_SPINLOCK + def_bool y + +config RWSEM_XCHGADD_ALGORITHM + bool + +config ARCH_HAS_ILOG2_U32 + def_bool n + +config ARCH_HAS_ILOG2_U64 + def_bool n + +config GENERIC_FIND_NEXT_BIT + def_bool y + +config GENERIC_HWEIGHT + def_bool y + +config GENERIC_HARDIRQS + def_bool y + +config GENERIC_IRQ_PROBE + def_bool y + +config GENERIC_CALIBRATE_DELAY + def_bool y + +config PCI + def_bool n + +config UID16 + def_bool y + +config DEFCONFIG_LIST + string + default "arch/$ARCH/defconfig" + +source "init/Kconfig" + +source "arch/microblaze/platform/Kconfig.platform" + +menu "Processor type and features" +config PREEMPT + bool "Preemptible Kernel" + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + This allows applications to run more reliably even when the system is + under load. + + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. + +config PREEMPT_TIMES + bool "Collect preemption latency times" + depends on PREEMPT + help + Allow collection for preemption latency times. + +config XILINX_UNCACHED_SHADOW + bool "Are you using uncached shadow for RAM ?" + depends on MICROBLAZE + default y + help + This is needed to be able to allocate uncachable memory regions. + The feature requires the design to define the RAM memory controller window + to be twice as large as the actual physical memory. + +config LARGE_ALLOCS + bool "Allow allocating large blocks (> 1MB) of memory" + help + Allow the slab memory allocator to keep chains for very large + memory sizes - up to 32MB. You may need this if your system has + a lot of RAM, and you need to able to allocate very large + contiguous chunks. If unsure, say N. + +comment "Boot options" + +config CMDLINE + string "Default kernel command string" + default "" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +config CMDLINE_FORCE + bool "Force default kernel command string" + help + Set this to have arguments from the default kernel command string + override those passed by the boot loader. + +config OF + def_bool y + +config OF_DEVICE + def_bool y + +endmenu + +config APM_EMULATION + bool + +source "mm/Kconfig" + +menu "Exectuable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + +source "net/Kconfig" + +source "drivers/Kconfig" + +source "fs/Kconfig" + +source "arch/microblaze/Kconfig.debug" + +source "security/Kconfig" + +source "crypto/Kconfig" + +source "lib/Kconfig"
arch/microblaze/Kconfig.debug new file +22 -0
@@ -0,0 +1,22 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. + +menu "Kernel hacking" + +source "lib/Kconfig.debug" + +config EARLY_PRINTK + def_bool y + +config EARLY_PRINTK_UARTLITE_ADDRESS + hex "Physical address where UART Lite for early printk is mapped" + depends on EARLY_PRINTK + default "0x40600000" + help + Please enter physical address where your uart lite is mapped. + +config DEBUG_BOOTMEM + depends on DEBUG_KERNEL + bool "Debug BOOTMEM initialization" + +endmenu
arch/microblaze/platform/Kconfig.platform new file +48 -0
48 lines not on this page · raw message
arch/microblaze/platform/generic/Kconfig.auto new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
1.5.4.rc4.14.g6fc74
Re: [PATCH 01/52] [microblaze] Kconfig patches v2
Quoted 108 lines · On Sun, 27 Jan 2008 11:41:01 +0100 Michal Simek wrote:
From
cd9e680aa7a732c1ff1188a22f2a0950f5d24e3bMon Sep 17 00:00:00 2001
Message-Id:
<cd9e680aa7a732c1ff1188a22f2a0950f5d24e3b.1201429312.git.monstr@monstr.eu>
From: Michal Simek <[email protected]>
Date: Sun, 27 Jan 2008 11:21:34 +0100
Subject: [PATCH 1/1] [microblaze]Kconfigpatches v2Signed-off-by Michal Simek <[email protected]>--- arch/microblaze/Kconfig | 140 +++++++++++++++++++++++++ arch/microblaze/Kconfig.debug | 22 ++++ arch/microblaze/platform/Kconfig.platform | 48 +++++++++ arch/microblaze/platform/generic/Kconfig.auto | 51 +++++++++ 4 files changed, 261 insertions(+), 0 deletions(-) create mode 100644 arch/microblaze/Kconfig create mode 100644 arch/microblaze/Kconfig.debug create mode 100644 arch/microblaze/platform/Kconfig.platform create mode 100644 arch/microblaze/platform/generic/Kconfig.autoarch/microblaze/Kconfig new file +81
-0@@ -0,0 +1,140 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. + +mainmenu "Linux/Microblaze Kernel Configuration" + +config MICROBLAZE + def_bool y + +config MMU + def_bool n + +config SWAP + def_bool n + +config RWSEM_GENERIC_SPINLOCK + def_bool y + +config RWSEM_XCHGADD_ALGORITHM + bool + +config ARCH_HAS_ILOG2_U32 + def_bool n + +config ARCH_HAS_ILOG2_U64 + def_bool n + +config GENERIC_FIND_NEXT_BIT + def_bool y + +config GENERIC_HWEIGHT + def_bool y + +config GENERIC_HARDIRQS + def_bool y + +config GENERIC_IRQ_PROBE + def_bool y + +config GENERIC_CALIBRATE_DELAY + def_bool y + +config PCI + def_bool n + +config UID16 + def_bool y + +config DEFCONFIG_LIST + string + default "arch/$ARCH/defconfig" + +source "init/Kconfig" + +source "arch/microblaze/platform/Kconfig.platform" + +menu "Processor type and features" +config PREEMPT + bool "Preemptible Kernel" + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + This allows applications to run more reliably even when the system is + under load. + + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. + +config PREEMPT_TIMES + bool "Collect preemption latency times" + depends on PREEMPT + help + Allow collection for preemption latency times. + +config XILINX_UNCACHED_SHADOW + bool "Are you using uncached shadow for RAM ?" + depends on MICROBLAZE + default y + help + This is needed to be able to allocate uncachable memory regions. + The feature requires the design to define the RAM memory
Quoted 2 lines
controller window
+ to be twice as large as the actual physical memory.
Hi,
In my MUA, the "controller window" text is on a line by itself but it shouldn't be. (http://lkml.org/lkml/2008/1/27/85
shows the same condition.)
I guess that Thunderbird is doing this for you (sadly). Please see if Documentation/email-clients.txt can help you with this.
A larger issue is that I don't see any tabs in the patch. Kconfig reserved words (like bool and def_bool) should be indented by 1 tab, and help text by 1 tab + 2 spaces.
I suppose that Thunderbird could have done this also. :(
Quoted 190 lines
arch/microblaze/Kconfig new file +58
-0+ +config LARGE_ALLOCS + bool "Allow allocating large blocks (> 1MB) of memory" + help + Allow the slab memory allocator to keep chains for very large + memory sizes - up to 32MB. You may need this if your system has + a lot of RAM, and you need to able to allocate very large + contiguous chunks. If unsure, say N. + +comment "Boot options" + +config CMDLINE + string "Default kernel command string" + default "" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +config CMDLINE_FORCE + bool "Force default kernel command string" + help + Set this to have arguments from the default kernel command string + override those passed by the boot loader. + +config OF + def_bool y + +config OF_DEVICE + def_bool y + +endmenu + +config APM_EMULATION + bool + +source "mm/Kconfig" + +menu "Exectuable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + +source "net/Kconfig" + +source "drivers/Kconfig" + +source "fs/Kconfig" + +source "arch/microblaze/Kconfig.debug" + +source "security/Kconfig" + +source "crypto/Kconfig" + +source "lib/Kconfig"arch/microblaze/Kconfig.debug new file +22
-0@@ -0,0 +1,22 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. + +menu "Kernel hacking" + +source "lib/Kconfig.debug" + +config EARLY_PRINTK + def_bool y + +config EARLY_PRINTK_UARTLITE_ADDRESS + hex "Physical address where UART Lite for early printk is mapped" + depends on EARLY_PRINTK + default "0x40600000" + help + Please enter physical address where your uart lite is mapped. + +config DEBUG_BOOTMEM + depends on DEBUG_KERNEL + bool "Debug BOOTMEM initialization" + +endmenuarch/microblaze/platform/Kconfig.platform new file +48
-0@@ -0,0 +1,48 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# +# Platform selection Kconfig menu for MicroBlaze targets +# + +menu "Platform options" +choice + prompt "Platform" + default PLATFORM_MICROBLAZE_AUTO + help + Choose which hardware board/platform you are targeting. + +config PLATFORM_GENERIC + bool "Generic" + help + Choose this option for the Generic platform. + +endchoice + +# This is still a bit broken - disabling for now JW 20070504 +config ALLOW_EDIT_AUTO + bool "Permit Display/edit of Kconfig.auto platform settings" + default n + help + Allows the editing of auto-generated platform settings from + the Kconfig.auto file. Obviously this does not change the + underlying hardware, so be very careful if you go editing + these settings. + + Also, if you enable this, and edit various Kconfig.auto + settings, YOUR CHANGES WILL BE LOST if you then disable it + again. You have been warned! + + If unsure, say no. + +# Ok, the platform is chosen. Source the kconfig.auto to get all of the +# system settings. +# If user selected CONFIG_EDIT_AUTO, these will be rendered in gory detail +# and be able to be edited +comment "Automatic platform settings from Kconfig.auto" + depends on ALLOW_EDIT_AUTO + +if PLATFORM_GENERIC=y + source "arch/microblaze/platform/generic/Kconfig.auto" +endif + +endmenuarch/microblaze/platform/generic/Kconfig.auto new file +41
-0@@ -0,0 +1,51 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# +# Platform Kconfig menu for Microblaze generic board +# + +config KERNEL_BASE_ADDR + hex "Physical address where Linux Kernel is" + default "0x44000000" + help + BASE Address for kernel + +config XILINX_ERAM_SIZE + hex "Memory size of XILINX_RAM" if XILINX_UNCACHED_SHADOW + default 0x02000000 + +comment "Definitions for MICROBLAZE0" + depends on ALLOW_EDIT_AUTO + +config XILINX_MICROBLAZE0_FAMILY + string "Targetted FPGA family" if ALLOW_EDIT_AUTO + default spartan3e + +config XILINX_MICROBLAZE0_HW_VER + string "Core version number" if ALLOW_EDIT_AUTO + default 5.00.c + +config XILINX_MICROBLAZE0_USE_MSR_INSTR + int "USE_MSR_INSTR" if ALLOW_EDIT_AUTO + default 1 + range 0 1 + +config XILINX_MICROBLAZE0_USE_BARREL + int "USE_BARREL" if ALLOW_EDIT_AUTO + default 1 + range 0 1 + +config XILINX_MICROBLAZE0_USE_DIV + int "USE_DIV" if ALLOW_EDIT_AUTO + default 1 + range 0 1
arch/microblaze/platform/generic/Kconfig.auto line 51
Quoted 10 lines
arch/microblaze/platform/generic/Kconfig.auto new file +10
-0+ +config XILINX_MICROBLAZE0_USE_HW_MUL + int "USE_HW_MUL" if ALLOW_EDIT_AUTO + default 1 + range 0 2 + +config XILINX_MICROBLAZE0_USE_FPU + int "USE_FPU" if ALLOW_EDIT_AUTO + default 0 + range 0 1
---
~Randy
Michal Simek
maintainerRe: [PATCH 01/52] [microblaze] Kconfig patches
In reply to Randy DunlapHi Randy,
thanks for review. Comments are below.
Quoted 12 lines
arch/microblaze/Kconfig line 2
Quoted 9 lines
arch/microblaze/Kconfig new file +2
-0@@ -0,0 +1,160 @@ +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/config-language.txt.It's kconfig-language.txt.
I fix it
Quoted 4 lines
Quoted 4 lines
arch/microblaze/Kconfig new file +4
-0+ +mainmenu "Linux/Microblaze Kernel Configuration" + +config MICROBLAZE
Quoted 9 lines
arch/microblaze/Kconfig line 8
Quoted 3 lines
arch/microblaze/Kconfig new file +2
-0+ bool + default yThe one-line form:
def_booly
is preferred, just to be more concise, use less screen real estate... Above and many times below.
fix.
Quoted 89 lines
Quoted 76 lines
arch/microblaze/Kconfig new file +75
-0+config MMU + bool + default n + +config SWAP + bool + default n + +config RWSEM_GENERIC_SPINLOCK + bool + default y + +config RWSEM_XCHGADD_ALGORITHM + bool + + +config ARCH_HAS_ILOG2_U32 + bool + default n + +config ARCH_HAS_ILOG2_U64 + bool + default n + +config GENERIC_FIND_NEXT_BIT + bool + default y + +config GENERIC_HWEIGHT + bool + default y + +config GENERIC_HARDIRQS + bool + default y + +config GENERIC_IRQ_PROBE + bool + default y + +config GENERIC_CALIBRATE_DELAY + bool + default y + +config PCI + bool + default n + +config UID16 + bool + default y + +config DEFCONFIG_LIST + string + default "arch/$ARCH/defconfig" + +source "init/Kconfig" + +source "arch/microblaze/platform/Kconfig.platform" + +menu "Processor type and features" +config PREEMPT + bool "Preemptible Kernel" + help + This option reduces the latency of the kernel when reacting to + real-time or interactive events by allowing a low priority process to + be preempted even if it is in kernel mode executing a system call. + This allows applications to run more reliably even when the system is + under load. + + Say Y here if you are building a kernel for a desktop, embedded + or real-time system. Say N if you are unsure. + +config PREEMPT_TIMES + bool "Collect preemption latency times"arch/microblaze/Kconfig line 94
Quoted 10 lines
arch/microblaze/Kconfig new file +10
-0+ depends on PREEMPT + help + Allow collection for preemption latency times. + +config XILINX_UNCACHED_SHADOW + bool "Are you using uncached shadow for RAM ?" + depends on MICROBLAZE + default y + help + This is needed to be able to allocate uncachable memory regions.We don't seem to spell uncacheable consistently.
Quoted 10 lines
Kernel source tree:
uncachable - 27 times
uncacheable - 53 times
google:uncachable - 11,900 hits uncacheable - 26,700 hitsso I would use "uncacheable".
I don't know if is spelling correct. But I tried to find count of uncached in kernel tree and a result is interesting. For me is not problem to change it.
$ grep -rn "uncached" * | grep -v "microblaze" | grep "*" | wc -l 198
Quoted 12 lines
arch/microblaze/Kconfig line 102
Quoted 9 lines
arch/microblaze/Kconfig new file +8
-0+ The feature requires the design to define the RAM memory controller window + to be twice as large as the actual physical memory. + +config LARGE_ALLOCS + bool "Allow allocating large blocks (> 1MB) of memory" + help + Allow the slab memory allocator to keep chains for very large + memory sizes - upto 32MB. You may need this if your system hass/upto/up to/
fix.
Quoted 8 lines
arch/microblaze/Kconfig line 104
Quoted 3 lines
arch/microblaze/Kconfig new file +2
-0+ a lot of RAM, and you need to able to allocate very large + contiguous chunks. If unsure, say N.Please indent config symbol help text as indicated in
Documentation/CodingStyle: one tab + 2 spaces for each line of help text. (Please check all help text.)
fix in all Kconfig files.
Quoted 11 lines
Quoted 11 lines
arch/microblaze/Kconfig new file +11
-0+comment "Boot options" + +config CMDLINE + string "Default kernel command string" + default "" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. +
Quoted 9 lines
arch/microblaze/Kconfig line 121
Quoted 6 lines
arch/microblaze/Kconfig new file +5
-0+config CMDLINE_FORCE + bool "Force default kernel command string" + help + Set this to have arguments from the default kernel command string + override those passed by the boot loaderEnd with period (".").
fix in all Kconfig files.
Quoted 11 lines
arch/microblaze/Kconfig line 127
Quoted 7 lines
arch/microblaze/Kconfig new file +6
-0+ +config OF + bool + default y + help + Set this to turn on OFEnd with period. Is this Open Firmware?
Quoted 9 lines
arch/microblaze/Kconfig line 133
Quoted 6 lines
arch/microblaze/Kconfig new file +5
-0+config OF_DEVICE + bool + default y + help + Set this to turn on OFDitto.
Yes. Microblaze architecture use Open Firmware files. I set to this value with def_boot y without help part.
Quoted 15 lines
Quoted 15 lines
arch/microblaze/Kconfig.debug new file +9
-0@@ -0,0 +1,22 @@ +menu "Kernel hacking" + +source "lib/Kconfig.debug" + +config EARLY_PRINTK + bool "EARLY_PRINTK" + default y + +config EARLY_PRINTK_UARTLITE_ADDRESS
Quoted 9 lines
arch/microblaze/Kconfig.debug line 14
Quoted 6 lines
arch/microblaze/Kconfig.debug new file +5
-0+ hex "Physical address where UART Lite for early printk is mapped" + depends on EARLY_PRINTK + default "0x40600000" + help + Please enter physcal address where your uart lite is mappedEnd with period. s/physcal/physical/
fix + all period faults.
Quoted 7 lines
arch/microblaze/Kconfig.debug line 17
Quoted 4 lines
arch/microblaze/Kconfig.debug new file +3
-0+endchoice + +# This is stil a bit broken - disabling for now JW 20070504s/stil/still/
fix
Quoted 13 lines
Quoted 13 lines
arch/microblaze/platform/generic/Kconfig.auto new file +7
-0@@ -0,0 +1,45 @@ +# +# Platform Kconfig menu for Microblaze generic board +# + +config KERNEL_BASE_ADDR + hex "Physical address where Linux Kernel is" + default "0x44000000"
Quoted 9 lines
arch/microblaze/platform/generic/Kconfig.auto line 12
Quoted 6 lines
arch/microblaze/platform/generic/Kconfig.auto new file +5
-0+ help + BASE Address for kernel + +config XILINX_ERAM_SIZE + hex "Size address of XILINX_RAM" if ALLOW_EDIT_AUTO && XILINX_UNCACHED_SHADOWWhat is a "Size address"?
Size address is physical size of main memory - fix.
Quoted 17 lines
Quoted 17 lines
arch/microblaze/platform/generic/Kconfig.auto new file +17
-0+ default 0x02000000 + +comment "Definitions for MICROBLAZE0" + depends on ALLOW_EDIT_AUTO + +config XILINX_MICROBLAZE0_FAMILY + string "Targetted FPGA family" if ALLOW_EDIT_AUTO + default spartan3e + +config XILINX_MICROBLAZE0_HW_VER + string "Core version number" if ALLOW_EDIT_AUTO + default 5.00.c + +config XILINX_MICROBLAZE0_USE_MSR_INSTR + int "USE_MSR_INSTR" if ALLOW_EDIT_AUTO + default 1 +
Quoted 9 lines
arch/microblaze/platform/generic/Kconfig.auto line 32
Quoted 4 lines
arch/microblaze/platform/generic/Kconfig.auto new file +3
-0+config XILINX_MICROBLAZE0_USE_BARREL + int "USE_BARREL range (0:1)" if ALLOW_EDIT_AUTO + default 1These (above & below) look like booleans. If you really need a range, config symbols can be specified as ranges. See
Documentation/kbuild/kconfig-language.txt.
Fix is with range property.
Quoted 9 lines
Quoted 9 lines
arch/microblaze/platform/generic/Kconfig.auto new file +9
-0+config XILINX_MICROBLAZE0_USE_DIV + int "USE_DIV range (0:1)" if ALLOW_EDIT_AUTO + default 1 + +config XILINX_MICROBLAZE0_USE_HW_MUL + int "USE_HW_MUL range (0:1)" if ALLOW_EDIT_AUTO + default 1 + +config XILINX_MICROBLAZE0_USE_FPU
Quoted 8 lines
arch/microblaze/platform/generic/Kconfig.auto line 45
Quoted 5 lines
arch/microblaze/platform/generic/Kconfig.auto new file +3
-0+ int "USE_FPU range (0:1)" if ALLOW_EDIT_AUTO + default 0 +---
~Randy
Regards,
Michal Simek