mirror of
https://github.com/daeken/Zookeeper.git
synced 2024-06-11 09:07:08 -04:00
Added LPC and SMBus stub devices. Moved boost headers out of Zookeeper to speed up compiles.
This commit is contained in:
parent
d53e5cb51b
commit
e3134a6424
2
Box.cpp
2
Box.cpp
|
@ -20,6 +20,8 @@ Box::Box() {
|
||||||
debugger = new Debugger();
|
debugger = new Debugger();
|
||||||
|
|
||||||
gpu = new Gpu();
|
gpu = new Gpu();
|
||||||
|
lpc = new Lpc();
|
||||||
|
smbus = new Smbus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box::add_mmio(uint32_t base, uint32_t pages, Device *dev) {
|
void Box::add_mmio(uint32_t base, uint32_t pages, Device *dev) {
|
||||||
|
|
5
Box.hpp
5
Box.hpp
|
@ -10,7 +10,6 @@ public:
|
||||||
void add_pci(uint16_t bus, uint16_t slot, Device *dev);
|
void add_pci(uint16_t bus, uint16_t slot, Device *dev);
|
||||||
|
|
||||||
Cpu *cpu;
|
Cpu *cpu;
|
||||||
Gpu *gpu;
|
|
||||||
Hypercall *hypercall;
|
Hypercall *hypercall;
|
||||||
HandleManager *hm;
|
HandleManager *hm;
|
||||||
PageManager *pm;
|
PageManager *pm;
|
||||||
|
@ -18,6 +17,10 @@ public:
|
||||||
IOManager *io;
|
IOManager *io;
|
||||||
Debugger *debugger;
|
Debugger *debugger;
|
||||||
|
|
||||||
|
Gpu *gpu;
|
||||||
|
Lpc *lpc;
|
||||||
|
Smbus *smbus;
|
||||||
|
|
||||||
map<uint32_t, Device *> mmio;
|
map<uint32_t, Device *> mmio;
|
||||||
map<uint32_t, Device *> ports;
|
map<uint32_t, Device *> ports;
|
||||||
map<uint32_t, Device *> pci;
|
map<uint32_t, Device *> pci;
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#include "Zookeeper.hpp"
|
#include "Zookeeper.hpp"
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/regex.hpp>
|
||||||
|
using namespace boost::algorithm;
|
||||||
|
|
||||||
void break_in(bool fatal) {
|
void break_in(bool fatal) {
|
||||||
if(fatal)
|
if(fatal)
|
||||||
|
|
5
Gpu.cpp
5
Gpu.cpp
|
@ -1,7 +1,9 @@
|
||||||
#include "Zookeeper.hpp"
|
#include "Zookeeper.hpp"
|
||||||
|
|
||||||
|
// Comment to enable break_in()s for this file
|
||||||
|
#define break_in() do { } while(0)
|
||||||
|
|
||||||
Gpu::Gpu() {
|
Gpu::Gpu() {
|
||||||
box->add_pci(1, 0, this);
|
|
||||||
box->add_mmio(0xFD000000, 4096, this); // 4096 pages * 4KB == 16MB address space
|
box->add_mmio(0xFD000000, 4096, this); // 4096 pages * 4KB == 16MB address space
|
||||||
box->add_port(0x80c0, this);
|
box->add_port(0x80c0, this);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +14,7 @@ uint32_t Gpu::readMmio(uint32_t addr) {
|
||||||
return 3;
|
return 3;
|
||||||
default:
|
default:
|
||||||
cout << format("Gpu::readMmio(0x%08x)") % addr << endl;
|
cout << format("Gpu::readMmio(0x%08x)") % addr << endl;
|
||||||
|
break_in();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "Zookeeper.hpp"
|
#include "Zookeeper.hpp"
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
using namespace boost::algorithm;
|
||||||
|
|
||||||
list<string> parse_path(string path) {
|
list<string> parse_path(string path) {
|
||||||
list<string> vec;
|
list<string> vec;
|
||||||
|
|
43
Lpc.cpp
Normal file
43
Lpc.cpp
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#include "Zookeeper.hpp"
|
||||||
|
|
||||||
|
// Comment to enable break_in()s for this file
|
||||||
|
#define break_in() do { } while(0)
|
||||||
|
|
||||||
|
Lpc::Lpc() {
|
||||||
|
box->add_pci(1, 0, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Lpc::readMmio(uint32_t addr) {
|
||||||
|
switch(addr) {
|
||||||
|
default:
|
||||||
|
cout << format("Lpc::readMmio(0x%08x)") % addr << endl;
|
||||||
|
break_in();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lpc::writeMmio(uint32_t addr, uint32_t value) {
|
||||||
|
cout << format("Lpc::writeMmio(0x%08x, 0x%08x)") % addr % value << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lpc::readPci(uint32_t reg, void *buffer, uint32_t length) {
|
||||||
|
cout << format("Lpc::readPci(0x%08x, %i)") % reg % length << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lpc::writePci(uint32_t reg, void *buffer, uint32_t length) {
|
||||||
|
cout << format("Lpc::writePci(0x%08x, %i)") % reg % length << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Lpc::readPort(uint32_t port, uint32_t size) {
|
||||||
|
cout << format("Lpc::readPort(0x%04x, %i)") % port % size << endl;
|
||||||
|
break_in();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lpc::writePort(uint32_t port, uint32_t size, uint32_t value) {
|
||||||
|
cout << format("Lpc::writePort(0x%04x, %i, 0x%x)") % port % size % value << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
16
Lpc.hpp
Normal file
16
Lpc.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
#include "Zookeeper.hpp"
|
||||||
|
|
||||||
|
class Lpc : public Device {
|
||||||
|
public:
|
||||||
|
Lpc();
|
||||||
|
|
||||||
|
uint32_t readMmio(uint32_t addr);
|
||||||
|
void writeMmio(uint32_t addr, uint32_t value);
|
||||||
|
|
||||||
|
void readPci(uint32_t reg, void *buffer, uint32_t length);
|
||||||
|
void writePci(uint32_t reg, void *buffer, uint32_t length);
|
||||||
|
|
||||||
|
uint32_t readPort(uint32_t port, uint32_t size);
|
||||||
|
void writePort(uint32_t port, uint32_t size, uint32_t value);
|
||||||
|
};
|
43
Smbus.cpp
Normal file
43
Smbus.cpp
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#include "Zookeeper.hpp"
|
||||||
|
|
||||||
|
// Comment to enable break_in()s for this file
|
||||||
|
#define break_in() do { } while(0)
|
||||||
|
|
||||||
|
Smbus::Smbus() {
|
||||||
|
box->add_pci(1, 1, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Smbus::readMmio(uint32_t addr) {
|
||||||
|
switch(addr) {
|
||||||
|
default:
|
||||||
|
cout << format("Smbus::readMmio(0x%08x)") % addr << endl;
|
||||||
|
break_in();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Smbus::writeMmio(uint32_t addr, uint32_t value) {
|
||||||
|
cout << format("Smbus::writeMmio(0x%08x, 0x%08x)") % addr % value << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Smbus::readPci(uint32_t reg, void *buffer, uint32_t length) {
|
||||||
|
cout << format("Smbus::readPci(0x%08x, %i)") % reg % length << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Smbus::writePci(uint32_t reg, void *buffer, uint32_t length) {
|
||||||
|
cout << format("Smbus::writePci(0x%08x, %i)") % reg % length << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Smbus::readPort(uint32_t port, uint32_t size) {
|
||||||
|
cout << format("Smbus::readPort(0x%04x, %i)") % port % size << endl;
|
||||||
|
break_in();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Smbus::writePort(uint32_t port, uint32_t size, uint32_t value) {
|
||||||
|
cout << format("Smbus::writePort(0x%04x, %i, 0x%x)") % port % size % value << endl;
|
||||||
|
break_in();
|
||||||
|
}
|
16
Smbus.hpp
Normal file
16
Smbus.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
#include "Zookeeper.hpp"
|
||||||
|
|
||||||
|
class Smbus : public Device {
|
||||||
|
public:
|
||||||
|
Smbus();
|
||||||
|
|
||||||
|
uint32_t readMmio(uint32_t addr);
|
||||||
|
void writeMmio(uint32_t addr, uint32_t value);
|
||||||
|
|
||||||
|
void readPci(uint32_t reg, void *buffer, uint32_t length);
|
||||||
|
void writePci(uint32_t reg, void *buffer, uint32_t length);
|
||||||
|
|
||||||
|
uint32_t readPort(uint32_t port, uint32_t size);
|
||||||
|
void writePort(uint32_t port, uint32_t size, uint32_t value);
|
||||||
|
};
|
|
@ -1,9 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
#include <boost/regex.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -11,9 +8,9 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <map>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using boost::format;
|
using boost::format;
|
||||||
using namespace boost::algorithm;
|
|
||||||
|
|
||||||
#define bailout(expr) do { if(expr) { cout << "Bailout: " << #expr << " @ " << __FILE__ << " (" << dec << __LINE__ << ")" << endl; exit(1); } } while(0)
|
#define bailout(expr) do { if(expr) { cout << "Bailout: " << #expr << " @ " << __FILE__ << " (" << dec << __LINE__ << ")" << endl; exit(1); } } while(0)
|
||||||
|
|
||||||
|
@ -34,9 +31,13 @@ using namespace boost::algorithm;
|
||||||
#include "Hypercall.hpp"
|
#include "Hypercall.hpp"
|
||||||
#include "xbetypes.hpp"
|
#include "xbetypes.hpp"
|
||||||
#include "Xbe.hpp"
|
#include "Xbe.hpp"
|
||||||
|
|
||||||
#include "Device.hpp"
|
#include "Device.hpp"
|
||||||
#include "Cpu.hpp"
|
#include "Cpu.hpp"
|
||||||
#include "Gpu.hpp"
|
#include "Gpu.hpp"
|
||||||
|
#include "Lpc.hpp"
|
||||||
|
#include "Smbus.hpp"
|
||||||
|
|
||||||
#include "HandleManager.hpp"
|
#include "HandleManager.hpp"
|
||||||
#include "PageManager.hpp"
|
#include "PageManager.hpp"
|
||||||
#include "ThreadManager.hpp"
|
#include "ThreadManager.hpp"
|
||||||
|
|
Loading…
Reference in a new issue