Add constants for fast path resume copying
[coreboot.git] / util / msrtool / msrtool.h
index ab7c227d375499a1e6510322cadc0b06dd7f598e..e6cea468635e92bd831ae98bbdca5bb8c0b1ff2a 100644 (file)
@@ -2,6 +2,7 @@
  * This file is part of msrtool.
  *
  * Copyright (c) 2008 Peter Stuge <peter@stuge.se>
+ * Copyright (c) 2009 coresystems GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
 
 #include <stdio.h>
 #include <stdint.h>
+#if (defined(__MACH__) && defined(__APPLE__))
+/* DirectHW is available here: http://www.coreboot.org/DirectHW */
+#define __DARWIN__
+#include <DirectHW/DirectHW.h>
+#endif
+#if defined(__FreeBSD__)
+#include <sys/ioctl.h>
+#include <sys/cpuctl.h>
+#endif
+#include <pci/pci.h>
 
 #define HEXCHARS "0123456789abcdefABCDEF"
 
@@ -132,6 +143,8 @@ extern const struct targetdef **targets;
 
 extern uint8_t reserved, verbose, quiet;
 
+extern struct pci_access *pacc;
+
 #define printf_quiet(x...) do { if (!quiet) fprintf(stderr,x); } while(0)
 #define printf_verbose(x...) do { if (verbose && !quiet) fprintf(stderr,x); } while(0)
 
@@ -145,6 +158,7 @@ extern uint8_t reserved, verbose, quiet;
 
 /* sys.c */
 struct cpuid_t *cpuid(void);
+struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
 
 /* msrutils.c */
 void hexprint(FILE *f, const struct msr val, const uint8_t bits);
@@ -153,9 +167,10 @@ struct msr msr_shl(const struct msr a, const uint8_t bits);
 struct msr msr_shr(const struct msr a, const uint8_t bits);
 void msr_and(struct msr *a, const struct msr b);
 const struct msrdef *findmsrdef(const uint32_t addr);
+uint32_t msraddrbyname(const char *name);
 void dumpmsrdefs(const struct targetdef *t);
 int dumpmsrdefsvals(FILE *f, const struct targetdef *t, const uint8_t cpu);
-uint8_t str2msr(char *str, struct msr *msr);
+uint8_t str2msr(char *str, struct msr *msr, char **endptr);
 void decodemsr(const uint8_t cpu, const uint32_t addr, const struct msr val);
 uint8_t diff_msr(FILE *fout, const uint32_t addr, const struct msr a, const struct msr b);
 
@@ -169,9 +184,24 @@ extern int linux_open(uint8_t cpu, enum SysModes mode);
 extern int linux_close(uint8_t cpu);
 extern int linux_rdmsr(uint8_t cpu, uint32_t addr, struct msr *val);
 
+/* darwin.c */
+extern int darwin_probe(const struct sysdef *system);
+extern int darwin_open(uint8_t cpu, enum SysModes mode);
+extern int darwin_close(uint8_t cpu);
+extern int darwin_rdmsr(uint8_t cpu, uint32_t addr, struct msr *val);
+
+/* freebsd.c */
+extern int freebsd_probe(const struct sysdef *system);
+extern int freebsd_open(uint8_t cpu, enum SysModes mode);
+extern int freebsd_close(uint8_t cpu);
+extern int freebsd_rdmsr(uint8_t cpu, uint32_t addr, struct msr *val);
 
 /** target externs **/
 
+/* geodegx2.c */
+extern int geodegx2_probe(const struct targetdef *t);
+extern const struct msrdef geodegx2_msrs[];
+
 /* geodelx.c */
 extern int geodelx_probe(const struct targetdef *t);
 extern const struct msrdef geodelx_msrs[];
@@ -180,4 +210,36 @@ extern const struct msrdef geodelx_msrs[];
 extern int cs5536_probe(const struct targetdef *t);
 extern const struct msrdef cs5536_msrs[];
 
+/* k8.c */
+extern int k8_probe(const struct targetdef *t);
+extern const struct msrdef k8_msrs[];
+
+/* intel_pentium3_early.c */
+extern int intel_pentium3_early_probe(const struct targetdef *t);
+extern const struct msrdef intel_pentium3_early_msrs[];
+
+/* intel_pentium3.c */
+extern int intel_pentium3_probe(const struct targetdef *t);
+extern const struct msrdef intel_pentium3_msrs[];
+
+/* intel_core1.c */
+extern int intel_core1_probe(const struct targetdef *t);
+extern const struct msrdef intel_core1_msrs[];
+
+/* intel_core2_early.c */
+extern int intel_core2_early_probe(const struct targetdef *t);
+extern const struct msrdef intel_core2_early_msrs[];
+
+/* intel_core2_later.c */
+extern int intel_core2_later_probe(const struct targetdef *t);
+extern const struct msrdef intel_core2_later_msrs[];
+
+/* intel_pentium4_early.c */
+extern int intel_pentium4_early_probe(const struct targetdef *t);
+extern const struct msrdef intel_pentium4_early_msrs[];
+
+/* intel_pentium4_later.c */
+extern int intel_pentium4_later_probe(const struct targetdef *t);
+extern const struct msrdef intel_pentium4_later_msrs[];
+
 #endif /* MSRTOOL_H */