fetchop.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. *
  3. * This file is subject to the terms and conditions of the GNU General Public
  4. * License. See the file "COPYING" in the main directory of this archive
  5. * for more details.
  6. *
  7. * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved.
  8. */
  9. #ifndef _ASM_IA64_SN_FETCHOP_H
  10. #define _ASM_IA64_SN_FETCHOP_H
  11. #include <linux/config.h>
  12. #define FETCHOP_BASENAME "sgi_fetchop"
  13. #define FETCHOP_FULLNAME "/dev/sgi_fetchop"
  14. #define FETCHOP_VAR_SIZE 64 /* 64 byte per fetchop variable */
  15. #define FETCHOP_LOAD 0
  16. #define FETCHOP_INCREMENT 8
  17. #define FETCHOP_DECREMENT 16
  18. #define FETCHOP_CLEAR 24
  19. #define FETCHOP_STORE 0
  20. #define FETCHOP_AND 24
  21. #define FETCHOP_OR 32
  22. #define FETCHOP_CLEAR_CACHE 56
  23. #define FETCHOP_LOAD_OP(addr, op) ( \
  24. *(volatile long *)((char*) (addr) + (op)))
  25. #define FETCHOP_STORE_OP(addr, op, x) ( \
  26. *(volatile long *)((char*) (addr) + (op)) = (long) (x))
  27. #ifdef __KERNEL__
  28. /*
  29. * Convert a region 6 (kaddr) address to the address of the fetchop variable
  30. */
  31. #define FETCHOP_KADDR_TO_MSPEC_ADDR(kaddr) TO_MSPEC(kaddr)
  32. /*
  33. * Each Atomic Memory Operation (AMO formerly known as fetchop)
  34. * variable is 64 bytes long. The first 8 bytes are used. The
  35. * remaining 56 bytes are unaddressable due to the operation taking
  36. * that portion of the address.
  37. *
  38. * NOTE: The AMO_t _MUST_ be placed in either the first or second half
  39. * of the cache line. The cache line _MUST NOT_ be used for anything
  40. * other than additional AMO_t entries. This is because there are two
  41. * addresses which reference the same physical cache line. One will
  42. * be a cached entry with the memory type bits all set. This address
  43. * may be loaded into processor cache. The AMO_t will be referenced
  44. * uncached via the memory special memory type. If any portion of the
  45. * cached cache-line is modified, when that line is flushed, it will
  46. * overwrite the uncached value in physical memory and lead to
  47. * inconsistency.
  48. */
  49. typedef struct {
  50. u64 variable;
  51. u64 unused[7];
  52. } AMO_t;
  53. /*
  54. * The following APIs are externalized to the kernel to allocate/free pages of
  55. * fetchop variables.
  56. * fetchop_kalloc_page - Allocate/initialize 1 fetchop page on the
  57. * specified cnode.
  58. * fetchop_kfree_page - Free a previously allocated fetchop page
  59. */
  60. unsigned long fetchop_kalloc_page(int nid);
  61. void fetchop_kfree_page(unsigned long maddr);
  62. #endif /* __KERNEL__ */
  63. #endif /* _ASM_IA64_SN_FETCHOP_H */