[OpenBIOS] r360 - in openbios-devel: arch/unix config/examples include/amd64 modules

svn at openbios.org svn at openbios.org
Tue Jan 6 20:06:59 CET 2009


Author: blueswirl
Date: 2009-01-06 20:06:58 +0100 (Tue, 06 Jan 2009)
New Revision: 360

Added:
   openbios-devel/include/amd64/pci.h
Modified:
   openbios-devel/arch/unix/boot.c
   openbios-devel/config/examples/amd64_rules.xml
   openbios-devel/modules/linuxbios.c
Log:
Fix amd64 warnings, enable more warnings

Modified: openbios-devel/arch/unix/boot.c
===================================================================
--- openbios-devel/arch/unix/boot.c	2009-01-06 18:46:22 UTC (rev 359)
+++ openbios-devel/arch/unix/boot.c	2009-01-06 19:06:58 UTC (rev 360)
@@ -74,7 +74,7 @@
 	printk("[unix] Booting '%s'\n",path);
 	entry=load_elf(path);
 	if(entry)
-		printk("successfully loaded client at %x.\n", (ucell)entry);
+                printk("successfully loaded client at %llx.\n", (unsigned long long)(ucell)entry);
 	else
 		printk("failed.\n");
 }

Modified: openbios-devel/config/examples/amd64_rules.xml
===================================================================
--- openbios-devel/config/examples/amd64_rules.xml	2009-01-06 18:46:22 UTC (rev 359)
+++ openbios-devel/config/examples/amd64_rules.xml	2009-01-06 19:06:58 UTC (rev 360)
@@ -10,6 +10,8 @@
 ODIR := obj-$(ARCH)
 HOSTCC := gcc
 HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
+HOSTCFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
+HOSTCFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
 HOSTINCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
 
 CC := gcc
@@ -22,6 +24,8 @@
 INSTALL := install
 
 CFLAGS := -Os -Wall -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin -g
+CFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
+CFLAGS+= -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
 INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
 
 #

Added: openbios-devel/include/amd64/pci.h
===================================================================
--- openbios-devel/include/amd64/pci.h	                        (rev 0)
+++ openbios-devel/include/amd64/pci.h	2009-01-06 19:06:58 UTC (rev 360)
@@ -0,0 +1,66 @@
+#ifndef AMD64_PCI_H
+#define AMD64_PCI_H
+
+#include "asm/io.h"
+
+#if !(defined(PCI_CONFIG_1) || defined(PCI_CONFIG_2))
+#define PCI_CONFIG_1 1 /* default */
+#endif
+
+#ifdef PCI_CONFIG_1
+
+/* PCI Configuration Mechanism #1 */
+
+/* Have pci_addr in the same format as the values written to 0xcf8
+ * so register accesses can be made easy. */
+#define PCI_ADDR(bus, dev, fn) \
+    ((pci_addr) (0x80000000u \
+		| (uint32_t) (bus) << 16 \
+		| (uint32_t) (dev) << 11 \
+		| (uint32_t) (fn) << 8))
+
+#define PCI_BUS(pcidev) ((uint8_t) ((pcidev) >> 16))
+#define PCI_DEV(pcidev) ((uint8_t) ((pcidev) >> 11) & 0x1f)
+#define PCI_FN(pcidev) ((uint8_t) ((pcidev) >> 8) & 7)
+
+static inline uint8_t pci_config_read8(pci_addr dev, uint8_t reg)
+{
+    outl(dev | (reg & ~3), 0xcf8);
+    return inb(0xcfc | (reg & 3));
+}
+
+static inline uint16_t pci_config_read16(pci_addr dev, uint8_t reg)
+{
+    outl(dev | (reg & ~3), 0xcf8);
+    return inw(0xcfc | (reg & 2));
+}
+
+static inline uint32_t pci_config_read32(pci_addr dev, uint8_t reg)
+{
+    outl(dev | reg, 0xcf8);
+    return inl(0xcfc | reg);
+}
+
+static inline void pci_config_write8(pci_addr dev, uint8_t reg, uint8_t val)
+{
+    outl(dev | (reg & ~3), 0xcf8);
+    outb(val, 0xcfc | (reg & 3));
+}
+
+static inline void pci_config_write16(pci_addr dev, uint8_t reg, uint16_t val)
+{
+    outl(dev | (reg & ~3), 0xcf8);
+    outw(val, 0xcfc | (reg & 2));
+}
+
+static inline void pci_config_write32(pci_addr dev, uint8_t reg, uint32_t val)
+{
+    outl(dev | reg, 0xcf8);
+    outl(val, 0xcfc);
+}
+
+#else /* !PCI_CONFIG_1 */
+#error PCI Configuration Mechanism is not specified or implemented
+#endif
+
+#endif /* AMD64_PCI_H */

Modified: openbios-devel/modules/linuxbios.c
===================================================================
--- openbios-devel/modules/linuxbios.c	2009-01-06 18:46:22 UTC (rev 359)
+++ openbios-devel/modules/linuxbios.c	2009-01-06 19:06:58 UTC (rev 360)
@@ -30,9 +30,9 @@
     info->memrange = malloc(lbcount * sizeof(struct memrange));
     info->n_memranges = 0;
     for (i = 0; i < lbcount; i++) {
-	debug("%#016Lx %#016Lx %d\n",
-		lbmem->map[i].start, lbmem->map[i].size,
-		(int) lbmem->map[i].type);
+	debug("%#016llx %#016llx %d\n",
+              (long long)lbmem->map[i].start, (long long)lbmem->map[i].size,
+              (int) lbmem->map[i].type);
 	if (lbmem->map[i].type != LB_MEM_RAM)
 	    continue;
 	info->memrange[info->n_memranges].base = lbmem->map[i].start;




More information about the OpenBIOS mailing list