prefetch.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2003 by Ralf Baechle
  7. */
  8. #ifndef __ASM_PREFETCH_H
  9. #define __ASM_PREFETCH_H
  10. /*
  11. * R5000 and RM5200 implements pref and prefx instructions but they're nops, so
  12. * rather than wasting time we pretend these processors don't support
  13. * prefetching at all.
  14. *
  15. * R5432 implements Load, Store, LoadStreamed, StoreStreamed, LoadRetained,
  16. * StoreRetained and WriteBackInvalidate but not Pref_PrepareForStore.
  17. *
  18. * Hell (and the book on my shelf I can't open ...) know what the R8000 does.
  19. *
  20. * RM7000 version 1.0 interprets all hints as Pref_Load; version 2.0 implements
  21. * Pref_PrepareForStore also.
  22. *
  23. * RM9000 is MIPS IV but implements prefetching like MIPS32/MIPS64; it's
  24. * Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in
  25. * current versions due to erratum G105.
  26. *
  27. * VR5500 (including VR5701 and VR7701) only implement load prefetch.
  28. *
  29. * Finally MIPS32 and MIPS64 implement all of the following hints.
  30. */
  31. #define Pref_Load 0
  32. #define Pref_Store 1
  33. /* 2 and 3 are reserved */
  34. #define Pref_LoadStreamed 4
  35. #define Pref_StoreStreamed 5
  36. #define Pref_LoadRetained 6
  37. #define Pref_StoreRetained 7
  38. /* 8 ... 24 are reserved */
  39. #define Pref_WriteBackInvalidate 25
  40. #define Pref_PrepareForStore 30
  41. #ifdef __ASSEMBLY__
  42. .macro __pref hint addr
  43. #ifdef CONFIG_CPU_HAS_PREFETCH
  44. pref \hint, \addr
  45. #endif
  46. .endm
  47. .macro pref_load addr
  48. __pref Pref_Load, \addr
  49. .endm
  50. .macro pref_store addr
  51. __pref Pref_Store, \addr
  52. .endm
  53. .macro pref_load_streamed addr
  54. __pref Pref_LoadStreamed, \addr
  55. .endm
  56. .macro pref_store_streamed addr
  57. __pref Pref_StoreStreamed, \addr
  58. .endm
  59. .macro pref_load_retained addr
  60. __pref Pref_LoadRetained, \addr
  61. .endm
  62. .macro pref_store_retained addr
  63. __pref Pref_StoreRetained, \addr
  64. .endm
  65. .macro pref_wback_inv addr
  66. __pref Pref_WriteBackInvalidate, \addr
  67. .endm
  68. .macro pref_prepare_for_store addr
  69. __pref Pref_PrepareForStore, \addr
  70. .endm
  71. #endif
  72. #endif /* __ASM_PREFETCH_H */