coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
h8.h File Reference
#include <stdint.h>
#include <device/device.h>
Include dependency graph for h8.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define H8_CONFIG0   0x00
 
#define H8_CONFIG0_EVENTS_ENABLE   0x02
 
#define H8_CONFIG0_HOTKEY_ENABLE   0x04
 
#define H8_CONFIG0_SMM_H8_ENABLE   0x20
 
#define H8_CONFIG0_TC_ENABLE   0x80
 
#define H8_CONFIG1   0x01
 
#define H8_CONFIG1_BKLT_LID   0x01
 
#define H8_CONFIG1_UBAY_PWR   0x20
 
#define H8_CONFIG2   0x02
 
#define H8_CONFIG2_USB_DOCK   0x01
 
#define H8_CONFIG2_DOCK_SPEAKER_MUTE   0x02
 
#define H8_CONFIG2_DOCK_SPEAKER_MUTE_POL   0x04
 
#define H8_CONFIG3   0x03
 
#define H8_SOUND_ENABLE0   0x04
 
#define H8_SOUND_ENABLE1   0x05
 
#define H8_SOUND_REG   0x06
 
#define H8_SOUND_REPEAT   0x07
 
#define H8_TRACKPOINT_CTRL   0x0B
 
#define H8_TRACKPOINT_AUTO   0x01
 
#define H8_TRACKPOINT_OFF   0x02
 
#define H8_TRACKPOINT_ON   0x03
 
#define H8_LED_CONTROL   0x0c
 
#define H8_LED_CONTROL_OFF   0x00
 
#define H8_LED_CONTROL_ON   0x80
 
#define H8_LED_CONTROL_PULSE   0xa0 /* Some models, power LED only*/
 
#define H8_LED_CONTROL_BLINK   0xc0
 
#define H8_LED_CONTROL_POWER_LED   0x00
 
#define H8_LED_CONTROL_BAT0_LED   0x01
 
#define H8_LED_CONTROL_BAT1_LED   0x02
 
#define H8_LED_CONTROL_UBAY_LED   0x04
 
#define H8_LED_CONTROL_SUSPEND_LED   0x07
 
#define H8_LED_CONTROL_DOCK_LED1   0x08
 
#define H8_LED_CONTROL_DOCK_LED2   0x09
 
#define H8_LED_CONTROL_ACDC_LED   0x0c
 
#define H8_LED_CONTROL_MUTE_LED   0x0e
 
#define H8_USB_ALWAYS_ON   0x0d
 
#define H8_USB_ALWAYS_ON_ENABLE   0x01
 
#define H8_USB_ALWAYS_ON_AC_ONLY   0x0c
 
#define H8_FAN_CONTROL   0x2f
 
#define H8_FAN_CONTROL_AUTO   0x80
 
#define H8_VOLUME_CONTROL   0x30
 
#define H8_VOLUME_CONTROL_MUTE   0x40
 
#define H8_EVENT_FN_F1   0x10
 
#define H8_EVENT_FN_F2   0x11
 
#define H8_EVENT_FN_F3   0x12
 
#define H8_EVENT_FN_F4   0x13
 
#define H8_EVENT_FN_HOME   0x14
 
#define H8_EVENT_FN_END   0x15
 
#define H8_EVENT_FN_F7   0x16
 
#define H8_EVENT_FN_F8   0x17
 
#define H8_EVENT_FN_F9   0x18
 
#define H8_EVENT_FN_THINKVANTAGE   0x19
 
#define H8_EVENT_FN_F11   0x1a
 
#define H8_EVENT_FN_F12   0x1b
 
#define H8_EVENT_FN_1   0x1c
 
#define H8_EVENT_FN_2   0x1d
 
#define H8_EVENT_FN_PGUP   0x1f
 
#define H8_EVENT_AC_ON   0x26
 
#define H8_EVENT_AC_OFF   0x27
 
