Commit Graph

1056 Commits

Author SHA1 Message Date
joevt
f09710a5f7 viacuda: Do shutdown.
Shutdown will enter the debugger or quit depending on the execution mode.
Quit is different from shutdown since it is triggered outside the guest by using the host Quit menu item.
2024-08-31 18:09:12 -07:00
Maxim Poliakovski
ef62e8b965 New API for registering PCI interrupts. 2024-08-29 00:16:59 +02:00
Maxim Poliakovski
825314c869 atahd: clean up READ_MULTIPLE/WRITE_MULTIPLE. 2024-08-26 00:20:53 +02:00
Mihai Parparita
52f4d847dd Fixes for READ_MULTIPLE and WRITE_MULTIPLE commands
We may be transferring less data than can fit in a chunk, so we need
to ensure that xfer_cnt is clamped to 0 when transferring the last
chunk (otherwise it remains negative, and has_data() will return true).

It's also possible that the transfer size is bigger than a chunk but not
an even multiple of the chunk size, so we need to ensure that we don't
try to transfer a whole chunk in the last iteration.

More correctly initialize the device identification struct, to report
the maximum (word 47) and current (word 59) number of blocks that can be
transferred with READ_MULTIPLE and WRITE_MULTIPLE commands.

Fix post_xfer_action to write the actual data size that was written,
as opposed to an entire chunk (which may be larger).
2024-08-24 22:51:07 -07:00
dingusdev
ebf4b0e969 minor ATA tweaks
From @Wack0's branch
2024-08-24 12:58:19 -07:00
Mihai Parparita
8d95aa5ed3 Fix ATA HD initialization on Beige G3 when booting 9.2
1f2256ec81a/7ee8b9b2 were referencing a multiple_sector_count field,
but it was never set. This was resulting in an error being returned
(`READ MULTIPLE with SET MULTIPLE==0`).` We actually should use
`sec_per_block``, which bd16b7c69e introduced.
2024-08-22 22:38:48 -07:00
dingusdev
7ee8b9b2f0 Add missing variable 2024-08-22 20:49:11 -07:00
dingusdev
1f2256ec81 Additional ATA commands
Mostly from Wack0's NT4 fork.

Co-Authored-By: Rairii <2650838+Wack0@users.noreply.github.com>
2024-08-22 20:42:43 -07:00
Maxim Poliakovski
0518f2ae2f atahd: fix DIAGNOSTICS command. 2024-08-21 23:12:53 +02:00
Maxim Poliakovski
3bf088f2c8 atahd: fix RECALIBRATE command.
Although being optional in ATA-3 and absent in >= ATA-4,
RECALIBRATE is issued by Open Firmware 3.1.1 during device
initialization. If it fails, the drive is considered non-bootable.
2024-08-21 21:21:44 +02:00
Maxim Poliakovski
bd16b7c69e atahd: implement mandatory SET_MULTIPLE_MODE command. 2024-08-21 21:21:44 +02:00
Maxim Poliakovski
f5c91968a2 idechannel: split MacIO specific stuff into a separate class.
Now we got two classes: IdeChannel and MacioIdeChannel.
The former models a generic IDE channel so it can be used elsewhere.
The latter implements MacIO specific configuration register(s)
and interrupt signaling.
2024-08-20 16:55:31 +02:00
Maxim Poliakovski
4e78ac33c5 atabasedevice: disable device interrupts on reset. 2024-08-20 15:36:12 +02:00
Maxim Poliakovski
a34e0a4737 PCI-to-PCI bridges now return true in supports_io_space().
Doing so ensures that accesses to the I/O space are broadcasted
to the PCI-to-PCI bridges automatically.
2024-08-17 01:01:53 +02:00
Maxim Poliakovski
2c026259b1 pcibridge: improve formatting. 2024-08-17 01:01:53 +02:00
Maxim Poliakovski
cd36df5500 pcibridge: fix a bug in pci_io_write() caused by copy-and-paste coding. 2024-08-17 01:01:53 +02:00
Maxim Poliakovski
5ea7b8c5f8
Merge pull request #111 from mihaip/upstream-alignment
atapibasedevice: fix unaligned memory access
2024-08-16 12:56:08 +02:00
Mihai Parparita
372b9cae7a atapibasedevice: fix unaligned memory access
Both cmd_pkt and data_buf class members are cast to a uint16_t pointer,
so we need to make sure they are properly aligned, otherwise it is
undefined behavior.
2024-08-15 22:32:46 -07:00
Maxim Poliakovski
595478ed6f hwcomponent: add IDE_HOST component type. 2024-08-12 14:03:05 +02:00
Maxim Poliakovski
f9338b8dd9 pcihost: broadcast I/O requests to PCI-to-PCI bridges. 2024-08-11 15:51:06 +02:00
Maxim Poliakovski
20b2fb1bef viacuda: refactor emulation of the VIA registers.
Take the DDRA and DDRB registers into account as well because
there is software that tries to change state of the pins configured
as inputs.
This commit fixes Cuda for Rhapsody.
2024-08-04 21:43:06 +02:00
Maxim Poliakovski
f096eef66d viacuda.h: cosmetic improvements. 2024-08-04 21:43:06 +02:00
roytam1
83afae5625 sdl: handle SDL_WINDOWEVENT_EXPOSED event to fix redrawing issue 2024-07-29 23:27:05 +08:00
Rairii
4d7c520f18 adbmouse: only send first two bytes in standard/classic protocol as per spec
Fixes any mouse driver that only supports the classic protocol and expects register 0 reads to return two bytes.
2024-07-29 11:37:54 +01:00
Mihai Parparita
9b49603c72 memctrl: keep address_map sorted by address
We do a linear scan in find_range (which is called on all TLB misses) to
find the entries. The largest and most frequently hit entry is the
system memory (which starts at 0). By ensuring that it's the first entry
in the list, we end up only doing one iteration through the loop.
2024-07-28 13:27:48 -07:00
dingusdev
f192d11758
Merge pull request #102 from mihaip/upstream-dev_id
atabasedevice: Set dev_id.
2024-07-27 14:40:16 -07:00
Mihai Parparita
dab9334c3a Pass through draw_fb optimization metadata to Display class
The JS implementation does content hashing to not blit unchanged
framebuffer contents (see mihaip/dingusppc@171ff2d407).
However, that is not necessary for the ATI adapters that already track
this and only set draw_fb if the framebuffer has actually changed.

Pass through a fb_known_to_be_changed for these cases, and also add an
optional update_skipped method (since the JS still wants to know when
the last logical screen update was).
2024-07-27 11:38:59 -07:00
joevt
7fdfd6109f atabasedevice: Set dev_id.
Extracted from @Wack0's Wack0/dingusppc-nt@529991bd78

