pass the location of the m5 backdoor via the m5AlphaAccess variable

only compile one console

console/Makefile:
    Now that the location of the m5 backdoor is passed into the
    console via the m5AlphaAccess variable, we only need to
    compile one console, and don't need to define TLASER or TSUNAMI
console/console.c:
    Don't hardcode the location of the AlphaAccess structure, but
    rely on m5 to pass in the correct value.
    Setup "volatile struct AlphaAccess *m5AlphaAccess" for use and
    get rid of the hardcoded usage.
This commit is contained in:
Nathan Binkert 2005-06-28 01:13:20 -04:00
parent 0b01f18603
commit 941db36a67
2 changed files with 35 additions and 59 deletions

View file

@ -36,34 +36,23 @@ LD=$(CROSS_COMPILE)ld
DBMENTRY= fffffc0000010000 DBMENTRY= fffffc0000010000
CFLAGS=-I . -I ../h -I$(M5)/dev -fno-builtin -Wa,-m21164 CFLAGS=-I . -I ../h -I$(M5)/dev -fno-builtin -Wa,-m21164
OBJS=dbmentry.o printf.o paljtokern.o paljtoslave.o OBJS=dbmentry.o printf.o paljtokern.o paljtoslave.o console.o
TLOBJS+=$(OBJS) console_tl.o
TSOBJS+=$(OBJS) console_ts.o
### Make sure that the M5 variable is set ### ### Make sure that the M5 variable is set ###
ifndef M5 ifndef M5
$(error The M5 variable must be set) $(error The M5 variable must be set)
endif endif
all: console_tl console_ts all: console
%.o: %.S %.o: %.S
$(CC) $(CFLAGS) -nostdinc -o $@ -c $< $(CC) $(CFLAGS) -nostdinc -o $@ -c $<
console_ts.o: console.c %.o: %.c
$(CC) -g3 $(CFLAGS) -D TSUNAMI -o $@ -c $<
console_tl.o: console.c
$(CC) -g3 $(CFLAGS) -D TLASER -o $@ -c $<
printf.o: printf.c
$(CC) -g3 $(CFLAGS) -o $@ -c $< $(CC) -g3 $(CFLAGS) -o $@ -c $<
console_ts: $(TSOBJS) console: $(OBJS)
$(LD) -o console_ts -N -Ttext $(DBMENTRY) -non_shared $(TSOBJS) -lc $(LD) -o console -N -Ttext $(DBMENTRY) -non_shared $(OBJS) -lc
console_tl: $(TLOBJS)
$(LD) -o console_tl -N -Ttext $(DBMENTRY) -non_shared $(TLOBJS) -lc
clean: clean:
rm -f *.o console_t? rm -f *.o console

View file

