Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / arch / powerpc / platforms / pseries / firmware.c
blobb765b7c77b65ddacdeb806ce10904d6e5697ea42
1 /*
2 * pSeries firmware setup code.
4 * Portions from arch/powerpc/platforms/pseries/setup.c:
5 * Copyright (C) 1995 Linus Torvalds
6 * Adapted from 'alpha' version by Gary Thomas
7 * Modified by Cort Dougan (cort@cs.nmt.edu)
8 * Modified by PPC64 Team, IBM Corp
10 * Portions from arch/powerpc/kernel/firmware.c
11 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
12 * Modifications for ppc64:
13 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
14 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
16 * Copyright 2006 IBM Corporation.
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
24 #undef DEBUG
26 #include <asm/firmware.h>
27 #include <asm/prom.h>
28 #include <asm/udbg.h>
30 #ifdef DEBUG
31 #define DBG(fmt...) udbg_printf(fmt)
32 #else
33 #define DBG(fmt...)
34 #endif
36 typedef struct {
37 unsigned long val;
38 char * name;
39 } firmware_feature_t;
41 static __initdata firmware_feature_t
42 firmware_features_table[FIRMWARE_MAX_FEATURES] = {
43 {FW_FEATURE_PFT, "hcall-pft"},
44 {FW_FEATURE_TCE, "hcall-tce"},
45 {FW_FEATURE_SPRG0, "hcall-sprg0"},
46 {FW_FEATURE_DABR, "hcall-dabr"},
47 {FW_FEATURE_COPY, "hcall-copy"},
48 {FW_FEATURE_ASR, "hcall-asr"},
49 {FW_FEATURE_DEBUG, "hcall-debug"},
50 {FW_FEATURE_PERF, "hcall-perf"},
51 {FW_FEATURE_DUMP, "hcall-dump"},
52 {FW_FEATURE_INTERRUPT, "hcall-interrupt"},
53 {FW_FEATURE_MIGRATE, "hcall-migrate"},
54 {FW_FEATURE_PERFMON, "hcall-perfmon"},
55 {FW_FEATURE_CRQ, "hcall-crq"},
56 {FW_FEATURE_VIO, "hcall-vio"},
57 {FW_FEATURE_RDMA, "hcall-rdma"},
58 {FW_FEATURE_LLAN, "hcall-lLAN"},
59 {FW_FEATURE_BULK, "hcall-bulk"},
60 {FW_FEATURE_XDABR, "hcall-xdabr"},
61 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
62 {FW_FEATURE_SPLPAR, "hcall-splpar"},
63 {FW_FEATURE_BULK_REMOVE, "hcall-bulk"},
66 /* Build up the firmware features bitmask using the contents of
67 * device-tree/ibm,hypertas-functions. Ultimately this functionality may
68 * be moved into prom.c prom_init().
70 void __init fw_feature_init(const char *hypertas, unsigned long len)
72 const char *s;
73 int i;
75 DBG(" -> fw_feature_init()\n");
77 for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
78 for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
79 /* check value against table of strings */
80 if (!firmware_features_table[i].name ||
81 strcmp(firmware_features_table[i].name, s))
82 continue;
84 /* we have a match */
85 powerpc_firmware_features |=
86 firmware_features_table[i].val;
87 break;
91 DBG(" <- fw_feature_init()\n");