aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/firmware.c
diff options
context:
space:
mode:
authorNathan Fontenot <nfont@linux.vnet.ibm.com>2013-04-24 01:57:18 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-04-26 02:08:22 -0400
commitf0ff7eb483b4c9b24b83aa682c4f42db256f9bdb (patch)
treed1733adf54ac7c44fa5d2dbb7107e2133c3f2c45 /arch/powerpc/platforms/pseries/firmware.c
parent43c0ea60537d9423f0f1b5c14b0cd0a0b4af5c81 (diff)
powerpc/pseries: Update firmware_has_feature() to check architecture vector 5 bits
The firmware_has_feature() function makes it easy to check for supported features of the hypervisor. This patch extends the capability of firmware_has_feature() to include checking for specified bits in vector 5 of the architecture vector as reported in the device tree. As part of this the #defines used for the architecture vector are re-defined such that each option has the index into vector 5 and the feature bit encoded into it. This makes checking for architecture bits when initiating data for firmware_has_feature much easier. Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/pseries/firmware.c')
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 1236a9d6146a..06639fa2d61d 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
31typedef struct { 31struct 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 */
41static __initdata firmware_feature_t 41static __initdata struct hypertas_fw_feature
42firmware_features_table[] = { 42hypertas_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,16 +69,16 @@ firmware_features_table[] = {
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 */
72void __init fw_feature_init(const char *hypertas, unsigned long len) 72void __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 < ARRAY_SIZE(firmware_features_table); 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 83
84 /* 84 /*
@@ -94,10 +94,39 @@ void __init fw_feature_init(const char *hypertas, unsigned long len)
94 94
95 /* we have a match */ 95 /* we have a match */
96 powerpc_firmware_features |= 96 powerpc_firmware_features |=
97 firmware_features_table[i].val; 97 hypertas_fw_features_table[i].val;
98 break; 98 break;
99 } 99 }
100 } 100 }
101 101
102 pr_debug(" <- fw_feature_init()\n"); 102 pr_debug(" <- fw_hypertas_feature_init()\n");
103}
104
105struct vec5_fw_feature {
106 unsigned long val;
107 unsigned int feature;
108};
109
110static __initdata struct vec5_fw_feature
111vec5_fw_features_table[] = {
112 {FW_FEATURE_TYPE1_AFFINITY, OV5_TYPE1_AFFINITY},
113};
114
115void __init fw_vec5_feature_init(const char *vec5, unsigned long len)
116{
117 unsigned int index, feat;
118 int i;
119
120 pr_debug(" -> fw_vec5_feature_init()\n");
121
122 for (i = 0; i < ARRAY_SIZE(vec5_fw_features_table); i++) {
123 index = OV5_INDX(vec5_fw_features_table[i].feature);
124 feat = OV5_FEAT(vec5_fw_features_table[i].feature);
125
126 if (vec5[index] & feat)
127 powerpc_firmware_features |=
128 vec5_fw_features_table[i].val;
129 }
130
131 pr_debug(" <- fw_vec5_feature_init()\n");
103} 132}