33 #include "debug/I8042.hh" 49 latency(p->pio_latency),
50 dataPort(p->data_port), commandPort(p->command_port),
51 statusReg(0), commandByte(0), dataReg(0), lastCommand(NoCommand),
52 mouse(p->mouse), keyboard(p->keyboard)
54 fatal_if(!
mouse,
"The i8042 model requires a mouse instance");
65 for (
int i = 0;
i < p->port_keyboard_int_pin_connection_count;
i++) {
69 for (
int i = 0;
i < p->port_mouse_int_pin_connection_count;
i++) {
92 statusReg.mouseOutputFull = (mouse ? 1 : 0);
137 panic(
"Read from unrecognized port %#x.\n", addr);
165 "command byte\" command.\n", data);
170 "mouse output buffer\" command.\n", data);
175 "keyboad output buffer\" command.\n", data);
180 "output port\" command.\n", data);
185 panic(
"Data written for unrecognized " 196 panic(
"Attempted to use i8042 read controller RAM command to " 200 panic(
"Attempted to use i8042 read controller RAM command to " 204 panic(
"Attempted to use i8042 pulse output bit command to " 217 panic(
"i8042 \"Check for password\" command not implemented.\n");
219 panic(
"i8042 \"Load password\" command not implemented.\n");
221 panic(
"i8042 \"Check password\" command not implemented.\n");
231 panic(
"i8042 \"Test mouse\" command not implemented.\n");
233 panic(
"i8042 \"Self test\" command not implemented.\n");
235 panic(
"i8042 \"Interface test\" command not implemented.\n");
237 panic(
"i8042 \"Diagnostic dump\" command not implemented.\n");
247 panic(
"i8042 \"Read input port\" command not implemented.\n");
249 panic(
"i8042 \"Continuous poll low\" command not implemented.\n");
251 panic(
"i8042 \"Continuous poll high\" command not implemented.\n");
253 panic(
"i8042 \"Read output port\" command not implemented.\n");
261 DPRINTF(
I8042,
"Got command to write to mouse output buffer.\n");
269 panic(
"i8042 \"Disable A20\" command not implemented.\n");
271 panic(
"i8042 \"Enable A20\" command not implemented.\n");
273 panic(
"i8042 \"Read test inputs\" command not implemented.\n");
275 panic(
"i8042 \"System reset\" command not implemented.\n");
277 warn(
"Write to unknown i8042 " 278 "(keyboard controller) command port.\n");
281 panic(
"Write to unrecognized port %#x.\n", addr);
310 I8042Params::create()
#define panic(...)
This implements a cprintf based panic() function.
AddrRange RangeSize(Addr start, Addr size)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::vector< IntSourcePin< I8042 > * > mouseIntPin
void serialize(CheckpointOut &cp) const override
Serialize an object.
void hostWrite(uint8_t c)
Transmit a character from the host interface to the device.
AddrRangeList getAddrRanges() const override
Determine the address ranges that this device responds to.
void setLE(T v)
Set the value in the data pointer to v as little endian.
#define UNSERIALIZE_SCALAR(scalar)
std::string csprintf(const char *format, const Args &...args)
void makeAtomicResponse()
uint64_t Tick
Tick count type.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
void writeData(uint8_t newData, bool mouse=false)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
#define SERIALIZE_SCALAR(scalar)
virtual const std::string name() const
Declaration of the Packet class.
std::ostream CheckpointOut
const uint8_t RamSize
Note: For details on the implementation see https://wiki.osdev.org/%228042%22_PS/2_Controller.
static const uint16_t NoCommand
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
const uint8_t NumOutputBits
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
bool hostDataAvailable() const
Check if there is pending data from the PS/2 device.
std::vector< IntSourcePin< I8042 > * > keyboardIntPin
uint8_t hostRead()
Read a character from the device.