98 Commits

Author SHA1 Message Date
7ebee9f2ea Rename wait() and wait_us() to sleep_s() and sleep_us() 2025-01-29 08:11:14 +00:00
061bc22c04 Fix a couple of memory leaks 2025-01-26 12:33:30 +00:00
Matt Harlum
41bfdf35c6
Fix some typos 2025-01-29 06:11:23 +13:00
70a7c6f98a ata.c: Fix memory leak in ata_autoselect_xfer 2025-01-27 00:15:36 +13:00
a140763cd1 ata: more read/write optimization 2025-01-07 01:08:30 +00:00
af771f9534 ata: read/write optimization - hardcode blocksize in transfer routines
It will always be 512 anyway, no need to hit memory for every loop iteration
2025-01-07 00:47:07 +00:00
4185bc5b8e ata: optimize read/write functions
Pass the src/dest pointers via registers rather than the stack
2025-01-07 00:44:41 +00:00
04af3bd24c Tweak GCC Pragmas 2025-01-03 23:12:52 +13:00
6d5dca71ad Move CreateFakeConfigDev to Device init
This is better than doing it in Mounter because mounter would create a ConfigDev for each unit
2024-12-20 01:03:07 +00:00
a3900a01ee Refactor to get rid of BSS & Data hunks
This should allow the code to run directly from ROM (i.e a custom kickstart)
More changes are needed to complete that support (finding the board, correct priority needed for the romtag etc)
2024-11-24 21:31:53 +00:00
5b3c169ee0 Benchmark units at init and select best transfer method
Which method is fastest will vary depending on the CPU and IDE boards etc, select the fastest one for the system we're running on
2024-11-25 01:40:16 +13:00
22e5a79baf Rework ideunit struct
No need for unit->drive to be a pointer any more
2024-11-13 22:47:57 +00:00
f434a797df Whitespace fixes 2024-11-13 22:36:30 +00:00
MHeinrichs
8e253bcc42 buffer alignment rework 2024-11-14 11:28:24 +13:00
da19b69566 Fix various things Coverity picked up on 2024-08-30 10:05:06 +00:00
e040eef914 ATA: Fixup boot delay on 68000
On a stock 68K system, doing 1000 loops checking DRQ is quite slow and will cause a boot delay so when doing an IDENTIFY, only loop 100 times before hitting the timer
2024-08-30 04:00:19 +00:00
fd4045635b ATA: remove "actual" from ata read/write as it's not needed there 2024-08-30 03:58:01 +00:00
6fc2e7d8d4 ATA: Add support for SCSI ATA_PASSTHOUGH command and make use of it in lidetool to get ident data 2024-08-07 09:28:13 +00:00
24b54d9aad ata: Fixup ata_set_pio 2024-08-06 02:43:46 +00:00
366dacd353 Add command to set PIO mode 2024-08-04 23:21:53 +00:00
b38f7aa209 ata: remove move16 transfer routine.
Apparently move16 is buggy in some system configurations, best to avoid it completely
2024-07-27 12:59:54 +00:00
fa7b8a540d Move io length check out of ata_read/write
Also return IOERR_BADLENGTH to satisfy PFS3 sanity check
https://eab.abime.net/showpost.php?p=1690569&postcount=2
2024-06-26 04:42:27 +00:00
ff79c987ab ATA: optimize ata_read/write to improve performance
Optimized the transfer loop. up to 5-6% perf increase measured on Olga
2024-06-24 01:25:07 +00:00
8dffc97e5f Some code tidying 2024-06-24 01:25:07 +00:00
30b7f2438a Revert "Some code tidying" - caused drives to be detected as CHS only
This reverts commit 013e308b6798b050d9c6c5a2f324ffc25e1544b4.
2024-06-02 21:12:49 +12:00
a7f69e6787 Revert ata_status_reg_delay change 2024-06-02 14:46:01 +12:00
013e308b67 Some code tidying 2024-06-02 14:46:01 +12:00
b096f0b29f ata: rename pointer functions for ata_read/write to make it less confusing 2024-06-02 14:46:01 +12:00
47a265c9cc ata/atapi status_reg_delay: make timing consistent across different cpus / speeds by reading from a CIA register 2024-06-02 14:46:01 +12:00
e03d6996ee ATA: drq enter / exit logs should be TRACE level, not Info 2024-06-02 14:46:01 +12:00
a505c633f5 Fix inconsistency of variable naming 2024-06-02 14:46:01 +12:00
d2e7843bc0 Add LBA48 support 2023-12-19 16:26:15 -08:00
79193bd356 Remove extraneous delays and reduce status wait 2023-12-19 16:26:15 -08:00
3abbb3e3c1 Increase loop count for ata_status_reg_Delay 2023-12-19 16:26:15 -08:00
081c836a54 write_taskfile: only change devhead if wait_ready doesn't timeout 2023-12-19 16:26:15 -08:00
0beac9f71e ata.c:
* optimize status_reg_delay
* write_taskfile_lba/chs - write head register after waiting for BSY to clear, not before
2023-12-19 16:26:15 -08:00
3f6cd1d86c ata: save registers on any error 2023-12-19 16:26:15 -08:00
936c0c0ca6 Decouple IDETask vars from DevBase
This will allow for multiple IDE Tasks to be run (e.g for multiple
cards)
2023-12-19 16:26:15 -08:00
0d2dd1e75d ATA: Check BSY/RDY before DRQ during transfers
Also check error before transferring
2023-11-30 13:59:15 +01:00
d8d7c49c0b Performance tweaks 2023-11-30 13:59:15 +01:00
4565798ef2 Add command CMD_XFER to set transfer method for a unit 2023-11-30 13:59:15 +01:00
bf74963107 ATA: read status register 4 times before checking value
On fast TKs the Status register may have been getting read sooner than the drive could set the status
2023-11-30 13:59:15 +01:00
6674e6d42a Transfer routines: Move the source/dest address adjustment
the movem.l routines need to start 48 bytes before the end of the buffer
Move the adjustment into the routines themselves so it doesn't mess up other routines that might do something different
2023-11-30 13:59:15 +01:00
1126d9ed4b Implement code for pluggable transfer routines
This will allow for additiomal transfer routines to be added and conditionally used i.e if some other board has a different need
2023-11-30 13:59:15 +01:00
a7e2afbee8 ata: optimize write_taskfile call
Instead of checking if the unit supports LBA on every transfer, use a function pointer set at init time
2023-11-16 11:08:27 +00:00
a1e1948007 ATA: Revert mutliple-count setting changes of last commit
The Multiple count flag applies to IDENT word 59, not 47
Word 59 contains the current configured value, 47 the maximum
2023-10-05 20:41:35 +00:00
291ea94623 Support CHS 2023-10-03 09:39:51 +00:00
fbe6f0b274 ATA: wait for RDY after drive selection in ata_read/write
Bumps version to 40.2
2023-09-16 19:34:20 +02:00
5db68783fe Tweak timeouts
* Increase loop wait from 100us to 1ms - this makes the timers more accurate on slow 68000 systems
* Increase ATA BSY wait to 10s - Spinning rust can take a while to spool up and become ready
* Skip ata_identify drq wait if error/fault is indicated - this will usually be an ATAPI drive and there's no point waiting
2023-09-06 19:06:20 +00:00
25c145c3e1 ATA init: Only need to clear shadowdevhead if no drive was found. 2023-09-06 19:02:26 +00:00