From: falcovorbis <fal...@us...> - 2024-08-19 04:15:26
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 8f1db16e84dbbc968567f5bda8c6f96b012b74b1 (commit) via 3d61838a3ee4c93ad4aa83efe3cd0025376e20d6 (commit) via f9f426bae33fa886039aab1f85a6744225aaaa0c (commit) from 3c99eb588dd1ae664b0e42481b15ba8c57381cf3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8f1db16e84dbbc968567f5bda8c6f96b012b74b1 Author: Paul Cercueil <pa...@cr...> Date: Mon Aug 19 06:15:09 2024 +0200 Support chained LBA28 DMA transfers in IDE and DMA transfers in FAT (#662) * g1ata: Factorize code Factorize the code that sets the sector LBA and length of the next transfer, into a dedicated function. Signed-off-by: Paul Cercueil <pa...@cr...> * g1ata: Support chained LBA28 DMA transfers Add support for transferring more than 256 sectors worth of data using DMA on devices that don't support LBA48. This works by cutting the DMA transfer into chunks of 256 sectors, that are transferred automatically: every time a 256-sectors transfer is done, the DMA complete IRQ will start the next one. Signed-off-by: Paul Cercueil <pa...@cr...> * libkosfat: Align buffers to 32 bytes to support DMA Use memalign() to allocate buffers aligned to 32 bytes for those that need it; and also align buffers on the stack when needed. This makes it possible to mount a FAT filesystem on a IDE drive using DMA accesses for faster and CPU-free transfers. Signed-off-by: Paul Cercueil <pa...@cr...> --------- Signed-off-by: Paul Cercueil <pa...@cr...> commit 3d61838a3ee4c93ad4aa83efe3cd0025376e20d6 Author: Paul Cercueil <pa...@cr...> Date: Mon Aug 19 06:09:27 2024 +0200 Fix 24-bit / 32-bit video modes (#697) * video: Configure PVR video mode in vid_set_mode() Also configure the pixel mode at which the PVR will render, instead of only configuring the framebuffer mode. This makes the 24-bit and 32-bit video modes usable with the PVR. Signed-off-by: Paul Cercueil <pa...@cr...> * pvr: Fix PVR rendering for 24/32-bit video modes Replace hardcoded x2 with the corresponding multiplier for the pixel mode. Signed-off-by: Paul Cercueil <pa...@cr...> --------- Signed-off-by: Paul Cercueil <pa...@cr...> commit f9f426bae33fa886039aab1f85a6744225aaaa0c Author: Andy Barajas <and...@gm...> Date: Sun Aug 18 21:06:05 2024 -0700 Make FD_SETSIZE configurable (#703) * Reduce FD_SETSIZE from 1024 => 64 The maximum amount of files that can be opened at once is 64. We can save 11.25 KB if we reduce FD_SETSIZE to 64. * Allow FD_SETSIZE value to be overwritten Move all the #define FD_SETSIZE definitions to one file, opts.h. Add an option to environ.sh to allow FD_SETSIZE to be configured. Add an printf message if opening a file fails and FD_SETSIZE is not set to the default. * Updated documenation comment ----------------------------------------------------------------------- Summary of changes: addons/libkosfat/bpb.c | 6 +- addons/libkosfat/bpb.h | 4 +- addons/libkosfat/fatfs.c | 5 +- doc/environ.sh.sample | 15 ++ include/kos/fs.h | 6 +- include/kos/opts.h | 6 + include/sys/_types.h | 4 - include/sys/select.h | 6 +- kernel/arch/dreamcast/hardware/g1ata.c | 220 +++++++++------------ kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 2 +- .../dreamcast/hardware/pvr/pvr_init_shutdown.c | 2 +- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 2 +- kernel/arch/dreamcast/hardware/video.c | 19 ++ kernel/fs/fs.c | 7 +- 14 files changed, 154 insertions(+), 150 deletions(-) diff --git a/addons/libkosfat/bpb.c b/addons/libkosfat/bpb.c index b34eece0..740a64e0 100644 --- a/addons/libkosfat/bpb.c +++ b/addons/libkosfat/bpb.c @@ -4,6 +4,7 @@ Copyright (C) 2012, 2019 Lawrence Sebald */ +#include <malloc.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> @@ -18,7 +19,7 @@ static int fat_read_raw_boot(fat_bootblock_t *sb, kos_blockdev_t *bd) { if(bd->l_block_size > 9) { uint8_t *buf; - if(!(buf = (uint8_t *)malloc(1 << bd->l_block_size))) + if(!(buf = (uint8_t *)memalign(32, 1 << bd->l_block_size))) return -ENOMEM; if(bd->read_blocks(bd, 0, 1, buf)) @@ -28,9 +29,6 @@ static int fat_read_raw_boot(fat_bootblock_t *sb, kos_blockdev_t *bd) { free(buf); return 0; } - else if(bd->l_block_size == 9) { - return bd->read_blocks(bd, 0, 1, sb); - } else { return bd->read_blocks(bd, 0, 512 >> bd->l_block_size, sb); } diff --git a/addons/libkosfat/bpb.h b/addons/libkosfat/bpb.h index bc57f9b7..b7ac1e95 100644 --- a/addons/libkosfat/bpb.h +++ b/addons/libkosfat/bpb.h @@ -64,7 +64,7 @@ typedef struct fat_bootblock { fat16_ebpb_t fat16; fat32_ebpb_t fat32; } ebpb; -} __attribute__((packed)) fat_bootblock_t; +} __attribute__((packed,aligned(32))) fat_bootblock_t; typedef struct fat32_fsinfo { uint32_t fsinfo_sig1; @@ -74,7 +74,7 @@ typedef struct fat32_fsinfo { uint32_t last_alloc_cluster; uint8_t reserved2[12]; uint32_t fsinfo_sig3; -} __attribute__((packed)) fat32_fsinfo_t; +} __attribute__((packed,aligned(32))) fat32_fsinfo_t; #define FAT32_FSINFO_SIG1 0x41615252 #define FAT32_FSINFO_SIG2 0x61417272 diff --git a/addons/libkosfat/fatfs.c b/addons/libkosfat/fatfs.c index 3e458806..438ba739 100644 --- a/addons/libkosfat/fatfs.c +++ b/addons/libkosfat/fatfs.c @@ -4,6 +4,7 @@ Copyright (C) 2012, 2013, 2019 Lawrence Sebald */ +#include <malloc.h> #include <stdio.h> #include <errno.h> #include <stdint.h> @@ -315,7 +316,7 @@ fat_fs_t *fat_fs_init_ex(kos_blockdev_t *bd, uint32_t flags, int cache_sz, } for(j = 0; j < cache_sz; ++j) { - if(!(rv->bcache[j]->data = (uint8_t *)malloc(cluster_size))) { + if(!(rv->bcache[j]->data = (uint8_t *)memalign(32, cluster_size))) { goto out_bcache; } @@ -337,7 +338,7 @@ fat_fs_t *fat_fs_init_ex(kos_blockdev_t *bd, uint32_t flags, int cache_sz, } for(j = 0; j < fcache_sz; ++j) { - if(!(rv->fcache[j]->data = (uint8_t *)malloc(block_size))) { + if(!(rv->fcache[j]->data = (uint8_t *)memalign(32, block_size))) { goto out_fcache2; } diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index f1a0989d..ad12f47e 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -144,6 +144,21 @@ export KOS_CFLAGS="${KOS_CFLAGS} -O2" # #export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple -flto=auto" +# RAM-Saving Optimization +# +# Uncomment the line below to reduce the default size of FD_SETSIZE from the +# default value of 1024 to 64. FD_SETSIZE defines the maximum number of files +# that can be opened simultaneously, including files on the ramdisk, romdisk, +# CD, VMU, network sockets, etc. The default setting allows 1024 files to be +# opened at once, which is typically more than most use cases require. +# +# By reducing this value, you can save approximately ~11.25 KB of RAM, which +# can be particularly useful when porting large games to the Dreamcast that +# are strapped for memory. However, be cautious not to set it too low, as this +# may limit the number of files and sockets that can be opened simultaneously. +# +# export KOS_CFLAGS="${KOS_CFLAGS} -DFD_SETSIZE=64" + # Frame Pointers # # Controls whether frame pointers are emitted or not. Disabled by diff --git a/include/kos/fs.h b/include/kos/fs.h index d3e58b90..2cc3924d 100644 --- a/include/kos/fs.h +++ b/include/kos/fs.h @@ -29,6 +29,7 @@ __BEGIN_DECLS #include <sys/types.h> #include <kos/limits.h> +#include <kos/opts.h> #include <time.h> #include <sys/queue.h> #include <stdarg.h> @@ -205,11 +206,6 @@ typedef struct vfs_handler { int (*fstat)(void *hnd, struct stat *st); } vfs_handler_t; -/** \brief The number of distinct file descriptors that can be in use at a - time. -*/ -#define FD_SETSIZE 1024 - /** \cond */ /* This is the private struct that will be used as raw file handles underlying descriptors. */ diff --git a/include/kos/opts.h b/include/kos/opts.h index 888e428a..fe005278 100644 --- a/include/kos/opts.h +++ b/include/kos/opts.h @@ -129,6 +129,12 @@ __BEGIN_DECLS #define FS_RAMDISK_MAX_FILES 8 #endif +/** \brief The number of distinct file descriptors that can be in use at a + time. This value can be overwritten in environ.sh */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 1024 +#endif + /** @} */ __END_DECLS diff --git a/include/sys/_types.h b/include/sys/_types.h index 4e3df568..2cbc2027 100644 --- a/include/sys/_types.h +++ b/include/sys/_types.h @@ -159,10 +159,6 @@ typedef _TIMER_T_ __timer_t; typedef _CLOCK_T_ __clock_t; -// This part inserted to fix newlib brokenness. -/** \brief Size of an fd_set. */ -#define FD_SETSIZE 1024 - /* The architecture should define the macro BYTE_ORDER in <arch/types.h> to equal one of these macros for code that looks for these BSD-style macros. */ /** \brief Little Endian test macro */ diff --git a/include/sys/select.h b/include/sys/select.h index bcc78eec..9d12ed14 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -26,6 +26,7 @@ __BEGIN_DECLS #include <newlib.h> +#include <kos/opts.h> #if __NEWLIB__ > 2 || (__NEWLIB__ == 2 && __NEWLIB_MINOR__ > 2) #include <sys/_timeval.h> @@ -41,11 +42,6 @@ __BEGIN_DECLS #define _SYS_TYPES_FD_SET -#ifndef FD_SETSIZE -/* This matches fs.h. */ -#define FD_SETSIZE 1024 -#endif - #define NFDBITS 32 /** \brief Represents a set of file descriptors */ diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 5d4e3fcc..7faa8c0a 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -170,6 +170,9 @@ static uint8_t orig_dev = 0x00; /* Variables related to DMA. */ static int dma_in_progress = 0; static int dma_blocking = 0; +static uint8_t dma_cmd = 0; +static size_t dma_nb_sectors = 0; +static uint64_t dma_sector = 0; static semaphore_t dma_done = SEM_INITIALIZER(0); static kthread_t *dma_thd = NULL; @@ -211,12 +214,47 @@ inline int g1_ata_mutex_unlock(void) { return mutex_unlock(&_g1_ata_mutex); } +static void g1_ata_set_sector_and_count(uint64_t sector, uint32_t count, int lba28) { + if(!lba28) { + OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)(count >> 8)); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 32) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 40) & 0xFF)); + } + + /* Write out the number of sectors we want and the lower 24-bits of + the LBA we're looking for. Note that putting 0 into the sector count + register returns 256 sectors. */ + OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)count); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); +} + static void g1_dma_irq_hnd(uint32 code, void *data) { + unsigned int nb_sectors; + /* XXXX: Probably should look at the code to make sure it isn't an error. */ (void)code; (void)data; - if(dma_in_progress) { + if(dma_in_progress && dma_nb_sectors > 256) { + dma_sector += 256; + dma_nb_sectors -= 256; + nb_sectors = dma_nb_sectors <= 256 ? dma_nb_sectors : 256; + + /* Set the DMA parameters for the next transfer. */ + g1_ata_set_sector_and_count(dma_sector, nb_sectors, 1); + OUT32(G1_ATA_DMA_ADDRESS, IN32(G1_ATA_DMA_ADDRESS) + 256 * 512); + OUT32(G1_ATA_DMA_LENGTH, nb_sectors * 512); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, dma_cmd); + + /* Re-start the DMA transfer. */ + OUT32(G1_ATA_DMA_STATUS, 1); + } + else if(dma_in_progress) { /* Signal the calling thread to continue, if it is blocking. */ if(dma_blocking) { sem_signal(&dma_done); @@ -283,6 +321,8 @@ static int dma_common(uint8_t cmd, size_t nsects, uint32_t addr, int dir, int block) { uint8_t status; + dma_cmd = cmd; + /* Set the thread ID that initiated this DMA. */ dma_thd = thd_current; @@ -489,6 +529,7 @@ int g1_ata_read_lba(uint64_t sector, size_t count, void *buf) { uint8_t nsects = (uint8_t)count; uint16_t word; uint8_t *ptr = (uint8_t *)buf; + int lba28, cmd; /* Make sure that we've been initialized and there's a disk attached. */ if(!devices) { @@ -520,44 +561,26 @@ int g1_ata_read_lba(uint64_t sector, size_t count, void *buf) { count -= nsects; /* Which mode are we using: LBA28 or LBA48? */ - if((sector + nsects) <= 0x0FFFFFFF) { + lba28 = (sector + nsects) <= 0x0FFFFFFF; + if(lba28) { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((sector >> 24) & 0x0F)); - - /* Write out the number of sectors we want and the lower 24-bits of - the LBA we're looking for. */ - OUT8(G1_ATA_SECTOR_COUNT, nsects); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); - - /* Wait until the drive is ready to accept the command. */ - g1_ata_wait_nbsy(); - g1_ata_wait_drdy(); - - /* Write out the command to the device. */ - OUT8(G1_ATA_COMMAND_REG, ATA_CMD_READ_SECTORS); + cmd = ATA_CMD_READ_SECTORS; } else { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE); + cmd = ATA_CMD_READ_SECTORS_EXT; + } - /* Write out the number of sectors we want and the LBA. */ - OUT8(G1_ATA_SECTOR_COUNT, 0); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 32) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 40) & 0xFF)); - OUT8(G1_ATA_SECTOR_COUNT, nsects); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); - - /* Wait until the drive is ready to accept the command. */ - g1_ata_wait_nbsy(); - g1_ata_wait_drdy(); + /* Write out the number of sectors we want and the LBA. */ + g1_ata_set_sector_and_count(sector, nsects, lba28); - /* Write out the command to the device. */ - OUT8(G1_ATA_COMMAND_REG, ATA_CMD_READ_SECTORS_EXT); - } + /* Wait until the drive is ready to accept the command. */ + g1_ata_wait_nbsy(); + g1_ata_wait_drdy(); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, cmd); /* Now, wait for the drive to give us back each sector. */ for(i = 0; i < nsects; ++i, ++sector) { @@ -589,9 +612,9 @@ out: int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, int block) { - int rv = 0; + int lba28, old, can_lba48 = CAN_USE_LBA48(); uint32_t addr; - int old, can_lba48 = CAN_USE_LBA48(); + uint8_t cmd; /* Make sure we're actually being asked to do work... */ if(!count) @@ -621,7 +644,7 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, } /* Chaining isn't done yet, so make sure we don't need to. */ - if(count > 65536 || (!can_lba48 && count > 256)) { + if(count > 65536) { errno = EOVERFLOW; return -1; } @@ -663,56 +686,41 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, /* Set the settings for this transfer and re-enable IRQs. */ dma_blocking = block; dma_in_progress = 1; + dma_nb_sectors = count; + dma_sector = sector; irq_restore(old); + if(!can_lba48 && count > 256) + count = 256; + /* Wait for the device to signal it is ready. */ g1_ata_wait_bsydrq(); /* Which mode are we using: LBA28 or LBA48? */ - if(!can_lba48 || use_lba28(sector, count)) { + lba28 = !can_lba48 || use_lba28(sector, count); + if(lba28) { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((sector >> 24) & 0x0F)); - - /* Write out the number of sectors we want and the lower 24-bits of - the LBA we're looking for. Note that putting 0 into the sector count - register returns 256 sectors. */ - OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)count); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); - - /* Do the rest of the work... */ - rv = dma_common(ATA_CMD_READ_DMA, count, addr, G1_DMA_TO_MEMORY, block); + cmd = ATA_CMD_READ_DMA; } else { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE); - - /* Write out the number of sectors we want and the LBA. Note that in - LBA48 mode, putting 0 into the sector count register returns 65536 - sectors (not that we have that much RAM on the Dreamcast). */ - OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)(count >> 8)); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 32) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 40) & 0xFF)); - OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)count); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); - - /* Do the rest of the work... */ - rv = dma_common(ATA_CMD_READ_DMA_EXT, count, addr, G1_DMA_TO_MEMORY, - block); + cmd = ATA_CMD_READ_DMA_EXT; } - return rv; + /* Write out the number of sectors we want and the LBA. */ + g1_ata_set_sector_and_count(sector, count, lba28); + + /* Do the rest of the work... */ + return dma_common(cmd, count, addr, G1_DMA_TO_MEMORY, block); } int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { - int rv = 0; unsigned int i, j; uint8_t nsects = (uint8_t)count; uint16_t word; uint8_t *ptr = (uint8_t *)buf; + int cmd, lba28; /* Make sure that we've been initialized and there's a disk attached. */ if(!devices) { @@ -744,37 +752,23 @@ int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { count -= nsects; /* Which mode are we using: LBA28 or LBA48? */ - if((sector + nsects) <= 0x0FFFFFFF) { + lba28 = (sector + nsects) <= 0x0FFFFFFF; + if(lba28) { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((sector >> 24) & 0x0F)); - - /* Write out the number of sectors we want and the lower 24-bits of - the LBA we're looking for. */ - OUT8(G1_ATA_SECTOR_COUNT, nsects); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); - - /* Write out the command to the device. */ - OUT8(G1_ATA_COMMAND_REG, ATA_CMD_WRITE_SECTORS); + cmd = ATA_CMD_WRITE_SECTORS; } else { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE); - - /* Write out the number of sectors we want and the LBA. */ - OUT8(G1_ATA_SECTOR_COUNT, 0); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 32) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 40) & 0xFF)); - OUT8(G1_ATA_SECTOR_COUNT, nsects); - OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); - OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); - OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); - - /* Write out the command to the device. */ - OUT8(G1_ATA_COMMAND_REG, ATA_CMD_WRITE_SECTORS_EXT); + cmd = ATA_CMD_WRITE_SECTORS_EXT; } + /* Write out the number of sectors we want and the LBA. */ + g1_ata_set_sector_and_count(sector, nsects, lba28); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, cmd); + /* Now, send the drive each sector. */ for(i = 0; i < nsects; ++i, ++sector) { /* Wait for the device to signal it is ready. */ @@ -792,18 +786,15 @@ int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { /* Wait for the device to signal that it has finished writing the data. */ g1_ata_wait_bsydrq(); - rv = 0; - g1_ata_mutex_unlock(); - return rv; + return 0; } int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, int block) { - int rv = 0; + int cmd, lba28, old, can_lba48 = CAN_USE_LBA48(); uint32_t addr; - int old, can_lba48 = CAN_USE_LBA48(); /* Make sure we're actually being asked to do work... */ if(!count) @@ -875,49 +866,30 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, /* Set the settings for this transfer and re-enable IRQs. */ dma_blocking = block; dma_in_progress = 1; + dma_nb_sectors = count; + dma_sector = sector; irq_restore(old); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |