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

Go to the source code of this file.

Macros

#define TH0LOW   80
 
#define TH0HIGH   85
 
#define TH0CRIT   120
 
#define TH1LOW   75
 
#define TH1HIGH   80
 
#define KBD_DATA   0x60
 
#define KBD_SC   0x64
 
#define KBD_IBF   (1 << 1) /* 1: input buffer full (data ready for ec) */
 
#define KBD_OBF   (1 << 0) /* 1: output buffer full (data ready for host) */
 

Functions

static int send_kbd_command (u8 command)
 
static int send_kbd_data (u8 data)
 
static u8 recv_kbd_data (void)
 
static u8 m3885_get_variable (u8 index)
 
static void m3885_set_variable (u8 index, u8 data)
 
static void m3885_set_proc_ram (u8 index, u8 data)
 
static u8 m3885_get_proc_ram (u8 index)
 
static u8 m3885_read_port (void)
 
void m3885_configure_multikey (void)
 
u8 m3885_gpio (u8 value)
 

Variables

static u8 variables []
 
static u8 matrix []
 
static u8 function_ram []
 

Macro Definition Documentation

◆ KBD_DATA

#define KBD_DATA   0x60

Definition at line 86 of file m3885.c.

◆ KBD_IBF

#define KBD_IBF   (1 << 1) /* 1: input buffer full (data ready for ec) */

Definition at line 89 of file m3885.c.

◆ KBD_OBF

#define KBD_OBF   (1 << 0) /* 1: output buffer full (data ready for host) */

Definition at line 90 of file m3885.c.

◆ KBD_SC

#define KBD_SC   0x64

Definition at line 87 of file m3885.c.

◆ TH0CRIT

#define TH0CRIT   120

Definition at line 13 of file m3885.c.

◆ TH0HIGH

#define TH0HIGH   85

Definition at line 12 of file m3885.c.

◆ TH0LOW

#define TH0LOW   80

Definition at line 11 of file m3885.c.

◆ TH1HIGH

#define TH1HIGH   80

Definition at line 15 of file m3885.c.

◆ TH1LOW

#define TH1LOW   75

Definition at line 14 of file m3885.c.

Function Documentation

◆ m3885_configure_multikey()

void m3885_configure_multikey ( void  )

Definition at line 210 of file m3885.c.

References ARRAY_SIZE, BIOS_DEBUG, function_ram, KBD_DATA, KBD_SC, m3885_get_variable(), m3885_read_port(), m3885_set_proc_ram(), m3885_set_variable(), matrix, outb(), printk, TH0CRIT, TH0HIGH, TH0LOW, TH1HIGH, TH1LOW, udelay(), and variables.

Referenced by m3885x_init().

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

◆ m3885_get_proc_ram()

static u8 m3885_get_proc_ram ( u8  index)
static

Definition at line 185 of file m3885.c.

References BIOS_SPEW, printk, recv_kbd_data(), send_kbd_command(), and send_kbd_data().

Referenced by m3885_read_port().

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

◆ m3885_get_variable()

static u8 m3885_get_variable ( u8  index)
static

Definition at line 154 of file m3885.c.

References BIOS_SPEW, printk, recv_kbd_data(), send_kbd_command(), and send_kbd_data().

Referenced by m3885_configure_multikey(), and m3885_read_port().

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

◆ m3885_gpio()

u8 m3885_gpio ( u8  value)

Definition at line 359 of file m3885.c.

References ec_write(), M3885_CMCMD, M3885_CMDAT1, and value.

Here is the call graph for this function:

◆ m3885_read_port()

static u8 m3885_read_port ( void  )
static

Definition at line 197 of file m3885.c.

References m3885_get_proc_ram(), m3885_get_variable(), and m3885_set_variable().

Referenced by m3885_configure_multikey().

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

◆ m3885_set_proc_ram()

static void m3885_set_proc_ram ( u8  index,
u8  data 
)
static

Definition at line 176 of file m3885.c.

References BIOS_SPEW, printk, send_kbd_command(), and send_kbd_data().

Referenced by m3885_configure_multikey().

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

◆ m3885_set_variable()

static void m3885_set_variable ( u8  index,
u8  data 
)
static

Definition at line 167 of file m3885.c.

References BIOS_SPEW, printk, send_kbd_command(), and send_kbd_data().

Referenced by m3885_configure_multikey(), and m3885_read_port().

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

◆ recv_kbd_data()

static u8 recv_kbd_data ( void  )
static

Definition at line 131 of file m3885.c.

References BIOS_DEBUG, BIOS_SPEW, inb(), KBD_DATA, KBD_OBF, KBD_SC, printk, and udelay().

Referenced by m3885_get_proc_ram(), and m3885_get_variable().

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

◆ send_kbd_command()

static int send_kbd_command ( u8  command)
static

Definition at line 92 of file m3885.c.

References BIOS_DEBUG, BIOS_SPEW, inb(), KBD_IBF, KBD_SC, outb(), printk, and udelay().