Co-authored-by: Rairii <2650838+Wack0@users.noreply.github.com>
2024-07-27 09:10:28 -07:00
dingusdev
7d6e87a0d3 Add stub for setting power messages 2024-07-26 07:31:31 -07:00
Maxim Poliakovski
8d6f77ea71 mesh: implement EnaParityCheck and DisParityCheck commands. 2024-07-25 22:18:43 +02:00
Maxim Poliakovski
19ecc4f945 mesh: fix writes to BusStatus0 & BusStatus1 registers. 2024-07-24 17:50:02 +02:00
Maxim Poliakovski
211f8adc0e Improve MACE stub. 2024-07-23 01:39:15 +02:00
Maxim Poliakovski
babd8d974f dbdma: fix cmd.resCount update. 2024-07-22 17:45:48 +02:00
Maxim Poliakovski
9fc5bbb951 sc53c94: fix interrupt status for CMD_MSG_ACCEPTED. 2024-07-19 03:38:55 +02:00
Maxim Poliakovski
3fe6e3c09e grandcentral: more elegant MeshStub with less checks. 2024-07-19 01:31:36 +02:00
Maxim Poliakovski
289a14dc7a scsidevice: release REQ before MESSAGE_IN phase. 2024-07-15 07:15:49 +02:00
Maxim Poliakovski
ba9fcd100d mesh: extend stub to a full implementation. 2024-07-15 03:34:43 +02:00
Maxim Poliakovski
889dc32a0a New base class for SCSI host controllers. 2024-07-15 03:28:45 +02:00
Maxim Poliakovski
f13f4e0023 grandcentral: break long lines. 2024-07-15 02:56:24 +02:00
Maxim Poliakovski
4a425c4ecf dbdma: introduce new DMA API. 2024-07-15 02:09:15 +02:00
Maxim Poliakovski
293e869acb dbdma: break long lines. 2024-07-15 02:09:15 +02:00
Maxim Poliakovski
f3d7cd9dd7 cdromdrive: add support for raw CD images. 2024-07-15 01:48:46 +02:00
Maxim Poliakovski
fd5498e16b blockstoragedevice: add support for raw images.
Raw images contain supplementary information like synchronization fields,
correction codes etc. that needs to be ignored/discarded when
reading/writing user data.
This commit establish a basic architecture for exchanging user data
between a virtual device and a raw image.
2024-07-15 01:48:46 +02:00
Maxim Poliakovski
55f91c5d3f scsicdrom: use READ_TOC implementation from cdromdrive.cpp 2024-07-15 01:28:42 +02:00
Maxim Poliakovski
0831182e39 scsihd: remove duplicated code. 2024-07-14 23:33:43 +02:00
Maxim Poliakovski
26153ca8ea scsihd: use ScsiError contants wherever applicable. 2024-07-14 23:12:53 +02:00
Maxim Poliakovski
7855770ca7 Use ScsiError constants instead of magic numbers. 2024-07-14 17:22:31 +02:00
Maxim Poliakovski
a81156c3e3 cdromdrive: convert MSF values to BCD. 2024-07-11 21:27:38 +02:00
Maxim Poliakovski
11bb10b44b Taos: cleanup GPIO pins. 2024-07-11 02:44:40 +02:00
Maxim Poliakovski
378965cc3d Taos: properly handle color mode changes. 2024-07-11 02:44:40 +02:00
Maxim Poliakovski
5eaff7a8ce MPC106: break long lines. 2024-06-28 19:52:22 +02:00
Maxim Poliakovski
9d44ac0901 mpc106: fix includes. 2024-06-25 16:53:52 +02:00
dingusdev
606c9dd9a8 More compiler warning fixes 2024-06-24 19:40:20 -07:00
kth5
742662e4fc Fix missing std::find_if and others with GCC 14.1.1 2024-06-24 23:41:55 +02:00
dingusdev
d3096ebaac Fixing compiler warnings, pt. 1 2024-06-21 08:01:21 -07:00
dingusdev
a95b06f703 Minor code clean-up 2024-05-08 07:07:32 -07:00
joevt
226c097b81 escc: Update RR0 if no character is available.
The RR0_RX_CHARACTER_AVAILABLE bit is cleared after the character is read in receive_byte, but clear it anyway in read_reg when there's no character available just in case a character that was available somehow becomes unavailable.
2024-05-07 06:45:01 -07:00
Maxim Poliakovski
971f6d79be scsicdrom: reduce code duplication. 2024-05-07 08:37:52 +02:00
Maxim Poliakovski
ed67ab81a3 scsicdrom: switch off info log in INQUIRY. 2024-05-07 08:37:52 +02:00
Maxim Poliakovski
07304781ea scsicdrom: improve MODE_SELECT_6 stub. 2024-05-07 08:37:52 +02:00
joevt
941a405cf8 escc: Implement RR8 and WR8.
Normally, the Port_B_Data or Port_A_Data address is used to directly access RR8 or WR8, but setting the register pointer in Port_B_Cmd or Port_A_Cmd to RR8/WR8 is another option.
Update write_regs[WR8] and read_regs[RR8] for possible debugging purposes.
2024-05-06 21:11:36 -07:00
joevt
b60d3061b7 escc: WR9 fixes.
Update write_regs[WR9] even though most or all of the bits are in master_int_cntrl.
Fix hardware reset for WR9. It's supposed to leave WR9_NO_VECTOR | WR9_VECTOR_INCLUDES_STATUS unchanged.
Fix channel reset for WR9. It's supposed to clear WR9_INTERRUPT_MASKING_WITHOUT_INTACK.
2024-05-06 21:11:21 -07:00
joevt
82e22174d6 escc: Set RR1 All Sent flag.
Helps booting Mac OS 8.1, etc.
2024-05-06 20:49:59 -07:00
joevt
cf9811d03a escc: Read ch_a is missing register pointer reset. 2024-05-06 20:37:22 -07:00
joevt
19f06fb3a2 escc: Init or reset values in constructor.
Constructor should set all values to something so they are not random.
2024-05-06 07:28:04 -07:00
joevt
5710758dd7 escc: Add z85c30 register names. 2024-05-06 07:27:47 -07:00
joevt
181e1d2e46 escc: Add Channel Enhancement registers. 2024-05-06 07:23:05 -07:00
joevt
59fba285b5 adbmouse: Add tablet and more bits and buttons.
Add absolute coordinates for tablets. Absolute coordinates is relative to window so it can't work for multiple displays? Doesn't work for single display without mouse driver modification.
Add arbitrary number of buttons. Previously, only one mouse button was supported.
Add arbitrary number of bits. Previously, only 7 bits per axis was supported which is good enough for relative movement but not absolute movement.
2024-05-06 06:49:15 -07:00
joevt
fdf8543c7e displayid: Update some display mode info. 2024-05-05 08:44:40 -07:00
joevt
86d8ae0911 soundserver_cubeb: Verify buffer is not null. 2024-05-05 06:52:59 -07:00
joevt
900e58f0ad swim3: Set write protect by default.
Until write support is added.
2024-05-01 06:52:11 -07:00
joevt
62e80c0c2f superdrive: Add name. 2024-05-01 06:52:01 -07:00
joevt
3483bebdb4 ati: Fix ver_blank calculation. 2024-04-25 06:52:00 -07:00
joevt
11d61359c1 dbdma: Add data callbacks.
Allow the dbdma program to initiate reading/writing by adding in and out callbacks.
Support the DBDMA flush command by adding a flush callback. If the transfer completes, then clear the flush flag, otherwise leave it unchanged.
Clear the flush flag after it is copied to the xferStatus of the DBDMA command.
2024-04-24 07:09:56 -07:00
joevt
721c70166c control: Fix 1280x960 and 1280x1024 15bpp.
Change the fb_ptr. This also affects the hardware cursor.
Tested with 4MB of VRAM.
2024-04-24 06:48:41 -07:00
joevt
861c2d4f04 athens: Allow P2_MUX bit 6 to be 1.
For modes 12 inch RGB 512x384@60 and VGA 800x600@72.
2024-04-24 06:48:27 -07:00
joevt
da203b69c5 escc: One return path for read. 2024-04-24 06:48:02 -07:00
joevt
159fe8d48e escc: Attempt to add DBDMA support.
Move dma channels from EsccController to EsccChannel.
Add DBDMA callbacks.
2024-04-24 06:46:35 -07:00
joevt
6adba32238 atirage: Update VBLANK bit.
It should not remain set.
2024-04-23 21:35:47 -07:00
joevt
d96da6434f atirage: Redraw framebuffer if DAC or fb changes. 2024-04-23 21:35:34 -07:00
joevt
5f37421ceb atirage: Add ability to read from PCI option rom.
Usually there is not PCI option rom if the chip is built-in to the motherboard such as in the Beige G3.
2024-04-23 08:01:54 -07:00
dingusdev
6f64e729c8 Tweak logging value for compiling 2024-04-23 07:59:23 -07:00
joevt
288e088f8a atirage: Fix hardware cursor update.
Switching from Watch to Arrow cursor at vertical position zero (top of the screen) would sometimes cut off the top half of the Arrow cursor. The following changes fix this:

