Initial commit; kernel source import

This commit is contained in:
Nathan
2025-04-06 23:50:55 -05:00
commit 25c6d769f4
45093 changed files with 18199410 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# UAPI Header export list
header-y += sv_addr.agh
header-y += sv_addr_ag.h
header-y += svinto.h
header-y += user.h

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,139 @@
/*!**************************************************************************
*!
*! MACROS:
*! IO_MASK(reg,field)
*! IO_STATE(reg,field,state)
*! IO_EXTRACT(reg,field,val)
*! IO_STATE_VALUE(reg,field,state)
*! IO_BITNR(reg,field)
*! IO_WIDTH(reg,field)
*! IO_FIELD(reg,field,val)
*! IO_RD(reg)
*! All moderegister addresses and fields of these.
*!
*!**************************************************************************/
#ifndef __sv_addr_ag_h__
#define __sv_addr_ag_h__
#define __test_sv_addr__ 0
/*------------------------------------------------------------
!* General macros to manipulate moderegisters.
!*-----------------------------------------------------------*/
/* IO_MASK returns a mask for a specified bitfield in a register.
Note that this macro doesn't work when field width is 32 bits. */
#define IO_MASK(reg, field) IO_MASK_ (reg##_, field##_)
#define IO_MASK_(reg_, field_) \
( ( ( 1 << reg_##_##field_##_WIDTH ) - 1 ) << reg_##_##field_##_BITNR )
/* IO_STATE returns a constant corresponding to a one of the symbolic
states that the bitfield can have. (Shifted to correct position) */
#define IO_STATE(reg, field, state) IO_STATE_ (reg##_, field##_, _##state)
#define IO_STATE_(reg_, field_, _state) \
( reg_##_##field_##_state << reg_##_##field_##_BITNR )
/* IO_EXTRACT returns the masked and shifted value corresponding to the
bitfield can have. */
#define IO_EXTRACT(reg, field, val) IO_EXTRACT_ (reg##_, field##_, val)
#define IO_EXTRACT_(reg_, field_, val) ( (( ( ( 1 << reg_##_##field_##_WIDTH ) \
- 1 ) << reg_##_##field_##_BITNR ) & (val)) >> reg_##_##field_##_BITNR )
/* IO_STATE_VALUE returns a constant corresponding to a one of the symbolic
states that the bitfield can have. (Not shifted) */
#define IO_STATE_VALUE(reg, field, state) \
IO_STATE_VALUE_ (reg##_, field##_, _##state)
#define IO_STATE_VALUE_(reg_, field_, _state) ( reg_##_##field_##_state )
/* IO_FIELD shifts the val parameter to be aligned with the bitfield
specified. */
#define IO_FIELD(reg, field, val) IO_FIELD_ (reg##_, field##_, val)
#define IO_FIELD_(reg_, field_, val) ((val) << reg_##_##field_##_BITNR)
/* IO_BITNR returns the starting bitnumber of a bitfield. Bit 0 is
LSB and the returned bitnumber is LSB of the field. */
#define IO_BITNR(reg, field) IO_BITNR_ (reg##_, field##_)
#define IO_BITNR_(reg_, field_) (reg_##_##field_##_BITNR)
/* IO_WIDTH returns the width, in bits, of a bitfield. */
#define IO_WIDTH(reg, field) IO_WIDTH_ (reg##_, field##_)
#define IO_WIDTH_(reg_, field_) (reg_##_##field_##_WIDTH)
/*--- Obsolete. Kept for backw compatibility. ---*/
/* Reads (or writes) a byte/uword/udword from the specified mode
register. */
#define IO_RD(reg) (*(volatile u32*)(reg))
#define IO_RD_B(reg) (*(volatile u8*)(reg))
#define IO_RD_W(reg) (*(volatile u16*)(reg))
#define IO_RD_D(reg) (*(volatile u32*)(reg))
/*------------------------------------------------------------
!* Start addresses of the different memory areas.
!*-----------------------------------------------------------*/
#define MEM_CSE0_START (0x00000000)
#define MEM_CSE0_SIZE (0x04000000)
#define MEM_CSE1_START (0x04000000)
#define MEM_CSE1_SIZE (0x04000000)
#define MEM_CSR0_START (0x08000000)
#define MEM_CSR1_START (0x0c000000)
#define MEM_CSP0_START (0x10000000)
#define MEM_CSP1_START (0x14000000)
#define MEM_CSP2_START (0x18000000)
#define MEM_CSP3_START (0x1c000000)
#define MEM_CSP4_START (0x20000000)
#define MEM_CSP5_START (0x24000000)
#define MEM_CSP6_START (0x28000000)
#define MEM_CSP7_START (0x2c000000)
#define MEM_DRAM_START (0x40000000)
#define MEM_NON_CACHEABLE (0x80000000)
/*------------------------------------------------------------
!* Type casts used in mode register macros, making pointer
!* dereferencing possible. Empty in assembler.
!*-----------------------------------------------------------*/
#ifndef __ASSEMBLER__
# define IO_TYPECAST_UDWORD (volatile u32*)
# define IO_TYPECAST_RO_UDWORD (const volatile u32*)
# define IO_TYPECAST_UWORD (volatile u16*)
# define IO_TYPECAST_RO_UWORD (const volatile u16*)
# define IO_TYPECAST_BYTE (volatile u8*)
# define IO_TYPECAST_RO_BYTE (const volatile u8*)
#else
# define IO_TYPECAST_UDWORD
# define IO_TYPECAST_RO_UDWORD
# define IO_TYPECAST_UWORD
# define IO_TYPECAST_RO_UWORD
# define IO_TYPECAST_BYTE
# define IO_TYPECAST_RO_BYTE
#endif
/*------------------------------------------------------------*/
#include <arch/sv_addr.agh>
#if __test_sv_addr__
/* IO_MASK( R_BUS_CONFIG , CE ) */
IO_MASK( R_WAITSTATES , SRAM_WS )
IO_MASK( R_TEST , W32 )
IO_STATE( R_BUS_CONFIG, CE, DISABLE )
IO_STATE( R_BUS_CONFIG, CE, ENABLE )
IO_STATE( R_DRAM_TIMING, REF, IVAL2 )
IO_MASK( R_DRAM_TIMING, REF )
IO_MASK( R_EXT_DMA_0_STAT, TFR_COUNT ) >> IO_BITNR( R_EXT_DMA_0_STAT, TFR_COUNT )
IO_RD(R_EXT_DMA_0_STAT) & IO_MASK( R_EXT_DMA_0_STAT, S )
== IO_STATE( R_EXT_DMA_0_STAT, S, STARTED )
#endif
#endif /* ifndef __sv_addr_ag_h__ */

View File

@@ -0,0 +1,64 @@
#ifndef _ASM_CRIS_SVINTO_H
#define _ASM_CRIS_SVINTO_H
#include <arch/sv_addr_ag.h>
extern unsigned int genconfig_shadow; /* defined and set in head.S */
/* dma stuff */
enum { /* Available in: */
d_eol = (1 << 0), /* flags */
d_eop = (1 << 1), /* flags & status */
d_wait = (1 << 2), /* flags */
d_int = (1 << 3), /* flags */
d_txerr = (1 << 4), /* flags */
d_stop = (1 << 4), /* status */
d_ecp = (1 << 4), /* flags & status */
d_pri = (1 << 5), /* flags & status */
d_alignerr = (1 << 6), /* status */
d_crcerr = (1 << 7) /* status */
};
/* Do remember that DMA does not go through the MMU and needs
* a real physical address, not an address virtually mapped or
* paged. Therefore the buf/next ptrs below are unsigned long instead
* of void * to give a warning if you try to put a pointer directly
* to them instead of going through virt_to_phys/phys_to_virt.
*/
typedef struct etrax_dma_descr {
unsigned short sw_len; /* 0-1 */
unsigned short ctrl; /* 2-3 */
unsigned long next; /* 4-7 */
unsigned long buf; /* 8-11 */
unsigned short hw_len; /* 12-13 */
unsigned char status; /* 14 */
unsigned char fifo_len; /* 15 */
} etrax_dma_descr;
/* Use this for constant numbers only */
#define RESET_DMA_NUM( n ) \
*R_DMA_CH##n##_CMD = IO_STATE( R_DMA_CH0_CMD, cmd, reset )
/* Use this for constant numbers or symbols,
* having two macros makes it possible to use constant expressions.
*/
#define RESET_DMA( n ) RESET_DMA_NUM( n )
/* Use this for constant numbers only */
#define WAIT_DMA_NUM( n ) \
while( (*R_DMA_CH##n##_CMD & IO_MASK( R_DMA_CH0_CMD, cmd )) != \
IO_STATE( R_DMA_CH0_CMD, cmd, hold ) )
/* Use this for constant numbers or symbols
* having two macros makes it possible to use constant expressions.
*/
#define WAIT_DMA( n ) WAIT_DMA_NUM( n )
extern void prepare_rx_descriptor(struct etrax_dma_descr *desc);
extern void flush_etrax_cache(void);
#endif

View File

@@ -0,0 +1,46 @@
#ifndef __ASM_CRIS_ARCH_USER_H
#define __ASM_CRIS_ARCH_USER_H
/* User mode registers, used for core dumps. In order to keep ELF_NGREG
sensible we let all registers be 32 bits. The csr registers are included
for future use. */
struct user_regs_struct {
unsigned long r0; /* General registers. */
unsigned long r1;
unsigned long r2;
unsigned long r3;
unsigned long r4;
unsigned long r5;
unsigned long r6;
unsigned long r7;
unsigned long r8;
unsigned long r9;
unsigned long r10;
unsigned long r11;
unsigned long r12;
unsigned long r13;
unsigned long sp; /* Stack pointer. */
unsigned long pc; /* Program counter. */
unsigned long p0; /* Constant zero (only 8 bits). */
unsigned long vr; /* Version register (only 8 bits). */
unsigned long p2; /* Reserved. */
unsigned long p3; /* Reserved. */
unsigned long p4; /* Constant zero (only 16 bits). */
unsigned long ccr; /* Condition code register (only 16 bits). */
unsigned long p6; /* Reserved. */
unsigned long mof; /* Multiply overflow register. */
unsigned long p8; /* Constant zero. */
unsigned long ibr; /* Not accessible. */
unsigned long irp; /* Not accessible. */
unsigned long srp; /* Subroutine return pointer. */
unsigned long bar; /* Not accessible. */
unsigned long dccr; /* Dword condition code register. */
unsigned long brp; /* Not accessible. */
unsigned long usp; /* User-mode stack pointer. Same as sp when
in user mode. */
unsigned long csrinstr; /* Internal status registers. */
unsigned long csraddr;
unsigned long csrdata;
};
#endif