[OpenBIOS] r25 - in openbios-devel: config/examples drivers include/libc include/sparc32 modules toke

svn@openbios.org svn at openbios.org
Mon May 22 12:37:34 CEST 2006


Author: stepan
Date: 2006-05-22 12:37:34 +0200 (Mon, 22 May 2006)
New Revision: 25

Modified:
   openbios-devel/config/examples/cross-sparc32_config.xml
   openbios-devel/config/examples/cross-sparc32_rules.xml
   openbios-devel/config/examples/sparc32_config.xml
   openbios-devel/config/examples/sparc32_rules.xml
   openbios-devel/drivers/esp.c
   openbios-devel/drivers/iommu.c
   openbios-devel/drivers/pgtsrmmu.h
   openbios-devel/include/libc/string.h
   openbios-devel/include/sparc32/io.h
   openbios-devel/modules/nvram.c
   openbios-devel/toke/stream.c
Log:
blueswirl -14 generic and sparc32 related code


Modified: openbios-devel/config/examples/cross-sparc32_config.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc32_config.xml	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/config/examples/cross-sparc32_config.xml	2006-05-22 10:37:34 UTC (rev 25)
@@ -46,20 +46,20 @@
   <option name="CONFIG_SUN_PARTS" type="boolean" value="true"/>
   <option name="CONFIG_FS" type="boolean" value="true"/>
   <option name="CONFIG_HFS" type="boolean" value="false"/>
-  <option name="CONFIG_HFSP" type="boolean" value="false"/>
+  <option name="CONFIG_HFSP" type="boolean" value="true"/>
   <option name="CONFIG_GRUBFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_EXT2FS" type="boolean" value="true"/>
-  <option name="CONFIG_FSYS_FAT" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_JFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_MINIX" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_REISERFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_XFS" type="boolean" value="false"/>
+  <option name="CONFIG_FSYS_FAT" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_JFS" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_MINIX" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_REISERFS" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_XFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_UFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_ISO9660" type="boolean" value="true"/>
-  <option name="CONFIG_FSYS_FFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_VSTAFS" type="boolean" value="false"/>
+  <option name="CONFIG_FSYS_FFS" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_VSTAFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_NTFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_AFFS" type="boolean" value="false"/>
+  <option name="CONFIG_FSYS_AFFS" type="boolean" value="true"/>
   <option name="CONFIG_DEBUG_FS" type="boolean" value="false"/>
   
   <!-- Miscellaneous -->
@@ -69,7 +69,7 @@
   <option name="CONFIG_DRIVER_SBUS" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_OBIO" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_ESP" type="boolean" value="true"/>
-  <option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
+  <option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="true"/>
 
 </config>
 

Modified: openbios-devel/config/examples/cross-sparc32_rules.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc32_rules.xml	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/config/examples/cross-sparc32_rules.xml	2006-05-22 10:37:34 UTC (rev 25)
@@ -21,6 +21,8 @@
 STRIP := sparc-linux-strip
 RANLIB := sparc-linux-ranlib
 CFLAGS := -Os -Wall -W -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
 INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
 
 #

Modified: openbios-devel/config/examples/sparc32_config.xml
===================================================================
--- openbios-devel/config/examples/sparc32_config.xml	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/config/examples/sparc32_config.xml	2006-05-22 10:37:34 UTC (rev 25)
@@ -46,20 +46,20 @@
   <option name="CONFIG_SUN_PARTS" type="boolean" value="true"/>
   <option name="CONFIG_FS" type="boolean" value="true"/>
   <option name="CONFIG_HFS" type="boolean" value="false"/>
-  <option name="CONFIG_HFSP" type="boolean" value="false"/>
+  <option name="CONFIG_HFSP" type="boolean" value="true"/>
   <option name="CONFIG_GRUBFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_EXT2FS" type="boolean" value="true"/>
-  <option name="CONFIG_FSYS_FAT" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_JFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_MINIX" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_REISERFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_XFS" type="boolean" value="false"/>
+  <option name="CONFIG_FSYS_FAT" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_JFS" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_MINIX" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_REISERFS" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_XFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_UFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_ISO9660" type="boolean" value="true"/>
-  <option name="CONFIG_FSYS_FFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_VSTAFS" type="boolean" value="false"/>
+  <option name="CONFIG_FSYS_FFS" type="boolean" value="true"/>
+  <option name="CONFIG_FSYS_VSTAFS" type="boolean" value="true"/>
   <option name="CONFIG_FSYS_NTFS" type="boolean" value="false"/>