#define H8_EVENT_PWRSW_PRESS   0x28
 
#define H8_EVENT_PWRSW_RELEASE   0x29
 
#define H8_EVENT_LIDSW_CLOSE   0x2a
 
#define H8_EVENT_LIDSW_PUSH   0x2b
 
#define H8_EVENT_UBAY_UNLOCK   0x2c
 
#define H8_EVENT_UBAY_LOCK   0x2d
 
#define H8_EVENT_KEYPRESS   0x33
 
#define H8_EVENT_FN_PRESS   0x39
 
#define H8_STATUS0   0x46
 
#define H8_STATUS0_FN_KEY_DOWN   0x01
 
#define H8_STATUS1   0x47
 
#define H8_STATUS2   0x48
 
#define H8_STATUS3   0x49
 
#define H8_EVENT_BAT0   0x4a
 
#define H8_EVENT_BAT0_STATE   0x4b
 
#define H8_EVENT_BAT1   0x4c
 
#define H8_EVENT_BAT1_STATE   0x4d
 
#define H8_EVENT_FN_F5   0x64
 
#define H8_EVENT_FN_F6   0x65
 

Enumerations

enum  usb_always_on { UAO_OFF = 0 , UAO_AC_AND_BATTERY = 1 , UAO_AC_ONLY = 2 }
 

Functions

void h8_trackpoint_enable (int on)
 
void h8_wlan_enable (int on)
 
void h8_set_audio_mute (int on)
 
void h8_usb_always_on_enable (enum usb_always_on on)
 
void h8_usb_power_enable (int on)
 
void h8_enable_event (int event)
 
void h8_disable_event (int event)
 
int h8_ultrabay_device_present (void)
 
u8 h8_build_id_and_function_spec_version (char *buf, u8 buf_len)
 
void h8_usb_always_on (void)
 
int h8_get_fn_key (void)
 Return the state of Fn key. More...
 
int h8_get_sense_ready (void)
 Return the EC sense status register state. More...
 
void h8_bluetooth_enable (int on)
 
bool h8_bluetooth_nv_enable (void)
 
bool h8_has_bdc (const struct device *dev)
 
void h8_wwan_enable (int on)
 
bool h8_wwan_nv_enable (void)
 
bool h8_has_wwan (const struct device *dev)
 
void h8_ssdt_generator (const struct device *dev)
 
void h8_mb_init (void)
 

Macro Definition Documentation

◆ H8_CONFIG0

#define H8_CONFIG0   0x00

Definition at line 44 of file h8.h.

◆ H8_CONFIG0_EVENTS_ENABLE

#define H8_CONFIG0_EVENTS_ENABLE   0x02

Definition at line 45 of file h8.h.

◆ H8_CONFIG0_HOTKEY_ENABLE

#define H8_CONFIG0_HOTKEY_ENABLE   0x04

Definition at line 46 of file h8.h.

◆ H8_CONFIG0_SMM_H8_ENABLE

#define H8_CONFIG0_SMM_H8_ENABLE   0x20

Definition at line 47 of file h8.h.

◆ H8_CONFIG0_TC_ENABLE

#define H8_CONFIG0_TC_ENABLE   0x80

Definition at line 48 of file h8.h.

◆ H8_CONFIG1

#define H8_CONFIG1   0x01

Definition at line 50 of file h8.h.

◆ H8_CONFIG1_BKLT_LID

#define H8_CONFIG1_BKLT_LID   0x01

Definition at line 51 of file h8.h.

◆ H8_CONFIG1_UBAY_PWR

#define H8_CONFIG1_UBAY_PWR   0x20

Definition at line 52 of file h8.h.

◆ H8_CONFIG2

#define H8_CONFIG2   0x02

Definition at line 54 of file h8.h.

◆ H8_CONFIG2_DOCK_SPEAKER_MUTE

#define H8_CONFIG2_DOCK_SPEAKER_MUTE   0x02