Referenced by m3885_get_proc_ram(), m3885_get_variable(), m3885_set_proc_ram(), and m3885_set_variable().

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

◆ send_kbd_data()

static int send_kbd_data ( u8  data)
static

Definition at line 111 of file m3885.c.

References BIOS_DEBUG, BIOS_SPEW, inb(), KBD_DATA, KBD_IBF, KBD_SC, outb(), printk, and udelay().

Referenced by m3885_get_proc_ram(), m3885_get_variable(), m3885_set_proc_ram(), and m3885_set_variable().

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

Variable Documentation

◆ function_ram

u8 function_ram[]
static
Initial value:
= {
0x04,0xbd,0x0c,0xbe,0x7e,0x9a,0x8a,0xb6,
0x92,0x8f,0x93,0x8e,0x81,0x86,0x82,0x87,
0x8a,0x9a,0x8d,0x7e,0x88,0x84,0x7e,0x78,
0x77,0x07,0x77,0x98,0x89,0xb2,0x05,0x9b,
0x78,0x84,0x07,0x88,0x8a,0x7e,0x05,0xa6,
0x06,0xa7,0x04,0xa8,0x0c,0xa9,0x03,0xaa,
0x0b,0xc1,0x83,0xc0,0x0a,0xad,0x01,0xae,
0x09,0xaf,0x78,0xb0,0x07,0xb1,0x1a,0x61,
0x3b,0x69,0x42,0x72,0x4b,0x7a,0x3c,0x6b,
0x43,0x73,0x44,0x74,0x3d,0x6c,0x3e,0x75,
0x46,0x7d,0x3a,0x70,0x49,0x71,0x4a,0x94,
0x4c,0x79,0x4c,0x7c,0x45,0x7c,0x45,0x79,
0x4d,0x7b,0x5a,0x95,0x4c,0x7b,0x45,0x7b,
0x4d,0x79,0x4d,0x7c,0x4e,0x7b,0x54,0x95,
0x52,0x7c,0x45,0x94,0x4a,0x79,0xb3,0x95,
0xb4,0x7b,0xb5,0x7c,0x00,0x00,0x55,0x79,
}

Definition at line 67 of file m3885.c.

Referenced by m3885_configure_multikey().

◆ matrix

u8 matrix[]
static
Initial value:
= {
0xc1,0xc0,0xd8,0xdb,0xbf,0x05,0x76,0xbf,
0xbf,0x80,0x78,0xbf,0xbf,0x07,0x88,0xc2,
0x03,0x09,0xd9,0x16,0xbf,0x06,0x0e,0x81,
0xbf,0xbf,0xee,0xbf,0xbf,0x55,0x9a,0x89,
0x1e,0x15,0x36,0xda,0xe8,0xbf,0x0d,0xbf,
0xbf,0xbf,0xbf,0xa3,0xbf,0x4e,0x66,0x8b,
0x1d,0x2e,0xe6,0xe7,0xe5,0x1c,0x58,0xbf,
0x82,0xbf,0xf0,0xbf,0xbf,0x5b,0x5d,0x8c,
0x22,0x25,0x2c,0x35,0xe1,0x1a,0x96,0xbf,
0xbf,0xbf,0xec,0xbf,0xbf,0x54,0xf1,0x8f,
0x1b,0x2a,0x2b,0x32,0xe9,0x31,0x29,0x61,
0xbf,0xbf,0x8d,0xbf,0x86,0xc3,0x92,0x93,
0x21,0x23,0x34,0x33,0x41,0xe0,0xbf,0xbf,
0xbf,0x85,0xeb,0xbf,0xb6,0xbf,0x91,0xbf,
0x26,0x24,0x2d,0xe3,0xe2,0xe4,0xbf,0xbf,
0x87,0xbf,0xea,0xbf,0xbf,0x52,0x90,0x8e,
}

Definition at line 48 of file m3885.c.

Referenced by m3885_configure_multikey().

◆ variables

u8 variables[]
static
Initial value:
= {
0x08, 0x48, 0x6C,
0x0a, 0x01, 0x00,
0x0c, 0x80, 0x08,
0x11, 0xff, 0x06,
0x13, 0xff, 0x00,
0x14, 0xff, 0x00,
0x15, 0xff, 0x3f,
0x16, 0xff, 0x00,
0x17, 0xff, 0x00,
0x18, 0xff, 0x0e,
0x19, 0xff, 0x9f,
0x1a, 0xff, 0x9f,
0x1b, 0xff, 0x6a,
0x1c, 0xff, 0x9f,
0x1d, 0xff, 0x9f,
0x1e, 0xff, 0x87,
0x1f, 0xff, 0x9f,
0x20, 0xff, 0x9f,
0x21, 0xff, 0x08,
0x24, 0xff, 0x30,
0x2b, 0xff, 0x00,
0x2c, 0xff, 0x80,
0x2d, 0xff, 0x02,
0x2e, 0xff, 0x00,
0x2f, 0xff, 0x00,
}

Definition at line 17 of file m3885.c.

Referenced by m3885_configure_multikey().