boot.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef _BOOT_H
  2. #define _BOOT_H
  3. /* All this should be defined somewhere in danube.h later... */
  4. #define MPS_SRAM_BASE_ADDRESS 0xBF200000
  5. #define MPS_SRAM_BOOT_OFFSET 0x1C0
  6. /* Offset for CPU1 (both CPUs have same register set) */
  7. #define BOOT_BASE_ADDRESS (MPS_SRAM_BASE_ADDRESS + MPS_SRAM_BOOT_OFFSET)
  8. #define BOOT_CPU_OFFSET 0x20
  9. #ifdef __ASSEMBLY__
  10. #define BOOT_RVEC (BOOT_BASE_ADDRESS + 0x00)
  11. #define BOOT_NVEC (BOOT_BASE_ADDRESS + 0x04)
  12. #define BOOT_EVEC (BOOT_BASE_ADDRESS + 0x08)
  13. #define BOOT_CP0_CAUSE (BOOT_BASE_ADDRESS + 0x0C)
  14. #define BOOT_CP0_EPC (BOOT_BASE_ADDRESS + 0x10)
  15. #define BOOT_CP0_EEPC (BOOT_BASE_ADDRESS + 0x14)
  16. #define BOOT_SIZE (BOOT_BASE_ADDRESS + 0x18) /* for CPU1 */
  17. #define BOOT_RCU_SR (BOOT_BASE_ADDRESS + 0x18) /* for CPU0 */
  18. #define BOOT_CFG_STAT (BOOT_BASE_ADDRESS + 0x1C)
  19. #else
  20. #define BOOT_RVEC(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x00)
  21. #define BOOT_NVEC(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x04)
  22. #define BOOT_EVEC(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x08)
  23. #define BOOT_CP0_STATUS(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x0C)
  24. #define BOOT_CP0_EPC(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x10)
  25. #define BOOT_CP0_EEPC(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x14)
  26. #define BOOT_SIZE(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x18) /* for CPU1 */
  27. #define BOOT_RCU_SR(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x18) /* for CPU0 */
  28. #define BOOT_CFG_STAT(cpu) (volatile u32*)(BOOT_BASE_ADDRESS + (cpu * BOOT_CPU_OFFSET) + 0x1C)
  29. #endif
  30. #define BOOT_CFG_NOR 0x01
  31. #define BOOT_CFG_MII 0x02
  32. #define BOOT_CFG_PCI 0x03
  33. #define BOOT_CFG_ASC 0x04
  34. #define BOOT_CFG_SFLASH 0x05
  35. #define BOOT_CFG_NAND 0x06
  36. #define BOOT_CFG_RMII 0x07
  37. #define BOOT_CFG_TEST 0x00
  38. #define BOOT_NUM_RETRY 3
  39. #define BOOT_STAT_MASK_ALL 0x0000FFFF
  40. #define BOOT_STAT_MASK_STAT 0x0000F000
  41. #define BOOT_STAT_MASK_BERR 0x00000F00
  42. #define BOOT_STAT_MASK_BSTRAP 0x000000F0
  43. #define BOOT_STAT_MASK_BMODULE 0x0000000F
  44. #define BOOT_STAT_INIT 0x00000000
  45. #define BOOT_STAT_BSTRAP 0x00001000
  46. #define BOOT_STAT_RETRY 0x00002000
  47. #define BOOT_STAT_START 0x00003000
  48. #define BOOT_STAT_HALT 0x0000F000
  49. #define BOOT_ERR_NO_RVEC 0x00000100
  50. #define BOOT_ERR_NO_NVEC 0x00000200
  51. #define BOOT_ERR_NO_EVEC 0x00000300
  52. #define BOOT_ERR_BSTRAP 0x00000400
  53. #define BOOT_ERR_EXC 0x00000800
  54. #ifndef __ASSEMBLY__
  55. void boot_set_status( u32 status, u32 mask);
  56. void boot_set_config( u32 config);
  57. void boot_set_rvec( u32 vector);
  58. void boot_set_size( u32 size);
  59. void boot_sdbg( u8* string, u32 value);
  60. void boot_error( u32 berr);
  61. int boot_from_ebu(void);
  62. void _boot_rvec(void);
  63. typedef struct
  64. {
  65. u32 cpu; /** CPU number */
  66. u32 config; /** Boot configuration */
  67. u32 endian; /** CPU endianess */
  68. u32 debug; /** Debug mode */
  69. u32 (*exit)(void); /** application vector */
  70. } boot_data;
  71. extern boot_data bootrom;
  72. #endif
  73. #endif /* #ifdef _BOOT_H */