i8042.cc (12450:b5a0300fc327) i8042.cc (12514:09556145b380)
1/*
2 * Copyright (c) 2008 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30
31#include "dev/x86/i8042.hh"
32
33#include "base/bitunion.hh"
34#include "debug/I8042.hh"
35#include "mem/packet.hh"
36#include "mem/packet_access.hh"
37
1/*
2 * Copyright (c) 2008 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 21 unchanged lines hidden (view full) ---

30
31#include "dev/x86/i8042.hh"
32
33#include "base/bitunion.hh"
34#include "debug/I8042.hh"
35#include "mem/packet.hh"
36#include "mem/packet_access.hh"
37
38/**
39 * Note: For details on the implementation see
40 * https://wiki.osdev.org/%228042%22_PS/2_Controller
41 */
42
38// The 8042 has a whopping 32 bytes of internal RAM.
39const uint8_t RamSize = 32;
40const uint8_t NumOutputBits = 14;
41const uint8_t X86ISA::PS2Keyboard::ID[] = {0xab, 0x83};
42const uint8_t X86ISA::PS2Mouse::ID[] = {0x00};
43const uint8_t CommandAck = 0xfa;
44const uint8_t CommandNack = 0xfe;
45const uint8_t BatSuccessful = 0xaa;

--- 331 unchanged lines hidden (view full) ---

377 "command byte\" command.\n", data);
378 statusReg.passedSelfTest = (uint8_t)commandByte.passedSelfTest;
379 break;
380 case WriteMouseOutputBuff:
381 DPRINTF(I8042, "Got data %#02x for \"Write "
382 "mouse output buffer\" command.\n", data);
383 writeData(data, true);
384 break;
43// The 8042 has a whopping 32 bytes of internal RAM.
44const uint8_t RamSize = 32;
45const uint8_t NumOutputBits = 14;
46const uint8_t X86ISA::PS2Keyboard::ID[] = {0xab, 0x83};
47const uint8_t X86ISA::PS2Mouse::ID[] = {0x00};
48const uint8_t CommandAck = 0xfa;
49const uint8_t CommandNack = 0xfe;
50const uint8_t BatSuccessful = 0xaa;

--- 331 unchanged lines hidden (view full) ---

382 "command byte\" command.\n", data);
383 statusReg.passedSelfTest = (uint8_t)commandByte.passedSelfTest;
384 break;
385 case WriteMouseOutputBuff:
386 DPRINTF(I8042, "Got data %#02x for \"Write "
387 "mouse output buffer\" command.\n", data);
388 writeData(data, true);
389 break;
390 case WriteKeyboardOutputBuff:
391 DPRINTF(I8042, "Got data %#02x for \"Write "
392 "keyboad output buffer\" command.\n", data);
393 writeData(data, false);
394 break;
395 case WriteOutputPort:
396 DPRINTF(I8042, "Got data %#02x for \"Write "
397 "output port\" command.\n", data);
398 panic_if(bits(data, 0) != 1, "Reset bit should be 1");
399 // Safe to ignore otherwise
400 break;
385 default:
386 panic("Data written for unrecognized "
387 "command %#02x\n", lastCommand);
388 }
389 lastCommand = NoCommand;
390 } else if (addr == commandPort) {
391 DPRINTF(I8042, "Got command %#02x.\n", data);
392 statusReg.commandLast = 1;

--- 55 unchanged lines hidden (view full) ---

448 panic("i8042 \"Read input port\" command not implemented.\n");
449 case ContinuousPollLow:
450 panic("i8042 \"Continuous poll low\" command not implemented.\n");
451 case ContinuousPollHigh:
452 panic("i8042 \"Continuous poll high\" command not implemented.\n");
453 case ReadOutputPort:
454 panic("i8042 \"Read output port\" command not implemented.\n");
455 case WriteOutputPort:
401 default:
402 panic("Data written for unrecognized "
403 "command %#02x\n", lastCommand);
404 }
405 lastCommand = NoCommand;
406 } else if (addr == commandPort) {
407 DPRINTF(I8042, "Got command %#02x.\n", data);
408 statusReg.commandLast = 1;

--- 55 unchanged lines hidden (view full) ---

464 panic("i8042 \"Read input port\" command not implemented.\n");
465 case ContinuousPollLow:
466 panic("i8042 \"Continuous poll low\" command not implemented.\n");
467 case ContinuousPollHigh:
468 panic("i8042 \"Continuous poll high\" command not implemented.\n");
469 case ReadOutputPort:
470 panic("i8042 \"Read output port\" command not implemented.\n");
471 case WriteOutputPort:
456 warn("i8042 \"Write output port\" command not implemented.\n");
457 lastCommand = WriteOutputPort;
458 break;
459 case WriteKeyboardOutputBuff:
472 lastCommand = WriteOutputPort;
473 break;
474 case WriteKeyboardOutputBuff:
460 warn("i8042 \"Write keyboard output buffer\" "
461 "command not implemented.\n");
462 lastCommand = WriteKeyboardOutputBuff;
463 break;
464 case WriteMouseOutputBuff:
465 DPRINTF(I8042, "Got command to write to mouse output buffer.\n");
466 lastCommand = WriteMouseOutputBuff;
467 break;
468 case WriteToMouse:
469 DPRINTF(I8042, "Expecting mouse command.\n");

--- 72 unchanged lines hidden ---
475 lastCommand = WriteKeyboardOutputBuff;
476 break;
477 case WriteMouseOutputBuff:
478 DPRINTF(I8042, "Got command to write to mouse output buffer.\n");
479 lastCommand = WriteMouseOutputBuff;
480 break;
481 case WriteToMouse:
482 DPRINTF(I8042, "Expecting mouse command.\n");

--- 72 unchanged lines hidden ---