-  <option name="CONFIG_FSYS_AFFS" type="boolean" value="false"/>
+  <option name="CONFIG_FSYS_AFFS" type="boolean" value="true"/>
   <option name="CONFIG_DEBUG_FS" type="boolean" value="false"/>
   
   <!-- Miscellaneous -->
@@ -69,7 +69,7 @@
   <option name="CONFIG_DRIVER_SBUS" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_OBIO" type="boolean" value="true"/>
   <option name="CONFIG_DRIVER_ESP" type="boolean" value="true"/>
-  <option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="false"/>
+  <option name="CONFIG_DRIVER_FLOPPY" type="boolean" value="true"/>
 
 </config>
 

Modified: openbios-devel/config/examples/sparc32_rules.xml
===================================================================
--- openbios-devel/config/examples/sparc32_rules.xml	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/config/examples/sparc32_rules.xml	2006-05-22 10:37:34 UTC (rev 25)
@@ -27,6 +27,8 @@
 endif
 
 CFLAGS := -Os -Wall -W -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
 INCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
 
 #

Modified: openbios-devel/drivers/esp.c
===================================================================
--- openbios-devel/drivers/esp.c	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/drivers/esp.c	2006-05-22 10:37:34 UTC (rev 25)
@@ -263,7 +263,10 @@
     id = POP();
     *sd = &global_esp->sd[id];
 
-    DPRINTF("opening drive %d\n", id);
+#ifdef CONFIG_DEBUG_ESP
+    fword("my-args");
+    DPRINTF("opening drive %d args %s\n", id, pop_fstr_copy());
+#endif
 
     selfword("open-deblocker");
 
@@ -393,7 +396,7 @@
 };
 
 static void
