crt0.o bootstrap.o commonmem.o coco2.o discard.o ../simple.o \
../start.o ../version.o ../lowlevel-6809.o \
tricks.o main.o ../timer.o ../kdata.o devices.o \
- drivewire.o devdw.o mini_ide.o mini_ide_discard.o \
+ drivewire.o devdw.o mini_ide.o mini_ide_discard.o ide.o \
../devio.o ../filesys.o ../process.o ../inode.o ../syscall_fs.o \
../syscall_proc.o ../syscall_other.o ../mm.o ../swap.o \
../tty.o ../devsys.o ../usermem.o usermem.o ../syscall_fs2.o \
.globl _devide_read_data
.globl _devide_write_data
-
- .globl _blk_op
+ .globl _idepage
include "kernel.def"
include "../kernel09.def"
.area .common
-
-;
-; Standard mapping for Glenside style IDE
;
; We don't really support swap properly but what we do is sufficient
; for a simple memory mapping.
pshs y,dp
lda #0xFF
tfr a,dp
- ldx _blk_op
leay 512,x
sty endp
- tst _blk_op+2
+ tst _idepage
beq readword
jsr map_process_always
readword:
pshs y,dp
lda #0xFF
tfr a,dp
- ldx _blk_op
leay 512,x
sty endp
- tst _blk_op+2
+ tst _idepage
beq writeword
jsr map_process_always
writeword:
puls y,dp,pc
endp: .dw 0
-
+_idepage:
+ .db 0
#define cmd ((volatile uint8_t *)0xFF57)
#define datal ((volatile uint8_t *)0xFF58)
+/* Assembler glue */
+
+extern void devide_read_data(uint8_t *p);
+extern void devide_write_data(uint8_t *p);
+extern uint8_t idepage;
+
/* FIXME: switch to the correct mpi slot on entry */
static int ide_transfer(uint8_t minor, bool is_read, uint8_t rawflag)
{
kprintf("IDE xfer dev %d r %d rf %d sec %d\n",
minor, is_read, rawflag, udata.u_block);
+
if (rawflag == 1 && d_blkoff(9))
return -1;
+
+ idepage = rawflag;
while(*status & 0x80); /* Wait !BUSY */
*devh = (minor & 0x80) ? 0xF0 : 0xE0 ; /* LBA, device */
while(udata.u_nblock--) {
unsigned int i;
while(!(*status & 0x08)); /* Wait DRQ */
- if (is_read) {
- for (i = 0; i < 256; i++) {
- *dptr++ = *data;
- *dptr++ = *datal;
- }
- } else {
- for (i = 0; i < 256; i++) {
- *datal = dptr[1];
- *data = *dptr++;
- dptr++;
- }
- }
+ if (is_read)
+ devide_read_data(dptr);
+ else
+ devide_write_data(dptr);
+ dptr += 512;
}
while(*status & 0x80); /* Wait !BUSY */
if (*status & 0x01) { /* Error */