firmware.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * pSeries firmware setup code.
  3. *
  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
  9. *
  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
  15. *
  16. * Copyright 2006 IBM Corporation.
  17. *
  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.
  22. */
  23. #include <asm/firmware.h>
  24. #include <asm/prom.h>
  25. #include <asm/udbg.h>
  26. #include "pseries.h"
  27. typedef struct {
  28. unsigned long val;
  29. char * name;
  30. } firmware_feature_t;
  31. static __initdata firmware_feature_t
  32. firmware_features_table[FIRMWARE_MAX_FEATURES] = {
  33. {FW_FEATURE_PFT, "hcall-pft"},
  34. {FW_FEATURE_TCE, "hcall-tce"},
  35. {FW_FEATURE_SPRG0, "hcall-sprg0"},
  36. {FW_FEATURE_DABR, "hcall-dabr"},
  37. {FW_FEATURE_COPY, "hcall-copy"},
  38. {FW_FEATURE_ASR, "hcall-asr"},
  39. {FW_FEATURE_DEBUG, "hcall-debug"},
  40. {FW_FEATURE_PERF, "hcall-perf"},
  41. {FW_FEATURE_DUMP, "hcall-dump"},
  42. {FW_FEATURE_INTERRUPT, "hcall-interrupt"},
  43. {FW_FEATURE_MIGRATE, "hcall-migrate"},
  44. {FW_FEATURE_PERFMON, "hcall-perfmon"},
  45. {FW_FEATURE_CRQ, "hcall-crq"},
  46. {FW_FEATURE_VIO, "hcall-vio"},
  47. {FW_FEATURE_RDMA, "hcall-rdma"},
  48. {FW_FEATURE_LLAN, "hcall-lLAN"},
  49. {FW_FEATURE_BULK_REMOVE, "hcall-bulk"},
  50. {FW_FEATURE_XDABR, "hcall-xdabr"},
  51. {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
  52. {FW_FEATURE_SPLPAR, "hcall-splpar"},
  53. {FW_FEATURE_VPHN, "hcall-vphn"},
  54. };
  55. /* Build up the firmware features bitmask using the contents of
  56. * device-tree/ibm,hypertas-functions. Ultimately this functionality may
  57. * be moved into prom.c prom_init().
  58. */
  59. void __init fw_feature_init(const char *hypertas, unsigned long len)
  60. {
  61. const char *s;
  62. int i;
  63. pr_debug(" -> fw_feature_init()\n");
  64. for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
  65. for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
  66. /* check value against table of strings */
  67. if (!firmware_features_table[i].name ||
  68. strcmp(firmware_features_table[i].name, s))
  69. continue;
  70. /* we have a match */
  71. powerpc_firmware_features |=
  72. firmware_features_table[i].val;
  73. break;
  74. }
  75. }
  76. pr_debug(" <- fw_feature_init()\n");
  77. }