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 |
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; |
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: |
472 lastCommand = WriteOutputPort; 473 break; 474 case WriteKeyboardOutputBuff: |
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 --- |