Commit Graph

370 Commits

Author SHA1 Message Date
joevt
c644d1609f PCI Expansion ROM size should be power of 2
The expansion rom base register indicates the size of the expansion rom by the number of bits that remain zero after code attempts to set them all to 1. For example, a result of fffe0000 means 128K. The 11 least significant bits are ignored in the size calculation, which means the minimum rom size is indicated by fffff800 = 2K.

Handle the case where an expansion rom file might not have a size that is a multiple of 2 or is not greater than 2K.
Bytes between the end of the file and the end of the calculated rom size are set to 0xff.
2022-08-22 17:16:22 -07:00
joevt
d843091a4d Allow setting PCI capabilities pointer
The capabilities pointer is usually a constant, but whatever the capabilities pointer points to has to be handled by the derived class.
2022-08-22 17:16:22 -07:00
joevt
6fad095730 Allow setting PCI status register
Don't always return 0 when reading it. The status register contains some bits that Open Firmware uses to set some properties.
A PCI device can set a default status register value to set those bits.
	this->status = 0x02B0; // 0000  0 01 0  1 0 1 1  0000 Capabilities List, 66 MHz, Fast Back-to-Back, DevSel Speed: Medium
2022-08-22 17:16:22 -07:00
joevt
6af8b52376 changes to pci logging
For invalid or unsupported PCI accesses, do the following:
- log a device's full pci address using pciutils setpci command format bb:dd.f @rr.s (bus:device:function @register+offset.size).
- report as read or write access.
- log value for writes.
- bus, device, function, and register values cannot be determined from Invalid IDSEL values so they will output as ??.
- for invalid IDSEL values, report the entire value of the config_addr.
- for valid IDSEL values, the bus number cannot be determined since IDSEL only specifies device number. It's probably bus 00 but we'll show ?? to indicate an IDSEL type access.

Add missing config type read access logging for chaos.
2022-08-22 17:16:17 -07:00
joevt
63248b0fa2 Set Bandit's HWComponent name
Bandit has two names:
- PCIDevice->pci_name
- PCIDevice:MMIODevice:HWComponent->name
The latter was not being set.
2022-08-22 17:07:50 -07:00
joevt
cd122ce263 Open Firmware is two words
Not OpenFirmware.
Also fixed a spelling mistake and removed some extra spaces.
2022-08-22 16:47:38 -07:00
Maxim Poliakovski
e097b7a0a1 bandit: fix return value for empty slots. 2022-08-22 15:05:35 +02:00
Maxim Poliakovski
32b8c8ed43 pcidevice: fix expansion ROM mapping. 2022-08-20 12:51:08 +02:00
Maxim Poliakovski
5220b03f0f MPC106: insert PCI devices using the CLI. 2022-08-19 20:07:22 +02:00
Maxim Poliakovski
56c54e4c8c pcihost: add attach_pci_device method. 2022-08-19 18:55:33 +02:00
Maxim Poliakovski
f4c0499078 deviceregistry: add device_registered method. 2022-08-19 18:53:05 +02:00
Maxim Poliakovski
4964008511 machineid: improve Gossamer ID description. 2022-08-15 20:49:06 +02:00
joevt
93fae1ee68 Merge remote-tracking branch 'upstream/master' 2022-08-14 16:38:51 -07:00
joevt
650c2c88dd Add socket type for serial_backend
With the option --serial_backend=socket, input and output to a serial port will use a SOCK_STREAM type UNIX domain socket. This allows you to do Open Firmware in one window, while the first window can be used for dingusppc debugger.

Other fixes:

- Added SIGTERM handler so that if the user force quits dingusppc, the terminal settings are properly restored. A user needs to force quit when --serial_backend=stdio and Open Firmware is taking input from ttya. If terminal settings are not restored, then running dingusppc after a force quit will cause Control-C to not work when --serial_backend is not stdio.

- Added a couple numbers to rcv_char_available - 15 is the number of consecutive characters that can processed. 400 is the total number of calls to rcv_char_available after 15 consecutive characters have been read before additional characters can be read. This delay in processing additional characters allows pasting arbitrarily large amounts of text into Open Firmware. A real serial port terminal app might have a text pacing option to limit the number of output characters per second but that is not an option since the emulator is not limiting character data to a baud rate.

Related Notes:

The socket file is created when dingusppc starts.
The socket file is named dingusppcsocket and is created in the current working directory (usually where the executable is located and where the dingusppc.log, nvram.bin, and pram.bin files are created).
The socket file is not visible in the Finder. You can see it in the terminal using the ls command.
The socket file can be used with the following command in a new terminal window:
socat UNIX-CLIENT:dingussocket -,cs8,parenb=0,echo=0,icanon=0,isig=0,icrnl=0
When dingusppc quits, the socat command ends.

Other notes:

