coco2cart: reclaim buffers
authorAlan Cox <alan@linux.intel.com>
Sun, 4 Dec 2016 14:31:30 +0000 (14:31 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 4 Dec 2016 14:31:30 +0000 (14:31 +0000)
Tidy up the oddments that need deleting, and update the README

Kernel/platform-coco2cart/README
Kernel/platform-coco2cart/coco2.s
Kernel/platform-coco2cart/main.c

index 6c06095..1e4ccf3 100644 (file)
@@ -47,17 +47,9 @@ Make the boot loader robust (timeout handling)
 Add hash of code not just simple magic - so we know bits match
 
 Support for a real time clock and clock locking
-Review irq disabling. We shouldn't need much of this at all as we don't have
-floppy hell to contend with, but the switchin/switchout logic needs to be
-reviewed for interrupt safety and the IRQs re-enabled during swap in and
-out. We should also be totally clean now on FIR blocking, so audio might
-actually be doable if not doing drivewire.
-
-MPI switching
 
-- Fix IDE to support the map flip on transfers (needs little asm code
-  adding)
-- reclaim discard space by packing bss, then buffers then discard
+We should be totally clean now on FIR blocking, so audio might
+actually be doable if not doing drivewire.
 
 We have about 2K left to try and jam those bits in which might just about be
 enough to add support for very minimal MBR parsing and offsets. That would
index c32267e..a0c967e 100644 (file)
@@ -22,6 +22,7 @@
        .globl _ramsize
        .globl _procmem
        .globl _bufpool
+       .globl _discard_size
 
        ; imported
        .globl unix_syscall_entry
@@ -241,3 +242,7 @@ _bufpool:
        .ds 520*6               ; initial buffers
 
        ; Discard follows this so will be reclaimed
+
+       .area .discard
+_discard_size:
+       .db     __sectionlen_.discard__/BUFSIZE
index 0c2114c..2bba597 100644 (file)
@@ -9,12 +9,8 @@
 
 uint8_t membanks;
 uint8_t system_id;
-#if 0
-uint8_t cartslots = 1;
-uint8_t carttype[4];
-uint8_t bootslot = 0;
-#endif
 uint16_t swap_dev;
+struct blkbuf *bufpool_end = bufpool + NBUFS;
 
 void platform_idle(void)
 {
@@ -31,24 +27,18 @@ void do_beep(void)
 
 void platform_discard(void)
 {
-}
-#if 0
-/* Find a cartridge or it's slot */
-int cart_find(int id)
-{
-       int i;
-       for (i = 0; i < id; i++) {
-               if (carttype[i] == id)
-                       return i;
+       extern uint8_t discard_size;
+       bufptr bp = bufpool_end;
+
+       kprintf("%d buffers reclaimed from discard\n", discard_size);
+
+       bufpool_end += discard_size;    /* Reclaim the discard space */
+
+       memset(bp, 0, discard_size * sizeof(struct blkbuf));
+       /* discard_size is in discard so it dies here */
+       for (bp = bufpool + NBUFS; bp < bufpool_end; ++bp) {
+               bp->bf_dev = NO_DEVICE;
+               bp->bf_busy = BF_FREE;
        }
-       return -1;
 }
-#endif
 
-unsigned char vt_mangle_6847(unsigned char c)
-{
-       if (c >= 96)
-               c -= 32;
-       c &= 0x3F;
-       return c;
-}