Merge branch 'bugzilla-21212' into release
[firefly-linux-kernel-4.4.55.git] / arch / mips / include / asm / mach-bcm47xx / nvram.h
index 0d8cc146f7a4dbb315f57a9353502e28bc556a1f..9759588ba3cff0c81da6cd454148a6787e4babcf 100644 (file)
@@ -12,6 +12,7 @@
 #define __NVRAM_H
 
 #include <linux/types.h>
+#include <linux/kernel.h>
 
 struct nvram_header {
        u32 magic;
@@ -31,6 +32,15 @@ struct nvram_header {
 #define NVRAM_MAX_VALUE_LEN 255
 #define NVRAM_MAX_PARAM_LEN 64
 
+#define NVRAM_ERR_INV_PARAM    -8
+#define NVRAM_ERR_ENVNOTFOUND  -9
+
 extern int nvram_getenv(char *name, char *val, size_t val_len);
 
+static inline void nvram_parse_macaddr(char *buf, u8 *macaddr)
+{
+       sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],
+              &macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
+}
+
 #endif