[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] [PATCH] USB mass storage driver. Avoid cpushi
Hi,
This patch is to avoid the crash when using the USB mass storage
driver with processors not implementing the cpushi instruction (ej:
030).
Comment: Change the way to install system variables (hd_rw, hd_bpb,
hd_mediach) through XBRA protocol. So no more crash with 030 because
cpushi.
Index: sys/usb/src.km/udd/storage/bios.S
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/udd/storage/bios.S,v
retrieving revision 1.1
diff -u -8 -p -r1.1 bios.S
--- sys/usb/src.km/udd/storage/bios.S 29 Apr 2011 11:39:32 -0000 1.1
+++ sys/usb/src.km/udd/storage/bios.S 11 Sep 2011 16:43:35 -0000
@@ -112,63 +112,27 @@ debug137: .ascii "XHDI XHDOSLimits"
debug138: .ascii "GALVEZ DEBUG" /* Galvez: DEBUG */
.byte 13,10,0
debug139: .ascii "XHDI XHReadWrite" /* Galvez: DEBUG */
.byte 13,10,0
.align 2
#endif
-// dc.l 0x58425241 // XBRA
-// dc.l 0x5F504349 // _PCI
-
text_color:
moveq #0,D0
move.w 0x3E86,D0 // number of planes
cmp.l #2,D0
bls.s .black_and_white
pea (A0)
move.w #9,-(SP)
jsr _cconws_from_S // Cconws
addq.l #6,SP
.black_and_white:
rts
-
-install_xbra: // A0: handler, D0: vector, D1: ID
- lea -28(SP),SP
- movem.l D1-D3/A0-A3,(SP)
- moveq #0,D3
- move.w D0,D3 // vector
- move.l A0,A3 // handler
- move.l D1,-(SP)
- move.l #18,-(SP) // size
- jsr _kmalloc_from_S
- addq.l #4,SP
- move.l (SP)+,D1
- tst.l D0
- beq.s .error_xbra
- move.l D0,A0
- move.l #0x58425241,(A0)+ // XBRA
- move.l D1,(A0)+
- clr.l (A0)+
- move.w #0x4EF9,(A0)+ // JMP
- move.l A3,(A0)+ // handler
- lea -10(A0),A0
-
- cpusha BC
-
- move.l D3,A1
- move.l (A1),D0
- move.l D0,(A0)+ // old vector
- move.l A0,(A1) // JMP, new vector
-.error_xbra:
- tst.l D0
- movem.l (SP),D1-D3/A0-A3
- lea 28(SP),SP
- rts
_install_usb_stor:
lea -32(SP),SP
movem.l D1-D4/A0-A3,(SP)
move.l 36(SP),D0 // dev_num
cmp.l #PUN_DEV,D0
bhi .no_pinfo // error
move.l 40(SP),D2 // part_type
@@ -285,29 +249,36 @@ _install_usb_stor:
beq .end_usb_disk // read error
tst.l _usb_1st_disk_drive
bne .usb_1st_drive_ok // hdv vectors installed
move.l D4,_usb_1st_disk_drive
move.w SR,D0
move.w D0,-(SP)
or.l #0x700,D0 // mask interrupts
move.w D0,SR
- move.l #0x5F555342,D1 // _USB
- lea det_hdv_bpb_usb(PC),A0
- move.w #hdv_bpb,D0
- bsr install_xbra
- move.l D0,old_hdv_bpb_usb
- lea det_hdv_rw_usb(PC),A0
- move.w #hdv_rw,D0
- bsr install_xbra
- move.l D0,old_hdv_rw_usb
- lea det_hdv_mediach_usb(PC),A0
- move.w #hdv_mediach,D0
- bsr install_xbra
- move.l D0,old_hdv_mediach_usb
+// move.l #0x5F555342,D1 // _USB
+
+ move.l #hdv_bpb,A0
+ lea old_hdv_bpb_usb(PC),A1
+ move.l (A0),(A1)
+ lea det_hdv_bpb_usb(PC),A1
+ move.l A1,(A0)
+
+ move.l #hdv_rw,A0
+ lea old_hdv_rw_usb(PC),A1
+ move.l (A0),(A1)
+ lea det_hdv_rw_usb(PC),A1
+ move.l A1,(A0)
+
+ move.l #hdv_mediach,A0
+ lea old_hdv_mediach_usb(PC),A1
+ move.l (A0),(A1)
+ lea det_hdv_mediach_usb(PC),A1
+ move.l A1,(A0)
+
move.l cookie,D0
beq.s .no_cookie_jar
move.l D0,A0
move.l #0x58484449,D1 // XHDI
.find_cookie_jar:
tst.l (A0)
beq.s .cookie_slot_free
cmp.l (A0),D1
@@ -535,16 +506,21 @@ _uninstall_usb_stor:
bclr D3,D0
move.l D0,my_drvbits
move.l D3,D0
.error:
movem.l (SP),D1-D4/A0-A3
lea 32(SP),SP
rts
+ dc.l 0x58425241 // XBRA
+ dc.l 0x5F555342 // ID: _USB
+old_hdv_bpb_usb:
+ dc.l 0
+
det_hdv_bpb_usb:
move.l A0,-(SP)
move.l pun_ptr,A0
moveq #0,D0
move.w 4+4(SP),D0 // drive
cmp.l _usb_1st_disk_drive,D0
bcs.s .dhbu2
cmp.l #MAX_LOGICAL_DRIVE,D0
@@ -588,16 +564,21 @@ det_hdv_bpb_usb:
lea debug4(PC),A0
jsr display_string
move.l (SP)+,D0
#endif
move.l (SP)+,D1
move.l (SP)+,A0
rts
+ dc.l 0x58425241 // XBRA
+ dc.l 0x5F555342 // ID: _USB
+old_hdv_rw_usb:
+ dc.l 0
+
det_hdv_rw_usb:
lea -28(SP),SP
movem.l D1-D4/A0-A2,(SP)
#ifdef DEBUG_BIOS_LAYER
lea debug3(PC),A0
jsr display_string
move.w 4+28(SP),D0 // rwflag
jsr hex_word
@@ -729,16 +710,21 @@ det_hdv_rw_usb:
ext.w D0
ext.l D0
bclr #0,D0 // OK or device not responding -2
.dhru3:
movem.l (SP),D1-D4/A0-A2
lea 28(SP),SP
rts
+ dc.l 0x58425241 // XBRA
+ dc.l 0x5F555342 // ID: _USB
+old_hdv_mediach_usb:
+ dc.l 0
+
det_hdv_mediach_usb:
move.l A0,-(SP)
move.l pun_ptr,A0
moveq #0,D0
move.w 4+4(SP),D0 // drive
cmp.l _usb_1st_disk_drive,D0
bcs.s .dhmu2
cmp.l #MAX_LOGICAL_DRIVE,D0
@@ -1297,16 +1283,12 @@ error4: .ascii "partition type not suppo
blue: .byte 0x1B,0x62,0x34,0
black: .byte 0x1B,0x62,0x3F,0
.align 2
.lcomm pun_ptr_usb,4
.lcomm my_drvbits,4
.lcomm _usb_1st_disk_drive,4
- .lcomm old_hdv_bpb_usb,4
- .lcomm old_hdv_rw_usb,4
- .lcomm old_hdv_mediach_usb,4
.lcomm old_xhdi,4
.lcomm old_xhdi_version,4
.lcomm product_name,4*(PUN_DEV+1)
-