Definition at line 56 of file h8.h.

◆ H8_CONFIG2_DOCK_SPEAKER_MUTE_POL

#define H8_CONFIG2_DOCK_SPEAKER_MUTE_POL   0x04

Definition at line 57 of file h8.h.

◆ H8_CONFIG2_USB_DOCK

#define H8_CONFIG2_USB_DOCK   0x01

Definition at line 55 of file h8.h.

◆ H8_CONFIG3

#define H8_CONFIG3   0x03

Definition at line 59 of file h8.h.

◆ H8_EVENT_AC_OFF

#define H8_EVENT_AC_OFF   0x27

Definition at line 114 of file h8.h.

◆ H8_EVENT_AC_ON

#define H8_EVENT_AC_ON   0x26

Definition at line 113 of file h8.h.

◆ H8_EVENT_BAT0

#define H8_EVENT_BAT0   0x4a

Definition at line 135 of file h8.h.

◆ H8_EVENT_BAT0_STATE

#define H8_EVENT_BAT0_STATE   0x4b

Definition at line 136 of file h8.h.

◆ H8_EVENT_BAT1

#define H8_EVENT_BAT1   0x4c

Definition at line 138 of file h8.h.

◆ H8_EVENT_BAT1_STATE

#define H8_EVENT_BAT1_STATE   0x4d

Definition at line 139 of file h8.h.

◆ H8_EVENT_FN_1

#define H8_EVENT_FN_1   0x1c

Definition at line 109 of file h8.h.

◆ H8_EVENT_FN_2

#define H8_EVENT_FN_2   0x1d

Definition at line 110 of file h8.h.

◆ H8_EVENT_FN_END

#define H8_EVENT_FN_END   0x15

Definition at line 102 of file h8.h.

◆ H8_EVENT_FN_F1

#define H8_EVENT_FN_F1   0x10

Definition at line 97 of file h8.h.

◆ H8_EVENT_FN_F11

#define H8_EVENT_FN_F11   0x1a

Definition at line 107 of file h8.h.

◆ H8_EVENT_FN_F12

#define H8_EVENT_FN_F12   0x1b

Definition at line 108 of file h8.h.

◆ H8_EVENT_FN_F2

#define H8_EVENT_FN_F2   0x11

Definition at line 98 of file h8.h.

◆ H8_EVENT_FN_F3

#define H8_EVENT_FN_F3   0x12

Definition at line 99 of file h8.h.

◆ H8_EVENT_FN_F4

#define H8_EVENT_FN_F4   0x13

Definition at line 100 of file h8.h.

◆ H8_EVENT_FN_F5

#define H8_EVENT_FN_F5   0x64

Definition at line 141 of file h8.h.

◆ H8_EVENT_FN_F6

#define H8_EVENT_FN_F6   0x65

Definition at line 142 of file h8.h.

◆ H8_EVENT_FN_F7

#define H8_EVENT_FN_F7   0x16

Definition at line 103 of file h8.h.

◆ H8_EVENT_FN_F8

#define H8_EVENT_FN_F8   0x17

Definition at line 104 of file h8.h.

◆ H8_EVENT_FN_F9

#define H8_EVENT_FN_F9   0x18

Definition at line 105 of file h8.h.

◆ H8_EVENT_FN_HOME

#define H8_EVENT_FN_HOME   0x14

Definition at line 101 of file h8.h.

◆ H8_EVENT_FN_PGUP

#define H8_EVENT_FN_PGUP   0x1f

Definition at line 111 of file h8.h.

◆ H8_EVENT_FN_PRESS

#define H8_EVENT_FN_PRESS   0x39

Definition at line 127 of file h8.h.

◆ H8_EVENT_FN_THINKVANTAGE

#define H8_EVENT_FN_THINKVANTAGE   0x19

Definition at line 106 of file h8.h.

◆ H8_EVENT_KEYPRESS