Use the new cursor_dirty flag to signal when the cursor should be updated. This reduces the number of cursor updates and doesn't depend on registers being accessed in a specific order.

Set the cursor_dirty flag for any change that should cause the hardware cursor to be updated:
- CUR_CLR0, CUR_CLR1: Cursor color changes. We don't check if the colors actually changed (all cursors are usually black and white). Rather, writes to these registers usually means the cursor bytes have changed or will change.
- CUR_OFFSET: Offset to cursor bytes.
- CUR_VERT_OFF: First vertical line of cursor to draw.
Other changes that don't require the cursor to be updated:
- CUR_HORZ_OFF: Horizontal offset of cursor position. The cursor is unchanged - just need to adjust the drawing position.
- CUR_HORZ_VERT_POSN: The cursor is unchanged - only the drawing position is changed.
The only thing that could change the cursor that we don't check is a change to the cursor bytes.
2024-04-23 07:58:20 -07:00
joevt
3797fdbf1b atirage: Move fb_pitch calculation. 2024-04-23 07:55:51 -07:00
joevt
3036f4676d Use default window size in constructor.
The window size should be changed later by the mon_id property.
2024-04-23 07:27:52 -07:00
joevt
e14b6677b2 displayid: Fix non-extended sense codes.
Sense codes for displays like the 12 inch RGB display (512x384) weren't working since they had the extended part set to 0xff.
Related to issues #25.
Also added some descriptive information and sizes which may be used for UI purposes such as creating a menu of displays to choose from. The sizes may be used to set the default window size for the display.
2024-04-23 06:52:38 -07:00
joevt
76f966845d viacuda: Use timer ids instead of timer flags. 2024-04-23 06:44:02 -07:00
joevt
288d97f24c atimach64gx: Add missing WRITE_VALUE_AND_LOG.
This commit fixes conflict resolution mistakes in the following commits:
"atimach64gx: Let crtc_update calculate fb_ptr."
"atimach64gx: Redraw only when necessary."

