atarist: get the fdc probing and add blkdev for the block devices
authorAlan Cox <alan@linux.intel.com>
Sun, 17 Mar 2019 00:39:09 +0000 (00:39 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 17 Mar 2019 00:39:09 +0000 (00:39 +0000)
No actual hard disk drivers yet, and it wil also need a GEMDOS partition table
parser adding.

Kernel/platform-atarist/Makefile
Kernel/platform-atarist/README
Kernel/platform-atarist/config.h
Kernel/platform-atarist/devfd.c
Kernel/platform-atarist/devices.c

index 62679e9..9e9e723 100644 (file)
@@ -5,12 +5,18 @@ CSRCS += devices.c main.c libc.c
 ASRCS = p68000.S crt0.S
 ASRCS += tricks.S
 
-COBJS = $(CSRCS:.c=$(BINEXT))
-AOBJS = $(ASRCS:.S=.o)
 LSRCS = ../lib/68000exception.c
 LOBJS = $(patsubst ../lib/%.c,%.o, $(LSRCS))
 
-OBJS  = $(COBJS) $(AOBJS) $(LOBJS)
+DSRCS = ../dev/mbr.c ../dev/blkdev.c
+DOBJS = $(patsubst ../dev/%.c,%.o, $(DSRCS))
+
+COBJS = $(CSRCS:.c=$(BINEXT))
+AOBJS = $(ASRCS:.S=.o)
+
+OBJS  = $(COBJS) $(AOBJS) $(DOBJS) $(LOBJS)
+
+CROSS_CCOPTS += -I../dev/
 
 all:   $(OBJS)
 
@@ -20,6 +26,9 @@ $(COBJS): %.o: %.c
 $(AOBJS): %.o: %.S
        $(CROSS_AS) $(ASOPTS) $< -o $*.o
 
+$(DOBJS): %.o: ../dev/%.c
+       $(CROSS_CC) $(CROSS_CCOPTS) -c $<
+
 $(LOBJS): %.o: ../lib/%.c
        $(CROSS_CC) $(CROSS_CCOPTS) -c $<
 
@@ -40,6 +49,7 @@ image:        loader fuzix.ld
        ../tty.o ../devsys.o ../usermem.o ../syscall_fs2.o \
        ../syscall_fs3.o ../syscall_exec32.o \
        ../usermem_std-68000.o devlpr.o devtty.o libc.o ../vt.o ../malloc.o \
+       blkdev.o mbr.o \
        ../font8x8.o >../fuzix.map
        m68k-uclinux-objcopy fuzix.elf -O binary ../fuzix.bin
        # And now make a bootable floppy
index 6d73366..40cb063 100644 (file)
@@ -1,6 +1,24 @@
 This is an initial 'gee it compiles' work in progress initial 68000 port
 
-Don't expect it to do anything !
+Status:
+-      Makes a bootable floppy correctly
+-      Floppy loads kernel and transfers to it
+-      Video seems to work (at least for high resolution)
+       (but clear to end of line is not yet done)
+-      Keyboard is done
+-      Timer interrupt is running
+-      Gets us to the point of prompting for a boot device
+-      Error trap handling seems to be a bit busted up
+
+In Progress
+-      Writing drivers for floppy, ACSI/SCSI, and IDE controllers
+
+TODO
+-      Clean up and abstract PSG GPIO interfaces and locking nicely
+-      Write the delay loop for the DMA. Probably a good excuse to use
+       the Linux 68K bogomips logic
+-      Probe for STe and Mega systems
+-      FDC set sides etc
 
 
 Notes:
@@ -9,15 +27,6 @@ Notes:
 Need to support 'resident' style binaries
 Start of disk boot block info ?
 
-Tidy up di/ei usage - we don't want to turn on hblank at random in our ei
-stuff!!!
-
-First boot sector loaded into buffer. must checksum to $1234
-then executed. Must be PI
-
-Eventually need multi-segment executables
-
-
 Interrupts
 
 2 - hblank
index 217cd50..463b037 100644 (file)
@@ -42,4 +42,6 @@
 #define NBUFS    10       /* Number of block buffers */
 #define NMOUNTS         4        /* Number of mounts at a time */
 
+#define MAX_BLKDEV     4
+
 /* TODO tty scan rows/cols etc */
index 80ab911..c6a59f3 100644 (file)
@@ -142,7 +142,8 @@ static int fd_wait(void)
 {
        timer_t x = set_timer_duration(3 * TICKSPERSEC);
        while (!timer_expired(x)) {
-               if (!((*(volatile uint8_t *)0xFFFA81) & 0x20))
+               uint8_t status = *(volatile uint8_t *)0xFFFA01;
+               if (!(status & 0x20))
                        return 0;
                platform_idle();
        }
@@ -391,6 +392,7 @@ static int fd_probe_drive(int unit)
 
 void fd_probe(void)
 {
+       /* Do we need to deal with waiting for motor off here ? */
        locked = 1;
        fd_probe_drive(0);
        fd_probe_drive(1);
index 50f0f27..e1d8402 100644 (file)
@@ -3,6 +3,7 @@
 #include <kdata.h>
 #include <devfd.h>
 #include <devsys.h>
+#include <blkdev.h>
 #include <devlpr.h>
 #include <tty.h>
 #include <vt.h>
@@ -11,16 +12,16 @@ struct devsw dev_tab[] =  /* The device driver switch table */
 {
 // minor    open         close        read      write       ioctl
 // -----------------------------------------------------------------
-  /* 0: /dev/fd                Floppy disc block devices  */
-  {  fd_open,     no_close,    fd_read,   fd_write,   no_ioctl },
-  /* 1: /dev/hd                Hard disc block devices (absent) */
-  {  nxio_open,     no_close,    no_rdwr,   no_rdwr,   no_ioctl },
+  /* 0: /dev/hd                Hard disc block devices */
+  {  blkdev_open, no_close,     blkdev_read, blkdev_write, blkdev_ioctl },
+  /* 1: /dev/fd                Floppy disc block devices  */
+  {  fd_open,     no_close,     fd_read,     fd_write,     no_ioctl },
   /* 2: /dev/tty       TTY devices */
-  {  tty_open,     tty_close,   tty_read,  tty_write,  vt_ioctl },
+  {  tty_open,    tty_close,    tty_read,    tty_write,    vt_ioctl },
   /* 3: /dev/lpr       Printer devices */
-  {  lpr_open,     lpr_close,   no_rdwr,   lpr_write,  no_ioctl  },
+  {  lpr_open,    lpr_close,    no_rdwr,     lpr_write,    no_ioctl  },
   /* 4: /dev/mem etc   System devices (one offs) */
-  {  no_open,      no_close,    sys_read, sys_write, sys_ioctl  },
+  {  no_open,     no_close,     sys_read,    sys_write,    sys_ioctl  },
   /* Pack to 7 with nxio if adding private devices and start at 8 */
 };
 
@@ -35,5 +36,6 @@ bool validdev(uint16_t dev)
 }
 void device_init(void)
 {
+    fd_probe();
 }