#define H8_EVENT_KEYPRESS   0x33

Definition at line 125 of file h8.h.

◆ H8_EVENT_LIDSW_CLOSE

#define H8_EVENT_LIDSW_CLOSE   0x2a

Definition at line 119 of file h8.h.

◆ H8_EVENT_LIDSW_PUSH

#define H8_EVENT_LIDSW_PUSH   0x2b

Definition at line 120 of file h8.h.

◆ H8_EVENT_PWRSW_PRESS

#define H8_EVENT_PWRSW_PRESS   0x28

Definition at line 116 of file h8.h.

◆ H8_EVENT_PWRSW_RELEASE

#define H8_EVENT_PWRSW_RELEASE   0x29

Definition at line 117 of file h8.h.

◆ H8_EVENT_UBAY_LOCK

#define H8_EVENT_UBAY_LOCK   0x2d

Definition at line 123 of file h8.h.

◆ H8_EVENT_UBAY_UNLOCK

#define H8_EVENT_UBAY_UNLOCK   0x2c

Definition at line 122 of file h8.h.

◆ H8_FAN_CONTROL

#define H8_FAN_CONTROL   0x2f

Definition at line 91 of file h8.h.

◆ H8_FAN_CONTROL_AUTO

#define H8_FAN_CONTROL_AUTO   0x80

Definition at line 92 of file h8.h.

◆ H8_LED_CONTROL

#define H8_LED_CONTROL   0x0c

Definition at line 71 of file h8.h.

◆ H8_LED_CONTROL_ACDC_LED

#define H8_LED_CONTROL_ACDC_LED   0x0c

Definition at line 84 of file h8.h.

◆ H8_LED_CONTROL_BAT0_LED

#define H8_LED_CONTROL_BAT0_LED   0x01

Definition at line 78 of file h8.h.

◆ H8_LED_CONTROL_BAT1_LED

#define H8_LED_CONTROL_BAT1_LED   0x02

Definition at line 79 of file h8.h.

◆ H8_LED_CONTROL_BLINK

#define H8_LED_CONTROL_BLINK   0xc0

Definition at line 75 of file h8.h.

◆ H8_LED_CONTROL_DOCK_LED1

#define H8_LED_CONTROL_DOCK_LED1   0x08

Definition at line 82 of file h8.h.

◆ H8_LED_CONTROL_DOCK_LED2

#define H8_LED_CONTROL_DOCK_LED2   0x09

Definition at line 83 of file h8.h.

◆ H8_LED_CONTROL_MUTE_LED

#define H8_LED_CONTROL_MUTE_LED   0x0e

Definition at line 85 of file h8.h.

◆ H8_LED_CONTROL_OFF

#define H8_LED_CONTROL_OFF   0x00

Definition at line 72 of file h8.h.

◆ H8_LED_CONTROL_ON

#define H8_LED_CONTROL_ON   0x80

Definition at line 73 of file h8.h.

◆ H8_LED_CONTROL_POWER_LED

#define H8_LED_CONTROL_POWER_LED   0x00

Definition at line 77 of file h8.h.

◆ H8_LED_CONTROL_PULSE

#define H8_LED_CONTROL_PULSE   0xa0 /* Some models, power LED only*/

Definition at line 74 of file h8.h.

◆ H8_LED_CONTROL_SUSPEND_LED

#define H8_LED_CONTROL_SUSPEND_LED   0x07

Definition at line 81 of file h8.h.

◆ H8_LED_CONTROL_UBAY_LED

#define H8_LED_CONTROL_UBAY_LED   0x04

Definition at line 80 of file h8.h.

◆ H8_SOUND_ENABLE0

#define H8_SOUND_ENABLE0   0x04

Definition at line 61 of file h8.h.

◆ H8_SOUND_ENABLE1

#define H8_SOUND_ENABLE1   0x05

Definition at line 62 of file h8.h.