The dingusppc --debugger option causes dingusppc to enter the debugger before Open Firmware outputs anything. You can connect to the socket while dingusppc is in the debugger. Then enter the go command to leave the debugger and start Open Firmware. However, since the startup sound takes a long time, you can probably connect to the socket before Open Firmware starts even without the --debugger option. It's like with a real Power Mac - you have a few seconds to hold Command-Option-O-F except in this case you have a few seconds to press the up arrow and press enter (for executing the last command from the terminal command history) and if you do it too late you'll still get into Open Firmware if auto-boot? was previously set to false using the dingusppc debugger which is actually the only way to get into Open Firmware since a keyboard is currently not emulated?).

To set ttya as the input and output device in Open Firmware, you can use the setenv command in the dingusppc debugger. The device path needs to be longer than the current device path (because code for handling shortening of the paths is currently not implemented). For example, ttya can replace kbd for the input-device, but to replace screen for the output-device you need to add some extra characters like this: ttya,11 (I think the number is for baud but we're not using a real serial port so baud doesn't matter).

Future ideas:

- Have dingusppc execute the socat command for you so that it opens a terminal window before Open Firmware starts.
- Add another --serial_backend for the printer port (ttyb) since now we have more than one type of serial backend. If both serial ports use socket backend, then a different name for the second socket is required.
- Have an option to make dingusppc block until something connects to the socket (this means calling accept after listen instead of after select).
- Test compatibility with serial port socket created by Parallels Desktop virtual machines in macOS.
- Find a solution that works with Windows.
- Test with Linux.
- Create a serial_backend type for tty devices. I suppose maybe socat can pipe the file socket to tty but a direct connection might be easier to setup.
- Allow using a socket created by some other app (for example, socat UNIX-LISTEN). This means dingusppc will assume the client role and will call connect instead of accept.
2022-08-14 16:36:52 -07:00
Maxim Poliakovski
3f3af68582 machinegossamer: add Whisper ID PROM. 2022-08-14 23:01:55 +02:00
Maxim Poliakovski
8cdbd9f81f Generic I2C PROM emulation. 2022-08-14 23:01:55 +02:00
joevt
b76bfedf4b Remove unnecessary linefeeds from log
To remove blank lines in the dingusppc.log file or in the console output when -d is used.
2022-08-14 05:26:56 -07:00
Maxim Poliakovski
b67644ba35 athens: support ID reading & dot clock disabling. 2022-08-11 01:43:29 +02:00
Maxim Poliakovski
56db0426a4 heathrow: fix EMMO bit. 2022-08-08 21:06:57 +02:00
Maxim Poliakovski
5463c8e6cb athens: fix compilation with GCC. 2022-08-07 15:32:05 +02:00
Maxim Poliakovski
8dfdf55dff Initial emulation for the Control video. 2022-08-07 15:25:58 +02:00
Maxim Poliakovski
a0e660f6b4 videoctrl: remove unnecessary delay. 2022-08-07 15:25:58 +02:00
Maxim Poliakovski
cd1d0031e6 GC: implement attachable IOBus devices. 2022-08-07 15:25:58 +02:00
Maxim Poliakovski
4216c412b3 Initial Hammerhead ASIC emulation. 2022-08-07 15:25:58 +02:00
Maxim Poliakovski
bd19914132 Initial emulation of the Athens clock ASIC. 2022-08-07 15:25:58 +02:00
Maxim Poliakovski
9a6336adb9 Move DRAM capacity constants to memctrlbase.h 2022-08-07 15:25:58 +02:00
Maxim Poliakovski
e3900b9062 bandit: add Chaos support. 2022-08-06 19:29:45 +02:00
Maxim Poliakovski
ea0fb3b410 bandit: initialize address mask register. 2022-07-25 12:51:55 +02:00
Maxim Poliakovski
c3939e3b25 Gossamer: factory test control. 2022-07-20 20:08:37 +02:00
Maxim Poliakovski
f0553720d6 Catalyst: factory test control. 2022-07-20 01:36:45 +02:00
Maxim Poliakovski
3c062443f6 PDM: factory test control. 2022-07-20 01:36:05 +02:00
Maxim Poliakovski
b9fb0b9c5f Switch fdd_wr_prot to BinProperty. 2022-07-19 23:48:17 +02:00
Maxim Poliakovski
b8915f11a2 debugger: fix ofnvram commands for Nubus machines. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
c0078ce97d Refactor MachineBase and MachineFactory classes.
Adding new machines is much easier now.
A significant amount of duplicated code has been reduced.
2022-07-18 20:27:34 +02:00
Maxim Poliakovski
9971052a78 mesh: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
7db0a31cc5 nvram: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
5e6f3a51b5 soundserver: shut-down safely. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
c37893847a atimach64gx: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
1d37982d02 mace: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
41a314d6d6 bandit: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
2dfc160e30 sc53c94: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
5f8a927846 platinum: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
97b3b9a6f8 MPC106: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
cb68b70d52 hmc: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
66debbc730 viacuda: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
9056d53474 macio: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
ca51c34157 amic: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
7fc28baf96 escc: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
439029cafe swim3: self-registration with the device registry. 2022-07-18 20:27:34 +02:00
Maxim Poliakovski
dc5373ae27 Implement basic device registry. 2022-07-18 20:24:40 +02:00
Maxim Poliakovski
f9ec73cd05 Merge branch 'tnt' 2022-06-18 18:47:31 +02:00
Maxim Poliakovski
5668fc161f macio: fix SWIM3 register space accesses. 2022-06-13 23:15:48 +02:00
Maxim Poliakovski
1d6f296d10 chario: working Windows CharIo backend. 2022-06-12 17:55:34 +02:00
Maxim Poliakovski
913944c607 platinum: implement video controller registers. 2022-06-09 23:16:03 +02:00
dingusdev
fd3ff7b703 Initial attempt at terminal support for Windows 2022-05-22 17:46:40 -07:00
Maxim Poliakovski
06001a778f GCC compilation fixes. 2022-05-21 15:10:40 +02:00
Maxim Poliakovski
f93df3b5c3 GrandCentral: improve error logging. 2022-05-21 14:51:28 +02:00
Maxim Poliakovski
51e6ffb24f GrandCentral: properly connect Curio SCSI. 2022-05-21 14:51:28 +02:00
Maxim Poliakovski
d928d3ff55 CharIoStdin: disable SIGINT generation with Ctrl-C. 2022-05-21 14:51:28 +02:00
Maxim Poliakovski
4c9001901e ESCC: connect NULL and STDIO backends. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
da25e72668 Fix ESCC register addressing. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
0df1b2c408 ATI Mach64 GX controller emulation. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
226b51d8db displayid: constructor with parameters. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
cd7624feb5 videoctrl: add pixel_depth member. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
bd24b644c9 Move ATI Mach64 definitions to separate header. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
ed02a06bb8 pcidevice: loading of expansion ROMs from files. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
5b7e79b979 Bandit: implement I/O space transactions. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
bfd48eeeb2 Bandit: implement address mask register. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
4225f0aec2 ofnvram: implement changing of string variables. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
6b686e402e videoctrl: fix surface size. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
dd79ec38e4 ATIRage: hack to support OF output. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
a7e06f4e4b Utility class for viewing/changing OF NVRAM variables. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
4b2f3cedc7 Make NVRAM a full-fledged HW component. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
32891867f2 GrandCentral: basic device interrupt handling. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
0ab4f4a7f9 GrandCentral: external SCSI (Curio style). 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
934f794d20 GrandCentral: fix access to NVRAM subdevice. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
9317719814 GrandCentral: access to ESCC and board reg 1. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
4676cfeee2 Platinum: implement memory controller registers. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
8be44dad82 Heathrow: interrupt registers & mode 1 interrupts. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
617f75851b Initial emulation of the GrandCentral I/O controller. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
fc3901676b Heathrow: use common PCI configuration code. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
fcfb2372b9 MPC106: use common PCI configuration code. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
36098af5eb ATIRage: use common PCI configuration code. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
d863fa0c80 Bandit: use common PCI configuration code. 2022-05-21 14:51:27 +02:00
Maxim Poliakovski
1f67a57d7b Common code for handling PCI config space. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
9d7d9f3103 MACE: add MaceEnet namespace. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
8d9691cc6f MESH: add MeshScsi namespace. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
6c564cb720 amic: fix MACE register range. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
4b32e9bd30 Initial emulation of the Platinum Memory controller. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
23a046d889 Refine Bandit config address handling. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
cdb34032bc Initial emulation of the Bandit ARBus-to-PCI bridge. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
74f4dbd7e6 pcihost: pull common code from Grackle. 2022-05-21 14:51:26 +02:00
Maxim Poliakovski
8889759f33 GrandCentral: improve error logging. 2022-05-21 14:45:33 +02:00
Maxim Poliakovski
533edf6ef5 GrandCentral: properly connect Curio SCSI. 2022-05-17 13:27:58 +02:00
Maxim Poliakovski
b26baaaeff CharIoStdin: disable SIGINT generation with Ctrl-C. 2022-05-07 23:42:33 +02:00
Maxim Poliakovski
e0b94e0b47 ESCC: connect NULL and STDIO backends. 2022-05-07 21:47:22 +02:00
Maxim Poliakovski
d4c08bbe31 Fix ESCC register addressing. 2022-05-07 21:47:22 +02:00
Maxim Poliakovski
57b102dae2 ATI Mach64 GX controller emulation. 2022-04-13 23:31:44 +02:00
Maxim Poliakovski
0e09ecdfa4 displayid: constructor with parameters. 2022-04-13 23:31:44 +02:00
Maxim Poliakovski
8fcdc5298a videoctrl: add pixel_depth member. 2022-04-13 23:31:44 +02:00