diff options
author | Helge Deller <deller@gmx.de> | 2022-10-23 17:58:55 +0200 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2022-10-23 17:58:55 +0200 |
commit | b610dbf9cde446e6cdf6d08a31d93d5e6ec77fdd (patch) | |
tree | c6a662df8be100d579438086f178529cdc3b7d29 | |
parent | b60ea94ebec37eee83ca909a6ea42d102ed83a90 (diff) | |
download | seabios-hppa-b610dbf9cde446e6cdf6d08a31d93d5e6ec77fdd.zip seabios-hppa-b610dbf9cde446e6cdf6d08a31d93d5e6ec77fdd.tar.gz seabios-hppa-b610dbf9cde446e6cdf6d08a31d93d5e6ec77fdd.tar.bz2 |
parisc: Add BOOT_OUT pdc functions
-rw-r--r-- | src/parisc/head.S | 7 | ||||
-rw-r--r-- | src/parisc/parisc.c | 72 | ||||
-rw-r--r-- | src/parisc/pdc.h | 6 |
3 files changed, 53 insertions, 32 deletions
diff --git a/src/parisc/head.S b/src/parisc/head.S index 4ef7e1f..e7c69f3 100644 --- a/src/parisc/head.S +++ b/src/parisc/head.S @@ -138,10 +138,15 @@ name: /* On HPMC, the CPUs will start here at 0xf0000000 */ hpmc_entry: b,n toc_asm_entry /* TOC and HPMC */ - reset_entry: /* at reset, the CPU begins fetching instructions from address 0xf0000004. */ b,n startup +BOOT_ADDR: + b,n startup +ENTRY_ADDR: + break 0,0 /* TODO: should probably be: b,n iodc_entry */ +LPMC_ADDR: + b,n startup marker: /* file identification */ diff --git a/src/parisc/parisc.c b/src/parisc/parisc.c index 0420c63..d440e53 100644 --- a/src/parisc/parisc.c +++ b/src/parisc/parisc.c @@ -111,6 +111,7 @@ extern unsigned long boot_args[]; /* flags for pdc_debug */ #define DEBUG_PDC 0x0001 #define DEBUG_IODC 0x0002 +#define DEBUG_CHASSIS 0x0004 int pdc_console; /* flags for pdc_console */ @@ -154,6 +155,7 @@ extern char iodc_entry_table[14*4]; #define ARG5 arg[-5] #define ARG6 arg[-6] #define ARG7 arg[-7] +#define ARG8 arg[-8] #define ARG_LIST unsigned int *arg #define ARG_REFS arg #endif @@ -240,16 +242,20 @@ void flush_data_cache(char *start, size_t length) asm ("sync"); } -static void dump_mem(unsigned long addr, signed long len) +static void dump_mem(unsigned long addr, signed long len, unsigned long oaddr) { unsigned char *p = (unsigned char *)addr; + if (!(pdc_debug & DEBUG_PDC)) + return; + while (len > 0) { printf("%08lx: %02x %02x %02x %02x %02x %02x %02x %02x" " %02x %02x %02x %02x %02x %02x %02x %02x\n", - addr, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], + oaddr, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); addr += 16; + oaddr += 16; p += 16; len -= 16; } @@ -379,7 +385,7 @@ static int class_of_hpa(unsigned long hpa) int HPA_is_serial_device(unsigned long hpa) { - return (hpa == DINO_UART_HPA) || (hpa == LASI_UART_HPA); + return (hpa == DINO_UART_HPA) || (hpa == LASI_UART_HPA) || (hpa == MPE_CONSOLE_HPA); } int HPA_is_storage_device(unsigned long hpa) @@ -641,7 +647,7 @@ static void iodc_log_call(ARG_LIST, const char *func) { if (pdc_debug & DEBUG_IODC) { printf("\nIODC %s called: hpa=0x%x (%s) option=0x%x arg2=0x%x arg3=0x%x ", func, ARG0, hpa_name(ARG0), ARG1, ARG2, ARG3); - printf("result=0x%x arg5=0x%x arg6=0x%x arg7=0x%x\n", ARG4, ARG5, ARG6, ARG7); + printf("result=0x%x arg5=0x%x arg6=0x%x arg7=0x%x arg8=0x%x\n", ARG4, ARG5, ARG6, ARG7, ARG8); } } @@ -697,12 +703,31 @@ int __VISIBLE parisc_iodc_ENTRY_IO(ARG_LIST) /* boot medium I/O */ if (HPA_is_storage_device(hpa)) switch (option) { - case ENTRY_IO_BOOTIN: /* boot medium IN */ - case ENTRY_IO_BBLOCK_IN: /* boot block medium IN */ + case ENTRY_IO_BOOTOUT: /* boot medium OUT */ + case ENTRY_IO_BBLOCK_OUT: /* boot block medium OUT */ + disk_op.command = CMD_WRITE; + goto process_bootio; + + case ENTRY_IO_BOOTIN: /* boot medium IN */ + case ENTRY_IO_BBLOCK_IN: /* boot block medium IN */ + disk_op.command = CMD_READ; + + process_bootio: + + if (ARG6 >= ram_size) { /* ram address outside memory range? */ + result[0] = ARG7; + return PDC_OK; // work around MEM size detection problem with "DUMPAREA found, save main memory to disc" should be: PDC_ERROR XXX + } + if (ARG6 < PAGE_SIZE && + (option == ENTRY_IO_BOOTIN || option == ENTRY_IO_BBLOCK_IN)) { + printf("\nSeaBIOS: Will not overwrite page zero!\n"); + return PDC_ERROR; + } + disk_op.drive_fl = boot_drive; disk_op.buf_fl = (void*)ARG6; - disk_op.command = CMD_READ; - if (option == ENTRY_IO_BBLOCK_IN) { /* in 2k blocks */ + if (option == ENTRY_IO_BBLOCK_IN || + option == ENTRY_IO_BBLOCK_OUT) { /* in 2k blocks */ disk_op.count = (ARG7 * ((u64)FW_BLOCKSIZE / disk_op.drive_fl->blksize)); disk_op.lba = (ARG5 * ((u64)FW_BLOCKSIZE / disk_op.drive_fl->blksize)); } else { @@ -712,6 +737,8 @@ int __VISIBLE parisc_iodc_ENTRY_IO(ARG_LIST) // ARG8 = maxsize !!! ret = process_op(&disk_op); // dprintf(0, "\nBOOT IO res %d count = %d\n", ret, ARG7); + if ((pdc_debug & DEBUG_IODC) && (option == ENTRY_IO_BOOTOUT)) + printf("\nBOOT IO OUT ret %d count = %d\n", ret, ARG7); result[0] = ARG7; if (ret) return PDC_ERROR; @@ -948,21 +975,9 @@ static int pdc_chassis(ARG_LIST) case PDC_CHASSIS_DISPWARN: ARG4 = (ARG3 >> 17) & 7; chassis_code = ARG3 & 0xffff; - if (1) printf("PDC_CHASSIS: %s (%d), %sCHASSIS %0x\n", + if (pdc_debug & (DEBUG_CHASSIS|DEBUG_PDC)) + printf("PDC_CHASSIS: %s (%d), %sCHASSIS %0x\n", systat[ARG4], ARG4, (ARG3>>16)&1 ? "blank display, ":"", chassis_code); - -// dump_mem(0x3a0, 32*4); -#if 0 -IN: -0x00000000000e4008: ldi 3c8,r21 -0x00000000000e400c: ldwa 0(r21),r21 -0x00000000000e4010: cmpb,=,n r0,r21,0xe41ec - -0x00000000000e4014: ldb -31(sp),r22 -0x00000000000e4018: depw r22,15,16,r26 -0x00000000000e401c: break 4,80 -#endif - // fall through case PDC_CHASSIS_WARN: // return warnings regarding fans, batteries and temperature: None! @@ -1164,7 +1179,8 @@ static int pdc_iodc(ARG_LIST) int hpa_index; unsigned char *c; - dprintf(9, "\nSeaBIOS: Info PDC_IODC option %ld ARG3=%x ARG4=%x ARG5=%x ARG6=%x\n", option, ARG3, ARG4, ARG5, ARG6); + if (pdc_debug & DEBUG_IODC) + printf("\nSeaBIOS: Info PDC_IODC option %ld ARG2=%x ARG3=%x ARG4=%x ARG5=%x ARG6=%x\n", option, ARG2, ARG3, ARG4, ARG5, ARG6); hpa = ARG3; if (hpa == IDE_HPA) { // do NOT check for DINO_SCSI_HPA, breaks Linux which scans IO areas for unlisted io modules @@ -1257,12 +1273,12 @@ static int pdc_stable(ARG_LIST) if ((ARG2 + ARG4) > STABLE_STORAGE_SIZE) return PDC_INVALID_ARG; memcpy((unsigned char *) ARG3, &stable_storage[ARG2], ARG4); - dump_mem(ARG3, ARG4); + dump_mem(ARG3, ARG4, ARG3); return PDC_OK; case PDC_STABLE_WRITE: if ((ARG2 + ARG4) > STABLE_STORAGE_SIZE) return PDC_INVALID_ARG; - dump_mem(ARG3, ARG4); + dump_mem(ARG3, ARG4, (unsigned long) &nvolatile_storage[ARG2]); memcpy(&stable_storage[ARG2], (unsigned char *) ARG3, ARG4); return PDC_OK; case PDC_STABLE_RETURN_SIZE: @@ -1287,12 +1303,12 @@ static int pdc_nvolatile(ARG_LIST) if ((ARG2 + ARG4) > NVOLATILE_STORAGE_SIZE) return PDC_INVALID_ARG; memcpy((unsigned char *) ARG3, &nvolatile_storage[ARG2], ARG4); - dump_mem(ARG3, ARG4); + dump_mem(ARG3, ARG4, ARG3); return PDC_OK; case PDC_NVOLATILE_WRITE: if ((ARG2 + ARG4) > NVOLATILE_STORAGE_SIZE) return PDC_INVALID_ARG; - dump_mem(ARG3, ARG4); + dump_mem(ARG3, ARG4, (unsigned long) &nvolatile_storage[ARG2]); memcpy(&nvolatile_storage[ARG2], (unsigned char *) ARG3, ARG4); return PDC_OK; case PDC_NVOLATILE_RETURN_SIZE: @@ -2294,7 +2310,7 @@ void __VISIBLE start_parisc_firmware(void) PAGE0->memc_cont = ram_size; PAGE0->memc_phsize = ram_size; - PAGE0->memc_adsize = ram_size; + PAGE0->memc_adsize = 0; PAGE0->mem_pdc_hi = (MEM_PDC_ENTRY + 0ULL) >> 32; PAGE0->mem_free = 0x6000; // min PAGE_SIZE PAGE0->mem_hpa = CPU_HPA; // HPA of boot-CPU diff --git a/src/parisc/pdc.h b/src/parisc/pdc.h index e794e14..97d79cb 100644 --- a/src/parisc/pdc.h +++ b/src/parisc/pdc.h @@ -432,9 +432,9 @@ struct zeropage { unsigned int imm_max_mem; /* bytes of mem in IMM */ /* [0x3A0] boot console, display device and keyboard */ - struct pz_device mem_cons; /* description of console device */ - struct pz_device mem_boot; /* description of boot device */ - struct pz_device mem_kbd; /* description of keyboard device */ + struct pz_device mem_cons; /* 0x3a0: description of console device */ + struct pz_device mem_boot; /* 0x3d0: description of boot device */ + struct pz_device mem_kbd; /* 0x400: description of keyboard device */ /* [0x430] reserved */ int pad430[116]; |