◆ H8_SOUND_REG

#define H8_SOUND_REG   0x06

Definition at line 63 of file h8.h.

◆ H8_SOUND_REPEAT

#define H8_SOUND_REPEAT   0x07

Definition at line 64 of file h8.h.

◆ H8_STATUS0

#define H8_STATUS0   0x46

Definition at line 129 of file h8.h.

◆ H8_STATUS0_FN_KEY_DOWN

#define H8_STATUS0_FN_KEY_DOWN   0x01

Definition at line 130 of file h8.h.

◆ H8_STATUS1

#define H8_STATUS1   0x47

Definition at line 131 of file h8.h.

◆ H8_STATUS2

#define H8_STATUS2   0x48

Definition at line 132 of file h8.h.

◆ H8_STATUS3

#define H8_STATUS3   0x49

Definition at line 133 of file h8.h.

◆ H8_TRACKPOINT_AUTO

#define H8_TRACKPOINT_AUTO   0x01

Definition at line 67 of file h8.h.

◆ H8_TRACKPOINT_CTRL

#define H8_TRACKPOINT_CTRL   0x0B

Definition at line 66 of file h8.h.

◆ H8_TRACKPOINT_OFF

#define H8_TRACKPOINT_OFF   0x02

Definition at line 68 of file h8.h.

◆ H8_TRACKPOINT_ON

#define H8_TRACKPOINT_ON   0x03

Definition at line 69 of file h8.h.

◆ H8_USB_ALWAYS_ON

#define H8_USB_ALWAYS_ON   0x0d

Definition at line 87 of file h8.h.

◆ H8_USB_ALWAYS_ON_AC_ONLY

#define H8_USB_ALWAYS_ON_AC_ONLY   0x0c

Definition at line 89 of file h8.h.

◆ H8_USB_ALWAYS_ON_ENABLE

#define H8_USB_ALWAYS_ON_ENABLE   0x01

Definition at line 88 of file h8.h.

◆ H8_VOLUME_CONTROL

#define H8_VOLUME_CONTROL   0x30

Definition at line 94 of file h8.h.

◆ H8_VOLUME_CONTROL_MUTE

#define H8_VOLUME_CONTROL_MUTE   0x40

Definition at line 95 of file h8.h.

Enumeration Type Documentation

◆ usb_always_on

Enumerator
UAO_OFF 
UAO_AC_AND_BATTERY 
UAO_AC_ONLY 

Definition at line 9 of file h8.h.

Function Documentation

◆ h8_bluetooth_enable()

void h8_bluetooth_enable ( int  on)

Definition at line 16 of file bluetooth.c.

References ec_clr_bit(), and ec_set_bit().

Here is the call graph for this function:

◆ h8_bluetooth_nv_enable()

bool h8_bluetooth_nv_enable ( void  )

Definition at line 49 of file bluetooth.c.

References get_uint_option().

Here is the call graph for this function:

◆ h8_build_id_and_function_spec_version()

u8 h8_build_id_and_function_spec_version ( char *  buf,
u8  buf_len 
)

Definition at line 164 of file h8.c.

References buf, c, ec_read(), memcpy(), MIN, and snprintf().

Referenced by h8_log_ec_version().

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

◆ h8_disable_event()

void h8_disable_event ( int  event)

Definition at line 115 of file h8.c.

References ec_clr_bit().

Here is the call graph for this function:

◆ h8_enable_event()

void h8_enable_event ( int  event)

Definition at line 107 of file h8.c.

References ec_set_bit().

Here is the call graph for this function:

◆ h8_get_fn_key()

int h8_get_fn_key ( void  )

Return the state of Fn key.

Only valid if h8_get_sense_ready (see above) returns true.

Returns
1 if the key is pressed.

Definition at line 38 of file sense.c.

References ec_read(), H8_STATUS0, and H8_STATUS0_FN_KEY_DOWN.

