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
7 * Copyright (C) 1992 - 1997, 2000-2001 Silicon Graphics, Inc. All rights reserved.
9 #ifndef _ASM_IA64_SN_SN1_HWCNTRS_H
10 #define _ASM_IA64_SN_SN1_HWCNTRS_H
13 typedef uint64_t refcnt_t;
15 #define SN0_REFCNT_MAX_COUNTERS 64
17 typedef struct sn0_refcnt_set {
18 refcnt_t refcnt[SN0_REFCNT_MAX_COUNTERS];
23 typedef struct sn0_refcnt_buf {
24 sn0_refcnt_set_t refcnt_set;
27 cnodeid_t cnodeid; /* cnodeid + pad[3] use 64 bits */
32 typedef struct sn0_refcnt_args {
35 sn0_refcnt_buf_t* buf;
40 * Info needed by the user level program
41 * to mmap the refcnt buffer
44 #define RCB_INFO_GET 1
45 #define RCB_SLOT_GET 2
47 typedef struct rcb_info {
48 uint64_t rcb_len; /* total refcnt buffer len in bytes */
50 int rcb_sw_sets; /* number of sw counter sets in buffer */
51 int rcb_sw_counters_per_set; /* sw counters per set -- num_compact_nodes */
52 int rcb_sw_counter_size; /* sizeof(refcnt_t) -- size of sw cntr */
54 int rcb_base_pages; /* number of base pages in node */
55 int rcb_base_page_size; /* sw base page size */
56 uint64_t rcb_base_paddr; /* base physical address for this node */
58 int rcb_cnodeid; /* cnodeid for this node */
59 int rcb_granularity; /* hw page size used for counter sets */
60 uint rcb_hw_counter_max; /* max hwcounter count (width mask) */
61 int rcb_diff_threshold; /* current node differential threshold */
62 int rcb_abs_threshold; /* current node absolute threshold */
63 int rcb_num_slots; /* physmem slots */
65 int rcb_reserved[512];
69 typedef struct rcb_slot {
74 #if defined(__KERNEL__)
75 typedef struct sn0_refcnt_args_32 {
80 } sn0_refcnt_args_32_t;
82 /* Defines and Macros */
83 /* A set of reference counts are for 4k bytes of physical memory */
84 #define NBPREFCNTP 0x1000
85 #define BPREFCNTPSHIFT 12
86 #define bytes_to_refcntpages(x) (((__psunsigned_t)(x)+(NBPREFCNTP-1))>>BPREFCNTPSHIFT)
87 #define refcntpage_offset(x) ((__psunsigned_t)(x)&((NBPP-1)&~(NBPREFCNTP-1)))
88 #define align_to_refcntpage(x) ((__psunsigned_t)(x)&(~(NBPREFCNTP-1)))
90 extern void migr_refcnt_read(sn0_refcnt_buf_t*);
91 extern void migr_refcnt_read_extended(sn0_refcnt_buf_t*);
92 extern int migr_refcnt_enabled(void);
94 #endif /* __KERNEL__ */
96 #endif /* _ASM_IA64_SN_SN1_HWCNTRS_H */