34 #include "debug/I8042.hh" 50 latency(p->pio_latency),
51 dataPort(p->data_port), commandPort(p->command_port),
52 statusReg(0), commandByte(0), dataReg(0), lastCommand(NoCommand),
53 mouse(p->mouse), keyboard(p->keyboard)
55 fatal_if(!
mouse,
"The i8042 model requires a mouse instance");
66 for (
int i = 0;
i < p->port_keyboard_int_pin_connection_count;
i++) {
70 for (
int i = 0;
i < p->port_mouse_int_pin_connection_count;
i++) {
93 statusReg.mouseOutputFull = (mouse ? 1 : 0);
138 panic(
"Read from unrecognized port %#x.\n", addr);
166 "command byte\" command.\n", data);
171 "mouse output buffer\" command.\n", data);
176 "keyboad output buffer\" command.\n", data);
181 "output port\" command.\n", data);
186 panic(
"Data written for unrecognized " 197 panic(
"Attempted to use i8042 read controller RAM command to " 201 panic(
"Attempted to use i8042 read controller RAM command to " 205 panic(
"Attempted to use i8042 pulse output bit command to " 218 panic(
"i8042 \"Check for password\" command not implemented.\n");
220 panic(
"i8042 \"Load password\" command not implemented.\n");
222 panic(
"i8042 \"Check password\" command not implemented.\n");
232 panic(
"i8042 \"Test mouse\" command not implemented.\n");
234 panic(
"i8042 \"Self test\" command not implemented.\n");
236 panic(
"i8042 \"Interface test\" command not implemented.\n");
238 panic(
"i8042 \"Diagnostic dump\" command not implemented.\n");
248 panic(
"i8042 \"Read input port\" command not implemented.\n");
250 panic(
"i8042 \"Continuous poll low\" command not implemented.\n");
252 panic(
"i8042 \"Continuous poll high\" command not implemented.\n");
254 panic(
"i8042 \"Read output port\" command not implemented.\n");
262 DPRINTF(
I8042,
"Got command to write to mouse output buffer.\n");
270 panic(
"i8042 \"Disable A20\" command not implemented.\n");
272 panic(
"i8042 \"Enable A20\" command not implemented.\n");
274 panic(
"i8042 \"Read test inputs\" command not implemented.\n");
276 panic(
"i8042 \"System reset\" command not implemented.\n");
278 warn(
"Write to unknown i8042 " 279 "(keyboard controller) command port.\n");
282 panic(
"Write to unrecognized port %#x.\n", addr);
311 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.
virtual const std::string name() const
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)
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.