blueswirl -14 generic and sparc32 related code

git-svn-id: svn://coreboot.org/openbios/openbios-devel@25 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Stefan Reinauer
2006-05-22 10:37:34 +00:00
parent ad82fa58a6
commit 2759b42cc1
11 changed files with 73 additions and 52 deletions

View File

@@ -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>

View File

@@ -21,6 +21,8 @@ NM := sparc-linux-nm
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
#

View File

@@ -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>

View File

@@ -27,6 +27,8 @@ ifeq ($(shell uname), Linux)
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
#

View File

@@ -263,7 +263,10 @@ ob_sd_open(__attribute__((unused))sd_private_t **sd)
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 @@ NODE_METHODS(ob_esp) = {
};
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 @@ int ob_esp_init(void)
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) {
@@ -434,6 +442,8 @@ int ob_esp_init(void)
// 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 @@ int ob_esp_init(void)
#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++) {

View File

@@ -70,7 +70,7 @@ iommu_invalidate(struct iommu_regs *regs) {
/*
* Allocate memory. This is reusable.
*/
static void
void
mem_init(struct mem *t, char *begin, char *limit)
{
t->start = begin;
@@ -82,8 +82,14 @@ void *
mem_alloc(struct mem *t, int size, int align)
{
char *p;
unsigned long pa;
// The alignment restrictions refer to physical, not virtual
// addresses
pa = va2pa((unsigned long)t->curp) + (align - 1);
pa &= ~(align - 1);
p = (char *)pa2va(pa);
p = (char *)((((unsigned int)t->curp) + (align-1)) & ~(align-1));
if (p >= t->uplim || p + size > t->uplim)
return 0;
t->curp = p + size;
@@ -193,12 +199,11 @@ map_io(unsigned pa, int size)
* 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 @@ iommu_init(struct iommu *t)
/* 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);
}

View File

@@ -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 @@ extern __inline__ unsigned int srmmu_get_mmureg(void)
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 @@ extern __inline__ void srmmu_set_ctable_ptr(unsigned long paddr)
"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 @@ extern __inline__ unsigned long srmmu_get_ctable_ptr(void)
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 @@ extern __inline__ int srmmu_get_context(void)
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 @@ extern __inline__ unsigned int srmmu_get_fstatus(void)
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 @@ extern __inline__ unsigned int srmmu_get_faddr(void)
}
/* 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 @@ extern __inline__ void srmmu_flush_whole_tlb(void)
}
/* 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_ctx(void)
}
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_region(unsigned long addr)
}
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_segment(unsigned long addr)
}
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__ void srmmu_flush_tlb_page(unsigned long page)
}
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 @@ extern __inline__ unsigned long srmmu_hwprobe(unsigned long vaddr)
return retval;
}
extern __inline__ int
static __inline__ int
srmmu_get_pte (unsigned long addr)
{
register unsigned long entry;

View File

@@ -42,7 +42,7 @@ extern char *bcopy(const char * src, char * dest, int count);
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);

View File

@@ -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 @@ pa2va(unsigned long pa)
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

View File

@@ -49,7 +49,7 @@ static struct {
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++ ) {

View File

@@ -104,7 +104,7 @@ int init_output( const char *in_name, const char *out_name )
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;