bios: asmiprobe command

Because with reordering architectures come order-dependent intermittent bugs.
This commit is contained in:
Sebastien Bourdeauducq 2012-08-04 16:32:15 +02:00
parent 855eec776d
commit 274a00217e
4 changed files with 39 additions and 6 deletions

View File

@ -1,7 +1,7 @@
M2DIR=../..
include $(M2DIR)/software/common.mak
OBJECTS=crt0.o isr.o ddrinit.o main.o microudp.o tftp.o boot-helper.o boot.o dataflow.o
OBJECTS=crt0.o isr.o sdram.o main.o microudp.o tftp.o boot-helper.o boot.o dataflow.o
all: bios.bin

View File

@ -13,7 +13,7 @@
#include <hw/mem.h>
#include <hw/minimac.h>
#include "ddrinit.h"
#include "sdram.h"
#include "dataflow.h"
#include "boot.h"
@ -367,6 +367,7 @@ static void do_command(char *c)
else if(strcmp(token, "ddrwr") == 0) ddrwr(get_token(&c));
else if(strcmp(token, "memtest") == 0) memtest();
else if(strcmp(token, "ddrinit") == 0) ddrinit();
else if(strcmp(token, "asmiprobe") == 0) asmiprobe();
else if(strcmp(token, "dfs") == 0) dfs(get_token(&c));

View File

@ -3,8 +3,9 @@
#include <hw/dfii.h>
#include <hw/mem.h>
#include <csrbase.h>
#include "ddrinit.h"
#include "sdram.h"
static void cdelay(int i)
{
@ -196,3 +197,32 @@ int ddrinit(void)
return 1;
}
static const char *format_slot_state(int state)
{
switch(state) {
case 0: return "Empty";
case 1: return "Pending";
case 2: return "Processing";
default: return "UNEXPECTED VALUE";
}
}
void asmiprobe(void)
{
volatile unsigned int *regs = (unsigned int *)ASMIPROBE_BASE;
int slot_count;
int trace_depth;
int i;
int offset;
offset = 0;
slot_count = regs[offset++];
trace_depth = regs[offset++];
for(i=0;i<slot_count;i++)
printf("Slot #%d: %s\n", i, format_slot_state(regs[offset++]));
printf("Latest tags:\n");
for(i=0;i<trace_depth;i++)
printf("%d ", regs[offset++]);
printf("\n");
}

View File

@ -1,5 +1,5 @@
#ifndef __DDRINIT_H
#define __DDRINIT_H
#ifndef __SDRAM_H
#define __SDRAM_H
void ddrsw(void);
void ddrhw(void);
@ -10,4 +10,6 @@ int memtest_silent(void);
void memtest(void);
int ddrinit(void);
#endif /* __DDRINIT_H */
void asmiprobe(void);
#endif /* __SDRAM_H */