standardize resource maps.
Good idea? bad idea?
ron
This is an attempt to unify the resource maps scattered all over fam10 and k8.
It makes the code a good deal cleaner than what is there now. At the same time, I'm open
to alternate suggestions.
Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>
Index: include/arch/x86/cpu.h
===================================================================
--- include/arch/x86/cpu.h (revision 716)
+++ include/arch/x86/cpu.h (working copy)
@@ -206,4 +206,44 @@
#define PRINTK_BUF_ADDR_RAM 0x90000
#endif
+/* resource maps. These started out as special for the K8 but now have more general usage */
+/* it's not totally clear that the type and union are a great idea, but see the v2 code:
+ * there are tables that are combinations of all three (or the code supports it anyway)
+ */
+/* types of resource maps */
+#define PCIRM 'p'
+#define IO8 '8'
+#define IO32 'I'
+
+/* pci config map */
+struct pcm {
+ u8 bus, dev, fn, reg;
+ u32 and;
+ u32 or;
+};
+
+struct io8 {
+ u16 port;
+ u8 and, or;
+};
+
+struct io32 {
+ u16 port;
+ u32 and, or;
+};
+
+
+/* convenience initializer */
+#define PCM(abus,adev,afn,areg,aand,aor) {.type = PCIRM, {.pcm ={.bus=abus,.dev=adev,.fn=afn,.reg=areg,.and=aand,.or=aor}}}
+#define IO8(aport, aand, aor) {.type=IO8, {.io8 = {.port = aport, .and = aand, .or = aor}}}
+#define IO32(aport, aand, aaor) {.type = IO32, {.io32 = {.port = aport, .and = aand, .or = aor}}}
+struct rmap {
+ int type;
+ union {
+ struct pcm pcm;
+ struct io8 io8;
+ struct io32 io32;
+ };
+};
+
#endif /* ARCH_X86_CPU_H */
--
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot