xor_64.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * include/asm/xor.h
  3. *
  4. * High speed xor_block operation for RAID4/5 utilizing the
  5. * UltraSparc Visual Instruction Set and Niagara block-init
  6. * twin-load instructions.
  7. *
  8. * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
  9. * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2, or (at your option)
  14. * any later version.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * (for example /usr/src/linux/COPYING); if not, write to the Free
  18. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20. #include <asm/spitfire.h>
  21. void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
  22. void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
  23. unsigned long *);
  24. void xor_vis_4(unsigned long, unsigned long *, unsigned long *,
  25. unsigned long *, unsigned long *);
  26. void xor_vis_5(unsigned long, unsigned long *, unsigned long *,
  27. unsigned long *, unsigned long *, unsigned long *);
  28. /* XXX Ugh, write cheetah versions... -DaveM */
  29. static struct xor_block_template xor_block_VIS = {
  30. .name = "VIS",
  31. .do_2 = xor_vis_2,
  32. .do_3 = xor_vis_3,
  33. .do_4 = xor_vis_4,
  34. .do_5 = xor_vis_5,
  35. };
  36. void xor_niagara_2(unsigned long, unsigned long *, unsigned long *);
  37. void xor_niagara_3(unsigned long, unsigned long *, unsigned long *,
  38. unsigned long *);
  39. void xor_niagara_4(unsigned long, unsigned long *, unsigned long *,
  40. unsigned long *, unsigned long *);
  41. void xor_niagara_5(unsigned long, unsigned long *, unsigned long *,
  42. unsigned long *, unsigned long *, unsigned long *);
  43. static struct xor_block_template xor_block_niagara = {
  44. .name = "Niagara",
  45. .do_2 = xor_niagara_2,
  46. .do_3 = xor_niagara_3,
  47. .do_4 = xor_niagara_4,
  48. .do_5 = xor_niagara_5,
  49. };
  50. #undef XOR_TRY_TEMPLATES
  51. #define XOR_TRY_TEMPLATES \
  52. do { \
  53. xor_speed(&xor_block_VIS); \
  54. xor_speed(&xor_block_niagara); \
  55. } while (0)
  56. /* For VIS for everything except Niagara. */
  57. #define XOR_SELECT_TEMPLATE(FASTEST) \
  58. ((tlb_type == hypervisor && \
  59. (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
  60. sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \
  61. sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || \
  62. sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || \
  63. sun4v_chip_type == SUN4V_CHIP_NIAGARA5)) ? \
  64. &xor_block_niagara : \
  65. &xor_block_VIS)