Commit Graph

43 Commits

Author SHA1 Message Date
dingusdev
606c9dd9a8 More compiler warning fixes 2024-06-24 19:40:20 -07:00
dingusdev
a95b06f703 Minor code clean-up 2024-05-08 07:07:32 -07:00
joevt
f1abb66f9a atahd: Add STANDBY_IMMEDIATE. 2024-03-30 08:30:37 -07:00
Maxim Poliakovski
71dabf5334 atahd: break long lines. 2024-03-29 12:46:57 +01:00
joevt
155b8cdad9 atahd: Support inexact CHS.
The total size needs to have 3 factors cylinders, heads, & sectors. Imagine a disk having a total size with 3 prime factors 3 x 5 x 11. 15 cannot be assigned to heads because that would only leave 11 for sectors and cylinders. Therefore, test all heads and sectors combinations. If the third factor for cylinders is not found, then choose 16 heads, then the minimum number of sectors, and finally the maximum number of cylinders. The loop could be changed to skip values of heads that are not a factor, but it doesn't take any time to try them all.
2024-03-28 21:07:12 -07:00
joevt
96dc02b249 atahd: Make sure disk is not too big. 2024-03-28 21:07:08 -07:00
Maxim Poliakovski
eaddcab0ba atahd: don't register device for empty images.
Workaround for the case when no hard disk image
was specified. The device instance is still there
but it won't be visible by the guest OS.
2024-03-29 03:54:09 +01:00
Maxim Poliakovski
a9cb0cfb2a atahd: report correct CHS parameters & capacity.
This is required for Open Firmware 2.x to boot Mac OS X
and OpenDarwin.
2024-03-20 12:16:10 +01:00
dingusdev
b63e42ecf2 Temporarily removing SOFT RESET ATA command
Not implemented properly. Will re-implement soon.
2024-03-11 19:05:13 -07:00
joevt
2ece059c5e atapi: Add ATAPI_SOFT_RESET command.
I don't know if this is correct.
2024-03-11 07:19:11 -07:00
Maxim Poliakovski
679e80a7c3 atahd: basic commands for disk I/O. 2023-12-30 16:23:00 +01:00
Maxim Poliakovski
ebdefb5acd atabasedevice: transfer data in chunks. 2023-12-30 16:23:00 +01:00
Maxim Poliakovski
65a343ce5c Clean up names for SCSI devices. 2023-12-04 22:41:01 +01:00
Maxim Poliakovski
446b1b8d99 atahd: various improvements implementing basic commands. 2023-11-22 17:35:14 +01:00
Maxim Poliakovski
27ff05607c atadefs: bit definitions for the device/head register. 2023-11-22 17:35:14 +01:00
Maxim Poliakovski
f2558cd379 atabasedevice: data transfers to host. 2023-11-22 17:35:14 +01:00
Maxim Poliakovski
4f76a4ead2 Move signal_data_ready() to atabasedevice. 2023-11-22 17:35:14 +01:00
Mihai Parparita
d4c9db7fcf Move disk image reading to be behind an ImgFile class
Allows different implementations for different platforms (the JS
build relies on browser APIs to stream disk images over the network).

Setting aside the JS build, this also reduces some code duplication.
2023-11-09 21:49:28 -08:00
Mihai Parparita
35c86ad6bf Clean up #includes
Result of running IWYU (https://include-what-you-use.org/) and
applying most of the suggestions about unncessary includes and
forward declarations.

Was motivated by observing that <thread> was being included in
ppcopcodes.cpp even though it was unused (found while researching
the use of threads), but seems generally good to help with build
times and correctness.
2023-11-03 00:33:47 -07:00
joevt
637844269f atapicdrom: Implement sector areas for Read CD.
The disk cache is unchanged. data_ptr continues to be only used for the user data sector area for each block. The other sector areas (synch, header, etc.) are filled in while reading.

has_data and get_data exist as a way to bypass data_ptr for parts of the transfer outside the user data sector area of each block. The default behaviour is defined in atabasedevice and is overridden by atapicdrom for the Read CD command. atapicdrom has a flag doing_sector_areas to control the behavior of the get_data method. When the flag is true, the sector_areas, current_block, and current_block_byte are used for selecting the correct data from one of the sector areas. The Read CD command initializes those variables. xfer_cnt remains the total number of bytes to be transferred and is now not necessarily the same as the number of disk image blocks read into the disk cache.

lba_to_msf is used to fill in the header. The values was not verified using a real CD.

Mac OS X just cares about the Mode in the header. For now, only the synch and header and user data areas are filled in. The other areas read as all zeros.
2023-09-25 12:22:17 +02:00
joevt
ec5bf8e985 atapicdrom: Implement READ(6) and READ(10). 2023-09-25 12:22:17 +02:00
Maxim Poliakovski
f7a1412ec7 atapibasedevice: fix task file initialization on reset. 2023-07-09 02:10:48 +02:00
Maxim Poliakovski
0687b0c60e New ATAPI CD-ROM implementation. 2023-06-18 23:36:46 +02:00
Maxim Poliakovski
fc26be3e24 atapibasedevice: implement PIO transfers.
Also move ATAPI CD-ROM related stuff to separate
source and implement various helpers.
2023-06-18 23:33:57 +02:00
Maxim Poliakovski
a4cac2df81 atabasedevice: interrupt support. 2023-06-18 23:30:06 +02:00
Maxim Poliakovski
ac267b3daa idechannel: support devices registration and interrupts. 2023-06-18 23:24:19 +02:00
Maxim Poliakovski
d113c4cf7a ATAPI Features bit definitions. 2023-06-18 23:06:04 +02:00
Maxim Poliakovski
586828b375 Base class for ATAPI devices. 2023-05-15 17:57:20 +02:00
Maxim Poliakovski
e36150a5ca Add ATAPI commands, clean up formatting. 2023-05-15 17:57:20 +02:00
Maxim Poliakovski
0f8e68d4bf Rework ATA reset logic. 2023-05-15 17:57:20 +02:00
Maxim Poliakovski
ed48766e5f atahd: cosmetic improvements. 2023-04-17 09:56:03 +02:00
Maxim Poliakovski
a189c94980 scsihd: fix READ_CAPACITY_10 command.
Also bump internal buffer size to 2 MB
to temporarily fix buffer overflows.
2022-12-14 16:14:53 +01:00
Maxim Poliakovski
dee225ee8f atabasedevice: add ATAPI signature at device reset. 2022-12-12 15:07:19 +01:00
Maxim Poliakovski
52bb87b72a Improve ATA interface. 2022-12-12 02:36:56 +01:00
dingusdev
0dd9a3d9b1 Further ATA cmd work 2022-12-11 16:08:43 -07:00
Maxim Poliakovski
86b0174b13 Fix previous. 2022-12-09 01:07:08 +01:00
Maxim Poliakovski
daf3ecde4e More ATA interface cleanup. 2022-12-09 01:03:09 +01:00
dingusdev
1e9ec5d7ae Start ATA command support 2022-12-08 15:29:04 -07:00
Maxim Poliakovski
2537751fa7 Clean up ATA interface. 2022-12-08 08:04:09 +01:00
Maxim Poliakovski
df1a56305a atabasedevice: rework task file registers. 2022-12-08 00:16:10 +01:00
Maxim Poliakovski
6173a782f2 Implement ATA hard disk stub. 2022-12-07 23:36:56 +01:00
Maxim Poliakovski
a892842b8f Refactor ATA/IDE classes. 2022-12-07 22:36:25 +01:00
dingusdev
58908621e6 IDE refinements 2022-12-05 08:42:51 -07:00