[Skiboot] [PATCH 05/15] FSP/LED: Define macro instead of hardcoding led type
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Fri Mar 20 23:07:13 AEDT 2015
Define macors for LED related device tree property and
its values.
Macros which needs to be exposed to host is defined in opal.h
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
hw/fsp/fsp-leds.c | 13 ++++++++-----
include/fsp-leds.h | 7 +++++++
include/opal.h | 13 +++++++++++++
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c
index c4e7e39..63cfeae 100644
--- a/hw/fsp/fsp-leds.c
+++ b/hw/fsp/fsp-leds.c
@@ -1308,13 +1308,13 @@ void create_led_device_nodes(void)
}
/* LED parent node */
- pled = dt_new(opal_node, "led");
+ pled = dt_new(opal_node, DT_PROPERTY_LED_NODE);
if (!pled) {
prlog(PR_WARNING, PREFIX
"Parent device node creation failed\n");
return;
}
- dt_add_property_strings(pled, "compatible", "ibm,opal-v3-led");
+ dt_add_property_strings(pled, "compatible", DT_PROPERTY_LED_COMPATIBLE);
/* LED child nodes */
list_for_each_safe(&cec_ledq, led, next, link) {
@@ -1329,11 +1329,14 @@ void create_led_device_nodes(void)
continue;
}
- dt_add_property_strings(cled, "led-types", "identify", "fault");
+ dt_add_property_strings(cled, DT_PROPERTY_LED_TYPE,
+ LED_TYPE_IDENTIFY, LED_TYPE_FAULT);
if (is_enclosure_led(led->loc_code))
- dt_add_property_strings(cled, "led-loc", "enclosure");
+ dt_add_property_strings(cled, DT_PROPERTY_LED_LOCATION,
+ LED_LOC_ENCLOSURE);
else
- dt_add_property_strings(cled, "led-loc", "descendent");
+ dt_add_property_strings(cled, DT_PROPERTY_LED_LOCATION,
+ LED_LOC_DESCENDENT);
}
}
diff --git a/include/fsp-leds.h b/include/fsp-leds.h
index a411636..1472c74 100644
--- a/include/fsp-leds.h
+++ b/include/fsp-leds.h
@@ -150,4 +150,11 @@ struct led_set_cmd {
#define LED_CONTROL_LEN 2
#define FSP_LC_STRUCT_FIXED_SZ 0x0a
+/* LED Device tree property names */
+#define DT_PROPERTY_LED_COMPATIBLE "ibm,opal-v3-led"
+#define DT_PROPERTY_LED_NODE "led"
+#define DT_PROPERTY_LED_MODE "led-mode"
+#define DT_PROPERTY_LED_TYPE "led-types"
+#define DT_PROPERTY_LED_LOCATION "led-loc"
+
#endif
diff --git a/include/opal.h b/include/opal.h
index 622e1d5..41a47bf 100644
--- a/include/opal.h
+++ b/include/opal.h
@@ -379,6 +379,19 @@ enum OpalPciMaskAction {
OPAL_MASK_ERROR_TYPE = 1
};
+/* LED Mode */
+#define LED_MODE_LIGHT_PATH "lightpath"
+#define LED_MODE_GUIDING_LIGHT "guidinglight"
+
+/* LED type */
+#define LED_TYPE_IDENTIFY "identify"
+#define LED_TYPE_FAULT "fault"
+#define LED_TYPE_ATTENTION "attention"
+
+/* LED location */
+#define LED_LOC_ENCLOSURE "enclosure"
+#define LED_LOC_DESCENDENT "descendent"
+
enum OpalSlotLedType {
OPAL_SLOT_LED_TYPE_ID = 0, /* IDENTIFY LED */
OPAL_SLOT_LED_TYPE_FAULT = 1, /* FAULT LED */
More information about the Skiboot
mailing list