Referenced by get_recovery_mode_switch().

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

◆ h8_get_sense_ready()

int h8_get_sense_ready ( void  )

Return the EC sense status register state.

Observations showed the sense registers are all zero until the EC populates them after some time. Likely the EC sets all bits to it's valid state at once, but there's no prove as the firmware isn't available.

Wait for any register having at least one bit set. Unlikely that all register will be zero after booting has finished.

Returns
1 if the EC provides valid data in sense status registers

Definition at line 19 of file sense.c.

References ARRAY_SIZE, ec_read(), H8_STATUS0, H8_STATUS1, H8_STATUS2, and H8_STATUS3.

Referenced by get_recovery_mode_switch().

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

◆ h8_has_bdc()

bool h8_has_bdc ( const struct device dev)

Definition at line 27 of file bluetooth.c.

References ec_lenovo_h8_config::bdc_gpio_lvl, ec_lenovo_h8_config::bdc_gpio_num, BIOS_INFO, device::chip_info, get_gpio(), ec_lenovo_h8_config::has_bdc_detection, and printk.

Referenced by h8_ssdt_generator().

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

◆ h8_has_wwan()

bool h8_has_wwan ( const struct device dev)

Definition at line 25 of file wwan.c.

References BIOS_INFO, device::chip_info, get_gpio(), ec_lenovo_h8_config::has_wwan_detection, printk, ec_lenovo_h8_config::wwan_gpio_lvl, and ec_lenovo_h8_config::wwan_gpio_num.

Referenced by h8_ssdt_generator().

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

◆ h8_mb_init()

void h8_mb_init ( void  )

Definition at line 222 of file h8.c.

References BIOS_DEBUG, dock_connect(), dock_present(), and printk.

Here is the call graph for this function:

◆ h8_set_audio_mute()

void h8_set_audio_mute ( int  on)

Definition at line 99 of file h8.c.

References ec_clr_bit(), and ec_set_bit().

Here is the call graph for this function:

◆ h8_ssdt_generator()

◆ h8_trackpoint_enable()

void h8_trackpoint_enable ( int  on)

Definition at line 17 of file h8.c.

References ec_write(), H8_TRACKPOINT_CTRL, H8_TRACKPOINT_OFF, and H8_TRACKPOINT_ON.

Here is the call graph for this function:

◆ h8_ultrabay_device_present()

int h8_ultrabay_device_present ( void  )

Definition at line 159 of file h8.c.

References ec_read(), and H8_STATUS1.

Referenced by mainboard_init().

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

◆ h8_usb_always_on()

void h8_usb_always_on ( void  )

◆ h8_usb_always_on_enable()

void h8_usb_always_on_enable ( enum usb_always_on  on)

Definition at line 123 of file h8.c.

References ec_read(), ec_write(), H8_USB_ALWAYS_ON, H8_USB_ALWAYS_ON_AC_ONLY, H8_USB_ALWAYS_ON_ENABLE, UAO_AC_AND_BATTERY, UAO_AC_ONLY, UAO_OFF, and val.

Here is the call graph for this function:

◆ h8_usb_power_enable()

void h8_usb_power_enable ( int  on)

Definition at line 151 of file h8.c.

References ec_clr_bit(), and ec_set_bit().

Here is the call graph for this function:

◆ h8_wlan_enable()

void h8_wlan_enable ( int  on)

Definition at line 24 of file h8.c.

References ec_clr_bit(), and ec_set_bit().

Here is the call graph for this function:

◆ h8_wwan_enable()

void h8_wwan_enable ( int  on)

Definition at line 14 of file wwan.c.

References ec_clr_bit(), and ec_set_bit().

Here is the call graph for this function:

◆ h8_wwan_nv_enable()

bool h8_wwan_nv_enable ( void  )

Definition at line 47 of file wwan.c.

References get_uint_option().

Here is the call graph for this function: