2.5.70 update
[linux-flexiantxendom0-3.2.10.git] / include / asm-ia64 / sn / sn1 / hwcntrs.h
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
12
13 typedef  uint64_t refcnt_t;
14
15 #define SN0_REFCNT_MAX_COUNTERS 64
16
17 typedef struct sn0_refcnt_set {
18         refcnt_t    refcnt[SN0_REFCNT_MAX_COUNTERS];
19         uint64_t  flags;
20         uint64_t  reserved[4];
21 } sn0_refcnt_set_t;
22
23 typedef struct sn0_refcnt_buf {
24         sn0_refcnt_set_t   refcnt_set;
25         uint64_t         paddr;
26         uint64_t         page_size;
27         cnodeid_t          cnodeid;         /* cnodeid + pad[3] use 64 bits */
28         uint16_t           pad[3];
29         uint64_t         reserved[4];
30 } sn0_refcnt_buf_t;
31
32 typedef struct sn0_refcnt_args {
33         uint64_t          vaddr;
34         uint64_t          len;
35         sn0_refcnt_buf_t*   buf;
36         uint64_t          reserved[4];
37 } sn0_refcnt_args_t;
38
39 /*
40  * Info needed by the user level program
41  * to mmap the refcnt buffer
42  */
43
44 #define RCB_INFO_GET  1
45 #define RCB_SLOT_GET  2
46
47 typedef struct rcb_info {
48         uint64_t  rcb_len;                  /* total refcnt buffer len in bytes */
49
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 */
53
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 */
57
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 */
64         
65         int         rcb_reserved[512];
66         
67 } rcb_info_t;
68
69 typedef struct rcb_slot {
70         uint64_t  base;
71         uint64_t  size;
72 } rcb_slot_t;
73
74 #if defined(__KERNEL__)
75 typedef struct sn0_refcnt_args_32 {
76         uint64_t    vaddr;
77         uint64_t    len;
78         app32_ptr_t   buf;
79         uint64_t    reserved[4];
80 } sn0_refcnt_args_32_t;
81
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)))
89
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);
93
94 #endif /* __KERNEL__ */
95
96 #endif /* _ASM_IA64_SN_SN1_HWCNTRS_H */