avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
86
u-boot/arch/microblaze/include/asm/asm.h
Normal file
86
u-boot/arch/microblaze/include/asm/asm.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* (C) Copyright 2007 Michal Simek
|
||||
*
|
||||
* Michal SIMEK <monstr@monstr.eu>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/* FSL macros */
|
||||
#define NGET(val, fslnum) \
|
||||
__asm__ __volatile__ ("nget %0, rfsl" #fslnum :"=r" (val));
|
||||
|
||||
#define GET(val, fslnum) \
|
||||
__asm__ __volatile__ ("get %0, rfsl" #fslnum :"=r" (val));
|
||||
|
||||
#define NCGET(val, fslnum) \
|
||||
__asm__ __volatile__ ("ncget %0, rfsl" #fslnum :"=r" (val));
|
||||
|
||||
#define CGET(val, fslnum) \
|
||||
__asm__ __volatile__ ("cget %0, rfsl" #fslnum :"=r" (val));
|
||||
|
||||
#define NPUT(val, fslnum) \
|
||||
__asm__ __volatile__ ("nput %0, rfsl" #fslnum ::"r" (val));
|
||||
|
||||
#define PUT(val, fslnum) \
|
||||
__asm__ __volatile__ ("put %0, rfsl" #fslnum ::"r" (val));
|
||||
|
||||
#define NCPUT(val, fslnum) \
|
||||
__asm__ __volatile__ ("ncput %0, rfsl" #fslnum ::"r" (val));
|
||||
|
||||
#define CPUT(val, fslnum) \
|
||||
__asm__ __volatile__ ("cput %0, rfsl" #fslnum ::"r" (val));
|
||||
|
||||
/* CPU dependent */
|
||||
/* machine status register */
|
||||
#define MFS(val, reg) \
|
||||
__asm__ __volatile__ ("mfs %0," #reg :"=r" (val));
|
||||
|
||||
#define MTS(val, reg) \
|
||||
__asm__ __volatile__ ("mts " #reg ", %0"::"r" (val));
|
||||
|
||||
/* get return address from interrupt */
|
||||
#define R14(val) \
|
||||
__asm__ __volatile__ ("addi %0, r14, 0":"=r" (val));
|
||||
|
||||
/* get return address from interrupt */
|
||||
#define R17(val) \
|
||||
__asm__ __volatile__ ("addi %0, r17, 0" : "=r" (val));
|
||||
|
||||
#define NOP __asm__ __volatile__ ("nop");
|
||||
|
||||
/* use machine status registe USE_MSR_REG */
|
||||
#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 1
|
||||
#define MSRSET(val) \
|
||||
__asm__ __volatile__ ("msrset r0," #val );
|
||||
|
||||
#define MSRCLR(val) \
|
||||
__asm__ __volatile__ ("msrclr r0," #val );
|
||||
|
||||
#else
|
||||
#define MSRSET(val) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
ori %0, %0, "#val"; \
|
||||
mts rmsr, %0; \
|
||||
nop;" \
|
||||
: "=r" (tmp) \
|
||||
: "d" (val) \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define MSRCLR(val) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
andi %0, %0, ~"#val"; \
|
||||
mts rmsr, %0; \
|
||||
nop;" \
|
||||
: "=r" (tmp) \
|
||||
: "d" (val) \
|
||||
: "memory"); \
|
||||
}
|
||||
#endif
|
||||
375
u-boot/arch/microblaze/include/asm/bitops.h
Normal file
375
u-boot/arch/microblaze/include/asm/bitops.h
Normal file
@@ -0,0 +1,375 @@
|
||||
#ifndef _MICROBLAZE_BITOPS_H
|
||||
#define _MICROBLAZE_BITOPS_H
|
||||
|
||||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
*/
|
||||
|
||||
#include <asm/byteorder.h> /* swab32 */
|
||||
#include <asm/system.h> /* save_flags */
|
||||
#include <asm-generic/bitops/fls.h>
|
||||
#include <asm-generic/bitops/__fls.h>
|
||||
#include <asm-generic/bitops/fls64.h>
|
||||
#include <asm-generic/bitops/__ffs.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* The __ functions are not atomic
|
||||
*/
|
||||
|
||||
/*
|
||||
* ffz = Find First Zero in word. Undefined if no zero exists,
|
||||
* so code should check against ~0UL first..
|
||||
*/
|
||||
static inline unsigned long ffz(unsigned long word)
|
||||
{
|
||||
unsigned long result = 0;
|
||||
|
||||
while(word & 1) {
|
||||
result++;
|
||||
word >>= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static inline void set_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
*a |= mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
static inline void __set_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
*a |= mask;
|
||||
}
|
||||
#define PLATFORM__SET_BIT
|
||||
|
||||
/*
|
||||
* clear_bit() doesn't provide any barrier for the compiler.
|
||||
*/
|
||||
#define smp_mb__before_clear_bit() barrier()
|
||||
#define smp_mb__after_clear_bit() barrier()
|
||||
|
||||
static inline void clear_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
*a &= ~mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
#define __clear_bit(nr, addr) clear_bit(nr, addr)
|
||||
#define PLATFORM__CLEAR_BIT
|
||||
|
||||
static inline void change_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
unsigned long *ADDR = (unsigned long *) addr;
|
||||
|
||||
ADDR += nr >> 5;
|
||||
mask = 1 << (nr & 31);
|
||||
save_flags_cli(flags);
|
||||
*ADDR ^= mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
static inline void __change_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask;
|
||||
unsigned long *ADDR = (unsigned long *) addr;
|
||||
|
||||
ADDR += nr >> 5;
|
||||
mask = 1 << (nr & 31);
|
||||
*ADDR ^= mask;
|
||||
}
|
||||
|
||||
static inline int test_and_set_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a |= mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int __test_and_set_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a |= mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int test_and_clear_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a &= ~mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int __test_and_clear_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a &= ~mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int test_and_change_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a ^= mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int __test_and_change_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a ^= mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine doesn't need to be atomic.
|
||||
*/
|
||||
static inline int __constant_test_bit(int nr, const volatile void *addr)
|
||||
{
|
||||
return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
|
||||
}
|
||||
|
||||
static inline int __test_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
return ((mask & *a) != 0);
|
||||
}
|
||||
|
||||
#define test_bit(nr,addr) \
|
||||
(__builtin_constant_p(nr) ? \
|
||||
__constant_test_bit((nr),(addr)) : \
|
||||
__test_bit((nr),(addr)))
|
||||
|
||||
#define find_first_zero_bit(addr, size) \
|
||||
find_next_zero_bit((addr), (size), 0)
|
||||
|
||||
static inline int find_next_zero_bit(void *addr, int size, int offset)
|
||||
{
|
||||
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
|
||||
unsigned long result = offset & ~31UL;
|
||||
unsigned long tmp;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
size -= result;
|
||||
offset &= 31UL;
|
||||
if (offset) {
|
||||
tmp = *(p++);
|
||||
tmp |= ~0UL >> (32-offset);
|
||||
if (size < 32)
|
||||
goto found_first;
|
||||
if (~tmp)
|
||||
goto found_middle;
|
||||
size -= 32;
|
||||
result += 32;
|
||||
}
|
||||
while (size & ~31UL) {
|
||||
if (~(tmp = *(p++)))
|
||||
goto found_middle;
|
||||
result += 32;
|
||||
size -= 32;
|
||||
}
|
||||
if (!size)
|
||||
return result;
|
||||
tmp = *p;
|
||||
|
||||
found_first:
|
||||
tmp |= ~0UL >> size;
|
||||
found_middle:
|
||||
return result + ffz(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* hweightN: returns the hamming weight (i.e. the number
|
||||
* of bits set) of a N-bit word
|
||||
*/
|
||||
|
||||
#define hweight32(x) generic_hweight32(x)
|
||||
#define hweight16(x) generic_hweight16(x)
|
||||
#define hweight8(x) generic_hweight8(x)
|
||||
|
||||
|
||||
static inline int ext2_set_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
unsigned long flags;
|
||||
volatile unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *ADDR) != 0;
|
||||
*ADDR |= mask;
|
||||
restore_flags(flags);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int ext2_clear_bit(int nr, volatile void *addr)
|
||||
{
|
||||
int mask, retval;
|
||||
unsigned long flags;
|
||||
volatile unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *ADDR) != 0;
|
||||
*ADDR &= ~mask;
|
||||
restore_flags(flags);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int ext2_test_bit(int nr, const volatile void *addr)
|
||||
{
|
||||
int mask;
|
||||
const volatile unsigned char *ADDR = (const unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
return ((mask & *ADDR) != 0);
|
||||
}
|
||||
|
||||
#define ext2_find_first_zero_bit(addr, size) \
|
||||
ext2_find_next_zero_bit((addr), (size), 0)
|
||||
|
||||
static inline unsigned long ext2_find_next_zero_bit(void *addr,
|
||||
unsigned long size, unsigned long offset)
|
||||
{
|
||||
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
|
||||
unsigned long result = offset & ~31UL;
|
||||
unsigned long tmp;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
size -= result;
|
||||
offset &= 31UL;
|
||||
if(offset) {
|
||||
/* We hold the little endian value in tmp, but then the
|
||||
* shift is illegal. So we could keep a big endian value
|
||||
* in tmp, like this:
|
||||
*
|
||||
* tmp = __swab32(*(p++));
|
||||
* tmp |= ~0UL >> (32-offset);
|
||||
*
|
||||
* but this would decrease preformance, so we change the
|
||||
* shift:
|
||||
*/
|
||||
tmp = *(p++);
|
||||
tmp |= __swab32(~0UL >> (32-offset));
|
||||
if(size < 32)
|
||||
goto found_first;
|
||||
if(~tmp)
|
||||
goto found_middle;
|
||||
size -= 32;
|
||||
result += 32;
|
||||
}
|
||||
while(size & ~31UL) {
|
||||
if(~(tmp = *(p++)))
|
||||
goto found_middle;
|
||||
result += 32;
|
||||
size -= 32;
|
||||
}
|
||||
if(!size)
|
||||
return result;
|
||||
tmp = *p;
|
||||
|
||||
found_first:
|
||||
/* tmp is little endian, so we would have to swab the shift,
|
||||
* see above. But then we have to swab tmp below for ffz, so
|
||||
* we might as well do this here.
|
||||
*/
|
||||
return result + ffz(__swab32(tmp) | (~0UL << size));
|
||||
found_middle:
|
||||
return result + ffz(__swab32(tmp));
|
||||
}
|
||||
|
||||
/* Bitmap functions for the minix filesystem. */
|
||||
#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
|
||||
#define minix_set_bit(nr,addr) set_bit(nr,addr)
|
||||
#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
|
||||
#define minix_test_bit(nr,addr) test_bit(nr,addr)
|
||||
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
|
||||
|
||||
/**
|
||||
* hweightN - returns the hamming weight of a N-bit word
|
||||
* @x: the word to weigh
|
||||
*
|
||||
* The Hamming Weight of a number is the total number of bits set in it.
|
||||
*/
|
||||
|
||||
#define hweight32(x) generic_hweight32(x)
|
||||
#define hweight16(x) generic_hweight16(x)
|
||||
#define hweight8(x) generic_hweight8(x)
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _MICROBLAZE_BITOPS_H */
|
||||
36
u-boot/arch/microblaze/include/asm/byteorder.h
Normal file
36
u-boot/arch/microblaze/include/asm/byteorder.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* include/asm-microblaze/byteorder.h -- Endian id and conversion ops
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001 NEC Corporation
|
||||
* Copyright (C) 2001 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* 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 <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_BYTEORDER_H__
|
||||
#define __MICROBLAZE_BYTEORDER_H__
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
|
||||
# define __BYTEORDER_HAS_U64__
|
||||
# define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef __MICROBLAZEEL__
|
||||
#include <linux/byteorder/little_endian.h>
|
||||
#else
|
||||
#include <linux/byteorder/big_endian.h>
|
||||
#endif
|
||||
|
||||
#endif /* __MICROBLAZE_BYTEORDER_H__ */
|
||||
22
u-boot/arch/microblaze/include/asm/cache.h
Normal file
22
u-boot/arch/microblaze/include/asm/cache.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The Chromium OS Authors.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_CACHE_H__
|
||||
#define __MICROBLAZE_CACHE_H__
|
||||
|
||||
/*
|
||||
* The microblaze can have either a 4 or 16 byte cacheline depending on whether
|
||||
* you are using OPB(4) or CacheLink(16). If the board config has not specified
|
||||
* a cacheline size we assume the larger value of 16 bytes for DMA buffer
|
||||
* alignment.
|
||||
*/
|
||||
#ifdef CONFIG_SYS_CACHELINE_SIZE
|
||||
#define ARCH_DMA_MINALIGN CONFIG_SYS_CACHELINE_SIZE
|
||||
#else
|
||||
#define ARCH_DMA_MINALIGN 16
|
||||
#endif
|
||||
|
||||
#endif /* __MICROBLAZE_CACHE_H__ */
|
||||
16
u-boot/arch/microblaze/include/asm/config.h
Normal file
16
u-boot/arch/microblaze/include/asm/config.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright 2009 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _ASM_CONFIG_H_
|
||||
#define _ASM_CONFIG_H_
|
||||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
#define CONFIG_NEEDS_MANUAL_RELOC
|
||||
#endif
|
||||
|
||||
#define CONFIG_NR_DRAM_BANKS 1
|
||||
|
||||
#endif
|
||||
1
u-boot/arch/microblaze/include/asm/errno.h
Normal file
1
u-boot/arch/microblaze/include/asm/errno.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <asm-generic/errno.h>
|
||||
20
u-boot/arch/microblaze/include/asm/global_data.h
Normal file
20
u-boot/arch/microblaze/include/asm/global_data.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_GBL_DATA_H
|
||||
#define __ASM_GBL_DATA_H
|
||||
|
||||
/* Architecture-specific global data */
|
||||
struct arch_global_data {
|
||||
};
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31")
|
||||
|
||||
#endif /* __ASM_GBL_DATA_H */
|
||||
14
u-boot/arch/microblaze/include/asm/gpio.h
Normal file
14
u-boot/arch/microblaze/include/asm/gpio.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef _ASM_MICROBLAZE_GPIO_H_
|
||||
#define _ASM_MICROBLAZE_GPIO_H_
|
||||
|
||||
#include <asm-generic/gpio.h>
|
||||
|
||||
/* Allocation functions */
|
||||
extern int gpio_alloc_dual(u32 baseaddr, const char *name, u32 gpio_no0,
|
||||
u32 gpio_no1);
|
||||
extern int gpio_alloc(u32 baseaddr, const char *name, u32 gpio_no);
|
||||
|
||||
#define gpio_status() gpio_info()
|
||||
extern void gpio_info(void);
|
||||
|
||||
#endif
|
||||
163
u-boot/arch/microblaze/include/asm/io.h
Normal file
163
u-boot/arch/microblaze/include/asm/io.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* include/asm-microblaze/io.h -- Misc I/O operations
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,02 NEC Corporation
|
||||
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* 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 <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_IO_H__
|
||||
#define __MICROBLAZE_IO_H__
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#define IO_SPACE_LIMIT 0xFFFFFFFF
|
||||
|
||||
#define readb(addr) \
|
||||
({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
|
||||
#define readw(addr) \
|
||||
({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
|
||||
#define readl(addr) \
|
||||
({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
|
||||
|
||||
#define writeb(b, addr) \
|
||||
(void)((*(volatile unsigned char *) (addr)) = (b))
|
||||
#define writew(b, addr) \
|
||||
(void)((*(volatile unsigned short *) (addr)) = (b))
|
||||
#define writel(b, addr) \
|
||||
(void)((*(volatile unsigned int *) (addr)) = (b))
|
||||
|
||||
#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))
|
||||
|
||||
#define inb(addr) readb (addr)
|
||||
#define inw(addr) readw (addr)
|
||||
#define inl(addr) readl (addr)
|
||||
#define outb(x, addr) ((void) writeb (x, addr))
|
||||
#define outw(x, addr) ((void) writew (x, addr))
|
||||
#define outl(x, addr) ((void) writel (x, addr))
|
||||
|
||||
/* Some #definitions to keep strange Xilinx code happy */
|
||||
#define in_8(addr) readb (addr)
|
||||
#define in_be16(addr) readw (addr)
|
||||
#define in_be32(addr) readl (addr)
|
||||
|
||||
#define out_8(addr,x ) outb (x,addr)
|
||||
#define out_be16(addr,x ) outw (x,addr)
|
||||
#define out_be32(addr,x ) outl (x,addr)
|
||||
|
||||
|
||||
#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))
|
||||
|
||||
/* Some defines to keep the MTD flash drivers happy */
|
||||
|
||||
#define __raw_readb readb
|
||||
#define __raw_readw readw
|
||||
#define __raw_readl readl
|
||||
#define __raw_writeb writeb
|
||||
#define __raw_writew writew
|
||||
#define __raw_writel writel
|
||||
|
||||
static inline void io_insb (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned char *p = dst;
|
||||
while (count--)
|
||||
*p++ = inb (port);
|
||||
}
|
||||
static inline void io_insw (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned short *p = dst;
|
||||
while (count--)
|
||||
*p++ = inw (port);
|
||||
}
|
||||
static inline void io_insl (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned long *p = dst;
|
||||
while (count--)
|
||||
*p++ = inl (port);
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_outsb (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned char *p = src;
|
||||
while (count--)
|
||||
outb (*p++, port);
|
||||
}
|
||||
static inline void
|
||||
io_outsw (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned short *p = src;
|
||||
while (count--)
|
||||
outw (*p++, port);
|
||||
}
|
||||
static inline void
|
||||
io_outsl (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned long *p = src;
|
||||
while (count--)
|
||||
outl (*p++, port);
|
||||
}
|
||||
|
||||
#define outsb(a,b,l) io_outsb(a,b,l)
|
||||
#define outsw(a,b,l) io_outsw(a,b,l)
|
||||
#define outsl(a,b,l) io_outsl(a,b,l)
|
||||
|
||||
#define insb(a,b,l) io_insb(a,b,l)
|
||||
#define insw(a,b,l) io_insw(a,b,l)
|
||||
#define insl(a,b,l) io_insl(a,b,l)
|
||||
|
||||
|
||||
#define iounmap(addr) ((void)0)
|
||||
#define ioremap(physaddr, size) (physaddr)
|
||||
#define ioremap_nocache(physaddr, size) (physaddr)
|
||||
#define ioremap_writethrough(physaddr, size) (physaddr)
|
||||
#define ioremap_fullcache(physaddr, size) (physaddr)
|
||||
|
||||
static inline void sync(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a physical address and a length, return a virtual address
|
||||
* that can be used to access the memory range with the caching
|
||||
* properties specified by "flags".
|
||||
*/
|
||||
#define MAP_NOCACHE (0)
|
||||
#define MAP_WRCOMBINE (0)
|
||||
#define MAP_WRBACK (0)
|
||||
#define MAP_WRTHROUGH (0)
|
||||
|
||||
static inline void *
|
||||
map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
|
||||
{
|
||||
return (void *)paddr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Take down a mapping set up by map_physmem().
|
||||
*/
|
||||
static inline void unmap_physmem(void *vaddr, unsigned long flags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline phys_addr_t virt_to_phys(void * vaddr)
|
||||
{
|
||||
return (phys_addr_t)(vaddr);
|
||||
}
|
||||
|
||||
#endif /* __MICROBLAZE_IO_H__ */
|
||||
36
u-boot/arch/microblaze/include/asm/microblaze_intc.h
Normal file
36
u-boot/arch/microblaze/include/asm/microblaze_intc.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* (C) Copyright 2007 Michal Simek
|
||||
*
|
||||
* Michal SIMEK <monstr@monstr.cz>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
typedef volatile struct microblaze_intc_t {
|
||||
int isr; /* interrupt status register */
|
||||
int ipr; /* interrupt pending register */
|
||||
int ier; /* interrupt enable register */
|
||||
int iar; /* interrupt acknowledge register */
|
||||
int sie; /* set interrupt enable bits */
|
||||
int cie; /* clear interrupt enable bits */
|
||||
int ivr; /* interrupt vector register */
|
||||
int mer; /* master enable register */
|
||||
} microblaze_intc_t;
|
||||
|
||||
struct irq_action {
|
||||
interrupt_handler_t *handler; /* pointer to interrupt rutine */
|
||||
void *arg;
|
||||
int count; /* number of interrupt */
|
||||
};
|
||||
|
||||
/**
|
||||
* Register and unregister interrupt handler rutines
|
||||
*
|
||||
* @param irq IRQ number
|
||||
* @param hdlr Interrupt handler rutine
|
||||
* @param arg Pointer to argument which is passed to int. handler rutine
|
||||
* @return 0 if registration pass, 1 if unregistration pass,
|
||||
* or an error code < 0 otherwise
|
||||
*/
|
||||
int install_interrupt_handler(int irq, interrupt_handler_t *hdlr,
|
||||
void *arg);
|
||||
27
u-boot/arch/microblaze/include/asm/microblaze_timer.h
Normal file
27
u-boot/arch/microblaze/include/asm/microblaze_timer.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* (C) Copyright 2007 Michal Simek
|
||||
*
|
||||
* Michal SIMEK <monstr@monstr.cz>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#define TIMER_ENABLE_ALL 0x400 /* ENALL */
|
||||
#define TIMER_PWM 0x200 /* PWMA0 */
|
||||
#define TIMER_INTERRUPT 0x100 /* T0INT */
|
||||
#define TIMER_ENABLE 0x080 /* ENT0 */
|
||||
#define TIMER_ENABLE_INTR 0x040 /* ENIT0 */
|
||||
#define TIMER_RESET 0x020 /* LOAD0 */
|
||||
#define TIMER_RELOAD 0x010 /* ARHT0 */
|
||||
#define TIMER_EXT_CAPTURE 0x008 /* CAPT0 */
|
||||
#define TIMER_EXT_COMPARE 0x004 /* GENT0 */
|
||||
#define TIMER_DOWN_COUNT 0x002 /* UDT0 */
|
||||
#define TIMER_CAPTURE_MODE 0x001 /* MDT0 */
|
||||
|
||||
typedef volatile struct microblaze_timer_t {
|
||||
int control; /* control/statuc register TCSR */
|
||||
int loadreg; /* load register TLR */
|
||||
int counter; /* timer/counter register */
|
||||
} microblaze_timer_t;
|
||||
|
||||
int timer_init(void);
|
||||
77
u-boot/arch/microblaze/include/asm/posix_types.h
Normal file
77
u-boot/arch/microblaze/include/asm/posix_types.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* include/asm-microblaze/posix_types.h -- Kernel versions of standard types
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* 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 <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_POSIX_TYPES_H__
|
||||
#define __MICROBLAZE_POSIX_TYPES_H__
|
||||
|
||||
typedef unsigned int __kernel_dev_t;
|
||||
typedef unsigned long __kernel_ino_t;
|
||||
typedef unsigned long long __kernel_ino64_t;
|
||||
typedef unsigned int __kernel_mode_t;
|
||||
typedef unsigned int __kernel_nlink_t;
|
||||
typedef long __kernel_off_t;
|
||||
typedef long long __kernel_loff_t;
|
||||
typedef int __kernel_pid_t;
|
||||
typedef unsigned short __kernel_ipc_pid_t;
|
||||
typedef unsigned int __kernel_uid_t;
|
||||
typedef unsigned int __kernel_gid_t;
|
||||
#ifdef __GNUC__
|
||||
typedef __SIZE_TYPE__ __kernel_size_t;
|
||||
#else
|
||||
typedef unsigned int __kernel_size_t;
|
||||
#endif
|
||||
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_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 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(fd, fd_set) \
|
||||
__set_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_CLR
|
||||
#define __FD_CLR(fd, fd_set) \
|
||||
__clear_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_ISSET
|
||||
#define __FD_ISSET(fd, fd_set) \
|
||||
__test_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_ZERO
|
||||
#define __FD_ZERO(fd_set) \
|
||||
memset (fd_set, 0, sizeof (*(fd_set *)fd_set))
|
||||
|
||||
#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
|
||||
|
||||
#endif /* __MICROBLAZE_POSIX_TYPES_H__ */
|
||||
21
u-boot/arch/microblaze/include/asm/processor.h
Normal file
21
u-boot/arch/microblaze/include/asm/processor.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Michal Simek <monstr@monstr.eu>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_MICROBLAZE_PROCESSOR_H
|
||||
#define __ASM_MICROBLAZE_PROCESSOR_H
|
||||
|
||||
/* References to section boundaries */
|
||||
|
||||
extern char __end[];
|
||||
extern char __text_start[];
|
||||
|
||||
/* Microblaze board initialization function */
|
||||
void board_init(void);
|
||||
|
||||
/* Watchdog functions */
|
||||
extern void hw_watchdog_disable(void);
|
||||
|
||||
#endif /* __ASM_MICROBLAZE_PROCESSOR_H */
|
||||
116
u-boot/arch/microblaze/include/asm/ptrace.h
Normal file
116
u-boot/arch/microblaze/include/asm/ptrace.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* include/asm-microblaze/ptrace.h -- Access to CPU registers
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* 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 <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_PTRACE_H__
|
||||
#define __MICROBLAZE_PTRACE_H__
|
||||
|
||||
|
||||
/* Microblaze general purpose registers with special meanings. */
|
||||
#define GPR_ZERO 0 /* constant zero */
|
||||
#define GPR_ASM 18 /* reserved for assembler */
|
||||
#define GPR_SP 1 /* stack pointer */
|
||||
#define GPR_GP 2 /* global data pointer */
|
||||
#define GPR_EP 30 /* `element pointer' */
|
||||
#define GPR_LP 15 /* link pointer (current return address) */
|
||||
|
||||
/* These aren't official names, but they make some code more descriptive. */
|
||||
#define GPR_ARG0 5
|
||||
#define GPR_ARG1 6
|
||||
#define GPR_ARG2 7
|
||||
#define GPR_ARG3 8
|
||||
#define GPR_ARG4 9
|
||||
#define GPR_ARG5 10
|
||||
#define GPR_RVAL0 3
|
||||
#define GPR_RVAL1 4
|
||||
#define GPR_RVAL GPR_RVAL0
|
||||
|
||||
#define NUM_GPRS 32
|
||||
|
||||
/* `system' registers. */
|
||||
/* Note these are old v850 values, microblaze has many fewer */
|
||||
#define SR_EIPC 0
|
||||
#define SR_EIPSW 1
|
||||
#define SR_FEPC 2
|
||||
#define SR_FEPSW 3
|
||||
#define SR_ECR 4
|
||||
#define SR_PSW 5
|
||||
#define SR_CTPC 16
|
||||
#define SR_CTPSW 17
|
||||
#define SR_DBPC 18
|
||||
#define SR_DBPSW 19
|
||||
#define SR_CTBP 20
|
||||
#define SR_DIR 21
|
||||
#define SR_ASID 23
|
||||
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
typedef unsigned long microblaze_reg_t;
|
||||
|
||||
/* How processor state is stored on the stack during a syscall/signal.
|
||||
If you change this structure, change the associated assembly-language
|
||||
macros below too (PT_*)! */
|
||||
struct pt_regs
|
||||
{
|
||||
/* General purpose registers. */
|
||||
microblaze_reg_t gpr[NUM_GPRS];
|
||||
|
||||
microblaze_reg_t pc; /* program counter */
|
||||
microblaze_reg_t psw; /* program status word */
|
||||
|
||||
microblaze_reg_t kernel_mode; /* 1 if in `kernel mode', 0 if user mode */
|
||||
microblaze_reg_t single_step; /* 1 if in single step mode */
|
||||
};
|
||||
|
||||
|
||||
#define instruction_pointer(regs) ((regs)->pc)
|
||||
#define user_mode(regs) (!(regs)->kernel_mode)
|
||||
|
||||
/* When a struct pt_regs is used to save user state for a system call in
|
||||
the kernel, the system call is stored in the space for R0 (since it's
|
||||
never used otherwise, R0 being a constant 0). Non-system-calls
|
||||
simply store 0 there. */
|
||||
#define PT_REGS_SYSCALL(regs) (regs)->gpr[0]
|
||||
#define PT_REGS_SET_SYSCALL(regs, val) ((regs)->gpr[0] = (val))
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
|
||||
/* The number of bytes used to store each register. */
|
||||
#define _PT_REG_SIZE 4
|
||||
|
||||
/* Offset of a general purpose register in a stuct pt_regs. */
|
||||
#define PT_GPR(num) ((num) * _PT_REG_SIZE)
|
||||
|
||||
/* Offsets of various special registers & fields in a struct pt_regs. */
|
||||
#define NUM_SPECIAL 4
|
||||
#define PT_PC ((NUM_GPRS + 0) * _PT_REG_SIZE)
|
||||
#define PT_PSW ((NUM_GPRS + 1) * _PT_REG_SIZE)
|
||||
#define PT_KERNEL_MODE ((NUM_GPRS + 2) * _PT_REG_SIZE)
|
||||
#define PT_SINGLESTEP ((NUM_GPRS + 3) * _PT_REG_SIZE)
|
||||
|
||||
#define PT_SYSCALL PT_GPR(0)
|
||||
|
||||
/* Size of struct pt_regs, including alignment. */
|
||||
#define PT_SIZE ((NUM_GPRS + NUM_SPECIAL) * _PT_REG_SIZE)
|
||||
|
||||
/* These are `magic' values for PTRACE_PEEKUSR that return info about where
|
||||
a process is located in memory. */
|
||||
#define PT_TEXT_ADDR (PT_SIZE + 1)
|
||||
#define PT_TEXT_LEN (PT_SIZE + 2)
|
||||
#define PT_DATA_ADDR (PT_SIZE + 3)
|
||||
#define PT_DATA_LEN (PT_SIZE + 4)
|
||||
|
||||
#endif /* __MICROBLAZE_PTRACE_H__ */
|
||||
11
u-boot/arch/microblaze/include/asm/sections.h
Normal file
11
u-boot/arch/microblaze/include/asm/sections.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The Chromium OS Authors.
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_MICROBLAZE_SECTIONS_H
|
||||
#define __ASM_MICROBLAZE_SECTIONS_H
|
||||
|
||||
#include <asm-generic/sections.h>
|
||||
|
||||
#endif
|
||||
16
u-boot/arch/microblaze/include/asm/spl.h
Normal file
16
u-boot/arch/microblaze/include/asm/spl.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* (C) Copyright 2013 - 2014 Xilinx, Inc
|
||||
*
|
||||
* Michal Simek <michal.simek@xilinx.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _ASM_MICROBLAZE_SPL_H_
|
||||
#define _ASM_MICROBLAZE_SPL_H_
|
||||
|
||||
#define BOOT_DEVICE_RAM 1
|
||||
#define BOOT_DEVICE_NOR 2
|
||||
#define BOOT_DEVICE_SPI 3
|
||||
|
||||
#endif
|
||||
29
u-boot/arch/microblaze/include/asm/string.h
Normal file
29
u-boot/arch/microblaze/include/asm/string.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* include/asm-microblaze/string.h -- Architecture specific string routines
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* 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 <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_STRING_H__
|
||||
#define __MICROBLAZE_STRING_H__
|
||||
|
||||
#if 0
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
|
||||
extern void *memcpy (void *, const void *, __kernel_size_t);
|
||||
extern void *memset (void *, int, __kernel_size_t);
|
||||
extern void *memmove (void *, const void *, __kernel_size_t);
|
||||
#endif
|
||||
|
||||
#endif /* __MICROBLAZE_STRING_H__ */
|
||||
161
u-boot/arch/microblaze/include/asm/system.h
Normal file
161
u-boot/arch/microblaze/include/asm/system.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* include/asm-microblaze/system.h -- Low-level interrupt/thread ops
|
||||
*
|
||||
* Copyright (C) 2003 John Williams (jwilliams@itee.uq.edu.au)
|
||||
* based upon microblaze version
|
||||
* Copyright (C) 2001 NEC Corporation
|
||||
* Copyright (C) 2001 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* 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 <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_SYSTEM_H__
|
||||
#define __MICROBLAZE_SYSTEM_H__
|
||||
|
||||
#if 0
|
||||
#include <linux/linkage.h>
|
||||
#endif
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
#define prepare_to_switch() do { } while (0)
|
||||
|
||||
/*
|
||||
* switch_to(n) should switch tasks to task ptr, first checking that
|
||||
* ptr isn't the current task, in which case it does nothing.
|
||||
*/
|
||||
struct thread_struct;
|
||||
extern void *switch_thread (struct thread_struct *last,
|
||||
struct thread_struct *next);
|
||||
#define switch_to(prev,next,last) do { \
|
||||
if (prev != next) { \
|
||||
(last) = switch_thread (&prev->thread, &next->thread); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Enable/disable interrupts. */
|
||||
#define __sti() \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
ori %0, %0, 2; \
|
||||
mts rmsr, %0" \
|
||||
: "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __cli() \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
andi %0, %0, ~2; \
|
||||
mts rmsr, %0" \
|
||||
: "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __save_flags(flags) \
|
||||
__asm__ __volatile__ ("mfs %0, rmsr" : "=r" (flags))
|
||||
#define __restore_flags(flags) \
|
||||
__asm__ __volatile__ ("mts rmsr, %0" :: "r" (flags))
|
||||
|
||||
#define __save_flags_cli(flags) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
andi %1, %0, ~2; \
|
||||
mts rmsr, %1;" \
|
||||
: "=r" (flags), "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __save_flags_sti(flags) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
ori %1, %0, 2; \
|
||||
mts rmsr, %1;" \
|
||||
: "=r" (flags) ,"=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
/* For spinlocks etc */
|
||||
#define local_irq_save(flags) __save_flags_cli (flags)
|
||||
#define local_irq_set(flags) __save_flags_sti (flags)
|
||||
#define local_irq_restore(flags) __restore_flags (flags)
|
||||
#define local_irq_disable() __cli ()
|
||||
#define local_irq_enable() __sti ()
|
||||
|
||||
#define cli() __cli ()
|
||||
#define sti() __sti ()
|
||||
#define save_flags(flags) __save_flags (flags)
|
||||
#define restore_flags(flags) __restore_flags (flags)
|
||||
#define save_flags_cli(flags) __save_flags_cli (flags)
|
||||
|
||||
/*
|
||||
* Force strict CPU ordering.
|
||||
* Not really required on microblaze...
|
||||
*/
|
||||
#define nop() __asm__ __volatile__ ("nop")
|
||||
#define mb() __asm__ __volatile__ ("nop" ::: "memory")
|
||||
#define rmb() mb ()
|
||||
#define wmb() mb ()
|
||||
#define set_mb(var, value) do { var = value; mb(); } while (0)
|
||||
#define set_wmb(var, value) do { var = value; wmb (); } while (0)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#define smp_mb() mb ()
|
||||
#define smp_rmb() rmb ()
|
||||
#define smp_wmb() wmb ()
|
||||
#else
|
||||
#define smp_mb() barrier ()
|
||||
#define smp_rmb() barrier ()
|
||||
#define smp_wmb() barrier ()
|
||||
#endif
|
||||
|
||||
#define xchg(ptr, with) \
|
||||
((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr))))
|
||||
#define tas(ptr) (xchg ((ptr), 1))
|
||||
|
||||
static inline unsigned long __xchg(unsigned long with,
|
||||
__volatile__ void *ptr, int size)
|
||||
{
|
||||
unsigned long tmp, flags;
|
||||
|
||||
save_flags_cli (flags);
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
tmp = *(unsigned char *)ptr;
|
||||
*(unsigned char *)ptr = with;
|
||||
break;
|
||||
case 2:
|
||||
tmp = *(unsigned short *)ptr;
|
||||
*(unsigned short *)ptr = with;
|
||||
break;
|
||||
case 4:
|
||||
tmp = *(unsigned long *)ptr;
|
||||
*(unsigned long *)ptr = with;
|
||||
break;
|
||||
}
|
||||
|
||||
restore_flags (flags);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endif /* __MICROBLAZE_SYSTEM_H__ */
|
||||
60
u-boot/arch/microblaze/include/asm/types.h
Normal file
60
u-boot/arch/microblaze/include/asm/types.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#ifndef _ASM_TYPES_H
|
||||
#define _ASM_TYPES_H
|
||||
|
||||
/*
|
||||
* This file is never included by application software unless
|
||||
* explicitly requested (e.g., via linux/types.h) in which case the
|
||||
* application is Linux specific so (user-) name space pollution is
|
||||
* not a major issue. However, for interoperability, libraries still
|
||||
* need to be careful to avoid a name clashes.
|
||||
*/
|
||||
|
||||
typedef unsigned short umode_t;
|
||||
|
||||
/*
|
||||
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
||||
* header files exported to user space
|
||||
*/
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
__extension__ typedef __signed__ long long __s64;
|
||||
__extension__ typedef unsigned long long __u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These aren't exported outside the kernel to avoid name space clashes
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef signed short s16;
|
||||
typedef unsigned short u16;
|
||||
|
||||
typedef signed int s32;
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef signed long long s64;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#define BITS_PER_LONG 32
|
||||
|
||||
/* Dma addresses are 32-bits wide. */
|
||||
|
||||
typedef u32 dma_addr_t;
|
||||
|
||||
typedef unsigned long phys_addr_t;
|
||||
typedef unsigned long phys_size_t;
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _ASM_TYPES_H */
|
||||
24
u-boot/arch/microblaze/include/asm/u-boot.h
Normal file
24
u-boot/arch/microblaze/include/asm/u-boot.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*
|
||||
********************************************************************
|
||||
* NOTE: This header file defines an interface to U-Boot. Including
|
||||
* this (unmodified) header file in another file is considered normal
|
||||
* use of U-Boot, and does *not* fall under the heading of "derived
|
||||
* work".
|
||||
********************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _U_BOOT_H_
|
||||
#define _U_BOOT_H_
|
||||
|
||||
#include <asm-generic/u-boot.h>
|
||||
|
||||
/* For image.h:image_check_target_arch() */
|
||||
#define IH_ARCH_DEFAULT IH_ARCH_MICROBLAZE
|
||||
|
||||
#endif /* _U_BOOT_H_ */
|
||||
1
u-boot/arch/microblaze/include/asm/unaligned.h
Normal file
1
u-boot/arch/microblaze/include/asm/unaligned.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <asm-generic/unaligned.h>
|
||||
Reference in New Issue
Block a user