Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356340
b: refs/heads/master
c: 0388c79
h: refs/heads/master
v: v3
  • Loading branch information
Michael Neuling authored and Benjamin Herrenschmidt committed Jan 10, 2013
1 parent f50d736 commit 801e190
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2f1d4ea7bcd96d3796eba4087388bdb37322ee7a
refs/heads/master: 0388c79c99ccb43f711af57d2e14fcd6a5f45a06
3 changes: 2 additions & 1 deletion trunk/arch/powerpc/include/asm/firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#define FW_FEATURE_OPAL ASM_CONST(0x0000000010000000)
#define FW_FEATURE_OPALv2 ASM_CONST(0x0000000020000000)
#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000)
#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000)

#ifndef __ASSEMBLY__

Expand All @@ -64,7 +65,7 @@ enum {
FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR |
FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO |
FW_FEATURE_SET_MODE,
FW_FEATURE_SET_MODE | FW_FEATURE_BEST_ENERGY,
FW_FEATURE_PSERIES_ALWAYS = 0,
FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2,
FW_FEATURE_POWERNV_ALWAYS = 0,
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/powerpc/platforms/pseries/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
{FW_FEATURE_SPLPAR, "hcall-splpar"},
{FW_FEATURE_VPHN, "hcall-vphn"},
{FW_FEATURE_SET_MODE, "hcall-set-mode"},
{FW_FEATURE_BEST_ENERGY, "hcall-best-energy-1*"},
};

/* Build up the firmware features bitmask using the contents of
Expand Down
37 changes: 2 additions & 35 deletions trunk/arch/powerpc/platforms/pseries/pseries_energy.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <asm/cputhreads.h>
#include <asm/page.h>
#include <asm/hvcall.h>
#include <asm/firmware.h>


#define MODULE_VERS "1.0"
Expand All @@ -32,40 +33,6 @@ static int sysfs_entries;

/* Helper routines */

/*
* Routine to detect firmware support for hcall
* return 1 if H_BEST_ENERGY is supported
* else return 0
*/

static int check_for_h_best_energy(void)
{
struct device_node *rtas = NULL;
const char *hypertas, *s;
int length;
int rc = 0;

rtas = of_find_node_by_path("/rtas");
if (!rtas)
return 0;

hypertas = of_get_property(rtas, "ibm,hypertas-functions", &length);
if (!hypertas) {
of_node_put(rtas);
return 0;
}

/* hypertas will have list of strings with hcall names */
for (s = hypertas; s < hypertas + length; s += strlen(s) + 1) {
if (!strncmp("hcall-best-energy-1", s, 19)) {
rc = 1; /* Found the string */
break;
}
}
of_node_put(rtas);
return rc;
}

/* Helper Routines to convert between drc_index to cpu numbers */

static u32 cpu_to_drc_index(int cpu)
Expand Down Expand Up @@ -262,7 +229,7 @@ static int __init pseries_energy_init(void)
int cpu, err;
struct device *cpu_dev;

if (!check_for_h_best_energy()) {
if (!firmware_has_feature(FW_FEATURE_BEST_ENERGY)) {
printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n");
return 0;
}
Expand Down

0 comments on commit 801e190

Please sign in to comment.