Pekka Paalanen | 8b7d89d | 2008-05-12 21:20:56 +0200 | [diff] [blame] | 1 | #ifndef MMIOTRACE_H |
| 2 | #define MMIOTRACE_H |
| 3 | |
| 4 | #include <asm/types.h> |
| 5 | |
| 6 | #define MMIO_VERSION 0x04 |
| 7 | |
| 8 | /* mm_io_header.type */ |
| 9 | #define MMIO_OPCODE_MASK 0xff |
| 10 | #define MMIO_OPCODE_SHIFT 0 |
| 11 | #define MMIO_WIDTH_MASK 0xff00 |
| 12 | #define MMIO_WIDTH_SHIFT 8 |
| 13 | #define MMIO_MAGIC (0x6f000000 | (MMIO_VERSION<<16)) |
| 14 | #define MMIO_MAGIC_MASK 0xffff0000 |
| 15 | |
| 16 | enum mm_io_opcode { /* payload type: */ |
| 17 | MMIO_READ = 0x1, /* struct mm_io_rw */ |
| 18 | MMIO_WRITE = 0x2, /* struct mm_io_rw */ |
| 19 | MMIO_PROBE = 0x3, /* struct mm_io_map */ |
| 20 | MMIO_UNPROBE = 0x4, /* struct mm_io_map */ |
| 21 | MMIO_MARKER = 0x5, /* raw char data */ |
| 22 | MMIO_UNKNOWN_OP = 0x6, /* struct mm_io_rw */ |
| 23 | }; |
| 24 | |
| 25 | struct mm_io_header { |
| 26 | __u32 type; |
| 27 | __u32 sec; /* timestamp */ |
| 28 | __u32 nsec; |
| 29 | __u32 pid; /* PID of the process, or 0 for kernel core */ |
| 30 | __u16 data_len; /* length of the following payload */ |
| 31 | }; |
| 32 | |
| 33 | struct mm_io_rw { |
| 34 | __u64 address; /* virtual address of register */ |
| 35 | __u64 value; |
| 36 | __u64 pc; /* optional program counter */ |
| 37 | }; |
| 38 | |
| 39 | struct mm_io_map { |
| 40 | __u64 phys; /* base address in PCI space */ |
| 41 | __u64 addr; /* base virtual address */ |
| 42 | __u64 len; /* mapping size */ |
| 43 | __u64 pc; /* optional program counter */ |
| 44 | }; |
| 45 | |
| 46 | |
| 47 | /* |
| 48 | * These structures are used to allow a single relay_write() |
| 49 | * call to write a full packet. |
| 50 | */ |
| 51 | |
| 52 | struct mm_io_header_rw { |
| 53 | struct mm_io_header header; |
| 54 | struct mm_io_rw rw; |
| 55 | } __attribute__((packed)); |
| 56 | |
| 57 | struct mm_io_header_map { |
| 58 | struct mm_io_header header; |
| 59 | struct mm_io_map map; |
| 60 | } __attribute__((packed)); |
| 61 | |
| 62 | #endif /* MMIOTRACE_H */ |