"atimach64gx: Log unhandled overlay registers." was mistakenly included in "atimach64gx: Let crtc_update calculate fb_ptr.". The OVR_ registers were included because they may be needed for 2D acceleration in System 7.5.3 and later.
2024-04-23 06:43:08 -07:00
joevt
755dd7f60a atimach64gx: Redraw only when necessary. 2024-04-22 20:13:37 -07:00
joevt
e6d669d187 atimach64gx: Check end of regs region.
There's only up to 256 regs.
2024-04-22 20:02:38 -07:00
joevt
0d1a2d3010 atimach64gx: Cleanup. 2024-04-22 20:00:54 -07:00
joevt
51af94f12d atimach64gx: Add properties. 2024-04-22 20:00:38 -07:00
joevt
8d7ca7fb03 scsibus: Use bus name in log messages. 2024-04-22 07:50:01 -07:00
joevt
bc691a9d86 scsibus: Check for invalid target_id. 2024-04-22 07:48:37 -07:00
joevt
2c79171be6 atimach64gx: Fix CONFIG_CNTL and MM_REGS_OFFSET.
Init them to defaults.
Make CONFIG_CNTL 8 bytes so unaligned read/write is easier.
Write changes to CONFIG_CNTL even if offset + size is > 4.
Log aperture change only if first byte (LSB) of CONFIG_CNTL is written. The driver might only write to the 2 most significant bytes which won't affect aperture size.
Offset and size are applied to the destination, not to source value, so we shouldn't use extract_bits when logging value.
Use ATI bitfield enums in switch statement.
2024-04-22 07:48:00 -07:00
joevt
e91432f939 atimach64gx: Fix interrupts.
Required for moving the mouse.
2024-04-22 07:33:08 -07:00
joevt
ea7b9db078 atimach64gx: Reset comp_index to 0. 2024-04-22 07:32:51 -07:00
joevt
a22bc34816 viacuda: Fix get/set time and one sec modes.
The first packet the one sec mode should send is a mode 1 real time packet, same as GET_REAL_TIME.
A mode 2 packet is the same but doesn't include the time.
2024-04-22 07:22:49 -07:00
joevt
2b76d8a53a viacuda: Remove parameters from pseudo_command.
They are incomplete or unused (includes cmd and count but not the data and the count isn't used). Might as well get everything from the class fields in_buf and in_count.
2024-04-22 07:11:22 -07:00
joevt
5f6b924004 appleramdac: Cursor lo-byte position delay option. 2024-04-22 14:51:16 +02:00