coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
keyboard.c File Reference
#include <console/console.h>
#include <pc80/keyboard.h>
#include <device/device.h>
#include <arch/io.h>
#include <delay.h>
#include <types.h>
#include <acpi/acpi.h>
Include dependency graph for keyboard.c:

Go to the source code of this file.

Macros

#define KBD_DATA   0x60
 
#define KBD_COMMAND   0x64
 
#define KBD_STATUS   0x64
 
#define KBD_IBF   (1 << 1)
 
#define KBD_OBF   (1 << 0)
 
#define KBC_CMD_READ_COMMAND   0x20
 
#define KBC_CMD_WRITE_COMMAND   0x60
 
#define KBC_CMD_AUX_ENABLE   0xA8
 
#define KBC_CMD_AUX_TEST   0xA9
 
#define KBC_CMD_SELF_TEST   0xAA
 
#define KBC_CMD_KBD_TEST   0xAB
 
#define KBC_REPLY_SELFTEST_OK   0x55
 
#define KBD_REPLY_POR   0xAA
 
#define KBD_REPLY_ACK   0xFA
 
#define KBD_REPLY_RESEND   0xFE
 
#define KBC_TIMEOUT_IN_MS   400
 

Functions

static int kbc_input_buffer_empty (void)
 
static int kbc_output_buffer_full (void)
 
static int kbc_cleanup_buffers (void)
 
static enum cb_err kbc_self_test (uint8_t probe_aux, uint8_t *aux_probe_result)
 
static u8 send_keyboard (u8 command)
 
uint8_t pc_keyboard_init (uint8_t probe_aux)
 
void set_kbc_ps2_mode (void)
 

Macro Definition Documentation

◆ KBC_CMD_AUX_ENABLE

#define KBC_CMD_AUX_ENABLE   0xA8

Definition at line 20 of file keyboard.c.

◆ KBC_CMD_AUX_TEST

#define KBC_CMD_AUX_TEST   0xA9

Definition at line 21 of file keyboard.c.

◆ KBC_CMD_KBD_TEST

#define KBC_CMD_KBD_TEST   0xAB

Definition at line 23 of file keyboard.c.

◆ KBC_CMD_READ_COMMAND

#define KBC_CMD_READ_COMMAND   0x20

Definition at line 18 of file keyboard.c.

◆ KBC_CMD_SELF_TEST

#define KBC_CMD_SELF_TEST   0xAA

Definition at line 22 of file keyboard.c.

◆ KBC_CMD_WRITE_COMMAND

#define KBC_CMD_WRITE_COMMAND   0x60

Definition at line 19 of file keyboard.c.

◆ KBC_REPLY_SELFTEST_OK

#define KBC_REPLY_SELFTEST_OK   0x55

Definition at line 39 of file keyboard.c.

◆ KBC_TIMEOUT_IN_MS

#define KBC_TIMEOUT_IN_MS   400

Definition at line 49 of file keyboard.c.

◆ KBD_COMMAND

#define KBD_COMMAND   0x64

Definition at line 12 of file keyboard.c.

◆ KBD_DATA

#define KBD_DATA   0x60

Definition at line 11 of file keyboard.c.

◆ KBD_IBF

#define KBD_IBF   (1 << 1)

Definition at line 14 of file keyboard.c.

◆ KBD_OBF

#define KBD_OBF   (1 << 0)

Definition at line 15 of file keyboard.c.

◆ KBD_REPLY_ACK

#define KBD_REPLY_ACK   0xFA

Definition at line 45 of file keyboard.c.

◆ KBD_REPLY_POR

#define KBD_REPLY_POR   0xAA

Definition at line 44 of file keyboard.c.

◆ KBD_REPLY_RESEND

#define KBD_REPLY_RESEND   0xFE

Definition at line 46 of file keyboard.c.

◆ KBD_STATUS

#define KBD_STATUS   0x64

Definition at line 13 of file keyboard.c.

Function Documentation

◆ kbc_cleanup_buffers()

static int kbc_cleanup_buffers ( void  )
static

Definition at line 79 of file keyboard.c.

References BIOS_ERR, inb(), KBC_TIMEOUT_IN_MS, KBD_DATA, KBD_IBF, KBD_OBF, KBD_STATUS, mdelay(), and printk.

Referenced by pc_keyboard_init(), and set_kbc_ps2_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kbc_input_buffer_empty()

static int kbc_input_buffer_empty ( void  )
static

Definition at line 51 of file keyboard.c.

References BIOS_WARNING, inb(), KBC_TIMEOUT_IN_MS, KBD_IBF, KBD_STATUS, mdelay(), and printk.

Referenced by pc_keyboard_init(), send_keyboard(), and set_kbc_ps2_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kbc_output_buffer_full()

static int kbc_output_buffer_full ( void  )
static

Definition at line 65 of file keyboard.c.

References BIOS_INFO, inb(), KBC_TIMEOUT_IN_MS, KBD_OBF, KBD_STATUS, mdelay(), and printk.

Referenced by pc_keyboard_init(), and send_keyboard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kbc_self_test()

static enum cb_err kbc_self_test ( uint8_t  probe_aux,
uint8_t aux_probe_result 
)
static

Definition at line 79 of file keyboard.c.

Referenced by pc_keyboard_init(), and set_kbc_ps2_mode().

Here is the caller graph for this function:

◆ pc_keyboard_init()

◆ send_keyboard()

static u8 send_keyboard ( u8  command)
static

Definition at line 197 of file keyboard.c.

References BIOS_ERR, inb(), kbc_input_buffer_empty(), kbc_output_buffer_full(), KBD_DATA, KBD_REPLY_RESEND, outb(), and printk.

Referenced by pc_keyboard_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_kbc_ps2_mode()

void set_kbc_ps2_mode ( void  )

Definition at line 351 of file keyboard.c.

References CB_KBD_INTERFACE_FAILURE, CB_SUCCESS, kbc_cleanup_buffers(), kbc_input_buffer_empty(), kbc_self_test(), KBD_COMMAND, KBD_DATA, NULL, and outb().

Referenced by it8712f_init(), it8728f_init(), it8772f_init(), and m3885x_init().

Here is the call graph for this function:
Here is the caller graph for this function: