Changeset f6f22cdb in mainline for boot/arch/sparc32/include


Ignore:
Timestamp:
2013-12-27T18:45:56Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32e8cd1
Parents:
e47ed05
Message:

code revision
coding style changes

Location:
boot/arch/sparc32/include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc32/include/ambapp.h

    re47ed05 rf6f22cdb  
    3737#define BOOT_sparc32_AMBAPP_H
    3838
    39 #define AMBAPP_MAX_DEVICES      64
    40 #define AMBAPP_AHBMASTER_AREA   0xfffff000
    41 #define AMBAPP_AHBSLAVE_AREA    0xfffff800
    42 #define AMBAPP_CONF_AREA        0xff000
     39#define AMBAPP_MAX_DEVICES     64
     40#define AMBAPP_AHBMASTER_AREA  0xfffff000
     41#define AMBAPP_AHBSLAVE_AREA   0xfffff800
     42#define AMBAPP_CONF_AREA       0xff000
    4343
    4444typedef enum {
    45         GAISLER                 = 1,
    46         ESA                     = 4
     45        GAISLER = 1,
     46        ESA = 4
    4747} amba_vendor_id_t;
    4848
    4949typedef enum {
    50         GAISLER_LEON3           = 0x003,
    51         GAISLER_LEON3DSU        = 0x004,
    52         GAISLER_ETHAHB          = 0x005,
    53         GAISLER_APBMST          = 0x006,
    54         GAISLER_AHBUART         = 0x007,
    55         GAISLER_SRCTRL          = 0x008,
    56         GAISLER_SDCTRL          = 0x009,
    57         GAISLER_APBUART         = 0x00C,
    58         GAISLER_IRQMP           = 0x00D,
    59         GAISLER_AHBRAM          = 0x00E,
    60         GAISLER_GPTIMER         = 0x011,
    61         GAISLER_PCITRG          = 0x012,
    62         GAISLER_PCISBRG         = 0x013,
    63         GAISLER_PCIFBRG         = 0x014,
    64         GAISLER_PCITRACE        = 0x015,
    65         GAISLER_PCIDMA          = 0x016,
    66         GAISLER_AHBTRACE        = 0x017,
    67         GAISLER_ETHDSU          = 0x018,
    68         GAISLER_PIOPORT         = 0x01A,
    69         GAISLER_AHBJTAG         = 0x01c,
    70         GAISLER_SPW             = 0x01f,
    71         GAISLER_ATACTRL         = 0x024,
    72         GAISLER_VGA             = 0x061,
    73         GAISLER_KBD             = 0x060,
    74         GAISLER_ETHMAC          = 0x01D,
    75         GAISLER_DDRSPA          = 0x025,
    76         GAISLER_EHCI            = 0x026,
    77         GAISLER_UHCI            = 0x027,
    78         GAISLER_SPW2            = 0x029,
    79         GAISLER_DDR2SPA         = 0x02E,
    80         GAISLER_AHBSTAT         = 0x052,
    81         GAISLER_FTMCTRL         = 0x054,
    82         ESA_MCTRL               = 0x00F,
     50        GAISLER_LEON3    = 0x003,
     51        GAISLER_LEON3DSU = 0x004,
     52        GAISLER_ETHAHB   = 0x005,
     53        GAISLER_APBMST   = 0x006,
     54        GAISLER_AHBUART  = 0x007,
     55        GAISLER_SRCTRL   = 0x008,
     56        GAISLER_SDCTRL   = 0x009,
     57        GAISLER_APBUART  = 0x00c,
     58        GAISLER_IRQMP    = 0x00d,
     59        GAISLER_AHBRAM   = 0x00e,
     60        GAISLER_GPTIMER  = 0x011,
     61        GAISLER_PCITRG   = 0x012,
     62        GAISLER_PCISBRG  = 0x013,
     63        GAISLER_PCIFBRG  = 0x014,
     64        GAISLER_PCITRACE = 0x015,
     65        GAISLER_PCIDMA   = 0x016,
     66        GAISLER_AHBTRACE = 0x017,
     67        GAISLER_ETHDSU   = 0x018,
     68        GAISLER_PIOPORT  = 0x01a,
     69        GAISLER_AHBJTAG  = 0x01c,
     70        GAISLER_SPW      = 0x01f,
     71        GAISLER_ATACTRL  = 0x024,
     72        GAISLER_VGA      = 0x061,
     73        GAISLER_KBD      = 0x060,
     74        GAISLER_ETHMAC   = 0x01d,
     75        GAISLER_DDRSPA   = 0x025,
     76        GAISLER_EHCI     = 0x026,
     77        GAISLER_UHCI     = 0x027,
     78        GAISLER_SPW2     = 0x029,
     79        GAISLER_DDR2SPA  = 0x02e,
     80        GAISLER_AHBSTAT  = 0x052,
     81        GAISLER_FTMCTRL  = 0x054,
     82        ESA_MCTRL        = 0x00f,
    8383} amba_device_id_t;
    8484
     
    109109
    110110typedef struct {
    111         unsigned int addr: 12;
    112         unsigned int reserved: 2;
    113         unsigned int prefetchable: 1;
    114         unsigned int cacheable: 1;
    115         unsigned int mask: 12;
    116         unsigned int type: 4;
     111        unsigned int addr : 12;
     112        unsigned int reserved : 2;
     113        unsigned int prefetchable : 1;
     114        unsigned int cacheable : 1;
     115        unsigned int mask : 12;
     116        unsigned int type : 4;
    117117} __attribute__((packed)) ambapp_bar_t;
    118118
    119119typedef struct {
    120         unsigned int vendor_id: 8;
    121         unsigned int device_id: 24;
    122         unsigned int reserved: 2;
    123         unsigned int version: 5;
    124         unsigned int irq: 5;
     120        unsigned int vendor_id : 8;
     121        unsigned int device_id : 24;
     122        unsigned int reserved : 2;
     123        unsigned int version : 5;
     124        unsigned int irq : 5;
    125125        uint32_t user_defined[3];
    126126        ambapp_bar_t bar[4];
     
    128128
    129129typedef struct {
    130         unsigned int ram_read_ws: 1;
    131         unsigned int ram_write_ws: 1;
    132         unsigned int ram_width: 2;
    133         unsigned int rmw: 1;
    134         unsigned int rbrdy: 1;
     130        unsigned int ram_read_ws : 1;
     131        unsigned int ram_write_ws : 1;
     132        unsigned int ram_width : 2;
     133        unsigned int rmw : 1;
     134        unsigned int rbrdy : 1;
    135135        unsigned int : 1;
    136         unsigned int bank_size: 4;
    137         unsigned int si: 1;
    138         unsigned int se: 1;
     136        unsigned int bank_size : 4;
     137        unsigned int si : 1;
     138        unsigned int se : 1;
    139139        unsigned int : 1;
    140         unsigned int ms: 1;
     140        unsigned int ms : 1;
    141141        unsigned int : 1;
    142         unsigned int d64: 1;
    143         unsigned int sdram_cmd: 2;
    144         unsigned int sdram_colsz: 2;
    145         unsigned int sdram_banksz: 3;
    146         unsigned int tcas: 1;
    147         unsigned int trfc: 3;
    148         unsigned int trp: 1;
    149         unsigned int sdrf: 1;
     142        unsigned int d64 : 1;
     143        unsigned int sdram_cmd : 2;
     144        unsigned int sdram_colsz : 2;
     145        unsigned int sdram_banksz : 3;
     146        unsigned int tcas : 1;
     147        unsigned int trfc : 3;
     148        unsigned int trp : 1;
     149        unsigned int sdrf : 1;
    150150} __attribute__((packed)) mctrl_mcfg2_t;
    151151
    152 amba_device_t amba_devices[AMBAPP_MAX_DEVICES];
    153 int amba_devices_found;
    154 bool amba_fake;
    155 uintptr_t amba_uart_base;
     152extern amba_device_t amba_devices[AMBAPP_MAX_DEVICES];
     153extern int amba_devices_found;
     154extern bool amba_fake;
     155extern uintptr_t amba_uart_base;
    156156
    157 void ambapp_scan(void);
    158 bool ambapp_fake(void);
    159 void ambapp_qemu_fake_scan(void);
    160 void ambapp_print_devices(void);
    161 amba_device_t *ambapp_lookup_first(amba_vendor_id_t, amba_device_id_t);
     157extern void ambapp_scan(void);
     158extern bool ambapp_fake(void);
     159extern void ambapp_qemu_fake_scan(void);
     160extern void ambapp_print_devices(void);
     161extern amba_device_t *ambapp_lookup_first(amba_vendor_id_t, amba_device_id_t);
    162162
    163163#endif
  • boot/arch/sparc32/include/arch.h

    re47ed05 rf6f22cdb  
    3030#define BOOT_sparc32_ARCH_H
    3131
    32 #define PTL0_ENTRIES    256
    33 #define PTL0_SHIFT      24
    34 #define PTL0_SIZE       (1 << 24)
    35 #define PTL0_ENTRY_SIZE 4
     32#define PTL0_ENTRIES     256
     33#define PTL0_SHIFT       24
     34#define PTL0_SIZE        (1 << 24)
     35#define PTL0_ENTRY_SIZE  4
    3636
    3737/* ASI assignments: */
    38 #define ASI_CACHEMISS   0x01
    39 #define ASI_CACHECTRL   0x02
    40 #define ASI_MMUREGS     0x19
    41 #define ASI_MMUBYPASS   0x1c
     38#define ASI_CACHEMISS  0x01
     39#define ASI_CACHECTRL  0x02
     40#define ASI_MMUREGS    0x19
     41#define ASI_MMUBYPASS  0x1c
    4242
    4343/*
    44  * Address where the boot stage image starts (beginning of usable physical
    45  * memory).
     44 * Address where the boot stage image starts
     45 * (beginning of usable physical memory).
    4646 */
    47 #define BOOT_BASE       0x40000000
    48 #define BOOT_OFFSET     (BOOT_BASE + 0xa00000)
    4947
    50 #define PA_OFFSET 0x40000000
     48#define BOOT_BASE   0x40000000
     49#define BOOT_OFFSET (BOOT_BASE + 0xa00000)
     50
     51#define PA_OFFSET  0x40000000
    5152
    5253#ifndef __ASM__
     
    5657#endif
    5758
    58 
    5959#endif
    6060
  • boot/arch/sparc32/include/asm.h

    re47ed05 rf6f22cdb  
    3232#include <typedefs.h>
    3333
    34 static inline uint32_t asi_u32_read(int asi, uintptr_t va)
     34extern uintptr_t boot_ctx_table;
     35
     36static inline uint32_t asi_u32_read(unsigned int asi, uintptr_t va)
    3537{
    3638        uint32_t v;
    37 
     39       
    3840        asm volatile (
    3941                "lda [%[va]] %[asi], %[v]\n"
    4042                : [v] "=r" (v)
    4143                : [va] "r" (va),
    42                   [asi] "i" ((unsigned int) asi)
     44                  [asi] "i" (asi)
    4345        );
    4446       
     
    4648}
    4749
    48 static inline void asi_u32_write(int asi, uintptr_t va, uint32_t v)
     50static inline void asi_u32_write(unsigned int asi, uintptr_t va, uint32_t v)
    4951{
    5052        asm volatile (
     
    5254                :: [v] "r" (v),
    5355                   [va] "r" (va),
    54                    [asi] "i" ((unsigned int) asi)
     56                   [asi] "i" (asi)
    5557                : "memory"
    5658        );
    5759}
    5860
    59 extern void jump_to_kernel(void *entry, bootinfo_t *bootinfo);
     61extern void jump_to_kernel(void *, bootinfo_t *);
    6062
    6163#endif
  • boot/arch/sparc32/include/main.h

    re47ed05 rf6f22cdb  
    3535
    3636#ifndef BOOT_sparc32_MAIN_H
    37 #define BOOT_sparc2_MAIN_H
     37#define BOOT_sparc32_MAIN_H
    3838
    3939/** Address where characters to be printed are expected. */
    40 #define APBUART_SCONS_THR       0x80000100
    41 #define APBUART_SCONS_THR_MMU   0xb0000100
     40#define APBUART_SCONS_THR      0x80000100
     41#define APBUART_SCONS_THR_MMU  0xb0000100
    4242
    4343extern void bootstrap(void);
  • boot/arch/sparc32/include/mm.h

    re47ed05 rf6f22cdb  
    3939 */
    4040
    41 #ifndef BOOT_sparc32__MM_H
    42 #define BOOT_sparc32__MM_H
     41#ifndef BOOT_sparc32_MM_H
     42#define BOOT_sparc32_MM_H
    4343
    4444#include <typedefs.h>
    4545
    46 #define PAGE_SIZE       (1 << 12)
     46#define PAGE_SIZE  (1 << 12)
    4747
    4848typedef struct {
     
    5454
    5555typedef struct {
    56         unsigned int ppn: 24;
    57         unsigned int cacheable: 1;
    58         unsigned int modified: 1;
    59         unsigned int referenced: 1;
    60         unsigned int acc: 3;
    61         unsigned int et: 2;
     56        unsigned int ppn : 24;
     57        unsigned int cacheable : 1;
     58        unsigned int modified : 1;
     59        unsigned int referenced : 1;
     60        unsigned int acc : 3;
     61        unsigned int et : 2;
    6262} __attribute__((packed)) pte_t;
    6363
    6464extern pte_t boot_pt[PTL0_ENTRIES];
    6565
    66 void mmu_init(void);
     66extern void mmu_init(void);
    6767
    68 #define PTE_ET_DESCRIPTOR       1
    69 #define PTE_ET_ENTRY            2
    70 #define PTE_ACC_RWX             3
    71 #define MMU_CONTROL_EN          (1 << 0)
     68#define PTE_ET_DESCRIPTOR  1
     69#define PTE_ET_ENTRY       2
     70#define PTE_ACC_RWX        3
     71#define MMU_CONTROL_EN     (1 << 0)
    7272
    7373#endif
Note: See TracChangeset for help on using the changeset viewer.