console.c (7977:60051d2262c2) | console.c (7978:9700266d52f4) |
---|---|
1 2 3/* ****************************************** 4 * SimOS SRM Console 5 * 6 * Derived from Lance Berc's SRM console 7 * for the SRC XXM�Machine 8 * ******************************************/ 9 10 11/* from simos */ 12typedef unsigned long long uint64; | 1 2 3/* ****************************************** 4 * SimOS SRM Console 5 * 6 * Derived from Lance Berc's SRM console 7 * for the SRC XXM�Machine 8 * ******************************************/ 9 10 11/* from simos */ 12typedef unsigned long long uint64; |
13#include "machine_defs.h" 14#include "new_aouthdr.h" | 13typedef unsigned int uint32; 14 15#define CONSOLE |
15#include "alpha_access.h" | 16#include "alpha_access.h" |
17#include "machine_defs.h" 18 |
|
16#if 0 | 19#if 0 |
20#include "new_aouthdr.h" |
|
17#include "srcmax.h" 18#endif 19 20/* from ../h */ 21#include "lib.h" 22#include "rpb.h" 23#include "cserve.h" 24 --- 34 unchanged lines hidden (view full) --- 59#define NUM_KERNEL_THIRD (4) 60 61 62static unixBoot(int go, int argc, char **argv); 63void jToPal(ul bootadr); 64void SlaveLoop(int cpu); 65 66 | 21#include "srcmax.h" 22#endif 23 24/* from ../h */ 25#include "lib.h" 26#include "rpb.h" 27#include "cserve.h" 28 --- 34 unchanged lines hidden (view full) --- 63#define NUM_KERNEL_THIRD (4) 64 65 66static unixBoot(int go, int argc, char **argv); 67void jToPal(ul bootadr); 68void SlaveLoop(int cpu); 69 70 |
67AlphaAccess simosConf; | 71struct AlphaAccess simosConf; |
68 69/* ************************************************************** 70 * Console callbacks use VMS calling conventions 71 * read AXP manual, 2-64. 72 * ***************************************************************/ 73typedef struct OpenVMSFunc { 74 long dummy; 75 long func; --- 31 unchanged lines hidden (view full) --- 107 108void InitConsole(void) 109{ 110#if 0 111 CDR->intr_status =(DevRegister)(DEV_CNSLE_RX_INTR |DEV_CNSLE_TX_INTR); 112#endif 113} 114 | 72 73/* ************************************************************** 74 * Console callbacks use VMS calling conventions 75 * read AXP manual, 2-64. 76 * ***************************************************************/ 77typedef struct OpenVMSFunc { 78 long dummy; 79 long func; --- 31 unchanged lines hidden (view full) --- 111 112void InitConsole(void) 113{ 114#if 0 115 CDR->intr_status =(DevRegister)(DEV_CNSLE_RX_INTR |DEV_CNSLE_TX_INTR); 116#endif 117} 118 |
119char GetChar() 120{ 121 struct AlphaAccess *k1Conf = (struct AlphaAccess *)(__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); 122 return 0; 123} 124 |
|
115void PutChar(char c) 116{ 117#if 0 118 CDR->data = c; 119#endif 120#if 0 121 *(int*) PHYS_TO_K1(SLOT_D_COM1<<5) = c; 122#endif | 125void PutChar(char c) 126{ 127#if 0 128 CDR->data = c; 129#endif 130#if 0 131 *(int*) PHYS_TO_K1(SLOT_D_COM1<<5) = c; 132#endif |
123 AlphaAccess *k1Conf = (AlphaAccess *)(__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); | 133 struct AlphaAccess *k1Conf = (struct AlphaAccess *)(__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); |
124 k1Conf->outputChar = c; 125 126} 127 128 | 134 k1Conf->outputChar = c; 135 136} 137 138 |
129int passArgs(int argc) 130{ 131 ; 132} | 139int 140passArgs(int argc) 141{ return 0; } |
133 | 142 |
134 | 143int |
135main(int argc, char **argv) 136{ 137 int x,i; | 144main(int argc, char **argv) 145{ 146 int x,i; |
138 AlphaAccess *k1Conf = (AlphaAccess *)(__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); | 147 struct AlphaAccess *k1Conf = (struct AlphaAccess *)(__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); |
139 ui *k1ptr,*ksegptr; 140 141 142 InitConsole(); 143 printf("SimOS console \n"); 144 /* 145 * get configuration from backdoor 146 */ --- 23 unchanged lines hidden (view full) --- 170 return x; 171} 172 173/* 174 * BOOTING 175 */ 176struct rpb xxm_rpb = { 177 NULL, /* 000: physical self-reference */ | 148 ui *k1ptr,*ksegptr; 149 150 151 InitConsole(); 152 printf("SimOS console \n"); 153 /* 154 * get configuration from backdoor 155 */ --- 23 unchanged lines hidden (view full) --- 179 return x; 180} 181 182/* 183 * BOOTING 184 */ 185struct rpb xxm_rpb = { 186 NULL, /* 000: physical self-reference */ |
178 'H'|('W'<<8)|('R'<<16)|('P'<<24)|('B'<<32), /* 008: contains string "HWRPB" */ | 187 ((long)'H') | (((long)'W') << 8) | (((long)'R') << 16) | 188 ((long)'P' << 24) | (((long)'B') << 32), /* 008: contains string "HWRPB" */ |
179 6, /* 010: HWRPB version number */ 180 /* the byte count is wrong, but who needs it? - lance */ 181 0, /* 018: bytes in RPB perCPU CTB CRB MEDSC */ 182 0, /* 020: primary cpu id */ 183 8192, /* 028: page size in bytes */ 184 43, /* 030: number of phys addr bits */ 185 127, /* 038: max valid ASN */ 186 {'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1'}, /* 040: system serial num: 10 ascii chars */ --- 51 unchanged lines hidden (view full) --- 238struct rpb_percpu xxm_rpb_percpu = { 239 {0,0,0,0,0,0,0,{0,0},{0,0,0,0,0,0,0,0}}, /* 000: boot/restart HWPCB */ 240 (STATE_PA | STATE_PP | STATE_CV | STATE_PV | STATE_PMV | STATE_PL), /* 080: per-cpu state bits */ 241 0xc000, /* 088: palcode memory length */ 242 0x2000, /* 090: palcode scratch length */ 243 0x4000, /* 098: phys addr of palcode mem space */ 244 0x2000, /* 0A0: phys addr of palcode scratch space */ 245 (2 << 16) | (5 << 8) | 1, /* 0A8: PALcode rev required */ | 189 6, /* 010: HWRPB version number */ 190 /* the byte count is wrong, but who needs it? - lance */ 191 0, /* 018: bytes in RPB perCPU CTB CRB MEDSC */ 192 0, /* 020: primary cpu id */ 193 8192, /* 028: page size in bytes */ 194 43, /* 030: number of phys addr bits */ 195 127, /* 038: max valid ASN */ 196 {'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1'}, /* 040: system serial num: 10 ascii chars */ --- 51 unchanged lines hidden (view full) --- 248struct rpb_percpu xxm_rpb_percpu = { 249 {0,0,0,0,0,0,0,{0,0},{0,0,0,0,0,0,0,0}}, /* 000: boot/restart HWPCB */ 250 (STATE_PA | STATE_PP | STATE_CV | STATE_PV | STATE_PMV | STATE_PL), /* 080: per-cpu state bits */ 251 0xc000, /* 088: palcode memory length */ 252 0x2000, /* 090: palcode scratch length */ 253 0x4000, /* 098: phys addr of palcode mem space */ 254 0x2000, /* 0A0: phys addr of palcode scratch space */ 255 (2 << 16) | (5 << 8) | 1, /* 0A8: PALcode rev required */ |
246 5|(2<<32), /* 0B0: processor type */ | 256 5 | (2L << 32), /* 0B0: processor type */ |
247 7, /* 0B8: processor variation */ 248 'D'|('a'<<8)|('v'<<16)|('e'<<24), /* 0C0: processor revision */ 249 {'D','a','v','e','C','o','n','r','o','y',0,0,0,0,0,0}, /* 0C8: proc serial num: 10 ascii chars */ 250 0, /* 0D8: phys addr of logout area */ 251 0, /* 0E0: length in bytes of logout area */ 252 0, /* 0E8: halt pcb base */ 253 0, /* 0F0: halt pc */ 254 0, /* 0F8: halt ps */ --- 111 unchanged lines hidden (view full) --- 366 unix_boot_mem += (pages * 8192); 367 return ret; 368} 369 370ul *first = 0; 371ul *third_rpb = 0; 372ul *reservedFixup = 0; 373 | 257 7, /* 0B8: processor variation */ 258 'D'|('a'<<8)|('v'<<16)|('e'<<24), /* 0C0: processor revision */ 259 {'D','a','v','e','C','o','n','r','o','y',0,0,0,0,0,0}, /* 0C8: proc serial num: 10 ascii chars */ 260 0, /* 0D8: phys addr of logout area */ 261 0, /* 0E0: length in bytes of logout area */ 262 0, /* 0E8: halt pcb base */ 263 0, /* 0F0: halt pc */ 264 0, /* 0F8: halt ps */ --- 111 unchanged lines hidden (view full) --- 376 unix_boot_mem += (pages * 8192); 377 return ret; 378} 379 380ul *first = 0; 381ul *third_rpb = 0; 382ul *reservedFixup = 0; 383 |
384int strcpy(char *dst, char *src); 385 |
|
374struct rpb *rpb; 375 376unixBoot(int go, int argc, char **argv) 377{ 378 ul *second, *third_kernel, ptr, *tbb, size, *percpu_logout; 379 unsigned char *mdt_bitmap; 380 long *lp1, *lp2, sum; 381 int i, cl; --- 390 unchanged lines hidden (view full) --- 772 if (rpb->rpb_size > 8192*HWRPB_PAGES) { 773 panic("HWRPB_PAGES=%d too small for HWRPB !!! \n"); 774 } 775 776 777 { 778 ul *ptr = (ul*)((char*)rpb_dsr + sizeof(struct rpb_dsr )); 779 rpb_crb->rpb_pa_disp = KSEG_TO_PHYS(ptr); | 386struct rpb *rpb; 387 388unixBoot(int go, int argc, char **argv) 389{ 390 ul *second, *third_kernel, ptr, *tbb, size, *percpu_logout; 391 unsigned char *mdt_bitmap; 392 long *lp1, *lp2, sum; 393 int i, cl; --- 390 unchanged lines hidden (view full) --- 784 if (rpb->rpb_size > 8192*HWRPB_PAGES) { 785 panic("HWRPB_PAGES=%d too small for HWRPB !!! \n"); 786 } 787 788 789 { 790 ul *ptr = (ul*)((char*)rpb_dsr + sizeof(struct rpb_dsr )); 791 rpb_crb->rpb_pa_disp = KSEG_TO_PHYS(ptr); |
792#if 0 |
|
780 rpb_crb->rpb_va_disp = 0x10000000 + ((ul)ptr&(0x2000*HWRPB_PAGES-1)); | 793 rpb_crb->rpb_va_disp = 0x10000000 + ((ul)ptr&(0x2000*HWRPB_PAGES-1)); |
794#else 795 rpb_crb->rpb_va_disp = 0x10000000 + ((ul)ptr & 0x1fff); 796#endif |
|
781 printf("ConsoleDispatch at virt %x phys %x val %x\n", 782 rpb_crb->rpb_va_disp, 783 rpb_crb->rpb_pa_disp, 784 consoleCallback); 785 *ptr++ = 0; 786 *ptr++ = (ul) consoleCallback; 787 rpb_crb->rpb_pa_fixup = KSEG_TO_PHYS(ptr); | 797 printf("ConsoleDispatch at virt %x phys %x val %x\n", 798 rpb_crb->rpb_va_disp, 799 rpb_crb->rpb_pa_disp, 800 consoleCallback); 801 *ptr++ = 0; 802 *ptr++ = (ul) consoleCallback; 803 rpb_crb->rpb_pa_fixup = KSEG_TO_PHYS(ptr); |
804#if 0 |
|
788 rpb_crb->rpb_va_fixup = 0x10000000 + ((ul)ptr& (0x2000*HWRPB_PAGES-1)); | 805 rpb_crb->rpb_va_fixup = 0x10000000 + ((ul)ptr& (0x2000*HWRPB_PAGES-1)); |
806#else 807 rpb_crb->rpb_va_fixup = 0x10000000 + ((ul)ptr & 0x1fff); 808#endif |
|
789 *ptr++ = 0; 790 *ptr++ = (ul) consoleFixup; 791 } 792 793 794 /* Checksum the rpb for good luck */ 795 sum = 0; 796 lp1 = (long *)rpb; --- 5 unchanged lines hidden (view full) --- 802 803 /* 804 * MP bootstrap 805 */ 806 807 { 808 int i; 809 for (i=1;i<simosConf.numCPUs;i++) { | 809 *ptr++ = 0; 810 *ptr++ = (ul) consoleFixup; 811 } 812 813 814 /* Checksum the rpb for good luck */ 815 sum = 0; 816 lp1 = (long *)rpb; --- 5 unchanged lines hidden (view full) --- 822 823 /* 824 * MP bootstrap 825 */ 826 827 { 828 int i; 829 for (i=1;i<simosConf.numCPUs;i++) { |
810 volatile AlphaAccess *k1Conf = (volatile AlphaAccess *) | 830 volatile struct AlphaAccess *k1Conf = (volatile struct AlphaAccess *) |
811 (__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); 812 SpinLock(&theLock); 813 printf("Bootstraping CPU %d with sp=0x%x \n", 814 i,bootStrapImpure[i]); 815 SpinUnlock(&theLock); 816 k1Conf->bootStrapImpure = bootStrapImpure[i]; 817 k1Conf->bootStrapCPU = i; 818 } --- 120 unchanged lines hidden (view full) --- 939 * Console I/O 940 * ******************************************/ 941 942int numOpenDevices = 11; 943struct { 944 char name[128]; 945} deviceState[32]; 946 | 831 (__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); 832 SpinLock(&theLock); 833 printf("Bootstraping CPU %d with sp=0x%x \n", 834 i,bootStrapImpure[i]); 835 SpinUnlock(&theLock); 836 k1Conf->bootStrapImpure = bootStrapImpure[i]; 837 k1Conf->bootStrapCPU = i; 838 } --- 120 unchanged lines hidden (view full) --- 959 * Console I/O 960 * ******************************************/ 961 962int numOpenDevices = 11; 963struct { 964 char name[128]; 965} deviceState[32]; 966 |
947#define BOOTDEVICE_NAME "SCSI 1 0 0 1 100" | 967#define BOOTDEVICE_NAME "SCSI 1 0 0 1 100 0" |
948 | 968 |
949void DeviceOperation(long op,long channel, long count, long address, long block) | 969void 970DeviceOperation(long op, long channel, long count, long address, long block) |
950{ | 971{ |
951 AlphaAccess *k1Conf = (AlphaAccess *) | 972 struct AlphaAccess *k1Conf = (struct AlphaAccess *) |
952 (__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); 953 954 long pAddr; 955 956#if 0 957 printf("Console::DeviceRead count=0x%x address=0x%x block=0x%x\n", 958 count,address,block); 959#endif --- 28 unchanged lines hidden (view full) --- 988 989#define CONSCB_OPEN 0x10 990#define CONSCB_CLOSE 0x11 991#define CONSCB_READ 0x13 992 993#define CONSCB_GETENV 0x22 994 995/* AXP manual 2-26 */ | 973 (__MAGIC_ZONE(0, 0, MAGIC_ZONE_EV5_ALIAS)); 974 975 long pAddr; 976 977#if 0 978 printf("Console::DeviceRead count=0x%x address=0x%x block=0x%x\n", 979 count,address,block); 980#endif --- 28 unchanged lines hidden (view full) --- 1009 1010#define CONSCB_OPEN 0x10 1011#define CONSCB_CLOSE 0x11 1012#define CONSCB_READ 0x13 1013 1014#define CONSCB_GETENV 0x22 1015 1016/* AXP manual 2-26 */ |
1017#define ENV_AUTO_ACTION 0X01 1018#define ENV_BOOT_DEV 0X02 1019#define ENV_BOOTDEF_DEV 0X03 1020#define ENV_BOOTED_DEV 0X04 1021#define ENV_BOOT_FILE 0X05 1022#define ENV_BOOTED_FILE 0X06 1023#define ENV_BOOT_OSFLAGS 0X07 1024#define ENV_BOOTED_OSFLAGS 0X08 1025#define ENV_BOOT_RESET 0X09 1026#define ENV_DUMP_DEV 0X0A 1027#define ENV_ENABLE_AUDIT 0X0B 1028#define ENV_LICENSE 0X0C 1029#define ENV_CHAR_SET 0X0D 1030#define ENV_LANGUAGE 0X0E 1031#define ENV_TTY_DEV 0X0F 1032#define ENV_SCSIID 0X42 1033#define ENV_SCSIFAST 0X43 1034#define ENV_COM1_BAUD 0X44 1035#define ENV_COM1_MODEM 0X45 1036#define ENV_COM1_FLOW 0X46 1037#define ENV_COM1_MISC 0X47 1038#define ENV_COM2_BAUD 0X48 1039#define ENV_COM2_MODEM 0X49 1040#define ENV_COM2_FLOW 0X4A 1041#define ENV_COM2_MISC 0X4B 1042#define ENV_PASSWORD 0X4C 1043#define ENV_SECURE 0X4D 1044#define ENV_LOGFAIL 0X4E 1045#define ENV_SRM2DEV_ID 0X4F |
|
996 | 1046 |
997#define ENV_BOOTED_DEV 0x4 998#define ENV_BOOTED_OSFLAGS 0x8 | 1047#define MAX_ENVLEN 32 |
999 | 1048 |
1000long CallBackDispatcher(long a0, long a1, long a2, long a3, long a4) | 1049char env_booted_dev[MAX_ENVLEN] = BOOTDEVICE_NAME; 1050char env_booted_osflags[MAX_ENVLEN] = ""; 1051char env_com1_baud[MAX_ENVLEN] = ""; 1052char env_secure[MAX_ENVLEN] = ""; 1053 1054#if 0 1055char env_auto_action[MAX_ENVLEN] = ""; 1056char env_boot_dev[MAX_ENVLEN] = ""; 1057char env_bootdef_dev[MAX_ENVLEN] = ""; 1058char env_boot_file[MAX_ENVLEN] = ""; 1059char env_booted_file[MAX_ENVLEN] = ""; 1060char env_boot_osflags[MAX_ENVLEN] = ""; 1061char env_boot_reset[MAX_ENVLEN] = ""; 1062char env_dump_dev[MAX_ENVLEN] = ""; 1063char env_enable_audit[MAX_ENVLEN] = ""; 1064char env_license[MAX_ENVLEN] = ""; 1065char env_char_set[MAX_ENVLEN] = ""; 1066int env_language = 0; 1067char env_tty_dev[MAX_ENVLEN] = ""; 1068char env_scsiid[MAX_ENVLEN] = ""; 1069char env_scsifast[MAX_ENVLEN] = ""; 1070char env_com1_modem[MAX_ENVLEN] = ""; 1071char env_com1_flow[MAX_ENVLEN] = ""; 1072char env_com1_misc[MAX_ENVLEN] = ""; 1073char env_com2_baud[MAX_ENVLEN] = ""; 1074char env_com2_modem[MAX_ENVLEN] = ""; 1075char env_com2_flow[MAX_ENVLEN] = ""; 1076char env_com2_misc[MAX_ENVLEN] = ""; 1077char env_password[MAX_ENVLEN] = ""; 1078char env_logfail[MAX_ENVLEN] = ""; 1079char env_srm2dev_id[MAX_ENVLEN] = ""; 1080#endif 1081 1082long 1083CallBackDispatcher(long a0, long a1, long a2, long a3, long a4) |
1001{ | 1084{ |
1002 int i; | 1085 long i; |
1003 switch (a0) { | 1086 switch (a0) { |
1087 case CONSCB_GETC: 1088 break; 1089 |
|
1004 case CONSCB_PUTS: | 1090 case CONSCB_PUTS: |
1005 for(i=0;i<a3;i++) { | 1091 for(i = 0; i < a3; i++) { |
1006 PutChar(*(char *)a2+i); 1007 } 1008 return a3; | 1092 PutChar(*(char *)a2+i); 1093 } 1094 return a3; |
1095 |
|
1009 case CONSCB_GETENV: 1010 switch (a1) { 1011 case ENV_BOOTED_DEV: | 1096 case CONSCB_GETENV: 1097 switch (a1) { 1098 case ENV_BOOTED_DEV: |
1012 i = strcpy((char*)a2,BOOTDEVICE_NAME); 1013 break; | 1099 i = strcpy((char*)a2, env_booted_dev); 1100 break; 1101 |
1014 case ENV_BOOTED_OSFLAGS: | 1102 case ENV_BOOTED_OSFLAGS: |
1015 /* 1016 * 'c':ignores the sysconfigtab 1017 * 1018 * i= strcpy((char*)a2,"c"); 1019 */ 1020 i = strcpy((char*)a2,""); 1021 break; | 1103 i = strcpy((char*)a2, env_booted_osflags); 1104 break; 1105 1106 case ENV_COM1_BAUD: 1107 i = strcpy((char*)a2, env_com1_baud); 1108 break; 1109 1110 case ENV_SECURE: 1111 i = strcpy((char *)a2, env_secure); 1112 break; 1113 1114#if 0 1115 case ENV_AUTO_ACTION: 1116 case ENV_BOOT_DEV: 1117 case ENV_BOOTDEF_DEV: 1118 case ENV_BOOT_FILE: 1119 case ENV_BOOTED_FILE: 1120 case ENV_BOOT_OSFLAGS: 1121 case ENV_BOOT_RESET: 1122 case ENV_DUMP_DEV: 1123 case ENV_ENABLE_AUDIT: 1124 case ENV_LICENSE: 1125 case ENV_CHAR_SET: 1126 case ENV_LANGUAGE: 1127 case ENV_TTY_DEV: 1128 case ENV_SCSIID: 1129 case ENV_SCSIFAST: 1130 case ENV_COM1_MODEM: 1131 case ENV_COM1_FLOW: 1132 case ENV_COM1_MISC: 1133 case ENV_COM2_BAUD: 1134 case ENV_COM2_MODEM: 1135 case ENV_COM2_FLOW: 1136 case ENV_COM2_MISC: 1137 case ENV_PASSWORD: 1138 case ENV_LOGFAIL: 1139 case ENV_SRM2DEV_ID: 1140#endif |
1022 default: | 1141 default: |
1023 i = strcpy((char*)a2,""); 1024 printf ("GETENV unsupported option %d\n", a1); | 1142 strcpy((char*)a2,""); 1143 i = (long)0xc000000000000000; 1144 if (a1 >= 0 && a1 < 100) 1145 printf ("GETENV unsupported option %d\n", a1); 1146 else 1147 printf ("GETENV unsupported option %s\n", a1); |
1025 break; 1026 } 1027 if (i > a3) { 1028 panic("CONSCB_GETENV overwrote buffer \n"); 1029 } 1030 return i; 1031 case CONSCB_OPEN: 1032 bcopy((char*)a1,deviceState[numOpenDevices].name,a2); --- 94 unchanged lines hidden --- | 1148 break; 1149 } 1150 if (i > a3) { 1151 panic("CONSCB_GETENV overwrote buffer \n"); 1152 } 1153 return i; 1154 case CONSCB_OPEN: 1155 bcopy((char*)a1,deviceState[numOpenDevices].name,a2); --- 94 unchanged lines hidden --- |