1 /*
2  * CPUMF HW sampler functions and internal structures
3  *
4  *    Copyright IBM Corp. 2010
5  *    Author(s): Heinz Graalfs <graalfs@de.ibm.com>
6  */
7 
8 #ifndef HWSAMPLER_H_
9 #define HWSAMPLER_H_
10 
11 #include <linux/workqueue.h>
12 #include <asm/cpu_mf.h>
13 
14 struct hws_ssctl_request_block     /* SET SAMPLING CONTROLS req block   */
15 { /* bytes 0 - 7  Bit(s) */
16 	unsigned int s:1;           /* 0: maximum buffer indicator       */
17 	unsigned int h:1;           /* 1: part. level reserved for VM use*/
18 	unsigned long b2_53:52;     /* 2-53: zeros                       */
19 	unsigned int es:1;          /* 54: sampling enable control       */
20 	unsigned int b55_61:7;      /* 55-61: - zeros                    */
21 	unsigned int cs:1;          /* 62: sampling activation control   */
22 	unsigned int b63:1;         /* 63: zero                          */
23 	unsigned long interval;     /* 8-15: sampling interval           */
24 	unsigned long tear;         /* 16-23: TEAR contents              */
25 	unsigned long dear;         /* 24-31: DEAR contents              */
26 	/* 32-63:                                                        */
27 	unsigned long rsvrd1;       /* reserved                          */
28 	unsigned long rsvrd2;       /* reserved                          */
29 	unsigned long rsvrd3;       /* reserved                          */
30 	unsigned long rsvrd4;       /* reserved                          */
31 };
32 
33 struct hws_cpu_buffer {
34 	unsigned long first_sdbt;       /* @ of 1st SDB-Table for this CP*/
35 	unsigned long worker_entry;
36 	unsigned long sample_overflow;  /* taken from SDB ...            */
37 	struct hws_qsi_info_block qsi;
38 	struct hws_ssctl_request_block ssctl;
39 	struct work_struct worker;
40 	atomic_t ext_params;
41 	unsigned long req_alert;
42 	unsigned long loss_of_sample_data;
43 	unsigned long invalid_entry_address;
44 	unsigned long incorrect_sdbt_entry;
45 	unsigned long sample_auth_change_alert;
46 	unsigned int finish:1;
47 	unsigned int oom:1;
48 	unsigned int stop_mode:1;
49 };
50 
51 int hwsampler_setup(void);
52 int hwsampler_shutdown(void);
53 int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
54 int hwsampler_deallocate(void);
55 unsigned long hwsampler_query_min_interval(void);
56 unsigned long hwsampler_query_max_interval(void);
57 int hwsampler_start_all(unsigned long interval);
58 int hwsampler_stop_all(void);
59 int hwsampler_deactivate(unsigned int cpu);
60 int hwsampler_activate(unsigned int cpu);
61 unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu);
62 
63 #endif /*HWSAMPLER_H_*/
64