From cf7dffeabc82c50f807a62ba8ef6ed45ff53cbc8 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Wed, 27 Apr 2011 19:47:28 +0000 Subject: [PATCH] Lenovo H8: add h8_ultrabay_device_present() returns 1 if a CDROM/HDD device is plugging in the ultrabay. Return 0 if there's a battery or superio extensions plugged in. Signed-off-by: Sven Schnelle Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6545 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/ec/lenovo/h8/h8.c | 5 +++++ src/ec/lenovo/h8/h8.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c index 6a595257f1..e2e5f998be 100644 --- a/src/ec/lenovo/h8/h8.c +++ b/src/ec/lenovo/h8/h8.c @@ -87,6 +87,11 @@ void h8_disable_event(int event) } +int h8_ultrabay_device_present(void) +{ + return ec_read(H8_STATUS1) & 0x5 ? 0 : 1; +} + static void h8_enable(device_t dev) { struct ec_lenovo_h8_config *conf = dev->chip_info; diff --git a/src/ec/lenovo/h8/h8.h b/src/ec/lenovo/h8/h8.h index d263313fad..b5d8f017bf 100644 --- a/src/ec/lenovo/h8/h8.h +++ b/src/ec/lenovo/h8/h8.h @@ -25,6 +25,7 @@ void h8_wlan_enable(int on); void h8_set_audio_mute(int on); void h8_enable_event(int event); void h8_disable_event(int event); +int h8_ultrabay_device_present(void); /* EC registers */ #define H8_CONFIG0 0x00 @@ -102,6 +103,10 @@ void h8_disable_event(int event); #define H8_EVENT_FN_PRESS 0x39 +#define H8_STATUS0 0x46 +#define H8_STATUS1 0x47 +#define H8_STATUS2 0x48 + #define H8_EVENT_BAT0 0x4a #define H8_EVENT_BAT0_STATE 0x4b