* ******************************************/
-/* from simos */
+typedef unsigned long long uint64_t;
typedef unsigned long long uint64;
-#include "machine_defs.h"
-#include "new_aouthdr.h"
+typedef unsigned int uint32_t;
+typedef unsigned int uint32;
+
+#define CONSOLE
#include "alpha_access.h"
+
#if 0
+#include "new_aouthdr.h"
#include "srcmax.h"
#endif
#include "rpb.h"
#include "cserve.h"
-
#define CONS_INT_TX 0x01 /* interrupt enable / state bits */
#define CONS_INT_RX 0x02
#define K1BASE 0xfffffc8000000000
#define KSEG_TO_PHYS(x)(((ul)x) & ~KSEG)
-#define CDR ((volatile DevConsoleRegisters *) \
- (__MAGIC_ZONE(0, 0, MAGIC_ZONE_BDOOR_DEV) + __MAGIC_BDOOR_CNSLE_OFFS))
+#define ALPHA_ACCESS_BASE 0xfffffc8000a00000
#define PHYS_TO_K1(_x) (K1BASE|(_x))
void SlaveLoop(int cpu);
-AlphaAccess simosConf;
+struct AlphaAccess simosConf;
/* **************************************************************
* Console callbacks use VMS calling conventions
#endif
}
+char GetChar()
+{
+ struct AlphaAccess *k1Conf = (struct AlphaAccess *)(ALPHA_ACCESS_BASE);
+ return k1Conf->inputChar;
+}
+
void PutChar(char c)
{
#if 0
#if 0
*(int*) PHYS_TO_K1(SLOT_D_COM1<<5) = c;
#endif
- AlphaAccess *k1Conf = (AlphaAccess *)(__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS));
+ struct AlphaAccess *k1Conf = (struct AlphaAccess *)(ALPHA_ACCESS_BASE);
k1Conf->outputChar = c;
}
-int passArgs(int argc)
-{
- ;
-}
-
+int
+passArgs(int argc)
+{ return 0; }
+int
main(int argc, char **argv)
{
int x,i;
- AlphaAccess *k1Conf = (AlphaAccess *)(__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS));
+ struct AlphaAccess *k1Conf = (struct AlphaAccess *)(ALPHA_ACCESS_BASE);
ui *k1ptr,*ksegptr;
*/
struct rpb xxm_rpb = {
NULL, /* 000: physical self-reference */
- 'H'|('W'<<8)|('R'<<16)|('P'<<24)|('B'<<32), /* 008: contains string "HWRPB" */
+ ((long)'H') | (((long)'W') << 8) | (((long)'R') << 16) |
+ ((long)'P' << 24) | (((long)'B') << 32), /* 008: contains string "HWRPB" */
6, /* 010: HWRPB version number */
/* the byte count is wrong, but who needs it? - lance */
0, /* 018: bytes in RPB perCPU CTB CRB MEDSC */
#if 0
0x12, /* 050: system type - masquarade as some random 21064 */
#endif
- 12, /* masquerade a DEC_3000_500 (bugnion) */
- (2<<1), /* 058: system variation */
+ 0, /* masquerade a Tsunami RGD */
+ (1<<10), /* 058: system variation */
'c'|('o'<<8)|('o'<<16)|('l'<< 24), /* 060: system revision */
1024*4096, /* 068: scaled interval clock intr freq OVERRIDEN*/
0, /* 070: cycle counter frequency */
0x4000, /* 098: phys addr of palcode mem space */
0x2000, /* 0A0: phys addr of palcode scratch space */
(2 << 16) | (5 << 8) | 1, /* 0A8: PALcode rev required */
- 5|(2<<32), /* 0B0: processor type */
+ 5 | (2L << 32), /* 0B0: processor type */
7, /* 0B8: processor variation */
'D'|('a'<<8)|('v'<<16)|('e'<<24), /* 0C0: processor revision */
{'D','a','v','e','C','o','n','r','o','y',0,0,0,0,0,0}, /* 0C8: proc serial num: 10 ascii chars */
ul *third_rpb = 0;
ul *reservedFixup = 0;
+int strcpy(char *dst, char *src);
+
struct rpb *rpb;
unixBoot(int go, int argc, char **argv)
{
ul *ptr = (ul*)((char*)rpb_dsr + sizeof(struct rpb_dsr ));
rpb_crb->rpb_pa_disp = KSEG_TO_PHYS(ptr);
+#if 0
rpb_crb->rpb_va_disp = 0x10000000 + ((ul)ptr&(0x2000*HWRPB_PAGES-1));
+#else
+ rpb_crb->rpb_va_disp = 0x10000000 + ((ul)ptr & 0x1fff);
+#endif
printf("ConsoleDispatch at virt %x phys %x val %x\n",
rpb_crb->rpb_va_disp,
rpb_crb->rpb_pa_disp,
*ptr++ = 0;
*ptr++ = (ul) consoleCallback;
rpb_crb->rpb_pa_fixup = KSEG_TO_PHYS(ptr);
+#if 0
rpb_crb->rpb_va_fixup = 0x10000000 + ((ul)ptr& (0x2000*HWRPB_PAGES-1));
+#else
+ rpb_crb->rpb_va_fixup = 0x10000000 + ((ul)ptr & 0x1fff);
+#endif
*ptr++ = 0;
*ptr++ = (ul) consoleFixup;
}
{
int i;
for (i=1;i<simosConf.numCPUs;i++) {
- volatile AlphaAccess *k1Conf = (volatile AlphaAccess *)
- (__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS));
+ volatile struct AlphaAccess *k1Conf = (volatile struct AlphaAccess *)
+ (ALPHA_ACCESS_BASE);
SpinLock(&theLock);
printf("Bootstraping CPU %d with sp=0x%x \n",
i,bootStrapImpure[i]);
char name[128];
} deviceState[32];
-#define BOOTDEVICE_NAME "SCSI 1 0 0 1 100"
+#define BOOTDEVICE_NAME "SCSI 1 0 0 1 100 0"
-void DeviceOperation(long op,long channel, long count, long address, long block)
+void
+DeviceOperation(long op, long channel, long count, long address, long block)
{
- AlphaAccess *k1Conf = (AlphaAccess *)
- (__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS));
+ struct AlphaAccess *k1Conf = (struct AlphaAccess *)
+ (ALPHA_ACCESS_BASE);
long pAddr;
#define CONSCB_SET_TERM_INT 0x4
#define CONSCB_SET_TERM_CTL 0x5
#define CONSCB_PROCESS_KEY 0x6
+#define CONSCB_OPEN_CONSOLE 0x7
+#define CONSCB_CLOSE_CONSOLE 0x8
#define CONSCB_OPEN 0x10
#define CONSCB_CLOSE 0x11
#define CONSCB_GETENV 0x22
/* AXP manual 2-26 */
+#define ENV_AUTO_ACTION 0X01
+#define ENV_BOOT_DEV 0X02
+#define ENV_BOOTDEF_DEV 0X03
+#define ENV_BOOTED_DEV 0X04
+#define ENV_BOOT_FILE 0X05
+#define ENV_BOOTED_FILE 0X06
+#define ENV_BOOT_OSFLAGS 0X07
+#define ENV_BOOTED_OSFLAGS 0X08
+#define ENV_BOOT_RESET 0X09
+#define ENV_DUMP_DEV 0X0A
+#define ENV_ENABLE_AUDIT 0X0B
+#define ENV_LICENSE 0X0C
+#define ENV_CHAR_SET 0X0D
+#define ENV_LANGUAGE 0X0E
+#define ENV_TTY_DEV 0X0F
+#define ENV_SCSIID 0X42
+#define ENV_SCSIFAST 0X43
+#define ENV_COM1_BAUD 0X44
+#define ENV_COM1_MODEM 0X45
+#define ENV_COM1_FLOW 0X46
+#define ENV_COM1_MISC 0X47
+#define ENV_COM2_BAUD 0X48
+#define ENV_COM2_MODEM 0X49
+#define ENV_COM2_FLOW 0X4A
+#define ENV_COM2_MISC 0X4B
+#define ENV_PASSWORD 0X4C
+#define ENV_SECURE 0X4D
+#define ENV_LOGFAIL 0X4E
+#define ENV_SRM2DEV_ID 0X4F
+
+#define MAX_ENVLEN 32
+
+char env_auto_action[MAX_ENVLEN] = "BOOT";
+char env_boot_dev[MAX_ENVLEN] = "";
+char env_bootdef_dev[MAX_ENVLEN] = "";
+char env_booted_dev[MAX_ENVLEN] = BOOTDEVICE_NAME;
+char env_boot_file[MAX_ENVLEN] = "";
+char env_booted_file[MAX_ENVLEN] = "";
+char env_boot_osflags[MAX_ENVLEN] = "";
+char env_booted_osflags[MAX_ENVLEN] = "";
+char env_boot_reset[MAX_ENVLEN] = "";
+char env_dump_dev[MAX_ENVLEN] = "";
+char env_enable_audit[MAX_ENVLEN] = "";
+char env_license[MAX_ENVLEN] = "";
+char env_char_set[MAX_ENVLEN] = "";
+char env_language[MAX_ENVLEN] = "";
+char env_tty_dev[MAX_ENVLEN] = "0";
+char env_scsiid[MAX_ENVLEN] = "";
+char env_scsifast[MAX_ENVLEN] = "";
+char env_com1_baud[MAX_ENVLEN] = "";
+char env_com1_modem[MAX_ENVLEN] = "";
+char env_com1_flow[MAX_ENVLEN] = "";
+char env_com1_misc[MAX_ENVLEN] = "";
+char env_com2_baud[MAX_ENVLEN] = "";
+char env_com2_modem[MAX_ENVLEN] = "";
+char env_com2_flow[MAX_ENVLEN] = "";
+char env_com2_misc[MAX_ENVLEN] = "";
+char env_password[MAX_ENVLEN] = "";
+char env_secure[MAX_ENVLEN] = "";
+char env_logfail[MAX_ENVLEN] = "";
+char env_srm2dev_id[MAX_ENVLEN] = "";
+
+#define MAX_ENV_INDEX 100
+char *env_ptr[MAX_ENV_INDEX] =
+{
+ 0, /* 0x00 */
+ env_auto_action, /* 0x01 */
+ env_boot_dev, /* 0x02 */
+ env_bootdef_dev, /* 0x03 */
+ env_booted_dev, /* 0x04 */
+ env_boot_file, /* 0x05 */
+ env_booted_file, /* 0x06 */
+ env_boot_osflags, /* 0x07 */
+ env_booted_osflags, /* 0x08 */
+ env_boot_reset, /* 0x09 */
+ env_dump_dev, /* 0x0A */
+ env_enable_audit, /* 0x0B */
+ env_license, /* 0x0C */
+ env_char_set, /* 0x0D */
+ (char *)&env_language, /* 0x0E */
+ env_tty_dev, /* 0x0F */
+ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x10 - 0x1F */
+ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x20 - 0x2F */
+ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x30 - 0x3F */
+ 0, /* 0x40 */
+ 0, /* 0x41 */
+ env_scsiid, /* 0x42 */
+ env_scsifast, /* 0x43 */
+ env_com1_baud, /* 0x44 */
+ env_com1_modem, /* 0x45 */
+ env_com1_flow, /* 0x46 */
+ env_com1_misc, /* 0x47 */
+ env_com2_baud, /* 0x48 */
+ env_com2_modem, /* 0x49 */
+ env_com2_flow, /* 0x4A */
+ env_com2_misc, /* 0x4B */
+ env_password, /* 0x4C */
+ env_secure, /* 0x4D */
+ env_logfail, /* 0x4E */
+ env_srm2dev_id, /* 0x4F */
+ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* 0x50 - 0x5F */
+ 0, /* 0x60 */
+ 0, /* 0x61 */
+ 0, /* 0x62 */
+ 0, /* 0x63 */
+};
-#define ENV_BOOTED_DEV 0x4
-#define ENV_BOOTED_OSFLAGS 0x8
-
-long CallBackDispatcher(long a0, long a1, long a2, long a3, long a4)
+long
+CallBackDispatcher(long a0, long a1, long a2, long a3, long a4)
{
- int i;
+ long i;
switch (a0) {
+ case CONSCB_GETC:
+ return GetChar();
+
case CONSCB_PUTS:
- for(i=0;i<a3;i++) {
- PutChar(*(char *)a2+i);
- }
+ for(i = 0; i < a3; i++)
+ PutChar(*((char *)a2+i));
return a3;
+
case CONSCB_GETENV:
- switch (a1) {
- case ENV_BOOTED_DEV:
- i = strcpy((char*)a2,BOOTDEVICE_NAME);
- break;
- case ENV_BOOTED_OSFLAGS:
- /*
- * 'c':ignores the sysconfigtab
- *
- * i= strcpy((char*)a2,"c");
- */
- i = strcpy((char*)a2,"");
- break;
- default:
- i = strcpy((char*)a2,"");
- printf ("GETENV unsupported option %d\n", a1);
- break;
- }
- if (i > a3) {
- panic("CONSCB_GETENV overwrote buffer \n");
- }
- return i;
+ if (a1 >= 0 && a1 < MAX_ENV_INDEX && env_ptr[a1] != 0 && *env_ptr[a1]) {
+ i = strcpy((char*)a2, env_ptr[a1]);
+ } else {
+ strcpy((char*)a2, "");
+ i = (long)0xc000000000000000;
+ if (a1 >= 0 && a1 < MAX_ENV_INDEX)
+ printf ("GETENV unsupported option %d (0x%x)\n", a1, a1);
+ else
+ printf ("GETENV unsupported option %s\n", a1);
+ }
+
+ if (i > a3)
+ panic("CONSCB_GETENV overwrote buffer\n");
+ return i;
+
case CONSCB_OPEN:
bcopy((char*)a1,deviceState[numOpenDevices].name,a2);
deviceState[numOpenDevices].name[a2] = '\0';
case CONSCB_READ:
DeviceOperation(a0,a1,a2,a3,a4);
break;
+
case CONSCB_CLOSE:
break;
+ case CONSCB_OPEN_CONSOLE:
+ printf("CONSOLE OPEN\n");
+ return 0; /* success */
+ break; /* not rearched */
+ case CONSCB_CLOSE_CONSOLE:
+ printf("CONSOLE CLOSE\n");
+ return 0; /* success */
+ break; /* not reached */
+
default:
- panic("cher (%x,%x,%x,%x) \n",
- a0,a1,a2,a3);
+ panic("cher (%x,%x,%x,%x)\n", a0, a1, a2, a3);
}
+
return 0;
}
long CallBackFixup(int a0, int a1, int a2)
{
- printf("CallbackFixup %x %x \n",a0,a1);
+ long temp;
+ /* Linux uses r8 for the current pointer (pointer to data structure
+ contating info about currently running process). It is set when the
+ kernel starts and is expected to remain there... Problem is that the
+ unlike the kernel, the console does not prevent the assembler from
+ using r8. So here is a work around. So far this has only been a problem
+ in CallBackFixup() but any other call back functions could cause a problem
+ at some point */
+
+ /* save off the current pointer to a temp variable */
+ asm("bis $8, $31, %0" : "=r" (temp));
+
+ /* call original code */
+ printf("CallbackFixup %x %x, t7=%x\n",a0,a1,temp);
+
+ /* restore the current pointer */
+ asm("bis %0, $31, $8" : : "r" (temp) : "$8");
#if 0
if (first[FIRST(a1)]==0) {