[Skiboot] [PATCH v2 06/12] hdata: Detect LED mode and populate device tree
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Mon Apr 6 18:31:34 AEST 2015
FSP based machine supports two different LED modes:
- Light Path : Both identify and fault LEDs are supported
- Guiding Light: Only identify LEDs are supported
And this information is passed to OPAL via HDAT. Lets parse this
and populate the device tree. Later LED driver uses this information
to populate indivisual LED node.
Device Tree property:
/ibm,opal/led/led-mode : lightpath/guidinglight
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
doc/device-tree/ibm,opal/led.txt | 3 +++
hdata/spira.c | 12 ++++++++++++
hdata/spira.h | 1 +
3 files changed, 16 insertions(+)
diff --git a/doc/device-tree/ibm,opal/led.txt b/doc/device-tree/ibm,opal/led.txt
index faff1e8..2ce6946 100644
--- a/doc/device-tree/ibm,opal/led.txt
+++ b/doc/device-tree/ibm,opal/led.txt
@@ -8,6 +8,7 @@ led {
compatible = "ibm,opal-v3-led";
phandle = <0x1000006b>;
linux,phandle = <0x1000006b>;
+ led-mode = "lightpath";
U78C9.001.RST0027-P1-C1 {
led-types = "identify", "fault";
@@ -21,6 +22,8 @@ led {
'compatible' property describes LEDs compatibility.
+'led-mode' property describes service indicator mode (lightpath/guidinglight).
+
Each node under 'led' node describes location code of FRU/Enclosure.
The properties under each node:
diff --git a/hdata/spira.c b/hdata/spira.c
index 464fd8d..d29e1dc 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -737,6 +737,7 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node)
static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node)
{
const struct iplparams_iplparams *p;
+ struct dt_node *led_node;
p = HDIF_get_idata(iplp, IPLPARAMS_IPLPARAMS, NULL);
if (!CHECK_SPPTR(p)) {
@@ -764,6 +765,17 @@ static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node)
dt_add_property_cells(node, "os-ipl-mode", p->os_ipl_mode);
dt_add_property_strings(node, "cec-major-type",
p->cec_ipl_maj_type ? "hot" : "cold");
+
+ /* Add LED type info under '/ibm,opal/led' node */
+ led_node = dt_find_by_path(opal_node, DT_PROPERTY_LED_NODE);
+ assert(led_node);
+
+ if (p->other_attrib & IPLPARAMS_OATRR_LIGHT_PATH)
+ dt_add_property_strings(led_node, DT_PROPERTY_LED_MODE,
+ LED_MODE_LIGHT_PATH);
+ else
+ dt_add_property_strings(led_node, DT_PROPERTY_LED_MODE,
+ LED_MODE_GUIDING_LIGHT);
}
static void add_iplparams_serials(const void *iplp, struct dt_node *node)
diff --git a/hdata/spira.h b/hdata/spira.h
index a1ed79d..e98edbd 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -265,6 +265,7 @@ struct iplparams_iplparams {
__be32 other_attrib;
#define IPLPARAMS_OATTR_RST_PCI_BUSNO 0x08000000
#define IPLPARAMS_OATTR_CLEAR_NVRAM 0x04000000
+#define IPLPARAMS_OATRR_LIGHT_PATH 0x00000004
__be16 huge_page_count;
uint8_t huge_page_size;
#define IPLPARAMS_HUGE_PG_SIZE_16G 0
More information about the Skiboot
mailing list