mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-24 13:30:26 +00:00
Add Machine ID register for the Gossamer architecture.
This commit is contained in:
parent
198b918a3c
commit
ddb303c5c0
37
devices/machineid.h
Normal file
37
devices/machineid.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef MACHINE_ID_H
|
||||
#define MACHINE_ID_H
|
||||
|
||||
#include <cinttypes>
|
||||
#include "mmiodevice.h"
|
||||
|
||||
/**
|
||||
@file Contains definitions for PowerMacintosh machine ID registers.
|
||||
|
||||
The machine ID register is a memory-based register containing hardcoded
|
||||
values the system software can read to identify machine/board it's running on.
|
||||
|
||||
Register location and value meaning are board-dependent.
|
||||
*/
|
||||
|
||||
/**
|
||||
The machine ID for the Gossamer board is accesible at 0xFF000004 (phys).
|
||||
It contains a 16-bit value revealing machine's capabilities like bus speed,
|
||||
ROM speed, I/O configuration etc.
|
||||
Because the meaning of these bits is poorly documented, the code below
|
||||
simply return raw values obtained from real hardware.
|
||||
*/
|
||||
class GossamerID : public MMIODevice {
|
||||
public:
|
||||
GossamerID(const uint16_t id) { this->id = id, this->name = "Machine-id"; };
|
||||
~GossamerID() = default;
|
||||
|
||||
uint32_t read(uint32_t offset, int size) {
|
||||
return ((!offset && size == 2) ? this->id : 0); };
|
||||
|
||||
void write(uint32_t offset, uint32_t value, int size) {}; /* not writable */
|
||||
|
||||
private:
|
||||
uint16_t id;
|
||||
};
|
||||
|
||||
#endif /* MACHINE_ID_H */
|
7
main.cpp
7
main.cpp
@ -25,6 +25,7 @@
|
||||
#include "devices/mpc106.h"
|
||||
#include "openpic.h"
|
||||
#include "debugger.h"
|
||||
#include "devices/machineid.h"
|
||||
#include "devices/macio.h"
|
||||
#include "devices/mpc106.h"
|
||||
|
||||
@ -84,6 +85,7 @@ uint32_t return_value;
|
||||
|
||||
MemCtrlBase *mem_ctrl_instance = 0;
|
||||
HeathrowIC *heathrow = 0;
|
||||
GossamerID *machine_id;
|
||||
|
||||
//A pointer to a pointer, used for quick movement to one of the following
|
||||
//memory areas. These are listed right below.
|
||||
@ -557,6 +559,10 @@ int main(int argc, char **argv)
|
||||
romFile.close();
|
||||
return 1;
|
||||
}
|
||||
machine_id = new GossamerID(0x3d8c);
|
||||
assert(machine_id != 0);
|
||||
mpc106->add_mmio_region(0xFF000004, 4096, machine_id);
|
||||
|
||||
heathrow = new HeathrowIC();
|
||||
assert(heathrow != 0);
|
||||
mpc106->pci_register_device(16, heathrow);
|
||||
@ -791,6 +797,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
delete(heathrow);
|
||||
delete(machine_id);
|
||||
delete(mem_ctrl_instance);
|
||||
|
||||
//Free memory after the emulation is completed.
|
||||
|
Loading…
x
Reference in New Issue
Block a user