diff options
Diffstat (limited to 'arch/powerpc/platforms/pseries/firmware.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/firmware.c | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c index aa3693f7fb27..8c80588abacc 100644 --- a/arch/powerpc/platforms/pseries/firmware.c +++ b/arch/powerpc/platforms/pseries/firmware.c | |||
@@ -28,18 +28,18 @@ | |||
28 | 28 | ||
29 | #include "pseries.h" | 29 | #include "pseries.h" |
30 | 30 | ||
31 | typedef struct { | 31 | struct hypertas_fw_feature { |
32 | unsigned long val; | 32 | unsigned long val; |
33 | char * name; | 33 | char * name; |
34 | } firmware_feature_t; | 34 | }; |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * The names in this table match names in rtas/ibm,hypertas-functions. If the | 37 | * The names in this table match names in rtas/ibm,hypertas-functions. If the |
38 | * entry ends in a '*', only upto the '*' is matched. Otherwise the entire | 38 | * entry ends in a '*', only upto the '*' is matched. Otherwise the entire |
39 | * string must match. | 39 | * string must match. |
40 | */ | 40 | */ |
41 | static __initdata firmware_feature_t | 41 | static __initdata struct hypertas_fw_feature |
42 | firmware_features_table[FIRMWARE_MAX_FEATURES] = { | 42 | hypertas_fw_features_table[] = { |
43 | {FW_FEATURE_PFT, "hcall-pft"}, | 43 | {FW_FEATURE_PFT, "hcall-pft"}, |
44 | {FW_FEATURE_TCE, "hcall-tce"}, | 44 | {FW_FEATURE_TCE, "hcall-tce"}, |
45 | {FW_FEATURE_SPRG0, "hcall-sprg0"}, | 45 | {FW_FEATURE_SPRG0, "hcall-sprg0"}, |
@@ -69,20 +69,18 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = { | |||
69 | * device-tree/ibm,hypertas-functions. Ultimately this functionality may | 69 | * device-tree/ibm,hypertas-functions. Ultimately this functionality may |
70 | * be moved into prom.c prom_init(). | 70 | * be moved into prom.c prom_init(). |
71 | */ | 71 | */ |
72 | void __init fw_feature_init(const char *hypertas, unsigned long len) | 72 | void __init fw_hypertas_feature_init(const char *hypertas, unsigned long len) |
73 | { | 73 | { |
74 | const char *s; | 74 | const char *s; |
75 | int i; | 75 | int i; |
76 | 76 | ||
77 | pr_debug(" -> fw_feature_init()\n"); | 77 | pr_debug(" -> fw_hypertas_feature_init()\n"); |
78 | 78 | ||
79 | for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { | 79 | for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { |
80 | for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) { | 80 | for (i = 0; i < ARRAY_SIZE(hypertas_fw_features_table); i++) { |
81 | const char *name = firmware_features_table[i].name; | 81 | const char *name = hypertas_fw_features_table[i].name; |
82 | size_t size; | 82 | size_t size; |
83 | /* check value against table of strings */ | 83 | |
84 | if (!name) | ||
85 | continue; | ||
86 | /* | 84 | /* |
87 | * If there is a '*' at the end of name, only check | 85 | * If there is a '*' at the end of name, only check |
88 | * upto there | 86 | * upto there |
@@ -96,10 +94,40 @@ void __init fw_feature_init(const char *hypertas, unsigned long len) | |||
96 | 94 | ||
97 | /* we have a match */ | 95 | /* we have a match */ |
98 | powerpc_firmware_features |= | 96 | powerpc_firmware_features |= |
99 | firmware_features_table[i].val; | 97 | hypertas_fw_features_table[i].val; |
100 | break; | 98 | break; |
101 | } | 99 | } |
102 | } | 100 | } |
103 | 101 | ||
104 | pr_debug(" <- fw_feature_init()\n"); | 102 | pr_debug(" <- fw_hypertas_feature_init()\n"); |
103 | } | ||
104 | |||
105 | struct vec5_fw_feature { | ||
106 | unsigned long val; | ||
107 | unsigned int feature; | ||
108 | }; | ||
109 | |||
110 | static __initdata struct vec5_fw_feature | ||
111 | vec5_fw_features_table[] = { | ||
112 | {FW_FEATURE_TYPE1_AFFINITY, OV5_TYPE1_AFFINITY}, | ||
113 | {FW_FEATURE_PRRN, OV5_PRRN}, | ||
114 | }; | ||
115 | |||
116 | void __init fw_vec5_feature_init(const char *vec5, unsigned long len) | ||
117 | { | ||
118 | unsigned int index, feat; | ||
119 | int i; | ||
120 | |||
121 | pr_debug(" -> fw_vec5_feature_init()\n"); | ||
122 | |||
123 | for (i = 0; i < ARRAY_SIZE(vec5_fw_features_table); i++) { | ||
124 | index = OV5_INDX(vec5_fw_features_table[i].feature); | ||
125 | feat = OV5_FEAT(vec5_fw_features_table[i].feature); | ||
126 | |||
127 | if (vec5[index] & feat) | ||
128 | powerpc_firmware_features |= | ||
129 | vec5_fw_features_table[i].val; | ||
130 | } | ||
131 | |||
132 | pr_debug(" <- fw_vec5_feature_init()\n"); | ||
105 | } | 133 | } |