#define NUM_KERNEL_THIRD (4)
+#define printf_lock(args...) \
+ do { \
+ SpinLock(&theLock); \
+ printf(args); \
+ SpinUnlock(&theLock); \
+ } while (0)
+
static unixBoot(int go, int argc, char **argv);
void jToPal(ul bootadr);
InitConsole();
- printf("M5 console\n");
+ printf_lock("M5 console\n");
/*
* get configuration from backdoor
*/
simosConf.last_offset = k1Conf->last_offset;
- printf("Got Configuration %d \n",simosConf.last_offset);
+ printf_lock("Got Configuration %d \n",simosConf.last_offset);
simosConf.last_offset = k1Conf->last_offset;
simosConf.version = k1Conf->version;
char *rpb_name;
ul nextPtr;
- printf( "memsize %x pages %x \n",mem_size,mem_pages);
+ printf_lock( "memsize %x pages %x \n",mem_size,mem_pages);
unix_boot_mem = ROUNDUP8K(&_end);
- printf("First free page after ROM 0x%x\n", unix_boot_mem);
+ printf_lock("First free page after ROM 0x%x\n", unix_boot_mem);
rpb = (struct rpb *) unix_boot_alloc( HWRPB_PAGES);
bootadr = simosConf.entryPoint;
- printf("HWRPB 0x%x l1pt 0x%x l2pt 0x%x l3pt_rpb 0x%x l3pt_kernel 0x%x l2reserv 0x%x\n",
+ printf_lock("HWRPB 0x%x l1pt 0x%x l2pt 0x%x l3pt_rpb 0x%x l3pt_kernel 0x%x l2reserv 0x%x\n",
rpb, first, second, third_rpb, third_kernel,reservedFixup);
if (kernel_end - simosConf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
- printf("Kernel is more than 8MB 0x%x - 0x%x = 0x%x\n",
+ printf_lock("Kernel is more than 8MB 0x%x - 0x%x = 0x%x\n",
kernel_end, simosConf.kernStart,
kernel_end -simosConf.kernStart );
panic("kernel too big\n");
/* blow 2 pages of phys mem for guards since it maintains 1-to-1 mapping */
ksp = ksp_top + (3 * 8192);
if (ksp - simosConf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
- printf("Kernel stack pushd us over 8MB\n");
+ printf_lock("Kernel stack pushd us over 8MB\n");
panic("ksp too big\n");
}
if (THIRD_XXX((ul)ksp_top) > NUM_KERNEL_THIRD * 1024) {
* XXX must be patched after a checkpoint restore (I guess)
*/
- printf("CPU Clock at %d MHz IntrClockFrequency=%d \n", simosConf.cpuClock,simosConf.intrClockFrequency);
+ printf_lock("CPU Clock at %d MHz IntrClockFrequency=%d \n", simosConf.cpuClock,simosConf.intrClockFrequency);
rpb->rpb_counter = simosConf.cpuClock * 1000 * 1000;
/*
int i;
int size = ROUNDUP128(sizeof(struct rpb_percpu));
- printf("Booting with %d processor(s) \n",simosConf.numCPUs);
+ printf_lock("Booting with %d processor(s) \n",simosConf.numCPUs);
rpb->rpb_numprocs = simosConf.numCPUs;
rpb->rpb_slotsize = size;
/* thisCPU->rpb_pcb.rpb_ptbr = PFN(second);*/
- printf("KSP: 0x%x PTBR 0x%x\n", thisCPU->rpb_pcb.rpb_ksp, thisCPU->rpb_pcb.rpb_ptbr);
+ printf_lock("KSP: 0x%x PTBR 0x%x\n", thisCPU->rpb_pcb.rpb_ksp, thisCPU->rpb_pcb.rpb_ptbr);
if (i) {
bootStrapImpure[i] = (ul)unix_boot_alloc(1);
rpb_crb->rpb_map[0].rpb_pgcount = HWRPB_PAGES;
- printf("Console Callback at 0x%x, fixup at 0x%x \n",
+ printf_lock("Console Callback at 0x%x, fixup at 0x%x \n",
rpb_crb->rpb_va_disp,
rpb_crb->rpb_va_fixup );
rpb_mdt->rpb_numcl = cl;
for (i = 0; i < cl; i++)
- printf("Memory cluster %d [%d - %d]\n", i, rpb_mdt->rpb_cluster[i].rpb_pfn, rpb_mdt->rpb_cluster[i].rpb_pfncount);
+ printf_lock("Memory cluster %d [%d - %d]\n", i, rpb_mdt->rpb_cluster[i].rpb_pfn, rpb_mdt->rpb_cluster[i].rpb_pfncount);
bzero((char *)mdt_bitmap, MDT_BITMAP_PAGES * 8192);
for (i = 0; i < mem_pages/8; i++) ((unsigned char *)mdt_bitmap)[i] = 0xff;
- printf("Initalizing mdt_bitmap addr 0x%x mem_pages %x \n",
+ printf_lock("Initalizing mdt_bitmap addr 0x%x mem_pages %x \n",
(long)mdt_bitmap,(long)mem_pages);
xxm_rpb.rpb_config_off = 0;
#else
rpb_crb->rpb_va_disp = 0x10000000 + ((ul)ptr & 0x1fff);
#endif
- printf("ConsoleDispatch at virt %x phys %x val %x\n",
+ printf_lock("ConsoleDispatch at virt %x phys %x val %x\n",
rpb_crb->rpb_va_disp,
rpb_crb->rpb_pa_disp,
consoleCallback);
for (i=1;i<simosConf.numCPUs;i++) {
volatile struct AlphaAccess *k1Conf = (volatile struct AlphaAccess *)
(ALPHA_ACCESS_BASE);
- SpinLock(&theLock);
- printf("Bootstraping CPU %d with sp=0x%x \n",
+ printf_lock("Bootstraping CPU %d with sp=0x%x \n",
i,bootStrapImpure[i]);
- SpinUnlock(&theLock);
k1Conf->bootStrapImpure = bootStrapImpure[i];
k1Conf->bootStrapCPU = i;
}
if ((ul)unix_boot_mem >= (ul)simosConf.kernStart) {
panic("CONSOLE: too much memory. Smashing kernel \n");
} else {
- SpinLock(&theLock);
- printf("unix_boot_mem ends at %x \n",unix_boot_mem);
- SpinUnlock(&theLock);
+ printf_lock("unix_boot_mem ends at %x \n",unix_boot_mem);
}
struct _kernel_params *kernel_params = (struct _kernel_params *) KSEG;
int i;
- printf("k_argc = %d ", k_argc);
+ printf_lock("k_argc = %d ", k_argc);
for (i = 0; i < k_argc; i++) {
- printf("'%s' ", k_argv[i]);
+ printf_lock("'%s' ", k_argv[i]);
}
- printf("\n");
+ printf_lock("\n");
/* rpb_percpu |= 0xfffffc0000000000;*/
kernel_params->bootadr = bootadr;
kernel_params->argc = k_argc;
kernel_params->argv = (ul)k_argv;
kernel_params->envp = (ul)envp;
- printf("jumping to kernel at 0x%x, (PCBB 0x%x pfn %d)\n", bootadr, rpb_percpu, free_pfn);
+ printf_lock("jumping to kernel at 0x%x, (PCBB 0x%x pfn %d)\n", bootadr, rpb_percpu, free_pfn);
jToPal(KSEG_TO_PHYS((ul)palJToKern));
- printf("returned from jToPal. Looping\n");
+ printf_lock("returned from jToPal. Looping\n");
while(1) continue;
}
strcpy((char*)a2, "");
i = (long)0xc000000000000000;
if (a1 >= 0 && a1 < MAX_ENV_INDEX)
- printf ("GETENV unsupported option %d (0x%x)\n", a1, a1);
+ printf_lock("GETENV unsupported option %d (0x%x)\n", a1, a1);
else
- printf ("GETENV unsupported option %s\n", a1);
+ printf_lock("GETENV unsupported option %s\n", a1);
}
if (i > a3)
case CONSCB_OPEN:
bcopy((char*)a1,deviceState[numOpenDevices].name,a2);
deviceState[numOpenDevices].name[a2] = '\0';
- printf("CONSOLE OPEN : %s --> success \n",
+ printf_lock("CONSOLE OPEN : %s --> success \n",
deviceState[numOpenDevices].name);
return numOpenDevices++;
case CONSCB_CLOSE:
break;
case CONSCB_OPEN_CONSOLE:
- printf("CONSOLE OPEN\n");
+ printf_lock("CONSOLE OPEN\n");
return 0; /* success */
break; /* not rearched */
case CONSCB_CLOSE_CONSOLE:
- printf("CONSOLE CLOSE\n");
+ printf_lock("CONSOLE CLOSE\n");
return 0; /* success */
break; /* not reached */
asm("bis $8, $31, %0" : "=r" (temp));
/* call original code */
- printf("CallbackFixup %x %x, t7=%x\n",a0,a1,temp);
+ printf_lock("CallbackFixup %x %x, t7=%x\n",a0,a1,temp);
/* restore the current pointer */
asm("bis %0, $31, $8" : : "r" (temp) : "$8");
/* extern void palJToSlave[]; */
extern unsigned int palJToSlave[];
- SpinLock(&theLock);
- printf("Slave CPU %d console command %s", cpu,my_rpb->rpb_iccb.iccb_rxbuf);
- SpinUnlock(&theLock);
+ printf_lock("Slave CPU %d console command %s", cpu,my_rpb->rpb_iccb.iccb_rxbuf);
my_rpb->rpb_state |= STATE_BIP;
my_rpb->rpb_state &= ~STATE_RC;
- SpinLock(&theLock);
- printf("SlaveCmd: restart %x %x vptb %x my_rpb %x my_rpb_phys %x\n",
+ printf_lock("SlaveCmd: restart %x %x vptb %x my_rpb %x my_rpb_phys %x\n",
rpb->rpb_restart,
rpb->rpb_restart_pv,
rpb->rpb_vptb, my_rpb,
KSEG_TO_PHYS(my_rpb));
- SpinUnlock(&theLock);
cServe(KSEG_TO_PHYS((ul)palJToSlave),
(ul)rpb->rpb_restart,
struct rpb_percpu *my_rpb = (struct rpb_percpu*)
((ul)rpb_percpu + size*cpu);
- SpinLock(&theLock);
if (cpu==0) {
panic("CPU 0 entering slaveLoop. Reenetering the console. HOSED \n");
} else {
- printf("Entering slaveloop for cpu %d my_rpb=%x \n",cpu,my_rpb);
+ printf_lock("Entering slaveloop for cpu %d my_rpb=%x \n",cpu,my_rpb);
}
- SpinUnlock(&theLock);
// swap the processors context to the one in the
// rpb_percpu struct very carefully (i.e. no stack usage)