hwcntrs.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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) 1992 - 1997, 2000-2001 Silicon Graphics, Inc. All rights reserved.
  8.  */
  9. #ifndef _ASM_IA64_SN_SN1_HWCNTRS_H
  10. #define _ASM_IA64_SN_SN1_HWCNTRS_H
  11. typedef  uint64_t refcnt_t;
  12. #define SN0_REFCNT_MAX_COUNTERS 64
  13. typedef struct sn0_refcnt_set {
  14. refcnt_t    refcnt[SN0_REFCNT_MAX_COUNTERS];
  15.         uint64_t  flags;
  16.         uint64_t  reserved[4];
  17. } sn0_refcnt_set_t;
  18. typedef struct sn0_refcnt_buf {
  19. sn0_refcnt_set_t   refcnt_set;
  20. uint64_t         paddr;
  21.         uint64_t         page_size;
  22.         cnodeid_t          cnodeid;         /* cnodeid + pad[3] use 64 bits */
  23.         uint16_t           pad[3];
  24.         uint64_t         reserved[4];
  25. } sn0_refcnt_buf_t;
  26. typedef struct sn0_refcnt_args {
  27. uint64_t          vaddr;
  28. uint64_t          len;
  29. sn0_refcnt_buf_t*   buf;
  30.         uint64_t          reserved[4];
  31. } sn0_refcnt_args_t;
  32. /*
  33.  * Info needed by the user level program
  34.  * to mmap the refcnt buffer
  35.  */
  36. #define RCB_INFO_GET  1
  37. #define RCB_SLOT_GET  2
  38. typedef struct rcb_info {
  39.         uint64_t  rcb_len;                  /* total refcnt buffer len in bytes */
  40.         int         rcb_sw_sets;              /* number of sw counter sets in buffer */
  41.         int         rcb_sw_counters_per_set;  /* sw counters per set -- num_compact_nodes */
  42.         int         rcb_sw_counter_size;      /* sizeof(refcnt_t) -- size of sw cntr */
  43.         int         rcb_base_pages;           /* number of base pages in node */
  44.         int         rcb_base_page_size;       /* sw base page size */        
  45.         uint64_t  rcb_base_paddr;           /* base physical address for this node */
  46.         int         rcb_cnodeid;              /* cnodeid for this node */
  47.         int         rcb_granularity;          /* hw page size used for counter sets */
  48.         uint        rcb_hw_counter_max;       /* max hwcounter count (width mask) */
  49.         int         rcb_diff_threshold;       /* current node differential threshold */
  50.         int         rcb_abs_threshold;        /* current node absolute threshold */
  51.         int         rcb_num_slots;            /* physmem slots */
  52.         
  53.         int         rcb_reserved[512];
  54.         
  55. } rcb_info_t;
  56. typedef struct rcb_slot {
  57.         uint64_t  base;
  58.         uint64_t  size;
  59. } rcb_slot_t;
  60. #if defined(__KERNEL__)
  61. typedef struct sn0_refcnt_args_32 {
  62. uint64_t    vaddr;
  63. uint64_t    len;
  64. app32_ptr_t   buf;
  65.         uint64_t    reserved[4];
  66. } sn0_refcnt_args_32_t;
  67. /* Defines and Macros  */
  68. /* A set of reference counts are for 4k bytes of physical memory */
  69. #define NBPREFCNTP 0x1000
  70. #define BPREFCNTPSHIFT 12
  71. #define bytes_to_refcntpages(x) (((__psunsigned_t)(x)+(NBPREFCNTP-1))>>BPREFCNTPSHIFT)
  72. #define refcntpage_offset(x) ((__psunsigned_t)(x)&((NBPP-1)&~(NBPREFCNTP-1)))
  73. #define align_to_refcntpage(x) ((__psunsigned_t)(x)&(~(NBPREFCNTP-1)))
  74. extern void migr_refcnt_read(sn0_refcnt_buf_t*);
  75. extern void migr_refcnt_read_extended(sn0_refcnt_buf_t*);
  76. extern int migr_refcnt_enabled(void);
  77. #endif /* __KERNEL__ */
  78. #endif /* _ASM_IA64_SN_SN1_HWCNTRS_H */