Author: svens
Date: Wed Apr 27 21:47:28 2011
New Revision: 6545
URL: https://tracker.coreboot.org/trac/coreboot/changeset/6545

Log:
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 <[email protected]>
Acked-by: Peter Stuge <[email protected]>

Modified:
   trunk/src/ec/lenovo/h8/h8.c
   trunk/src/ec/lenovo/h8/h8.h

Modified: trunk/src/ec/lenovo/h8/h8.c
==============================================================================
--- trunk/src/ec/lenovo/h8/h8.c Wed Apr 27 01:47:04 2011        (r6544)
+++ trunk/src/ec/lenovo/h8/h8.c Wed Apr 27 21:47:28 2011        (r6545)
@@ -87,6 +87,11 @@
 
 }
 
+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;

Modified: trunk/src/ec/lenovo/h8/h8.h
==============================================================================
--- trunk/src/ec/lenovo/h8/h8.h Wed Apr 27 01:47:04 2011        (r6544)
+++ trunk/src/ec/lenovo/h8/h8.h Wed Apr 27 21:47:28 2011        (r6545)
@@ -25,6 +25,7 @@
 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 @@
 
 #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
 

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to