#include "sfl.h"
#include "boot.h"
-extern void boot_helper(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int addr);
+extern void boot_helper(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr);
-static void __attribute__((noreturn)) boot(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int addr)
+static void __attribute__((noreturn)) boot(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr)
{
printf("Executing booted program at 0x%08x\n", addr);
uart_sync();
{
struct sfl_frame frame;
int failed;
- unsigned int cmdline_adr, initrdstart_adr, initrdend_adr;
+ unsigned long cmdline_adr, initrdstart_adr, initrdend_adr;
static const char str[SFL_MAGIC_LEN+1] = SFL_MAGIC_REQ;
const char *c;
int ack_status;
failed = 0;
writepointer = (char *)(
- ((unsigned int)frame.payload[0] << 24)
- |((unsigned int)frame.payload[1] << 16)
- |((unsigned int)frame.payload[2] << 8)
- |((unsigned int)frame.payload[3] << 0));
+ ((unsigned long)frame.payload[0] << 24)
+ |((unsigned long)frame.payload[1] << 16)
+ |((unsigned long)frame.payload[2] << 8)
+ |((unsigned long)frame.payload[3] << 0));
for(i=4;i<frame.length;i++)
*(writepointer++) = frame.payload[i];
uart_write(SFL_ACK_SUCCESS);
break;
}
case SFL_CMD_JUMP: {
- unsigned int addr;
+ unsigned long addr;
failed = 0;
- addr = ((unsigned int)frame.payload[0] << 24)
- |((unsigned int)frame.payload[1] << 16)
- |((unsigned int)frame.payload[2] << 8)
- |((unsigned int)frame.payload[3] << 0);
+ addr = ((unsigned long)frame.payload[0] << 24)
+ |((unsigned long)frame.payload[1] << 16)
+ |((unsigned long)frame.payload[2] << 8)
+ |((unsigned long)frame.payload[3] << 0);
uart_write(SFL_ACK_SUCCESS);
boot(cmdline_adr, initrdstart_adr, initrdend_adr, addr);
break;
}
case SFL_CMD_CMDLINE:
failed = 0;
- cmdline_adr = ((unsigned int)frame.payload[0] << 24)
- |((unsigned int)frame.payload[1] << 16)
- |((unsigned int)frame.payload[2] << 8)
- |((unsigned int)frame.payload[3] << 0);
+ cmdline_adr = ((unsigned long)frame.payload[0] << 24)
+ |((unsigned long)frame.payload[1] << 16)
+ |((unsigned long)frame.payload[2] << 8)
+ |((unsigned long)frame.payload[3] << 0);
uart_write(SFL_ACK_SUCCESS);
break;
case SFL_CMD_INITRDSTART:
failed = 0;
- initrdstart_adr = ((unsigned int)frame.payload[0] << 24)
- |((unsigned int)frame.payload[1] << 16)
- |((unsigned int)frame.payload[2] << 8)
- |((unsigned int)frame.payload[3] << 0);
+ initrdstart_adr = ((unsigned long)frame.payload[0] << 24)
+ |((unsigned long)frame.payload[1] << 16)
+ |((unsigned long)frame.payload[2] << 8)
+ |((unsigned long)frame.payload[3] << 0);
uart_write(SFL_ACK_SUCCESS);
break;
case SFL_CMD_INITRDEND:
failed = 0;
- initrdend_adr = ((unsigned int)frame.payload[0] << 24)
- |((unsigned int)frame.payload[1] << 16)
- |((unsigned int)frame.payload[2] << 8)
- |((unsigned int)frame.payload[3] << 0);
+ initrdend_adr = ((unsigned long)frame.payload[0] << 24)
+ |((unsigned long)frame.payload[1] << 16)
+ |((unsigned long)frame.payload[2] << 8)
+ |((unsigned long)frame.payload[3] << 0);
uart_write(SFL_ACK_SUCCESS);
break;
default:
void netboot(void)
{
int size;
- unsigned int cmdline_adr, initrdstart_adr, initrdend_adr;
+ unsigned long cmdline_adr, initrdstart_adr, initrdend_adr;
unsigned int ip;
unsigned short tftp_port;
/* General address space functions */
#define NUMBER_OF_BYTES_ON_A_LINE 16
-static void dump_bytes(unsigned int *ptr, int count, unsigned addr)
+static void dump_bytes(unsigned int *ptr, int count, unsigned long addr)
{
char *data = (char *)ptr;
int line_bytes = 0, i = 0;
}
}
- dump_bytes(addr, length, (unsigned)addr);
+ dump_bytes(addr, length, (unsigned long)addr);
}
static void mw(char *addr, char *value, char *count)
static void crcbios(void)
{
- unsigned int offset_bios;
- unsigned int length;
+ unsigned long offset_bios;
+ unsigned long length;
unsigned int expected_crc;
unsigned int actual_crc;
* We also use the address of _edata to know the length
* of our code.
*/
- offset_bios = (unsigned int)&_ftext;
+ offset_bios = (unsigned long)&_ftext;
expected_crc = _edata;
- length = (unsigned int)&_edata - offset_bios;
+ length = (unsigned long)&_edata - offset_bios;
actual_crc = crc32((unsigned char *)offset_bios, length);
if(expected_crc == actual_crc)
printf(" BIOS CRC passed (%08x)\n", actual_crc);
#ifdef __ASSEMBLER__
#define MMPTR(x) x
#else /* ! __ASSEMBLER__ */
-#define MMPTR(x) (*((volatile unsigned int *)(x)))
+#define MMPTR(x) (*((volatile unsigned long *)(x)))
-static inline void csr_writeb(uint8_t value, uint32_t addr)
+static inline void csr_writeb(uint8_t value, unsigned long addr)
{
*((volatile uint8_t *)addr) = value;
}
-static inline uint8_t csr_readb(uint32_t addr)
+static inline uint8_t csr_readb(unsigned long addr)
{
return *(volatile uint8_t *)addr;
}
-static inline void csr_writew(uint16_t value, uint32_t addr)
+static inline void csr_writew(uint16_t value, unsigned long addr)
{
*((volatile uint16_t *)addr) = value;
}
-static inline uint16_t csr_readw(uint32_t addr)
+static inline uint16_t csr_readw(unsigned long addr)
{
return *(volatile uint16_t *)addr;
}
-static inline void csr_writel(uint32_t value, uint32_t addr)
+static inline void csr_writel(uint32_t value, unsigned long addr)
{
*((volatile uint32_t *)addr) = value;
}
-static inline uint32_t csr_readl(uint32_t addr)
+static inline uint32_t csr_readl(unsigned long addr)
{
return *(volatile uint32_t *)addr;
}