@ -73,14 +73,6 @@
#define K1BASE 0xfffffc8000000000 #define K1BASE 0xfffffc8000000000
#define KSEG_TO_PHYS(x) (((ulong)x) & ~KSEG) #define KSEG_TO_PHYS(x) (((ulong)x) & ~KSEG)
#ifdef TSUNAMI
#define ALPHA_ACCESS_BASE 0xfffffd0200000000
#elif TLASER
#define ALPHA_ACCESS_BASE 0xfffffc8000a00000
#else
#error TSUNAMI/TLASER not defined.
#endif
#define ROUNDUP8(x) ((ulong)(((ulong)x)+7) & ~7) #define ROUNDUP8(x) ((ulong)(((ulong)x)+7) & ~7)
#define ROUNDUP128(x) ((ulong)(((ulong)x) + 127) & ~127) #define ROUNDUP128(x) ((ulong)(((ulong)x) + 127) & ~127)
#define ROUNDUP8K(x) ((ulong)(((ulong)(x)) + 8191) & ~8191) #define ROUNDUP8K(x) ((ulong)(((ulong)(x)) + 8191) & ~8191)
@ -113,6 +105,7 @@ void JToKern(char *bootadr, ulong rpb_percpu, ulong free_pfn, ulong k_argc,
void JToPal(ulong bootadr); void JToPal(ulong bootadr);
void SlaveLoop(int cpu); void SlaveLoop(int cpu);
volatile struct AlphaAccess *m5AlphaAccess;
struct AlphaAccess m5Conf; struct AlphaAccess m5Conf;
ulong theLock; ulong theLock;
@ -146,15 +139,13 @@ InitConsole()
char char
GetChar() GetChar()
{ {
struct AlphaAccess *k1Conf = (struct AlphaAccess *)(ALPHA_ACCESS_BASE); return m5AlphaAccess->inputChar;
return k1Conf->inputChar;
} }
void void
PutChar(char c) PutChar(char c)
{ {
struct AlphaAccess *k1Conf = (struct AlphaAccess *)(ALPHA_ACCESS_BASE); m5AlphaAccess->outputChar = c;
k1Conf->outputChar = c;
} }
int int
@ -167,36 +158,35 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int x, i; int x, i;
struct AlphaAccess *k1Conf = (struct AlphaAccess *)(ALPHA_ACCESS_BASE);
uint *k1ptr, *ksegptr; uint *k1ptr, *ksegptr;
InitConsole(); InitConsole();
printf_lock("M5 console\n"); printf_lock("M5 console: m5AlphaAccess @ 0x%x\n", m5AlphaAccess);
/* /*
* get configuration from backdoor * get configuration from backdoor
*/ */
m5Conf.last_offset = k1Conf->last_offset; m5Conf.last_offset = m5AlphaAccess->last_offset;
printf_lock("Got Configuration %d\n", m5Conf.last_offset); printf_lock("Got Configuration %d\n", m5Conf.last_offset);
m5Conf.last_offset = k1Conf->last_offset; m5Conf.last_offset = m5AlphaAccess->last_offset;
m5Conf.version = k1Conf->version; m5Conf.version = m5AlphaAccess->version;
m5Conf.numCPUs = k1Conf->numCPUs; m5Conf.numCPUs = m5AlphaAccess->numCPUs;
m5Conf.intrClockFrequency = k1Conf->intrClockFrequency; m5Conf.intrClockFrequency = m5AlphaAccess->intrClockFrequency;
m5Conf.cpuClock = k1Conf->cpuClock; m5Conf.cpuClock = m5AlphaAccess->cpuClock;
m5Conf.mem_size = k1Conf->mem_size; m5Conf.mem_size = m5AlphaAccess->mem_size;
m5Conf.kernStart = k1Conf->kernStart; m5Conf.kernStart = m5AlphaAccess->kernStart;
m5Conf.kernEnd = k1Conf->kernEnd; m5Conf.kernEnd = m5AlphaAccess->kernEnd;
m5Conf.entryPoint = k1Conf->entryPoint; m5Conf.entryPoint = m5AlphaAccess->entryPoint;
m5Conf.diskUnit = k1Conf->diskUnit; m5Conf.diskUnit = m5AlphaAccess->diskUnit;
m5Conf.diskCount = k1Conf->diskCount; m5Conf.diskCount = m5AlphaAccess->diskCount;
m5Conf.diskPAddr = k1Conf->diskPAddr; m5Conf.diskPAddr = m5AlphaAccess->diskPAddr;
m5Conf.diskBlock = k1Conf->diskBlock; m5Conf.diskBlock = m5AlphaAccess->diskBlock;
m5Conf.diskOperation = k1Conf->diskOperation; m5Conf.diskOperation = m5AlphaAccess->diskOperation;
m5Conf.outputChar = k1Conf->outputChar; m5Conf.outputChar = m5AlphaAccess->outputChar;
m5Conf.inputChar = k1Conf->inputChar; m5Conf.inputChar = m5AlphaAccess->inputChar;
m5Conf.bootStrapImpure = k1Conf->bootStrapImpure; m5Conf.bootStrapImpure = m5AlphaAccess->bootStrapImpure;
m5Conf.bootStrapCPU = k1Conf->bootStrapCPU; m5Conf.bootStrapCPU = m5AlphaAccess->bootStrapCPU;
if (m5Conf.version != ALPHA_ACCESS_VERSION) { if (m5Conf.version != ALPHA_ACCESS_VERSION) {
panic("Console version mismatch. Console expects %d. has %d \n", panic("Console version mismatch. Console expects %d. has %d \n",
@ -776,12 +766,10 @@ unixBoot(int go, int argc, char **argv)
* MP bootstrap * MP bootstrap
*/ */
for (i = 1; i < m5Conf.numCPUs; i++) { for (i = 1; i < m5Conf.numCPUs; i++) {
volatile struct AlphaAccess *k1Conf;
k1Conf = (volatile struct AlphaAccess *)(ALPHA_ACCESS_BASE);
printf_lock("Bootstraping CPU %d with sp=0x%x\n", printf_lock("Bootstraping CPU %d with sp=0x%x\n",
i, bootStrapImpure[i]); i, bootStrapImpure[i]);
k1Conf->bootStrapImpure = bootStrapImpure[i]; m5AlphaAccess->bootStrapImpure = bootStrapImpure[i];
k1Conf->bootStrapCPU = i; m5AlphaAccess->bootStrapCPU = i;
} }
/* /*
@ -866,7 +854,6 @@ struct {
void void
DeviceOperation(long op, long channel, long count, long address, long block) DeviceOperation(long op, long channel, long count, long address, long block)
{ {
struct AlphaAccess *k1Conf = (struct AlphaAccess *)(ALPHA_ACCESS_BASE);
long pAddr; long pAddr;
if (strcmp(deviceState[channel].name, BOOTDEVICE_NAME )) { if (strcmp(deviceState[channel].name, BOOTDEVICE_NAME )) {
@ -877,10 +864,10 @@ DeviceOperation(long op, long channel, long count, long address, long block)
panic("DeviceRead: request out of range \n"); panic("DeviceRead: request out of range \n");
} }
k1Conf->diskCount = count; m5AlphaAccess->diskCount = count;
k1Conf->diskPAddr = pAddr; m5AlphaAccess->diskPAddr = pAddr;
k1Conf->diskBlock = block; m5AlphaAccess->diskBlock = block;
k1Conf->diskOperation = op; /* launch */ m5AlphaAccess->diskOperation = op; /* launch */
} }
/* /*