summaryrefslogtreecommitdiff
path: root/tools/intel_reg_spec.h
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2014-12-10 14:27:07 +0200
committerJani Nikula <jani.nikula@intel.com>2015-04-23 01:09:59 +0300
commitdfda0b6aeccef464cc6f1af60d8ea16c11fb13f7 (patch)
tree817f77e03af6bc511faceb43ab1a3ca24ff57507 /tools/intel_reg_spec.h
parente1ce5eac338f44deda488a44db04faceea12f13a (diff)
intel_reg: introduce one intel_reg tool to rule them all
Three Tools for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Nine for Mortal Men doomed to die, One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. One Tool to rule them all, One Tool to find them, One Tool to bring them all and in the darkness bind them In the Land of Mordor where the Shadows lie. J.R.R. Tolkien's epigraph to The Lord of The Tools | sed 's/Ring/Tool/g' Introduce intel_reg as the one Intel graphics register multitool to replace intel_reg_read, intel_reg_write, intel_iosf_sb_read, intel_iosf_sb_write, intel_vga_read, intel_vga_write, intel_reg_dumper, intel_reg_snapshot, and quick_dump.py. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'tools/intel_reg_spec.h')
-rw-r--r--tools/intel_reg_spec.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/tools/intel_reg_spec.h b/tools/intel_reg_spec.h
new file mode 100644
index 00000000..26e82523
--- /dev/null
+++ b/tools/intel_reg_spec.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __INTEL_REG_SPEC_H__
+#define __INTEL_REG_SPEC_H__
+
+enum port_addr {
+ PORT_NONE = 0,
+ PORT_MMIO = -1,
+ PORT_PORTIO_VGA = -2, /* see vga reg read/write */
+ PORT_MMIO_VGA = -3, /* see vga reg read/write */
+
+ /* vlv */
+ PORT_BUNIT = 0x03,
+ PORT_PUNIT = 0x04,
+ PORT_NC = 0x11,
+ PORT_DPIO = 0x12,
+ PORT_GPIO_NC = 0x13,
+ PORT_CCK = 0x14,
+ PORT_CCU = 0xa9,
+ PORT_DPIO2 = 0x1a,
+ PORT_FLISDSI = 0x1b,
+
+ /* threshold for interpreting port as mmio offset */
+ PORT_MAX = 0xff,
+};
+
+struct port_desc {
+ enum port_addr port;
+ const char *name;
+ uint32_t stride;
+};
+
+struct reg {
+ struct port_desc port_desc;
+ uint32_t mmio_offset;
+ uint32_t addr;
+ char *name;
+};
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+#endif
+
+static inline void *recalloc(void *ptr, size_t nmemb, size_t size)
+{
+ return realloc(ptr, nmemb * size);
+}
+
+int parse_port_desc(struct reg *reg, const char *s);
+ssize_t intel_reg_spec_builtin(struct reg **regs, uint32_t devid);
+ssize_t intel_reg_spec_file(struct reg **regs, const char *filename);
+void intel_reg_spec_free(struct reg *regs, size_t n);
+int intel_reg_spec_decode(char *buf, size_t bufsize, const struct reg *reg,
+ uint32_t val, uint32_t devid);
+
+#endif /* __INTEL_REG_SPEC_H__ */