2 * Copyright © 2011 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * Ben Widawsky <ben@bwidawsk.net>
31 #define DEBUG_PROTOCOL_VERSION 1
32 #define COMMUNICATION_OFFSET 0xc00
33 #define COMMUNICATION_QWORD 0xc0
35 #define STATE_EU_MSG 0x47534d65 /* eMSG */
36 #define STATE_CPU_ACK 0x4b434163 /* cACK */
37 #define STATE_OFFSET 0xc20
38 #define STATE_QWORD 0xc2
40 #define TX_OFFSET 0xc40
42 #define RX_OFFSET 0xc60
46 typedef uint32_t grf[8];
47 typedef uint32_t mrf[8];
48 typedef uint8_t cr[12];
51 #define DWORD8(x) {x, x, x, x, x, x, x, x}
53 const static grf protocol_version = DWORD8(DEBUG_PROTOCOL_VERSION);
54 const static grf eu_msg = DWORD8(STATE_EU_MSG);
55 const static grf cpu_ack = DWORD8(STATE_CPU_ACK);
66 uint8_t pad2[992 + 1024];
68 /* 0xc00 COMMUNICATION_OFFSET */
75 } __attribute__((packed));
78 print_reg(uint8_t reg[32]) {
79 uint32_t *dwords = (uint32_t *)reg;
80 printf("%08x %08x %08x %08x %08x %08x %08x %08x",
81 dwords[7], dwords[6], dwords[5], dwords[4],
82 dwords[3], dwords[2], dwords[1], dwords[0]);
86 print_creg(uint8_t reg[12]) {
87 uint32_t *dwords = (uint32_t *)reg;
88 printf("%08x %08x %08x", dwords[2], dwords[1], dwords[0]);