Commit Graph

23 Commits

Author SHA1 Message Date
joevt
bfd3077bd0 scsicdrom: Check Lun for INQUIRY.
INQUIRY now returns 0x7f for device type if LUN doesn't match. INQUIRY can get LUN from CDB or from IDENTIFY message.
2024-04-01 08:00:41 -07:00
dingusdev
c54ec7be2d Use memset instead of bzero 2024-03-30 11:19:32 -07:00
joevt
274e380b34 scsicdrom: Allow INQUIRY allocation length != 36.
Truncate for < 36 and zero fill for > 36.
2024-03-30 11:16:41 -07:00
joevt
e872f08273 scsicdrom: Include invalid field info.
For CHECK_CONDITION status from READ_CAPACITY_10 and READ_TOC.
2024-03-30 11:00:01 -07:00
joevt
a6fda3b787 scsicdrom: Handle MODE_SENSE_6 unsupported page.
Return CHECK_CONDITION status instead of abort. To Do: apply change to scshhd.
2024-03-30 10:59:43 -07:00
joevt
c999c51d77 scsicdrom, scsihd: Check lun.
READ_CAPACITY_10, READ_6, and READ_10 now checks LUN that is included in CDB and returns a CHECK_CONDITION if it doesn't match.
2024-03-29 19:12:06 -07:00
joevt
4be6bad526 scsicdrom: Fix compiler warning. 2024-03-29 19:00:38 -07:00
joevt
d3c913e384 scsicdrom: Cleanup.
- Use macros for reading 2 byte or 4 byte big endian data. block_size is assumed to be < 64K so WRITE_DWORD_BE_A will write two leading zeros.
- Scalar pass by value parameters don't need to be const.
- Remove some unnecessary locals.
2024-03-29 18:53:13 -07:00
joevt
a79f07e4dc scsicdrom: Move mode_select_6.
Make it a separate method like scsihd. It also checks the incoming param size. If it's zero then the phase is not switched. Is that wrong? Still probably unfinished.
2024-03-29 18:52:30 -07:00
joevt
5062508940 scsicdrom: Rename mode_sense_6.
To match scsihd.
2024-03-29 07:56:48 -07:00
joevt
9cf91328c1 scsicdrom: Move inquiry info to class fields.
Like scsihd.
2024-03-29 07:56:44 -07:00
joevt
6a30ef7017 scsicdrom: Fields inited by parent class.
They don't need to be reinitialized.
2024-03-29 07:56:31 -07:00
joevt
fd961f9ff9 Fix Analyzer warnings.
In Xcode, type Command-Shift-B to analyze every source file or Command-Shift-Control-B to analyze the current source file.

For pseudo_dma_read report FIFO underrun and init data_word in that case.
2024-03-24 12:56:11 -07:00
joevt
45a9d45e3f Add SCSI devices.
scsibus has a new method attach_scsi_devices which is used by all machines to populate a SCSI bus with one or more hard drives or CD-ROM drives.

HDDs are specified by the hdd_img property.
CDs are specified by the cdr_img property.
Multiple images are delimited by a colon :

attach_scsi_devices is called by the scsi controller after the scsi controller has attached itself to the scsi bus.
The bus suffix is applied to the property name.
Curio has no suffix so it will use hdd_img and cdr_img properties.
Mesh is expected to have a suffix of 2 so it will use hdd_img2 and cdr_img2 properties.

HDDs will skip SCSI ID 3 unless 7 HDDs are added, in which case, the seventh HDD will use ID 3.
CDs will start at SCSI ID 3, go to 7, then down to 0.
SCSI IDs are skipped if a device is already using that SCSI ID.

ScsiCdrom and ScsiHD no longer use REGISTER_DEVICE or DeviceDescription or PropMap which is normal for devices that can have multiple instances.
2024-03-14 19:12:11 -07:00
joevt
5a54b6a761 scsicdrom: Rename read_capacity_10.
Like scsihd.
2024-03-13 07:50:32 -07:00
joevt
a605c435b6 scsicdrom: Move test_unit_ready.
Make it a separate method like scsihd.
2024-03-13 07:50:20 -07:00
joevt
3f826b8971 scsi: Add illegal_command method.
- scsicdrom now logs unsupported commands instead of abort.
2024-03-13 07:45:50 -07:00
Maxim Poliakovski
114737db41 scsicdrom: use CdromDrive as base class. 2023-12-10 00:19:44 +01:00
Maxim Poliakovski
65a343ce5c Clean up names for SCSI devices. 2023-12-04 22:41:01 +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
Maxim Poliakovski
13684f7c0b scsicdrom: implement READ_CAPACITY_10 command. 2022-11-14 02:08:05 +01:00
Maxim Poliakovski
5f0358a347 Implement basic SCSI CD-ROM emulation. 2022-11-14 00:55:05 +01:00