-add_alias(const unsigned char *device, const unsigned char *alias)
+add_alias(const char *device, const char *alias)
 {
     push_str("/aliases");
     fword("find-device");
@@ -413,6 +416,11 @@
     DPRINTF("Initializing SCSI...");
 
     esp = malloc(sizeof(esp_private_t));
+    if (!esp) {
+        DPRINTF("Can't allocate ESP private structure\n");
+        return -1;
+    }
+
     global_esp = esp;
 
     if (espdma_init(&esp->espdma) != 0) {
@@ -433,7 +441,9 @@
 
     // Chip reset
     esp->ll->regs[ESP_CMD] = ESP_CMD_RC;
-
+    
+    DPRINTF("ESP at 0x%lx, buffer va 0x%lx dva 0x%lx\n", (unsigned long)esp,
+            (unsigned long)esp->buffer, (unsigned long)esp->buffer_dvma);
     DPRINTF("done\n");
     DPRINTF("Initializing SCSI devices...");
 
@@ -448,8 +458,7 @@
 #endif
     }
 
-    sprintf(nodebuff, "/iommu/sbus/espdma/esp");
-    REGISTER_NAMED_NODE(ob_esp, nodebuff);
+    REGISTER_NAMED_NODE(ob_esp, "/iommu/sbus/espdma/esp");
     device_end();
 
     for (id = 0; id < 8; id++) {

Modified: openbios-devel/drivers/iommu.c
===================================================================
--- openbios-devel/drivers/iommu.c	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/drivers/iommu.c	2006-05-22 10:37:34 UTC (rev 25)
@@ -70,7 +70,7 @@
 /*
  * Allocate memory. This is reusable.
  */
-static void
+void
 mem_init(struct mem *t, char *begin, char *limit)
 {
     t->start = begin;
@@ -82,8 +82,14 @@
 mem_alloc(struct mem *t, int size, int align)
 {
     char *p;
+    unsigned long pa;
 
-    p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
+    // The alignment restrictions refer to physical, not virtual
+    // addresses
+    pa = va2pa((unsigned long)t->curp) + (align - 1);
+    pa &= ~(align - 1);
+    p = (char *)pa2va(pa);
+    
     if (p >= t->uplim || p + size > t->uplim)
         return 0;
     t->curp = p + size;
@@ -193,12 +199,11 @@
  * Switch page tables.
  */
 void
-init_mmu_swift()
+init_mmu_swift(void)
 {
     unsigned int addr, i;
     unsigned long pa, va;
 
-    mem_init(&cmem, (char *) &_vmem, (char *)&_evmem);
     mem_init(&cio, (char *)&_end, (char *)&_iomem);
 
     context_table = mem_zalloc(&cmem, NCTX_SWIFT * sizeof(int), NCTX_SWIFT * sizeof(int));
@@ -343,11 +348,12 @@
 
     /* flush_cache_all(); */
     /** flush_tlb_all(); **/
-    regs->base = ((unsigned int)va2pa((unsigned long)ptab)) >> 4;
+    tmp = (unsigned int)va2pa((unsigned long)ptab);
+    regs->base = tmp >> 4;
     iommu_invalidate(regs);
 
-    DPRINTF("IOMMU: impl %d vers %d page table at 0x%p of size %d bytes\n",
-            impl, vers, t->page_table, ptsize);
+    DPRINTF("IOMMU: impl %d vers %d page table at 0x%p (pa 0x%x) of size %d bytes\n",
+            impl, vers, t->page_table, tmp, ptsize);
 
     mem_init(&t->bmap, (char*)t->plow, (char *)0xfffff000);
 }

Modified: openbios-devel/drivers/pgtsrmmu.h
===================================================================
--- openbios-devel/drivers/pgtsrmmu.h	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/drivers/pgtsrmmu.h	2006-05-22 10:37:34 UTC (rev 25)
@@ -83,7 +83,7 @@
 #ifndef __ASSEMBLY__
 
 /* Accessing the MMU control register. */
-extern __inline__ unsigned int srmmu_get_mmureg(void)
+static __inline__ unsigned int srmmu_get_mmureg(void)
 {
         unsigned int retval;
 	__asm__ __volatile__("lda [%%g0] %1, %0\n\t" :
@@ -92,14 +92,14 @@
 	return retval;
 }
 
-extern __inline__ void srmmu_set_mmureg(unsigned long regval)
+static __inline__ void srmmu_set_mmureg(unsigned long regval)
 {
 	__asm__ __volatile__("sta %0, [%%g0] %1\n\t" : :
 			     "r" (regval), "i" (ASI_M_MMUREGS) : "memory");
 
 }
 
-extern __inline__ void srmmu_set_ctable_ptr(unsigned long paddr)
+static __inline__ void srmmu_set_ctable_ptr(unsigned long paddr)
 {
 	paddr = ((paddr >> 4) & SRMMU_CTX_PMASK);
 	__asm__ __volatile__("sta %0, [%1] %2\n\t" : :
@@ -108,7 +108,7 @@
 			     "memory");
 }
 
-extern __inline__ unsigned long srmmu_get_ctable_ptr(void)
+static __inline__ unsigned long srmmu_get_ctable_ptr(void)
 {
 	unsigned int retval;
 
@@ -119,14 +119,14 @@
 	return (retval & SRMMU_CTX_PMASK) << 4;
 }
 
-extern __inline__ void srmmu_set_context(int context)
+static __inline__ void srmmu_set_context(int context)
 {
 	__asm__ __volatile__("sta %0, [%1] %2\n\t" : :
 			     "r" (context), "r" (SRMMU_CTX_REG),
 			     "i" (ASI_M_MMUREGS) : "memory");
 }
 
-extern __inline__ int srmmu_get_context(void)
+static __inline__ int srmmu_get_context(void)
 {
 	register int retval;
 	__asm__ __volatile__("lda [%1] %2, %0\n\t" :
@@ -136,7 +136,7 @@
 	return retval;
 }
 
-extern __inline__ unsigned int srmmu_get_fstatus(void)
+static __inline__ unsigned int srmmu_get_fstatus(void)
 {
 	unsigned int retval;
 
@@ -146,7 +146,7 @@
 	return retval;
 }
 
-extern __inline__ unsigned int srmmu_get_faddr(void)
+static __inline__ unsigned int srmmu_get_faddr(void)
 {
 	unsigned int retval;
 
@@ -157,7 +157,7 @@
 }
 
 /* This is guaranteed on all SRMMU's. */
-extern __inline__ void srmmu_flush_whole_tlb(void)
+static __inline__ void srmmu_flush_whole_tlb(void)
 {
 	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
 			     "r" (0x400),        /* Flush entire TLB!! */
@@ -166,7 +166,7 @@
 }
 
 /* These flush types are not available on all chips... */
-extern __inline__ void srmmu_flush_tlb_ctx(void)
+static __inline__ void srmmu_flush_tlb_ctx(void)
 {
 	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
 			     "r" (0x300),        /* Flush TLB ctx.. */
@@ -174,7 +174,7 @@
 
 }
 
-extern __inline__ void srmmu_flush_tlb_region(unsigned long addr)
+static __inline__ void srmmu_flush_tlb_region(unsigned long addr)
 {
 	addr &= SRMMU_PGDIR_MASK;
 	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
@@ -184,7 +184,7 @@
 }
 
 
-extern __inline__ void srmmu_flush_tlb_segment(unsigned long addr)
+static __inline__ void srmmu_flush_tlb_segment(unsigned long addr)
 {
 	addr &= SRMMU_PMD_MASK;
 	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
@@ -193,7 +193,7 @@
 
 }
 
-extern __inline__ void srmmu_flush_tlb_page(unsigned long page)
+static __inline__ void srmmu_flush_tlb_page(unsigned long page)
 {
 	page &= PAGE_MASK;
 	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
@@ -202,7 +202,7 @@
 
 }
 
-extern __inline__ unsigned long srmmu_hwprobe(unsigned long vaddr)
+static __inline__ unsigned long srmmu_hwprobe(unsigned long vaddr)
 {
 	unsigned long retval;
 
@@ -214,7 +214,7 @@
 	return retval;
 }
 
-extern __inline__ int
+static __inline__ int
 srmmu_get_pte (unsigned long addr)
 {
 	register unsigned long entry;

Modified: openbios-devel/include/libc/string.h
===================================================================
--- openbios-devel/include/libc/string.h	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/include/libc/string.h	2006-05-22 10:37:34 UTC (rev 25)
@@ -42,7 +42,7 @@
 extern void 	*memcpy(void * dest,const void *src,size_t count);
 extern void 	*memmove(void * dest,const void *src,size_t count);
 extern int	memcmp(const void * cs,const void * ct,size_t count);
-extern void 	*memscan(void * addr, int c, size_t size);void * memscan(void * addr, int c, size_t size);
+extern void 	*memscan(void * addr, int c, size_t size);
 extern char 	*strstr(const char * s1,const char * s2);
 extern void	*memchr(const void *s, int c, size_t n);
 

Modified: openbios-devel/include/sparc32/io.h
===================================================================
--- openbios-devel/include/sparc32/io.h	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/include/sparc32/io.h	2006-05-22 10:37:34 UTC (rev 25)
@@ -4,7 +4,8 @@
 #include "asm/types.h"
 
 extern unsigned int va_shift; // Set in entry.S
-extern char _start, _data, _end, _vmem, _evmem, _iomem; // Defined in ldscript
+extern char _start, _data, _heap, _eheap, _stack, _estack, _end,
+    _vmem, _evmem,_iomem; // Defined in ldscript
 
 static inline unsigned long
 va2pa(unsigned long va)
@@ -32,11 +33,12 @@
 
 struct mem;
 
+void mem_init(struct mem *t, char *begin, char *limit);
 void *mem_alloc(struct mem *t, int size, int align);
 void *mem_zalloc(struct mem *t, int size, int align);
 int map_page(unsigned long va, unsigned long epa, int type);
 void *map_io(unsigned pa, int size);
-void init_mmu_swift();
+void init_mmu_swift(void);
 void *dvma_alloc(int size, unsigned int *pphys);
 
 #ifndef BOOTSTRAP

Modified: openbios-devel/modules/nvram.c
===================================================================
--- openbios-devel/modules/nvram.c	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/modules/nvram.c	2006-05-22 10:37:34 UTC (rev 25)
@@ -49,7 +49,7 @@
 static unsigned int
 nvpart_checksum( nvpart_t* hdr )
 {
-	unsigned char *p = (char*)hdr;
+	unsigned char *p = (unsigned char*)hdr;
 	int i, val = p[0];
 
 	for( i=2; i<16; i++ ) {

Modified: openbios-devel/toke/stream.c
===================================================================
--- openbios-devel/toke/stream.c	2006-05-22 10:33:31 UTC (rev 24)
+++ openbios-devel/toke/stream.c	2006-05-22 10:37:34 UTC (rev 25)
@@ -104,7 +104,7 @@
 		oname = (u8 *)strdup( out_name );
 	else {
 		ext=strrchr(in_name, '.');
-		len=ext ? (ext-in_name) : (unsigned int)strlen(in_name) ;
+		len=ext ? (unsigned int)(ext-in_name) : (unsigned int)strlen(in_name) ;
 		oname=malloc(len+4);
 		memcpy(oname, in_name, len);
 		oname[len] = 0;




More information about the OpenBIOS mailing list