changeset 11:ec991c3809db

make the ipl code generic
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 26 Feb 2011 12:28:22 -0500
parents 68bac03da6ff
children 2356e9d59bc4 e2b1d6184703
files Makefile hercules/herc.cnf ipl/loader.c ipl/loader_asm.S
diffstat 4 files changed, 19 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Feb 26 11:02:49 2011 -0500
+++ b/Makefile	Sat Feb 26 12:28:22 2011 -0500
@@ -49,8 +49,8 @@
 ipl/loader_asm.o: ipl/loader_asm.S
 	$(AS) -m64 -o $@ $<
 
-ipl/loader_c.o: ipl/loader.c sarpn
-	$(CC) $(CFLAGS) -DBLOCK_SIZE=80 -DBYTES_TO_READ=`stat -c '%s' sarpn` -c -o $@ $<
+ipl/loader_c.o: ipl/loader.c
+	$(CC) $(CFLAGS) -DBLOCK_SIZE=80 -c -o $@ $<
 
 ipl/ipl_ccws.S: ipl/setmode.rto ipl/loader.rto
 	bash scripts/gen_ccws.sh $@
--- a/hercules/herc.cnf	Sat Feb 26 11:02:49 2011 -0500
+++ b/hercules/herc.cnf	Sat Feb 26 12:28:22 2011 -0500
@@ -15,4 +15,4 @@
 # V     V       V
 #---    ----    --------------------
 0009	3215	
-000C    3505	../loader.bin ../sarpn ebcdic multifile
+000C    3505	../loader.bin ../sarpn ebcdic multifile intrq
--- a/ipl/loader.c	Sat Feb 26 11:02:49 2011 -0500
+++ b/ipl/loader.c	Sat Feb 26 12:28:22 2011 -0500
@@ -1,11 +1,3 @@
-#ifndef BYTES_TO_READ
-#error missing BYTES_TO_READ
-#endif
-
-#if BYTES_TO_READ > 0x300000
-#error The system size is limited to 3MB
-#endif
-
 #ifndef BLOCK_SIZE
 #error missing BLOCK_SIZE
 #endif
@@ -254,7 +246,7 @@
 /*
  * It is easier to write this thing in assembly...
  */
-extern void __do_io();
+extern int __do_io();
 extern void PGMHANDLER();
 
 static u64 pgm_new_psw[2] = {
@@ -326,13 +318,12 @@
 	read_ccw[7] = ((unsigned char) (BLOCK_SIZE & 0xff));
 
 	base = (unsigned long) TEMP_BASE;
-	for( ;
-	    (base - (unsigned long)TEMP_BASE) < BYTES_TO_READ;
-	    base += BLOCK_SIZE) {
+	for(;; base += BLOCK_SIZE) {
 		read_ccw[1] = ((unsigned char) (base >> 16));
 		read_ccw[2] = ((unsigned char) (base >> 8) & 0xff);
 		read_ccw[3] = ((unsigned char) (base & 0xff));
-		__do_io();
+		if (__do_io())
+			break;
 	}
 }
 
--- a/ipl/loader_asm.S	Sat Feb 26 11:02:49 2011 -0500
+++ b/ipl/loader_asm.S	Sat Feb 26 12:28:22 2011 -0500
@@ -32,15 +32,8 @@
 /*
 7) Enable the PSW for I/O interrupts and go into wait state (you need bits 6, 12 & 14 set to 1 in the PSW : X'020A000000000000' is a good example)
 */
-	LA	%r3, RETURN(%r4)	# interrupt return address
-	#STG	%r1, WAITPSW+8(%r4)	
-
 	LPSWE	WAITPSW(%r4)
 
-RETURN:
-	SR	%r2, %r2	# return 0
-	BR	%r14		# Done, let's go back to C!
-
 #
 # The IO interrupt handler
 #
@@ -57,11 +50,6 @@
 
 	TSCH	IRB(%r4)
 
-	# check the SCSW.. If CE Only : LPSW Old I/O PSW
-	L	%r1, IRB+5(%r4)
-	NILL	%r1, 0x04
-	BC	8, IONOTDONE(%r4)	# not device end => LPSWE
-
 /*
 FIXME: we should do more checking!
 
@@ -70,8 +58,18 @@
 13) If device end : I/O Completed.. Perform post I/O stuff (like advancing your pointers) and back to step 3
 */
 
-	# return to the "caller"
-	BR	%r3
+	# unit check? (end of media?)
+	L	%r1,IRB+5(%r4)
+	LA	%r0,0x02
+	NR	%r0,%r1
+	LA	%r2,1			# return 1 - end of medium
+	BCR	4,%r14			# unit chk => return
+
+	# check the SCSW.. If CE Only : LPSW Old I/O PSW
+	LA	%r0,0x04
+	NR	%r0,%r1
+	LA	%r2,0			# means IO done
+	BCR	4,%r14			# device end => return
 
 IONOTDONE:
 	LPSWE	0x170