OpenBIOS
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1996 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1995 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1994 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1993 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1992 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1991 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1990 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1989 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1988 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1987 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1986 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1985 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1984 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1983 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1982 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1981 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1980 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1979 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1978 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1977 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1976 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1975 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1974 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1973 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1972 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1971 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1970 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1969 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1968 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1967 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1966 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1965 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1964 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1963 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1962 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1961 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1960 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1959 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1958 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1957 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1956 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1955 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1954 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1953 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1952 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1951 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1950 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1949 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1948 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1947 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1946 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1945 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1944 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1943 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1942 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1941 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1940 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1939 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1938 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1937 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1936 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1935 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1934 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1933 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1932 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1931 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1930 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1929 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1928 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1927 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1926 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1925 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1924 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1923 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1922 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1921 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1920 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1919 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1918 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1917 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1916 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1915 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1914 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1913 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1912 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1911 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1910 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1909 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1908 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1907 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1906 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1905 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1904 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
November 2008
- 13 participants
- 62 discussions
Hi!
Linux kernel expects at least "cpuid" property in cpu device node, or
it halts execution. This patch adds one with dummy "1" value. This
allows to make some progress into booting the kernel.
Please apply.
--
Kind regards,
Igor V. Kovalenko
2
7

r277 - in openbios-devel: arch/amd64 arch/ppc/briq arch/ppc/mol arch/ppc/pearpc arch/ppc/qemu arch/sparc32 arch/sparc64 arch/x86 drivers
by svn@openbios.org Nov. 30, 2008
by svn@openbios.org Nov. 30, 2008
Nov. 30, 2008
Author: blueswirl
Date: 2008-11-30 14:44:38 +0100 (Sun, 30 Nov 2008)
New Revision: 277
Modified:
openbios-devel/arch/amd64/lib.c
openbios-devel/arch/ppc/briq/briq.c
openbios-devel/arch/ppc/mol/main.c
openbios-devel/arch/ppc/mol/mol.c
openbios-devel/arch/ppc/pearpc/pearpc.c
openbios-devel/arch/ppc/qemu/qemu.c
openbios-devel/arch/sparc32/boot.c
openbios-devel/arch/sparc32/lib.c
openbios-devel/arch/sparc64/boot.c
openbios-devel/arch/sparc64/lib.c
openbios-devel/arch/sparc64/openbios.c
openbios-devel/arch/x86/lib.c
openbios-devel/drivers/adb.c
openbios-devel/drivers/cuda.c
openbios-devel/drivers/esp.c
openbios-devel/drivers/ide.c
openbios-devel/drivers/obio.c
openbios-devel/drivers/pci.c
Log:
Change uses of sprintf to snprintf
Modified: openbios-devel/arch/amd64/lib.c
===================================================================
--- openbios-devel/arch/amd64/lib.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/amd64/lib.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -19,12 +19,12 @@
*/
int printk( const char *fmt, ... )
{
- char *p, buf[512]; /* XXX: no buffer overflow protection... */
+ char *p, buf[512];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ )
Modified: openbios-devel/arch/ppc/briq/briq.c
===================================================================
--- openbios-devel/arch/ppc/briq/briq.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/ppc/briq/briq.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -62,12 +62,12 @@
int
printk( const char *fmt, ... )
{
- char *p, buf[1024]; /* XXX: no buffer overflow protection... */
+ char *p, buf[1024];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vnsprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ ) {
Modified: openbios-devel/arch/ppc/mol/main.c
===================================================================
--- openbios-devel/arch/ppc/mol/main.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/ppc/mol/main.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -300,7 +300,8 @@
continue;
for( j=0; !entry && j<32; j++ ) {
- sprintf( spec, "%s/disk@%x:%d", path, i, j );
+ snprintf( spec, sizeof(spec), "%s/disk@%x:%d",
+ path, i, j );
entry = newworld_load( path, spec, (!type || type==2) );
}
if( entry ) {
Modified: openbios-devel/arch/ppc/mol/mol.c
===================================================================
--- openbios-devel/arch/ppc/mol/mol.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/ppc/mol/mol.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -57,12 +57,12 @@
int
printk( const char *fmt, ... )
{
- char *p, buf[1024]; /* XXX: no buffer overflow protection... */
+ char *p, buf[1024];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vnsprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ ) {
Modified: openbios-devel/arch/ppc/pearpc/pearpc.c
===================================================================
--- openbios-devel/arch/ppc/pearpc/pearpc.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/ppc/pearpc/pearpc.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -64,12 +64,12 @@
int
printk( const char *fmt, ... )
{
- char *p, buf[1024]; /* XXX: no buffer overflow protection... */
+ char *p, buf[1024];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ ) {
Modified: openbios-devel/arch/ppc/qemu/qemu.c
===================================================================
--- openbios-devel/arch/ppc/qemu/qemu.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/ppc/qemu/qemu.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -62,12 +62,12 @@
int
printk( const char *fmt, ... )
{
- char *p, buf[1024]; /* XXX: no buffer overflow protection... */
+ char *p, buf[1024];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ ) {
@@ -105,7 +105,7 @@
char buf[64];
nvram = (char*)addr + IO_NVRAM_OFFSET;
- sprintf(buf, "%s/nvram", path);
+ snprintf(buf, sizeof(buf), "%s/nvram", path);
nvram_init(buf);
dnode = find_dev(buf);
set_int_property(dnode, "#bytes", IO_NVRAM_SIZE >> 4);
Modified: openbios-devel/arch/sparc32/boot.c
===================================================================
--- openbios-devel/arch/sparc32/boot.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/sparc32/boot.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -107,7 +107,7 @@
if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, path, romvec) == LOADER_NOT_SUPPORT) {
- sprintf(altpath, "%s:d", path);
+ snprintf(altpath, sizeof(altpath), "%s:d", path);
if (elf_load(&sys_info, altpath, param, romvec)
== LOADER_NOT_SUPPORT)
Modified: openbios-devel/arch/sparc32/lib.c
===================================================================
--- openbios-devel/arch/sparc32/lib.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/sparc32/lib.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -19,12 +19,12 @@
*/
int printk( const char *fmt, ... )
{
- char *p, buf[512]; /* XXX: no buffer overflow protection... */
+ char *p, buf[512];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ )
Modified: openbios-devel/arch/sparc64/boot.c
===================================================================
--- openbios-devel/arch/sparc64/boot.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/sparc64/boot.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -88,7 +88,7 @@
if (aout_load(&sys_info, path) == LOADER_NOT_SUPPORT)
if (fcode_load(path) == LOADER_NOT_SUPPORT) {
- sprintf(altpath, "%s:d", path);
+ snprintf(altpath, sizeof(altpath), "%s:d", path);
if (elf_load(&sys_info, altpath, param)
== LOADER_NOT_SUPPORT)
Modified: openbios-devel/arch/sparc64/lib.c
===================================================================
--- openbios-devel/arch/sparc64/lib.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/sparc64/lib.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -19,12 +19,12 @@
*/
int printk( const char *fmt, ... )
{
- char *p, buf[512]; /* XXX: no buffer overflow protection... */
+ char *p, buf[512];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ )
Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/sparc64/openbios.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -432,7 +432,7 @@
fword("finish-device");
// MMU node
- sprintf(nodebuff, "/%s", cpu->name);
+ snprintf(nodebuff, sizeof(nodebuff), "/%s", cpu->name);
push_str(nodebuff);
fword("find-device");
@@ -443,7 +443,7 @@
fword("finish-device");
- sprintf(nodebuff, "/%s/mmu", cpu->name);
+ snprintf(nodebuff, sizeof(nodebuff), "/%s/mmu", cpu->name);
REGISTER_NODE_METHODS(mmu, nodebuff);
Modified: openbios-devel/arch/x86/lib.c
===================================================================
--- openbios-devel/arch/x86/lib.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/arch/x86/lib.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -19,12 +19,12 @@
*/
int printk( const char *fmt, ... )
{
- char *p, buf[512]; /* XXX: no buffer overflow protection... */
+ char *p, buf[512];
va_list args;
int i;
va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
+ i = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
for( p=buf; *p; p++ )
Modified: openbios-devel/drivers/adb.c
===================================================================
--- openbios-devel/drivers/adb.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/drivers/adb.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -494,7 +494,7 @@
my_adb_dev = dev;
}
- sprintf(buf, "%s/keyboard", path);
+ snprintf(buf, sizeof(buf), "%s/keyboard", path);
REGISTER_NAMED_NODE( keyboard, buf);
ph = find_dev(buf);
@@ -551,7 +551,7 @@
phandle_t ph, aliases;
adb_dev_t *dev = private;
- sprintf(buf, "%s/mouse", path);
+ snprintf(buf, sizeof(buf), "%s/mouse", path);
REGISTER_NAMED_NODE( mouse, buf);
ph = find_dev(buf);
Modified: openbios-devel/drivers/cuda.c
===================================================================
--- openbios-devel/drivers/cuda.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/drivers/cuda.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -227,7 +227,7 @@
phandle_t ph, aliases;
char buf[64];
- sprintf(buf, "%s/rtc", path);
+ snprintf(buf, sizeof(buf), "%s/rtc", path);
REGISTER_NAMED_NODE(rtc, buf);
ph = find_dev(buf);
@@ -250,7 +250,7 @@
if (cuda == NULL)
return NULL;
- sprintf(buf, "%s/via-cuda", path);
+ snprintf(buf, sizeof(buf), "%s/via-cuda", path);
REGISTER_NAMED_NODE(ob_cuda, buf);
cuda->base = base;
@@ -323,7 +323,7 @@
* */
int adb_bus_init (char *path, adb_bus_t *bus)
{
- char buf[64];
+ char buf[64];
uint8_t buffer[ADB_BUF_SIZE];
uint8_t adb_addresses[16] =
{ 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, -1, 0, };
@@ -332,7 +332,7 @@
int reloc = 0, next_free = 7;
int keep;
- sprintf(buf, "%s/adb", path);
+ snprintf(buf, sizeof(buf), "%s/adb", path);
REGISTER_NAMED_NODE( adb, buf);
/* Reset the bus */
// ADB_DPRINTF("\n");
Modified: openbios-devel/drivers/esp.c
===================================================================
--- openbios-devel/drivers/esp.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/drivers/esp.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -507,7 +507,8 @@
push_str("reg");
fword("property");
fword("finish-device");
- sprintf(nodebuff, "/iommu/sbus/espdma/esp/sd@%d,0", id);
+ snprintf(nodebuff, sizeof(nodebuff), "/iommu/sbus/espdma/esp/sd@%d,0",
+ id);
REGISTER_NODE_METHODS(ob_sd, nodebuff);
if (esp->sd[id].media == TYPE_ROM) {
counter_ptr = &cdcount;
@@ -517,11 +518,12 @@
if (*counter_ptr == 0) {
add_alias(nodebuff, esp->sd[id].media_str);
}
- sprintf(aliasbuff, "%s%d", esp->sd[id].media_str, *counter_ptr);
+ snprintf(aliasbuff, sizeof(aliasbuff), "%s%d", esp->sd[id].media_str,
+ *counter_ptr);
add_alias(nodebuff, aliasbuff);
- sprintf(aliasbuff, "sd(0,%d,0)", id);
+ snprintf(aliasbuff, sizeof(aliasbuff), "sd(0,%d,0)", id);
add_alias(nodebuff, aliasbuff);
- sprintf(aliasbuff, "sd(0,%d,0)@0,0", id);
+ snprintf(aliasbuff, sizeof(aliasbuff), "sd(0,%d,0)@0,0", id);
add_alias(nodebuff, aliasbuff);
(*counter_ptr)++;
}
Modified: openbios-devel/drivers/ide.c
===================================================================
--- openbios-devel/drivers/ide.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/drivers/ide.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -1330,7 +1330,7 @@
ob_ide_identify_drives(chan);
- sprintf(nodebuff, nodetemp_chan, i);
+ snprintf(nodebuff, sizeof(nodebuff), nodetemp_chan, i);
REGISTER_NAMED_NODE(ob_ide_ctrl, nodebuff);
printk("ide%d: [io ports 0x%x-0x%x,0x%x]\n", i, chan->io_regs[0], chan->io_regs[0] + 7, chan->io_regs[8]);
@@ -1357,7 +1357,8 @@
break;
}
printk("%s]: %s\n", media, drive->model);
- sprintf(nodebuff, nodetemp, i, media);
+ snprintf(nodebuff, sizeof(nodebuff), nodetemp, i,
+ media);
REGISTER_NAMED_NODE(ob_ide, nodebuff);
dnode=find_dev(nodebuff);
set_int_property(dnode, "reg", j);
Modified: openbios-devel/drivers/obio.c
===================================================================
--- openbios-devel/drivers/obio.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/drivers/obio.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -275,7 +275,8 @@
fword("finish-device");
- sprintf(nodebuff, "/obio/zs@0,%x", (int)offset & 0xffffffff);
+ snprintf(nodebuff, sizeof(nodebuff), "/obio/zs@0,%x",
+ (int)offset & 0xffffffff);
if (keyboard) {
REGISTER_NODE_METHODS(zs_keyboard, nodebuff);
} else {
Modified: openbios-devel/drivers/pci.c
===================================================================
--- openbios-devel/drivers/pci.c 2008-11-30 13:43:27 UTC (rev 276)
+++ openbios-devel/drivers/pci.c 2008-11-30 13:44:38 UTC (rev 277)
@@ -1098,7 +1098,7 @@
phandle_t ph;
cell props[2];
- sprintf(buf, "%s/interrupt-controller", config->path);
+ snprintf(buf, sizeof(buf), "%s/interrupt-controller", config->path);
REGISTER_NAMED_NODE(ob_pci_node, buf);
ph = find_dev(buf);
@@ -1505,9 +1505,11 @@
dbus=get_cur_dev();
if (pci_dev == NULL || pci_dev->name == NULL)
- sprintf(config.path, "%s/pci%x,%x", path, vid, did);
+ snprintf(config.path, sizeof(config.path),
+ "%s/pci%x,%x", path, vid, did);
else
- sprintf(config.path, "%s/%s", path, pci_dev->name);
+ snprintf(config.path, sizeof(config.path),
+ "%s/%s", path, pci_dev->name);
#ifdef CONFIG_DEBUG_PCI
printk("%s - ", config.path);
#endif
1
0
Author: blueswirl
Date: 2008-11-30 14:43:27 +0100 (Sun, 30 Nov 2008)
New Revision: 276
Modified:
openbios-devel/config/examples/cross-sparc32_rules.xml
openbios-devel/config/examples/cross-sparc64_rules.xml
Log:
Use a cross compiler prefix like PPC
Modified: openbios-devel/config/examples/cross-sparc32_rules.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc32_rules.xml 2008-11-30 13:42:11 UTC (rev 275)
+++ openbios-devel/config/examples/cross-sparc32_rules.xml 2008-11-30 13:43:27 UTC (rev 276)
@@ -12,13 +12,14 @@
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTINCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
-CC := sparc-linux-gcc
-AS := sparc-linux-as
-AR := sparc-linux-ar
-LD := sparc-linux-ld
-NM := sparc-linux-nm
-STRIP := sparc-linux-strip
-RANLIB := sparc-linux-ranlib
+TARGET=sparc-elf-
+CC := $(TARGET)gcc
+AS := $(TARGET)as
+AR := $(TARGET)ar
+LD := $(TARGET)ld
+NM := $(TARGET)nm
+STRIP := $(TARGET)strip
+RANLIB := $(TARGET)ranlib
CFLAGS := -Os -Wall -W -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -fno-builtin -g
CFLAGS+= -Wa,-xarch=v8 -Wa,-32 -m32 -mcpu=supersparc
CFLAGS+= -Wredundant-decls -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
Modified: openbios-devel/config/examples/cross-sparc64_rules.xml
===================================================================
--- openbios-devel/config/examples/cross-sparc64_rules.xml 2008-11-30 13:42:11 UTC (rev 275)
+++ openbios-devel/config/examples/cross-sparc64_rules.xml 2008-11-30 13:43:27 UTC (rev 276)
@@ -12,13 +12,14 @@
HOSTCFLAGS := -O2 -g -Wall -W -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTINCLUDES := -Iinclude -Ikernel/include -I$(ODIR)/target/include
-CC := sparc64-linux-gcc
-AS := sparc64-linux-as
-AR := sparc64-linux-ar
-LD := sparc64-linux-ld
-NM := sparc64-linux-nm
-STRIP := sparc64-linux-strip
-RANLIB := sparc64-linux-ranlib
+TARGET=sparc64-elf-
+CC := $(TARGET)gcc
+AS := $(TARGET)as
+AR := $(TARGET)ar
+LD := $(TARGET)ld
+NM := $(TARGET)nm
+STRIP := $(TARGET)strip
+RANLIB := $(TARGET)ranlib
CFLAGS := -Os -Wall -W -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -g
CFLAGS+= -Wa,-xarch=v9b -Wa,-64 -m64 -mcpu=ultrasparc -mcmodel=medany
CFLAGS+= -fno-builtin -nostdlib -ffreestanding
1
0

Nov. 30, 2008
Author: blueswirl
Date: 2008-11-30 14:42:11 +0100 (Sun, 30 Nov 2008)
New Revision: 275
Modified:
openbios-devel/include/a.out.h
openbios-devel/include/openbios/kernel.h
openbios-devel/kernel/bootstrap.c
Log:
Fix some more warnings
Modified: openbios-devel/include/a.out.h
===================================================================
--- openbios-devel/include/a.out.h 2008-11-30 11:54:01 UTC (rev 274)
+++ openbios-devel/include/a.out.h 2008-11-30 13:42:11 UTC (rev 275)
@@ -127,17 +127,19 @@
#define SEGMENT_SIZE PAGE_SIZE
#endif
+#if !defined(SEGMENT_SIZE)
#ifdef linux
#if defined(__i386__) || defined(__mc68000__)
#define SEGMENT_SIZE 1024
#elif defined(__sparc__)
-#define SEGMENT_SIZE 4096
+#define SEGMENT_SIZE 0x2000
#else
-#ifndef SEGMENT_SIZE
+#if defined(PAGE_SIZE)
#define SEGMENT_SIZE PAGE_SIZE
#endif
#endif
#endif
+#endif
#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
Modified: openbios-devel/include/openbios/kernel.h
===================================================================
--- openbios-devel/include/openbios/kernel.h 2008-11-30 11:54:01 UTC (rev 274)
+++ openbios-devel/include/openbios/kernel.h 2008-11-30 13:42:11 UTC (rev 275)
@@ -37,11 +37,14 @@
extern int get_inputbyte( void );
#endif
+#ifndef BOOTSTRAP
#undef putchar
#undef getchar
extern int putchar( int ch );
-extern int availchar( void );
extern int getchar( void );
+#endif
+extern int availchar( void );
+
#endif /* _H_KERNEL */
Modified: openbios-devel/kernel/bootstrap.c
===================================================================
--- openbios-devel/kernel/bootstrap.c 2008-11-30 11:54:01 UTC (rev 274)
+++ openbios-devel/kernel/bootstrap.c 2008-11-30 13:42:11 UTC (rev 275)
@@ -80,7 +80,7 @@
"$include", "$encode-file"
};
-void init_trampoline(void)
+static void init_trampoline(void)
{
if (!trampoline) {
/* We're using side effects which is to some extent nasty */
1
0

r274 - in openbios-devel: arch/ppc/qemu arch/sparc32 arch/sparc64 drivers fs/grubfs fs/hfsplus fs/hfsplus/include include include/libc include/openbios kernel libc modules
by svn@openbios.org Nov. 30, 2008
by svn@openbios.org Nov. 30, 2008
Nov. 30, 2008
Author: blueswirl
Date: 2008-11-30 12:54:01 +0100 (Sun, 30 Nov 2008)
New Revision: 274
Modified:
openbios-devel/arch/ppc/qemu/console.c
openbios-devel/arch/ppc/qemu/init.c
openbios-devel/arch/ppc/qemu/qemu.c
openbios-devel/arch/ppc/qemu/qemu.h
openbios-devel/arch/ppc/qemu/tree.c
openbios-devel/arch/sparc32/aoutload.c
openbios-devel/arch/sparc32/boot.c
openbios-devel/arch/sparc32/boot.h
openbios-devel/arch/sparc32/context.c
openbios-devel/arch/sparc32/elfload.c
openbios-devel/arch/sparc32/forthload.c
openbios-devel/arch/sparc32/linux_load.c
openbios-devel/arch/sparc32/romvec.c
openbios-devel/arch/sparc32/sys_info.c
openbios-devel/arch/sparc64/aoutload.c
openbios-devel/arch/sparc64/boot.c
openbios-devel/arch/sparc64/boot.h
openbios-devel/arch/sparc64/context.c
openbios-devel/arch/sparc64/elfload.c
openbios-devel/arch/sparc64/fcodeload.c
openbios-devel/arch/sparc64/forthload.c
openbios-devel/arch/sparc64/linux_load.c
openbios-devel/arch/sparc64/sys_info.c
openbios-devel/drivers/adb.c
openbios-devel/drivers/adb.h
openbios-devel/drivers/cuda.c
openbios-devel/drivers/esp.c
openbios-devel/drivers/iommu.c
openbios-devel/drivers/obio.c
openbios-devel/drivers/timer.c
openbios-devel/drivers/vga.h
openbios-devel/fs/grubfs/fsys_affs.c
openbios-devel/fs/grubfs/fsys_ext2fs.c
openbios-devel/fs/grubfs/fsys_jfs.c
openbios-devel/fs/grubfs/fsys_reiserfs.c
openbios-devel/fs/grubfs/fsys_ufs.c
openbios-devel/fs/grubfs/fsys_vstafs.c
openbios-devel/fs/grubfs/grubfs_fs.c
openbios-devel/fs/hfsplus/btree.c
openbios-devel/fs/hfsplus/include/libhfsp.h
openbios-devel/fs/hfsplus/volume.c
openbios-devel/include/elf_boot.h
openbios-devel/include/libc/string.h
openbios-devel/include/openbios/drivers.h
openbios-devel/kernel/dict.c
openbios-devel/kernel/internal.c
openbios-devel/libc/misc.c
openbios-devel/libc/string.c
openbios-devel/libc/vsprintf.c
openbios-devel/modules/cmdline.c
openbios-devel/modules/video.c
Log:
Fix most warnings from Sparse
Modified: openbios-devel/arch/ppc/qemu/console.c
===================================================================
--- openbios-devel/arch/ppc/qemu/console.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/ppc/qemu/console.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -58,7 +58,7 @@
static void uart_putchar(int port, unsigned char c)
{
if (!port)
- return -1;
+ return;
while (!(inb(LSR(port)) & 0x20));
outb(c, THR(port));
}
@@ -134,6 +134,7 @@
#define openbios_GetFBInfo(x) Qemu_GetFBInfo(x)
#include "../../../modules/font_8x16.c"
+#undef FONTDATAMAX
#include "../../../modules/video.c"
#include "../../../modules/console.c"
Modified: openbios-devel/arch/ppc/qemu/init.c
===================================================================
--- openbios-devel/arch/ppc/qemu/init.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/ppc/qemu/init.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -47,7 +47,7 @@
ARCH_HEATHROW,
};
-pci_arch_t known_arch[] = {
+static pci_arch_t known_arch[] = {
[ARCH_PREP] = { "PREP", 0x1057, 0x4801, 0x80800000, 0x800c0000,
0x80000000, 0x00100000, 0xf0000000, 0x10000000,
0x80000000, 0x00010000, 0x00000000, 0x00400000,
Modified: openbios-devel/arch/ppc/qemu/qemu.c
===================================================================
--- openbios-devel/arch/ppc/qemu/qemu.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/ppc/qemu/qemu.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -20,6 +20,7 @@
#include "openbios/kernel.h"
#include "openbios/nvram.h"
#include "openbios/bindings.h"
+#include "openbios/drivers.h"
#include "libc/vsprintf.h"
#include "libc/string.h"
#include "libc/byteorder.h"
@@ -111,7 +112,7 @@
set_property(dnode, "compatible", "nvram,flash", 12);
props[0] = __cpu_to_be32(IO_NVRAM_OFFSET);
props[1] = __cpu_to_be32(IO_NVRAM_SIZE);
- set_property(dnode, "reg", &props, sizeof(props));
+ set_property(dnode, "reg", (char *)&props, sizeof(props));
set_property(dnode, "device_type", "nvram", 6);
chosen = find_dev("/chosen");
Modified: openbios-devel/arch/ppc/qemu/qemu.h
===================================================================
--- openbios-devel/arch/ppc/qemu/qemu.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/ppc/qemu/qemu.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -21,6 +21,9 @@
extern int console_draw_str( const char *str );
+/* console.c */
+int serial_init(void);
+
#include "kernel.h"
#endif /* _H_QEMU */
Modified: openbios-devel/arch/ppc/qemu/tree.c
===================================================================
--- openbios-devel/arch/ppc/qemu/tree.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/ppc/qemu/tree.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -16,6 +16,7 @@
#include "openbios/config.h"
#include "openbios/bindings.h"
+#include "qemu.h"
void devtree_init( void )
{
Modified: openbios-devel/arch/sparc32/aoutload.c
===================================================================
--- openbios-devel/arch/sparc32/aoutload.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/aoutload.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -51,8 +51,7 @@
return 0;
}
-int aout_load(struct sys_info *info, const char *filename, const char *cmdline,
- const void *romvec)
+int aout_load(struct sys_info *info, const char *filename, const void *romvec)
{
int retval = -1;
int image_retval;
@@ -60,7 +59,7 @@
unsigned long start, size;
unsigned int offset;
- image_name = image_version = 0;
+ image_name = image_version = NULL;
if (!file_open(filename))
goto out;
Modified: openbios-devel/arch/sparc32/boot.c
===================================================================
--- openbios-devel/arch/sparc32/boot.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/boot.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -6,6 +6,7 @@
#include "openbios/bindings.h"
#include "openbios/elfload.h"
#include "openbios/nvram.h"
+#include "openbios/drivers.h"
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "sys_info.h"
@@ -103,14 +104,17 @@
printk("without parameters.\n");
if (elf_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT)
- if (linux_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT)
- if (aout_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT) {
+ if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
+ if (aout_load(&sys_info, path, romvec) == LOADER_NOT_SUPPORT) {
sprintf(altpath, "%s:d", path);
- if (elf_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT)
- if (linux_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT)
- if (aout_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT)
+ if (elf_load(&sys_info, altpath, param, romvec)
+ == LOADER_NOT_SUPPORT)
+ if (linux_load(&sys_info, altpath, param)
+ == LOADER_NOT_SUPPORT)
+ if (aout_load(&sys_info, altpath, romvec)
+ == LOADER_NOT_SUPPORT)
printk("Unsupported image format\n");
}
Modified: openbios-devel/arch/sparc32/boot.h
===================================================================
--- openbios-devel/arch/sparc32/boot.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/boot.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -6,25 +6,35 @@
* the copyright and warranty status of this work.
*/
-int forth_load(struct sys_info *info, const char *filename, const char *cmdline);
+// forthload.c
+int forth_load(const char *filename);
+
+// elfload.c
int elf_load(struct sys_info *, const char *filename, const char *cmdline,
const void *romvec);
-int aout_load(struct sys_info *, const char *filename, const char *cmdline,
- const void *romvec);
-int linux_load(struct sys_info *, const char *filename, const char *cmdline,
- const void *romvec);
+// aout_load.c
+int aout_load(struct sys_info *info, const char *filename, const void *romvec);
+
+// linux_load.c
+int linux_load(struct sys_info *info, const char *file, const char *cmdline);
+
+// context.c
+extern struct context *__context;
unsigned int start_elf(unsigned long entry_point, unsigned long param);
+// romvec.c
void *init_openprom(unsigned long memsize, const char *path);
+
+// boot.c
+extern struct sys_info sys_info;
void boot(void);
-extern struct sys_info sys_info;
-extern uint32_t kernel_image;
-extern uint32_t kernel_size;
-extern uint32_t qemu_cmdline;
-extern uint32_t cmdline_size;
-extern char boot_device;
+// sys_info.c
extern unsigned int qemu_mem_size;
+
+// romvec.c
extern struct linux_arguments_v0 obp_arg;
+
+// openbios.c
extern int qemu_machine_type;
Modified: openbios-devel/arch/sparc32/context.c
===================================================================
--- openbios-devel/arch/sparc32/context.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/context.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -22,7 +22,7 @@
* It is placed at the bottom of our stack, and loaded by assembly routine
* to start us up.
*/
-struct context main_ctx = {
+static struct context main_ctx = {
.regs[REG_SP] = (uint32_t) &_estack - 96,
.pc = (uint32_t) start_main,
.npc = (uint32_t) start_main + 4,
Modified: openbios-devel/arch/sparc32/elfload.c
===================================================================
--- openbios-devel/arch/sparc32/elfload.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/elfload.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -26,7 +26,7 @@
if (alloc_size < nmemb || alloc_size < size) {
printf("calloc overflow: %u, %u\n", nmemb, size);
- return 0;
+ return NULL;
}
mem = malloc(alloc_size);
@@ -314,7 +314,7 @@
int image_retval;
unsigned int offset;
- image_name = image_version = 0;
+ image_name = image_version = NULL;
if (!file_open(filename))
goto out;
Modified: openbios-devel/arch/sparc32/forthload.c
===================================================================
--- openbios-devel/arch/sparc32/forthload.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/forthload.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -16,7 +16,8 @@
#define debug printk
static char *forthtext=NULL;
-int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
+
+int forth_load(const char *filename)
{
char magic[2];
unsigned long forthsize;
Modified: openbios-devel/arch/sparc32/linux_load.c
===================================================================
--- openbios-devel/arch/sparc32/linux_load.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/linux_load.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -156,7 +156,7 @@
uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
};
-uint64_t forced_memsize;
+static uint64_t forced_memsize;
/* Load the first part the file and check if it's Linux */
static uint32_t load_linux_header(struct linux_header *hdr)
@@ -293,14 +293,14 @@
unsigned long len;
int k_len;
int to_kern;
- char *initrd = 0;
+ char *initrd = NULL;
int toolong = 0;
forced_memsize = 0;
if (!orig_cmdline) {
- *kern_cmdline = 0;
- return 0;
+ *kern_cmdline = '\0';
+ return NULL;
}
k_len = 0;
@@ -327,7 +327,7 @@
val = sep + 1;
len = end - val;
} else {
- val = 0;
+ val = NULL;
len = 0;
}
@@ -434,8 +434,8 @@
return kern_size;
}
-static int load_initrd(struct linux_header *hdr, struct sys_info *info,
- uint32_t kern_end, struct linux_params *params, const char *initrd_file)
+static int load_initrd(struct linux_header *hdr, uint32_t kern_end,
+ struct linux_params *params, const char *initrd_file)
{
uint32_t max;
uint32_t start, end, size;
@@ -549,7 +549,7 @@
}
/* Start Linux */
-static int start_linux(uint32_t kern_addr, struct linux_params *params)
+static int start_linux(uint32_t kern_addr)
{
struct context *ctx;
//extern int cursor_x, cursor_y;
@@ -579,13 +579,12 @@
return ctx->regs[REG_O0];
}
-int linux_load(struct sys_info *info, const char *file, const char *cmdline,
- const void *romvec)
+int linux_load(struct sys_info *info, const char *file, const char *cmdline)
{
struct linux_header hdr;
struct linux_params *params;
uint32_t kern_addr, kern_size;
- char *initrd_file = 0;
+ char *initrd_file = NULL;
if (!file_open(file))
return -1;
@@ -610,7 +609,7 @@
}
if (initrd_file) {
- if (load_initrd(&hdr, info, kern_addr+kern_size, params, initrd_file)
+ if (load_initrd(&hdr, kern_addr+kern_size, params, initrd_file)
!= 0) {
free(initrd_file);
return -1;
@@ -620,6 +619,6 @@
hardware_setup();
- start_linux(kern_addr, params);
+ start_linux(kern_addr);
return 0;
}
Modified: openbios-devel/arch/sparc32/romvec.c
===================================================================
--- openbios-devel/arch/sparc32/romvec.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/romvec.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -257,18 +257,14 @@
static void obp_reboot(char *str)
{
- extern volatile unsigned int *reset_reg;
-
printk("rebooting (%s)\n", str);
*reset_reg = 1;
printk("reboot failed\n");
for (;;) {}
}
-extern volatile unsigned char *power_reg;
static void obp_abort(void)
{
-
printk("abort, power off\n");
*power_reg = 1;
printk("power off failed\n");
Modified: openbios-devel/arch/sparc32/sys_info.c
===================================================================
--- openbios-devel/arch/sparc32/sys_info.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc32/sys_info.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -3,6 +3,7 @@
#include "elf_boot.h"
#include "sys_info.h"
#include "context.h"
+#include "boot.h"
#define printf printk
#ifdef CONFIG_DEBUG_BOOT
@@ -20,7 +21,6 @@
int i;
unsigned long long total = 0;
struct memrange *mmap;
- extern struct elf_image_note elf_image_notes;
/* Pick up paramters given by bootloader to us */
//info->boot_type = boot_ctx->eax;
Modified: openbios-devel/arch/sparc64/aoutload.c
===================================================================
--- openbios-devel/arch/sparc64/aoutload.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/aoutload.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -52,7 +52,7 @@
return 0;
}
-int aout_load(struct sys_info *info, const char *filename, const char *cmdline)
+int aout_load(struct sys_info *info, const char *filename)
{
int retval = -1;
int image_retval;
@@ -60,7 +60,7 @@
unsigned long start, size;
unsigned int offset;
- image_name = image_version = 0;
+ image_name = image_version = NULL;
if (!file_open(filename))
goto out;
Modified: openbios-devel/arch/sparc64/boot.c
===================================================================
--- openbios-devel/arch/sparc64/boot.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/boot.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -85,9 +85,8 @@
if (elf_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
- if (aout_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
- if (fcode_load(&sys_info, path, param)
- == LOADER_NOT_SUPPORT) {
+ if (aout_load(&sys_info, path) == LOADER_NOT_SUPPORT)
+ if (fcode_load(path) == LOADER_NOT_SUPPORT) {
sprintf(altpath, "%s:d", path);
@@ -95,9 +94,9 @@
== LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, altpath, param)
== LOADER_NOT_SUPPORT)
- if (aout_load(&sys_info, altpath, param)
+ if (aout_load(&sys_info, altpath)
== LOADER_NOT_SUPPORT)
- if (fcode_load(&sys_info, path, param)
+ if (fcode_load(altpath)
== LOADER_NOT_SUPPORT)
printk("Unsupported image format\n");
}
Modified: openbios-devel/arch/sparc64/boot.h
===================================================================
--- openbios-devel/arch/sparc64/boot.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/boot.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -6,21 +6,32 @@
* the copyright and warranty status of this work.
*/
-int forth_load(struct sys_info *info, const char *filename, const char *cmdline);
+// forthload.c
+int forth_load(const char *filename);
+
+// elfload.c
int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
+
+// aout_load.c
+int aout_load(struct sys_info *info, const char *filename);
+
+// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
-int aout_load(struct sys_info *info, const char *filename, const char *cmdline);
-int fcode_load(struct sys_info *info, const char *filename,
- const char *cmdline);
+// fcodeload.c
+int fcode_load(const char *filename);
+
+// context.c
uint64_t start_elf(uint64_t entry_point, uint64_t param);
-void boot(void);
-
+// boot.c
+extern struct sys_info sys_info;
extern uint64_t kernel_image;
extern uint64_t kernel_size;
extern uint64_t qemu_cmdline;
extern uint64_t cmdline_size;
extern char boot_device;
-extern struct sys_info sys_info;
+void boot(void);
+
+// console.c
void ob_su_init(uint64_t base, uint64_t offset, int intr);
Modified: openbios-devel/arch/sparc64/context.c
===================================================================
--- openbios-devel/arch/sparc64/context.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/context.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -22,7 +22,7 @@
* It is placed at the bottom of our stack, and loaded by assembly routine
* to start us up.
*/
-struct context main_ctx = {
+static struct context main_ctx = {
.regs[REG_SP] = (uint64_t) &_estack - 2047 - 96,
.pc = (uint64_t) start_main,
.npc = (uint64_t) start_main + 4,
Modified: openbios-devel/arch/sparc64/elfload.c
===================================================================
--- openbios-devel/arch/sparc64/elfload.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/elfload.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -26,7 +26,7 @@
if (alloc_size < nmemb || alloc_size < size) {
printf("calloc overflow: %u, %u\n", nmemb, size);
- return 0;
+ return NULL;
}
mem = malloc(alloc_size);
@@ -313,7 +313,7 @@
int image_retval;
unsigned int offset;
- image_name = image_version = 0;
+ image_name = image_version = NULL;
if (!file_open(filename))
goto out;
Modified: openbios-devel/arch/sparc64/fcodeload.c
===================================================================
--- openbios-devel/arch/sparc64/fcodeload.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/fcodeload.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -11,8 +11,7 @@
#define printf printk
#define debug printk
-int fcode_load(struct sys_info *info, const char *filename,
- const char *cmdline)
+int fcode_load(const char *filename)
{
int retval = -1;
uint8_t fcode_header[8];
Modified: openbios-devel/arch/sparc64/forthload.c
===================================================================
--- openbios-devel/arch/sparc64/forthload.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/forthload.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -16,7 +16,7 @@
#define debug printk
static char *forthtext=NULL;
-int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
+int forth_load(const char *filename)
{
char magic[2];
unsigned long forthsize;
Modified: openbios-devel/arch/sparc64/linux_load.c
===================================================================
--- openbios-devel/arch/sparc64/linux_load.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/linux_load.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -156,7 +156,7 @@
uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
};
-uint64_t forced_memsize;
+static uint64_t forced_memsize;
/* Load the first part the file and check if it's Linux */
static uint32_t load_linux_header(struct linux_header *hdr)
@@ -293,14 +293,14 @@
unsigned long len;
int k_len;
int to_kern;
- char *initrd = 0;
+ char *initrd = NULL;
int toolong = 0;
forced_memsize = 0;
if (!orig_cmdline) {
- *kern_cmdline = 0;
- return 0;
+ *kern_cmdline = '\0';
+ return NULL;
}
k_len = 0;
@@ -327,7 +327,7 @@
val = sep + 1;
len = end - val;
} else {
- val = 0;
+ val = NULL;
len = 0;
}
@@ -584,7 +584,7 @@
struct linux_header hdr;
struct linux_params *params;
uint32_t kern_addr, kern_size;
- char *initrd_file = 0;
+ char *initrd_file = NULL;
if (!file_open(file))
return -1;
Modified: openbios-devel/arch/sparc64/sys_info.c
===================================================================
--- openbios-devel/arch/sparc64/sys_info.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/arch/sparc64/sys_info.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -21,7 +21,6 @@
int i;
unsigned long long total = 0;
struct memrange *mmap;
- extern struct elf_image_note elf_image_notes;
/* Pick up paramters given by bootloader to us */
//info->boot_type = boot_ctx->eax;
Modified: openbios-devel/drivers/adb.c
===================================================================
--- openbios-devel/drivers/adb.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/adb.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -39,8 +39,6 @@
#define ADB_DPRINTF(fmt, args...) do { } while (0)
#endif
-static void adb_read(void);
-
DECLARE_UNNAMED_NODE( keyboard, INSTALL_OPEN, sizeof(int));
static void
@@ -447,7 +445,6 @@
int next_key;
};
-static adb_kbd_t *my_adb_kbd = NULL;
static adb_dev_t *my_adb_dev = NULL;
static int adb_kbd_read (void *private)
@@ -504,7 +501,7 @@
set_property(ph, "device_type", "keyboard", 9);
props[0] = __cpu_to_be32(dev->addr);
- set_property(ph, "reg", &props, sizeof(props));
+ set_property(ph, "reg", (char *)&props, sizeof(props));
aliases = find_dev("/aliases");
set_property(aliases, "adb-keyboard", buf, strlen(buf) + 1);
@@ -542,14 +539,12 @@
{
}
-static void mouse_read(void);
-
NODE_METHODS( mouse ) = {
{ "open", mouse_open },
{ "close", mouse_close },
};
-void *adb_mouse_new (char *path, void *private)
+void adb_mouse_new (char *path, void *private)
{
char buf[64];
int props[1];
@@ -563,7 +558,7 @@
set_property(ph, "device_type", "mouse", 6);
props[0] = __cpu_to_be32(dev->addr);
- set_property(ph, "reg", &props, sizeof(props));
+ set_property(ph, "reg", (char *)&props, sizeof(props));
set_int_property(ph, "#buttons", 3);
aliases = find_dev("/aliases");
Modified: openbios-devel/drivers/adb.h
===================================================================
--- openbios-devel/drivers/adb.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/adb.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -101,5 +101,6 @@
void *adb_kbd_new (char *path, void *private);
+void adb_mouse_new (char *path, void *private);
#endif /* !defined(__OHW_ADB_H__) */
Modified: openbios-devel/drivers/cuda.c
===================================================================
--- openbios-devel/drivers/cuda.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/cuda.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -171,7 +171,7 @@
props[0] = __cpu_to_be32(IO_CUDA_OFFSET);
props[1] = __cpu_to_be32(IO_CUDA_SIZE);
- set_property(ph, "reg", &props, sizeof(props));
+ set_property(ph, "reg", (char *)&props, sizeof(props));
set_int_property(ph, "interrupt-parent", pic_handle);
// HEATHROW
set_int_property(ph, "interrupts", 0x12);
Modified: openbios-devel/drivers/esp.c
===================================================================
--- openbios-devel/drivers/esp.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/esp.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -62,7 +62,7 @@
sd_private_t sd[8];
} esp_private_t;
-esp_private_t *global_esp;
+static esp_private_t *global_esp;
/* DECLARE data structures for the nodes. */
DECLARE_UNNAMED_NODE(ob_sd, INSTALL_OPEN, sizeof(sd_private_t *));
@@ -304,7 +304,7 @@
{
espdma->regs = (void *)map_io(base + (uint64_t)offset, 0x10);
- if (espdma->regs == 0) {
+ if (espdma->regs == NULL) {
DPRINTF("espdma_init: cannot map registers\n");
return -1;
}
@@ -437,7 +437,7 @@
/* Get the IO region */
esp->ll = (void *)map_io(base + (uint64_t)espoffset,
sizeof(struct esp_regs));
- if (esp->ll == 0) {
+ if (esp->ll == NULL) {
DPRINTF("Can't map ESP registers\n");
return -1;
}
Modified: openbios-devel/drivers/iommu.c
===================================================================
--- openbios-devel/drivers/iommu.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/iommu.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -41,7 +41,7 @@
};
struct mem cmem; /* Current memory, virtual */
-struct mem cio; /* Current I/O space */
+static struct mem cio; /* Current I/O space */
unsigned int va_shift;
@@ -59,7 +59,7 @@
struct mem bmap;
};
-struct iommu ciommu;
+static struct iommu ciommu;
static struct iommu_regs *regs;
static void iommu_init(struct iommu *t, uint64_t base);
@@ -95,7 +95,7 @@
if ((unsigned long)p >= (unsigned long)t->uplim ||
(unsigned long)p + size > (unsigned long)t->uplim)
- return 0;
+ return NULL;
t->curp = p + size;
return p;
@@ -106,7 +106,7 @@
{
char *p;
- if ((p = mem_alloc(t, size, align)) != 0)
+ if ((p = mem_alloc(t, size, align)) != NULL)
memset(p, 0, size);
return p;
@@ -124,7 +124,7 @@
if (alloc) {
p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD * sizeof(int),
SRMMU_PTRS_PER_PMD * sizeof(int));
- if (p == 0)
+ if (p == NULL)
return -1;
pte = SRMMU_ET_PTD | ((va2pa((unsigned long)p)) >> 4);
l1[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)] = pte;
@@ -141,7 +141,7 @@
if (alloc) {
p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE * sizeof(void *),
SRMMU_PTRS_PER_PTE * sizeof(void *));
- if (p == 0)
+ if (p == NULL)
return -2;
pte = SRMMU_ET_PTD | ((va2pa((unsigned int)p)) >> 4);
*(uint32_t *)pa2va(pa) = pte;
@@ -199,7 +199,7 @@
pa &= ~(PAGE_SIZE - 1);
va = mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE);
- if (va == 0)
+ if (va == NULL)
return va;
mva = (unsigned int) va;
@@ -435,12 +435,12 @@
npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
va = mem_alloc(&cmem, npages * PAGE_SIZE, PAGE_SIZE);
- if (va == 0)
- return 0;
+ if (va == NULL)
+ return NULL;
ba = (unsigned int)mem_alloc(&t->bmap, npages * PAGE_SIZE, PAGE_SIZE);
if (ba == 0)
- return 0;
+ return NULL;
pa = (unsigned int)va2pa((unsigned long)va);
@@ -484,7 +484,7 @@
unsigned int tmp;
regs = map_io(base, IOMMU_REGS);
- if (regs == 0) {
+ if (regs == NULL) {
DPRINTF("Cannot map IOMMU\n");
for (;;) { }
}
@@ -505,7 +505,7 @@
/* Allocate IOMMU page table */
/* Thremendous alignment causes great waste... */
ptsize = (t->vasize/PAGE_SIZE) * sizeof(int);
- if ((ptab = mem_zalloc(&cmem, ptsize, ptsize)) == 0) {
+ if ((ptab = mem_zalloc(&cmem, ptsize, ptsize)) == NULL) {
DPRINTF("Cannot allocate IOMMU table [0x%x]\n", ptsize);
for (;;) { }
}
Modified: openbios-devel/drivers/obio.c
===================================================================
--- openbios-devel/drivers/obio.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/obio.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -325,7 +325,7 @@
}
static unsigned char *nvram;
-ohwcfg_v3_t nv_info;
+static ohwcfg_v3_t nv_info;
#define NVRAM_OB_START (sizeof(ohwcfg_v3_t) + sizeof(struct sparc_arch_cfg))
#define NVRAM_OB_SIZE ((NVRAM_IDPROM - NVRAM_OB_START) & ~15)
@@ -807,15 +807,6 @@
static void
ob_nvram_init(uint64_t base, uint64_t offset)
{
- extern uint32_t kernel_image;
- extern uint32_t kernel_size;
- extern uint32_t qemu_cmdline;
- extern uint32_t cmdline_size;
- extern char boot_device;
- extern char obp_stdin, obp_stdout;
- extern const char *obp_stdin_path, *obp_stdout_path;
- extern uint16_t graphic_depth;
-
const char *stdin, *stdout;
unsigned int i;
char nographic;
Modified: openbios-devel/drivers/timer.c
===================================================================
--- openbios-devel/drivers/timer.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/timer.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -79,7 +79,7 @@
* TODO: pass via lb table
*/
-unsigned long get_timer_freq()
+unsigned long get_timer_freq(void)
{
return 100000000 / 4;
}
Modified: openbios-devel/drivers/vga.h
===================================================================
--- openbios-devel/drivers/vga.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/drivers/vga.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -14,6 +14,8 @@
#ifndef VGA_H_INCL
#define VGA_H_INCL 1
+#include "video_subr.h"
+
//#include <cpu/p5/io.h>
#define u8 unsigned char
@@ -226,9 +228,4 @@
__u32 vmode; /* interlaced etc */
__u32 reserved[6]; /* Reserved for future compatibility */
};
-
-void vga_set_gmode (void);
-void vga_set_amode (void);
-void vga_font_load(unsigned char *vidmem, const unsigned char *font, int height,
- int num_chars);
#endif
Modified: openbios-devel/fs/grubfs/fsys_affs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_affs.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/grubfs/fsys_affs.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -235,10 +235,10 @@
#define rdsk(x) ((struct RigidDiskBlock *)(x)->blockbuffer)
#define part(x) ((struct PartitionBlock *)(x)->blockbuffer)
-struct FSysBuffer *fsysb;
-int blockoffset; /* offset if there is an embedded RDB partition */
-int rootb; /* block number of root block */
-int rdbb; /* block number of rdb block */
+static struct FSysBuffer *fsysb;
+static int blockoffset; /* offset if there is an embedded RDB partition */
+static int rootb; /* block number of root block */
+static int rdbb; /* block number of rdb block */
static void initCache(void)
{
@@ -357,7 +357,7 @@
{
disk_read_func = disk_read_hook;
cblock = getBlock(block);
- disk_read_func = 0;
+ disk_read_func = NULL;
block = AROS_BE2LONG(extensionBlock(cblock)->extension);
togo--;
}
@@ -383,7 +383,7 @@
len=fsysb->file.filesize-fsysb->file.current.offset;
disk_read_func = disk_read_hook;
cblock = getBlock(fsysb->file.current.block);
- disk_read_func = 0;
+ disk_read_func = NULL;
while (len)
{
disk_read_func = disk_read_hook;
@@ -427,7 +427,7 @@
fsysb->file.current.byte = 0;
fsysb->file.current.filekey--;
}
- disk_read_func = 0;
+ disk_read_func = NULL;
len -= size;
readbytes += size;
}
@@ -580,10 +580,9 @@
return 0;
}
+#ifndef STAGE1_5
static void checkPossibility(char *filename, char *bstr)
{
-
-#ifndef STAGE1_5
char cstr[32];
if (noCaseStrCmp(filename, bstr, 1)<=0)
@@ -594,8 +593,10 @@
cstr[bstr[0]]=0;
print_a_completion(cstr);
}
+}
+#else
+#define checkPossibility(a, b) do { } while(0)
#endif
-}
int affs_dir(char *dirname)
{
Modified: openbios-devel/fs/grubfs/fsys_ext2fs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_ext2fs.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/grubfs/fsys_ext2fs.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -468,7 +468,7 @@
devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
offset, size, buf);
- disk_read_func = 0;
+ disk_read_func = NULL;
buf += size;
len -= size;
Modified: openbios-devel/fs/grubfs/fsys_jfs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_jfs.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/grubfs/fsys_jfs.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -53,8 +53,8 @@
#define dtroot ((dtroot_t *)(&inode->di_btroot))
static ldtentry_t de_always[2] = {
- {1, -1, 2, {'.', '.'}},
- {1, -1, 1, {'.'}}
+ {1, -1, 2, {'.', '.'}, 0},
+ {1, -1, 1, {'.'}, 0}
};
static int
Modified: openbios-devel/fs/grubfs/fsys_reiserfs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_reiserfs.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/grubfs/fsys_reiserfs.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -691,12 +691,12 @@
blockNr, depth);
#endif /* REISERDEBUG */
if (! block_read (blockNr, 0, INFO->blocksize, cache))
- return 0;
+ return NULL;
/* Make sure it has the right node level */
if (BLOCKHEAD (cache)->blk_level != depth)
{
errnum = ERR_FSYS_CORRUPT;
- return 0;
+ return NULL;
}
INFO->blocks[depth] = blockNr;
Modified: openbios-devel/fs/grubfs/fsys_ufs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_ufs.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/grubfs/fsys_ufs.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -94,7 +94,7 @@
char sbbuf[SBLOCKSIZE]; /* superblock */
char secbuf[DEV_BSIZE]; /* for MBR/disklabel */
};
-struct dmadat *dmadat = (struct dmadat*)FSYS_BUF;
+static struct dmadat *dmadat = (struct dmadat*)FSYS_BUF;
#define SUPERBLOCK ((struct fs*)dmadat->sbbuf)
Modified: openbios-devel/fs/grubfs/fsys_vstafs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_vstafs.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/grubfs/fsys_vstafs.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -74,7 +74,7 @@
if (FILE_INFO->type != 2)
{
errnum = ERR_FILE_NOT_FOUND;
- return 0;
+ return NULL;
}
a1 = FILE_INFO->blocks;
@@ -105,8 +105,8 @@
}
else
{
- /* errnum =ERR_FILE_NOT_FOUND; */
- return 0;
+ /* errnum =ERR_FILE_NOT_FOUND; */
+ return NULL;
}
}
Modified: openbios-devel/fs/grubfs/grubfs_fs.c
===================================================================
--- openbios-devel/fs/grubfs/grubfs_fs.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/grubfs/grubfs_fs.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -57,34 +57,34 @@
static const struct fsys_entry fsys_table[] = {
# ifdef CONFIG_FSYS_FAT
- {"fat", fat_mount, fat_read, fat_dir, 0, 0},
+ {"fat", fat_mount, fat_read, fat_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_EXT2FS
- {"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, 0, 0},
+ {"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_MINIX
- {"minix", minix_mount, minix_read, minix_dir, 0, 0},
+ {"minix", minix_mount, minix_read, minix_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_REISERFS
- {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed},
+ {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, NULL, reiserfs_embed},
# endif
# ifdef CONFIG_FSYS_JFS
- {"jfs", jfs_mount, jfs_read, jfs_dir, 0, jfs_embed},
+ {"jfs", jfs_mount, jfs_read, jfs_dir, NULL, jfs_embed},
# endif
# ifdef CONFIG_FSYS_XFS
- {"xfs", xfs_mount, xfs_read, xfs_dir, 0, 0},
+ {"xfs", xfs_mount, xfs_read, xfs_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_UFS
- {"ufs", ufs_mount, ufs_read, ufs_dir, 0, ufs_embed},
+ {"ufs", ufs_mount, ufs_read, ufs_dir, NULL, ufs_embed},
# endif
# ifdef CONFIG_FSYS_ISO9660
- {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0},
+ {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_NTFS
- {"ntfs", ntfs_mount, ntfs_read, ntfs_dir, 0, 0},
+ {"ntfs", ntfs_mount, ntfs_read, ntfs_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_AFFS
- {"affs", affs_mount, affs_read, affs_dir, 0, 0},
+ {"affs", affs_mount, affs_read, affs_dir, NULL, NULL},
# endif
};
@@ -157,9 +157,10 @@
grubfs_file_read( file_desc_t *fd, void *buf, size_t count )
{
grubfile_t *file = (grubfile_t*)fd;
- curfs = (grubfs_t *)file->fs->fs_data;
- int ret;
+ int ret;
+ curfs = (grubfs_t *)file->fs->fs_data;
+
filepos=file->pos;
filemax=file->len;
@@ -186,8 +187,9 @@
open_path( fs_ops_t *fs, const char *path )
{
grubfile_t *ret = NULL;
+ char *s = (char *)path;
+
curfs = (grubfs_t *)fs->fs_data;
- char *s=(char *)path;
while(*s) {
if(*s=='\\') *s='/';
Modified: openbios-devel/fs/hfsplus/btree.c
===================================================================
--- openbios-devel/fs/hfsplus/btree.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/hfsplus/btree.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -114,12 +114,6 @@
{
return (node_buf*) (cache->buffers + (i * cache->nodebufsize));
}
-
-/* flush the cache NYI */
-static void node_cache_flush(node_cache* cache)
-{
- // NYI
-}
/* flush the node at index */
static void node_cache_flush_node(node_cache* cache, int index)
@@ -132,7 +126,6 @@
{
if (!cache->entries) // not (fully) intialized ?
return;
- node_cache_flush(cache);
free(cache->entries);
}
Modified: openbios-devel/fs/hfsplus/include/libhfsp.h
===================================================================
--- openbios-devel/fs/hfsplus/include/libhfsp.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/hfsplus/include/libhfsp.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -27,7 +27,6 @@
# include "hfs.h"
# include "hfsp.h"
-extern int errno;
/* Last error is eventually found here */
extern const char *hfsp_error;
Modified: openbios-devel/fs/hfsplus/volume.c
===================================================================
--- openbios-devel/fs/hfsplus/volume.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/fs/hfsplus/volume.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -114,8 +114,8 @@
*
* ToDo: add more consitency checks.
*/
-static int
-volume_readbuf(volume * vol, hfsp_vh* vh, char * p)
+static int
+volume_readbuf(hfsp_vh* vh, char * p)
{
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
HFSP_ERROR(-1, "This is not a HFS+ volume");
@@ -159,7 +159,7 @@
if( volume_readinbuf(vol, buf, block))
return -1;
- return volume_readbuf(vol, vh, buf);
+ return volume_readbuf(vh, buf);
}
/* Find out wether the volume is wrapped and unwrap it eventually */
@@ -200,7 +200,7 @@
}
else if( signature == HFSP_VOLHEAD_SIG) { /* Native HFS+ volume */
p = buf; // Restore to begin of block
- return volume_readbuf(vol, vh, p);
+ return volume_readbuf(vh, p);
} else
HFSP_ERROR(-1, "Neither Wrapper nor native HFS+ volume header found");
fail:
Modified: openbios-devel/include/elf_boot.h
===================================================================
--- openbios-devel/include/elf_boot.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/include/elf_boot.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -100,5 +100,6 @@
#define EB_IA64_IMAGE_HANDLE 0x00000007
#define EB_I386_MEMMAP 0x00000008
+extern const struct elf_image_note elf_image_notes;
#endif /* ELF_BOOT_H */
Modified: openbios-devel/include/libc/string.h
===================================================================
--- openbios-devel/include/libc/string.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/include/libc/string.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -17,6 +17,8 @@
#ifndef _H_STRING
#define _H_STRING
+#include "openbios/config.h"
+
#define bzero(s,n) memset( s, 0, n )
#define atol(nptr) strtol(nptr, NULL, 10 )
@@ -95,5 +97,6 @@
#define tolower(c) __tolower(c)
#define toupper(c) __toupper(c)
+extern int errno_int;
#endif /* _H_STRING */
Modified: openbios-devel/include/openbios/drivers.h
===================================================================
--- openbios-devel/include/openbios/drivers.h 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/include/openbios/drivers.h 2008-11-30 11:54:01 UTC (rev 274)
@@ -13,6 +13,7 @@
#ifdef CONFIG_DRIVER_PCI
int ob_pci_init(void);
+void macio_nvram_init(char *path, uint32_t addr);
#endif
#ifdef CONFIG_DRIVER_SBUS
int ob_sbus_init(uint64_t base, int machine_id);
@@ -38,6 +39,17 @@
int start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context,
int cpu);
extern struct mem cmem;
+extern uint16_t graphic_depth;
+extern volatile unsigned char *power_reg;
+extern volatile unsigned int *reset_reg;
+extern const char *obp_stdin_path, *obp_stdout_path;
+extern char obp_stdin, obp_stdout;
+extern volatile struct sun4m_timer_regs *counter_regs;
+extern uint32_t kernel_image;
+extern uint32_t kernel_size;
+extern uint32_t qemu_cmdline;
+extern uint32_t cmdline_size;
+extern char boot_device;
#endif
#ifdef CONFIG_DRIVER_FLOPPY
int ob_floppy_init(void);
Modified: openbios-devel/kernel/dict.c
===================================================================
--- openbios-devel/kernel/dict.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/kernel/dict.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -18,7 +18,7 @@
#include "cross.h"
-unsigned char *dict = 0;
+unsigned char *dict = NULL;
ucell *last;
cell dicthead = 0;
Modified: openbios-devel/kernel/internal.c
===================================================================
--- openbios-devel/kernel/internal.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/kernel/internal.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -24,7 +24,7 @@
* point behind the pointer.
*/
static ucell t[] = { DOCOL, 0, (ucell)(t+3), 0 };
-ucell *trampoline = t;
+static ucell *trampoline = t;
#endif
#ifndef CONFIG_DEBUG_INTERPRETER
@@ -287,7 +287,7 @@
#ifndef FCOMPILER
static ucell get_myself(void)
{
- static ucell **myself = 0;
+ static ucell **myself = NULL;
if( !myself )
myself = (ucell**)findword("my-self") + 1;
return (*myself && **myself) ? (ucell)**myself : 0;
Modified: openbios-devel/libc/misc.c
===================================================================
--- openbios-devel/libc/misc.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/libc/misc.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -17,7 +17,7 @@
#include "openbios/config.h"
#include "libc/string.h"
-int errno;
+int errno_int;
void
qsort( void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void*) )
Modified: openbios-devel/libc/string.c
===================================================================
--- openbios-devel/libc/string.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/libc/string.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -50,7 +50,7 @@
return (int)c1 - (int)c2;
}
-char * ___strtok;
+static char * ___strtok;
/**
* strcpy - Copy a %NUL terminated string
Modified: openbios-devel/libc/vsprintf.c
===================================================================
--- openbios-devel/libc/vsprintf.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/libc/vsprintf.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -63,7 +63,7 @@
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
- return 0;
+ return NULL;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
Modified: openbios-devel/modules/cmdline.c
===================================================================
--- openbios-devel/modules/cmdline.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/modules/cmdline.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -120,7 +120,7 @@
ci->buf[0] = 0;
if( !p )
- return 0;
+ return NULL;
for( len=0; len <= ci->ncol && p[len] != '\n' && p[len] ; len++ )
;
Modified: openbios-devel/modules/video.c
===================================================================
--- openbios-devel/modules/video.c 2008-11-29 19:31:28 UTC (rev 273)
+++ openbios-devel/modules/video.c 2008-11-30 11:54:01 UTC (rev 274)
@@ -41,11 +41,13 @@
static void
startup_splash( void )
{
+#ifdef CONFIG_MOL
int fd, s, i, y, x, dx, dy;
int width, height;
char *pp, *p;
char buf[64];
-
+#endif
+
/* only draw logo in 24-bit mode (for now) */
if( video.fb.depth < 15 )
return;
@@ -247,7 +249,7 @@
video_write(void)
{
char *addr;
- int i, len;
+ int len;
len = GETTOS();
addr = pop_fstr_copy();
1
0

r273 - in openbios-devel: arch/sparc32 arch/sparc64 drivers fs/grubfs fs/hfsplus include include/openbios libc
by svn@openbios.org Nov. 29, 2008
by svn@openbios.org Nov. 29, 2008
Nov. 29, 2008
Author: blueswirl
Date: 2008-11-29 20:31:28 +0100 (Sat, 29 Nov 2008)
New Revision: 273
Modified:
openbios-devel/arch/sparc32/elfload.c
openbios-devel/arch/sparc32/romvec.c
openbios-devel/arch/sparc64/elfload.c
openbios-devel/arch/sparc64/openbios.c
openbios-devel/drivers/floppy.c
openbios-devel/drivers/obio.c
openbios-devel/drivers/vga.h
openbios-devel/fs/grubfs/dir.h
openbios-devel/fs/grubfs/fsys_affs.c
openbios-devel/fs/grubfs/fsys_ext2fs.c
openbios-devel/fs/grubfs/fsys_vstafs.c
openbios-devel/fs/grubfs/fsys_xfs.c
openbios-devel/fs/hfsplus/btree.c
openbios-devel/fs/hfsplus/hfsp_fs.c
openbios-devel/fs/hfsplus/unicode.c
openbios-devel/fs/hfsplus/volume.c
openbios-devel/include/ofmem.h
openbios-devel/include/openbios/firmware_abi.h
openbios-devel/libc/diskio.c
Log:
Reduce warnings by 29%
Modified: openbios-devel/arch/sparc32/elfload.c
===================================================================
--- openbios-devel/arch/sparc32/elfload.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/arch/sparc32/elfload.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -308,7 +308,7 @@
Elf_phdr *phdr = NULL;
unsigned long phdr_size;
unsigned long checksum_offset;
- unsigned short checksum;
+ unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL;
int retval = -1;
int image_retval;
Modified: openbios-devel/arch/sparc32/romvec.c
===================================================================
--- openbios-devel/arch/sparc32/romvec.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/arch/sparc32/romvec.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -265,9 +265,9 @@
for (;;) {}
}
+extern volatile unsigned char *power_reg;
static void obp_abort(void)
{
- extern volatile unsigned char *power_reg;
printk("abort, power off\n");
*power_reg = 1;
@@ -277,8 +277,6 @@
static void obp_halt(void)
{
- extern volatile unsigned char *power_reg;
-
printk("halt, power off\n");
*power_reg = 1;
printk("power off failed\n");
Modified: openbios-devel/arch/sparc64/elfload.c
===================================================================
--- openbios-devel/arch/sparc64/elfload.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/arch/sparc64/elfload.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -307,7 +307,7 @@
Elf_phdr *phdr = NULL;
unsigned long phdr_size;
unsigned long checksum_offset;
- unsigned short checksum;
+ unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL;
int retval = -1;
int image_retval;
Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/arch/sparc64/openbios.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -58,14 +58,12 @@
static const struct hwdef hwdefs[] = {
{
- .pci.cfg_addr = PCI_CONFIG,
- .pci.cfg_data = 0,
- .pci.cfg_base = 0x80000000ULL,
- .pci.cfg_len = 0,
- .pci.mem_base = 0,
- .pci.mem_len = 0,
- .pci.io_base = 0,
- .pci.io_len = 0,
+ .pci = {
+ .cfg_addr = PCI_CONFIG,
+ .cfg_data = 0,
+ .cfg_base = 0x80000000ULL,
+ .cfg_len = 0,
+ },
.machine_id_low = 0,
.machine_id_high = 255,
},
Modified: openbios-devel/drivers/floppy.c
===================================================================
--- openbios-devel/drivers/floppy.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/drivers/floppy.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -223,7 +223,7 @@
static void floppy_reset(void);
-static int set_dor(int fdc, char mask, char data)
+static int set_dor(char mask, char data)
{
unsigned char newdor,olddor;
@@ -236,15 +236,6 @@
return olddor;
}
-
-static void bounce_motor(void)
-{
- /* Bounce the drive motor... */
- outb(fdc_state.dor & ~(0x10<<FD_DRIVE), FD_DOR);
- outb(fdc_state.dor, FD_DOR);
-}
-
-
/* waits until the fdc becomes ready */
static int wait_til_ready(void)
{
@@ -408,7 +399,7 @@
#endif
new_dor |= (1 << (drive + 4)); /* Spinup the selected drive */
new_dor |= drive; /* Select the drive for commands as well */
- set_dor(fdc, 0xc, new_dor);
+ set_dor(0xc, new_dor);
mdelay(DRIVE_H1440_SPINUP);
@@ -432,7 +423,7 @@
mask = 0xff;
mask &= ~(1 << (drive +4));
/* Now clear the bit in the Digital Output Register */
- set_dor(0, mask, 0);
+ set_dor(mask, 0);
}
/* Set the FDC's data transfer rate on behalf of the specified drive.
@@ -523,7 +514,6 @@
case 1:
dtr = 300;
if (fdc_state.version >= FDC_82078) {
- unsigned char cmd[3];
/* chose the default rate table, not the one
* where 1 = 2 Mbps */
cmd[0] = FD_DRIVESPEC;
@@ -553,9 +543,6 @@
if (srt > 0xf) {
srt = 0xf;
}
- if (srt < 0 ) {
- srt = 0;
- }
hlt = (head_load_time*scale_dtr/2 + NOMINAL_DTR - 1)/NOMINAL_DTR;
if (hlt < 0x01)
@@ -726,7 +713,6 @@
if (success)
drive_state[FD_DRIVE].track = track;
else {
- int i;
printk_debug("seek failed\n");
printk_debug("nr = %d\n", nr);
printk_debug("ST0 = %02x\n", reply[0]);
@@ -906,21 +892,23 @@
return -1;
}
-int floppy_read(char *dest, unsigned long offset, unsigned long length)
+static int floppy_read(char *dest, unsigned long offset, unsigned long length)
{
- int result, bytes_read;;
+ int fr_result, bytes_read;;
+
printk_debug("floppy_read\n");
bytes_read = 0;
do {
int max_errors = 3;
do {
- result = __floppy_read(dest + bytes_read, offset, length - bytes_read);
+ fr_result = __floppy_read(dest + bytes_read, offset,
+ length - bytes_read);
if (max_errors-- == 0) {
return (bytes_read)?bytes_read: -1;
}
- } while (result <= 0);
- offset += result;
- bytes_read += result;
+ } while (fr_result <= 0);
+ offset += fr_result;
+ bytes_read += fr_result;
} while(bytes_read < length);
return bytes_read;
}
@@ -1005,7 +993,7 @@
} /* get_fdc_version */
-int floppy_init(void)
+static int floppy_init(void)
{
printk_debug("floppy_init\n");
fdc_state.in_sync = 0;
@@ -1041,13 +1029,6 @@
fdc_state.in_sync = 1;
}
-void floppy_fini(void)
-{
- /* Disable the floppy and the floppy drive controller */
- set_dor(0, 0, 0);
-}
-
-
static void
ob_floppy_initialize(int *idx)
{
@@ -1068,7 +1049,7 @@
static void
ob_floppy_open(int *idx)
{
- int ret=1, len;
+ int ret = 1;
phandle_t ph;
fword("my-unit");
Modified: openbios-devel/drivers/obio.c
===================================================================
--- openbios-devel/drivers/obio.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/drivers/obio.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -831,7 +831,7 @@
ob_new_obio_device("eeprom", NULL);
- nvram = (char *)ob_reg(base, offset, NVRAM_SIZE, 1);
+ nvram = (unsigned char *)ob_reg(base, offset, NVRAM_SIZE, 1);
PUSH((unsigned long)nvram);
fword("encode-int");
Modified: openbios-devel/drivers/vga.h
===================================================================
--- openbios-devel/drivers/vga.h 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/drivers/vga.h 2008-11-29 19:31:28 UTC (rev 273)
@@ -227,4 +227,8 @@
__u32 reserved[6]; /* Reserved for future compatibility */
};
+void vga_set_gmode (void);
+void vga_set_amode (void);
+void vga_font_load(unsigned char *vidmem, const unsigned char *font, int height,
+ int num_chars);
#endif
Modified: openbios-devel/fs/grubfs/dir.h
===================================================================
--- openbios-devel/fs/grubfs/dir.h 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/grubfs/dir.h 2008-11-29 19:31:28 UTC (rev 273)
@@ -137,11 +137,5 @@
#ifndef NULL
#define NULL 0
#endif
-extern DIR *opendir ();
-extern struct direct *readdir ();
-extern int telldir ();
-extern void seekdir ();
-#define rewinddir(dirp) seekdir((dirp), (long)0)
-extern void closedir ();
#endif /* not KERNEL */
#endif /* _BOOT_UFS_DIR_H_ */
Modified: openbios-devel/fs/grubfs/fsys_affs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_affs.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/grubfs/fsys_affs.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -56,7 +56,7 @@
unsigned long pb_Flags;
unsigned long pb_Reserved1[2];
unsigned long pb_DevFlags;
- unsigned char pb_DriveName[32];
+ char pb_DriveName[32];
unsigned long pb_Reserved2[15];
unsigned long pb_Environment[20];
unsigned long pb_EReserved[12];
@@ -201,7 +201,7 @@
unsigned int filesize;
};
-#warning "Big vs. little endian for configure needed"
+//#warning "Big vs. little endian for configure needed"
#define AROS_BE2LONG(l) \
( \
((((unsigned long)(l)) >> 24) & 0x000000FFUL) | \
@@ -240,7 +240,8 @@
int rootb; /* block number of root block */
int rdbb; /* block number of rdb block */
-void initCache() {
+static void initCache(void)
+{
int i;
for (i=0;i<MAX_CACHE_BLOCKS;i++)
@@ -251,7 +252,8 @@
}
}
-struct CacheBlock *getBlock(unsigned int block) {
+static struct CacheBlock *getBlock(unsigned int block)
+{
struct CacheBlock *freeblock;
int i;
@@ -278,7 +280,8 @@
return freeblock;
}
-unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer) {
+static unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer)
+{
unsigned int sum=0,count=0;
for (count=0;count<SizeBlock;count++)
@@ -337,7 +340,8 @@
return 1;
}
-int seek(unsigned long offset) {
+static int seek(unsigned long offset)
+{
struct CacheBlock *cblock;
unsigned long block;
unsigned long togo;
@@ -391,7 +395,7 @@
{
cblock = getBlock(fsysb->file.current.block);
}
-#warning "else shouldn't occour"
+ //#warning "else shouldn't occour"
}
size = 512;
size -= fsysb->file.current.byte;
@@ -405,7 +409,7 @@
extensionBlock(cblock)->filekey_table
[fsysb->file.current.filekey]
)+blockoffset,
- fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
+ fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
);
fsysb->file.current.byte += size;
}
@@ -418,7 +422,7 @@
extensionBlock(cblock)->filekey_table
[fsysb->file.current.filekey]
)+blockoffset,
- fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
+ fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
);
fsysb->file.current.byte = 0;
fsysb->file.current.filekey--;
@@ -432,7 +436,8 @@
return readbytes;
}
-unsigned char capitalch(unsigned char ch, unsigned char flags) {
+static unsigned char capitalch(unsigned char ch, unsigned char flags)
+{
if ((flags==0) || (flags==1))
return (unsigned char)((ch>='a') && (ch<='z') ? ch-('a'-'A') : ch);
@@ -442,7 +447,8 @@
}
// str2 is a BCPL string
-int noCaseStrCmp(char *str1, char *str2, unsigned char flags) {
+static int noCaseStrCmp(char *str1, char *str2, unsigned char flags)
+{
unsigned char length;
length=str2++[0];
@@ -456,7 +462,8 @@
return (*str1) ? 1 : -1;
}
-unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags) {
+static unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags)
+{
unsigned int length;
length=0;
@@ -467,7 +474,8 @@
return length%tablesize;
}
-grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh) {
+static grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh)
+{
int key;
key = getHashKey(name, 72, 1);
@@ -501,8 +509,8 @@
return 0;
}
-char *copyPart(char *src, char *dst) {
-
+static char *copyPart(char *src, char *dst)
+{
while ((*src != '/') && (*src))
*dst++ = *src++;
if (*src == '/')
@@ -514,7 +522,8 @@
return src;
}
-grub_error_t findBlock(char *name, struct CacheBlock **dirh) {
+static grub_error_t findBlock(char *name, struct CacheBlock **dirh)
+{
char dname[32];
int block;
@@ -571,7 +580,8 @@
return 0;
}
-void checkPossibility(char *filename, char *bstr) {
+static void checkPossibility(char *filename, char *bstr)
+{
#ifndef STAGE1_5
char cstr[32];
@@ -668,7 +678,7 @@
fname = filename;
while (*fname)
*current++ = *fname++;
-#warning "TODO: add some more chars until posibilities differ"
+ //#warning "TODO: add some more chars until possibilities differ"
if (print_possibilities>0)
errnum = ERR_FILE_NOT_FOUND;
return (print_possibilities<0);
Modified: openbios-devel/fs/grubfs/fsys_ext2fs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_ext2fs.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/grubfs/fsys_ext2fs.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -587,7 +587,7 @@
log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
printf ("ext2fs_dir: inode table fsblock=%d\n", ino_blk);
#endif /* E2DEBUG */
- if (!ext2_rdfsb (ino_blk, INODE))
+ if (!ext2_rdfsb (ino_blk, (char *)INODE))
{
return 0;
}
Modified: openbios-devel/fs/grubfs/fsys_vstafs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_vstafs.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/grubfs/fsys_vstafs.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -30,8 +30,8 @@
#define FIRST_SECTOR ((struct first_sector *) FSYS_BUF)
-#define FILE_INFO ((struct fs_file *) (int) FIRST_SECTOR + 8192)
-#define DIRECTORY_BUF ((struct dir_entry *) (int) FILE_INFO + 512)
+#define FILE_INFO ((struct fs_file *) (long) FIRST_SECTOR + 8192)
+#define DIRECTORY_BUF ((struct dir_entry *) (long) FILE_INFO + 512)
#define ROOT_SECTOR 1
@@ -39,7 +39,6 @@
* In f_sector we store the sector number in which the information about
* the found file is.
*/
-extern int filepos;
static int f_sector;
int
@@ -63,7 +62,7 @@
}
static int curr_ext, current_direntry, current_blockpos;
-static struct alloc *a;
+static struct alloc *a1;
static struct dir_entry *
vstafs_readdir (long sector)
@@ -78,9 +77,9 @@
return 0;
}
- a = FILE_INFO->blocks;
+ a1 = FILE_INFO->blocks;
curr_ext = 0;
- devread (a[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
+ devread (a1[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
current_direntry = 11;
current_blockpos = 0;
@@ -93,7 +92,7 @@
if (current_direntry > 15)
{
current_direntry = 0;
- if (++current_blockpos > (a[curr_ext].a_len - 1))
+ if (++current_blockpos > (a1[curr_ext].a_len - 1))
{
current_blockpos = 0;
curr_ext++;
@@ -101,8 +100,8 @@
if (curr_ext < FILE_INFO->extents)
{
- devread (a[curr_ext].a_start + current_blockpos, 0,
- 512, (char *) DIRECTORY_BUF);
+ devread (a1[curr_ext].a_start + current_blockpos, 0,
+ 512, (char *) DIRECTORY_BUF);
}
else
{
@@ -188,35 +187,35 @@
int
vstafs_read (char *addr, int len)
{
- struct alloc *a;
+ struct alloc *a2;
int size, ret = 0, offset, curr_len = 0;
- int curr_ext;
+ int curr_ext2;
char extent;
int ext_size;
char *curr_pos;
get_file_info (f_sector);
size = FILE_INFO->len-VSTAFS_START_DATA;
- a = FILE_INFO->blocks;
+ a2 = FILE_INFO->blocks;
if (filepos > 0)
{
- if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA)
+ if (filepos < a2[0].a_len * 512 - VSTAFS_START_DATA)
{
offset = filepos + VSTAFS_START_DATA;
extent = 0;
- curr_len = a[0].a_len * 512 - offset - filepos;
+ curr_len = a2[0].a_len * 512 - offset - filepos;
}
else
{
- ext_size = a[0].a_len * 512 - VSTAFS_START_DATA;
+ ext_size = a2[0].a_len * 512 - VSTAFS_START_DATA;
offset = filepos - ext_size;
extent = 1;
do
{
curr_len -= ext_size;
offset -= ext_size;
- ext_size = a[extent+1].a_len * 512;
+ ext_size = a2[extent+1].a_len * 512;
}
while (extent < FILE_INFO->extents && offset>ext_size);
}
@@ -225,16 +224,16 @@
{
offset = VSTAFS_START_DATA;
extent = 0;
- curr_len = a[0].a_len * 512 - offset;
+ curr_len = a2[0].a_len * 512 - offset;
}
curr_pos = addr;
if (curr_len > len)
curr_len = len;
- for (curr_ext=extent;
- curr_ext < FILE_INFO->extents;
- curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++)
+ for (curr_ext2=extent;
+ curr_ext2 < FILE_INFO->extents;
+ curr_len = a2[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext2++)
{
ret += curr_len;
size -= curr_len;
@@ -244,7 +243,7 @@
curr_len += size;
}
- devread (a[curr_ext].a_start,offset, curr_len, curr_pos);
+ devread (a2[curr_ext2].a_start,offset, curr_len, curr_pos);
offset = 0;
}
Modified: openbios-devel/fs/grubfs/fsys_xfs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_xfs.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/grubfs/fsys_xfs.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -97,7 +97,7 @@
return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS);
}
-static inline __const__ __uint16_t
+static inline __uint16_t
le16 (__uint16_t x)
{
#ifdef __i386__
@@ -110,7 +110,7 @@
#endif
}
-static inline __const__ __uint32_t
+static inline __uint32_t
le32 (__uint32_t x)
{
#ifdef __i386__
@@ -130,7 +130,7 @@
#endif
}
-static inline __const__ __uint64_t
+static inline __uint64_t
le64 (__uint64_t x)
{
__uint32_t h = x >> 32;
@@ -195,7 +195,7 @@
}
#undef offsetof
-#define offsetof(t,m) ((int)&(((t *)0)->m))
+#define offsetof(t,m) ((long)&(((t *)0)->m))
static inline int
btroot_maxrecs (void)
Modified: openbios-devel/fs/hfsplus/btree.c
===================================================================
--- openbios-devel/fs/hfsplus/btree.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/hfsplus/btree.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -38,7 +38,7 @@
*
* return pointer after reading the structure
*/
-static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
+static void* btree_readnode(btree_node_desc* node, void *p)
{
node->next = bswabU32_inc(p);
node->prev = bswabU32_inc(p);
@@ -53,7 +53,7 @@
*
* return pointer after reading the structure
*/
-static void* btree_readhead(btree* bt, btree_head* head, void *p)
+static void* btree_readhead(btree_head* head, void *p)
{
UInt32 *q;
head->depth = bswabU16_inc(p);
@@ -153,7 +153,7 @@
return NULL; // evil ...
result->index = node_index;
- btree_readnode(bt, &result->desc, p);
+ btree_readnode(&result->desc, p);
e -> priority = result->desc.height * DEPTH_FACTOR;
e -> index = node_index;
@@ -229,10 +229,10 @@
HFSP_EXTENT_DATA, bt->cnid);
if (!p)
return -1;
- p = btree_readnode(bt, &node, p);
+ p = btree_readnode(&node, p);
if (node.kind != HFSP_NODE_HEAD)
return -1; // should not happen ?
- p = btree_readhead(bt, &bt->head, p);
+ p = btree_readhead(&bt->head, p);
node_size = bt->head.node_size;
bt->blkpernode = node_size / vol->blksize;
Modified: openbios-devel/fs/hfsplus/hfsp_fs.c
===================================================================
--- openbios-devel/fs/hfsplus/hfsp_fs.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/hfsplus/hfsp_fs.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -98,7 +98,7 @@
static int
match_file( record *r, record *parent, const void *match_data, hfsp_file_t *pt )
{
- unsigned char *p = (char*)match_data;
+ const char *p = (const char*)match_data;
char name[256];
int ret=1;
@@ -340,7 +340,7 @@
max -= t->pos - curpos;
}
size = (count-act_count > max)? max : count-act_count;
- memcpy( buf + act_count, &buf2[add], size );
+ memcpy( (char *)buf + act_count, &buf2[add], size );
curpos += blksize;
act_count += size;
Modified: openbios-devel/fs/hfsplus/unicode.c
===================================================================
--- openbios-devel/fs/hfsplus/unicode.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/hfsplus/unicode.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -79,8 +79,8 @@
register UInt16 length1 = ustr1->strlen;
register UInt16 length2 = ustr2->strlen;
register const UInt16* lowerCaseTable = gLowerCaseTable;
- register UInt16* str1 = ustr1->name;
- register UInt16* str2 = ustr2->name;
+ register const UInt16* str1 = ustr1->name;
+ register const UInt16* str2 = ustr2->name;
while (1) {
// Set default values for c1, c2 in case there are no more valid chars
Modified: openbios-devel/fs/hfsplus/volume.c
===================================================================
--- openbios-devel/fs/hfsplus/volume.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/fs/hfsplus/volume.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -115,7 +115,7 @@
* ToDo: add more consitency checks.
*/
static int
-volume_readbuf(volume * vol, hfsp_vh* vh, void* p)
+volume_readbuf(volume * vol, hfsp_vh* vh, char * p)
{
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
HFSP_ERROR(-1, "This is not a HFS+ volume");
@@ -168,7 +168,7 @@
{
UInt16 signature;
char buf[vol->blksize];
- void *p = buf;
+ char *p = buf;
if( volume_readinbuf(vol, buf, 2) ) // Wrapper or volume header starts here
return -1;
Modified: openbios-devel/include/ofmem.h
===================================================================
--- openbios-devel/include/ofmem.h 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/include/ofmem.h 2008-11-29 19:31:28 UTC (rev 273)
@@ -29,10 +29,4 @@
extern void ofmem_release( ulong virt, ulong size );
extern ulong ofmem_translate( ulong virt, ulong *ret_mode );
-/* allocations from the private pool */
-extern void *malloc( int size );
-extern void free( void *ptr );
-extern void *realloc( void *ptr, size_t size );
-
-
#endif /* _H_OFMEM */
Modified: openbios-devel/include/openbios/firmware_abi.h
===================================================================
--- openbios-devel/include/openbios/firmware_abi.h 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/include/openbios/firmware_abi.h 2008-11-29 19:31:28 UTC (rev 273)
@@ -139,7 +139,7 @@
}
static inline uint32_t
-OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const unsigned char *str)
+OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const char *str)
{
uint32_t len;
Modified: openbios-devel/libc/diskio.c
===================================================================
--- openbios-devel/libc/diskio.c 2008-11-29 16:24:51 UTC (rev 272)
+++ openbios-devel/libc/diskio.c 2008-11-29 19:31:28 UTC (rev 273)
@@ -108,7 +108,7 @@
push_str( filename );
call_package( fdp->reopen_xt, fdp->ih );
- ret = (POP() == -1)? 0:-1;
+ ret = (POP() == (ucell)-1)? 0 : -1;
return ret;
}
@@ -121,7 +121,7 @@
if( lookup_xt(fdp->ih, "open-nwrom", &fdp->open_nwrom_xt) )
return -1;
call_package( fdp->open_nwrom_xt, fdp->ih );
- return (POP() == -1)? 0:-1;
+ return (POP() == (ucell)-1)? 0 : -1;
}
ihandle_t
1
0

Nov. 29, 2008
Author: blueswirl
Date: 2008-11-29 17:24:51 +0100 (Sat, 29 Nov 2008)
New Revision: 272
Modified:
openbios-devel/arch/sparc64/aoutload.c
openbios-devel/arch/sparc64/elfload.c
openbios-devel/arch/sparc64/linux_load.c
openbios-devel/arch/sparc64/openbios.c
openbios-devel/drivers/floppy.c
openbios-devel/kernel/cross.h
openbios-devel/modules/client.c
Log:
Fix most print format warnings
Modified: openbios-devel/arch/sparc64/aoutload.c
===================================================================
--- openbios-devel/arch/sparc64/aoutload.c 2008-11-29 13:20:42 UTC (rev 271)
+++ openbios-devel/arch/sparc64/aoutload.c 2008-11-29 16:24:51 UTC (rev 272)
@@ -106,11 +106,11 @@
if (N_MAGIC(ehdr) == NMAGIC) {
if ((unsigned long)lfile_read((void *)start, ehdr.a_text) != ehdr.a_text) {
- printf("Can't read program text segment (size 0x%lx)\n", ehdr.a_text);
+ printf("Can't read program text segment (size 0x%x)\n", ehdr.a_text);
goto out;
}
if ((unsigned long)lfile_read((void *)(start + N_DATADDR(ehdr)), ehdr.a_data) != ehdr.a_data) {
- printf("Can't read program data segment (size 0x%lx)\n", ehdr.a_data);
+ printf("Can't read program data segment (size 0x%x)\n", ehdr.a_data);
goto out;
}
} else {
Modified: openbios-devel/arch/sparc64/elfload.c
===================================================================
--- openbios-devel/arch/sparc64/elfload.c 2008-11-29 13:20:42 UTC (rev 271)
+++ openbios-devel/arch/sparc64/elfload.c 2008-11-29 16:24:51 UTC (rev 272)
@@ -145,7 +145,7 @@
for (i = 0; i < phnum; i++) {
if (phdr[i].p_type != PT_LOAD)
continue;
- debug("segment %d addr:%#lx file:%#lx mem:%#lx ",
+ debug("segment %d addr:%#llx file:%#llx mem:%#llx ",
i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz);
file_seek(offset + phdr[i].p_offset);
debug("loading... ");
@@ -377,7 +377,7 @@
//debug("current time: %lu\n", currticks());
- debug("entry point is %#lx\n", addr_fixup(ehdr.e_entry));
+ debug("entry point is %#llx\n", addr_fixup(ehdr.e_entry));
printf("Jumping to entry point...\n");
#if 0
Modified: openbios-devel/arch/sparc64/linux_load.c
===================================================================
--- openbios-devel/arch/sparc64/linux_load.c 2008-11-29 13:20:42 UTC (rev 271)
+++ openbios-devel/arch/sparc64/linux_load.c 2008-11-29 16:24:51 UTC (rev 272)
@@ -574,7 +574,7 @@
ctx = switch_to(ctx);
/* It's impossible but... */
- printf("Returned with o0=%#lx\n", ctx->regs[REG_O0]);
+ printf("Returned with o0=%#llx\n", ctx->regs[REG_O0]);
return ctx->regs[REG_O0];
}
Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c 2008-11-29 13:20:42 UTC (rev 271)
+++ openbios-devel/arch/sparc64/openbios.c 2008-11-29 16:24:51 UTC (rev 272)
@@ -598,7 +598,7 @@
cmdline_size = size;
boot_device = nv_info.boot_devices[0];
- printk("kernel addr %lx size %lx\n", kernel_image, kernel_size);
+ printk("kernel addr %llx size %llx\n", kernel_image, kernel_size);
if (size)
printk("kernel cmdline %s\n", obio_cmdline);
Modified: openbios-devel/drivers/floppy.c
===================================================================
--- openbios-devel/drivers/floppy.c 2008-11-29 13:20:42 UTC (rev 271)
+++ openbios-devel/drivers/floppy.c 2008-11-29 16:24:51 UTC (rev 272)
@@ -938,7 +938,7 @@
if ((bytes = result(reply_buffer, MAX_REPLIES)) <= 0x00)
return FDC_NONE; /* No FDC present ??? */
if ((bytes==1) && (reply_buffer[0] == 0x80)){
- printk_info("FDC %d is an 8272A\n");
+ printk_info("FDC is an 8272A\n");
return FDC_8272A; /* 8272a/765 don't know DUMPREGS */
}
if (bytes != 10) {
Modified: openbios-devel/kernel/cross.h
===================================================================
--- openbios-devel/kernel/cross.h 2008-11-29 13:20:42 UTC (rev 271)
+++ openbios-devel/kernel/cross.h 2008-11-29 16:24:51 UTC (rev 272)
@@ -43,8 +43,8 @@
#define target_ulong(value) (target_long(value))
#if BITS==32
-#define target_ucell(value) (target_long(value))
-#define target_cell(value) (target_long(value))
+#define target_ucell(value) ((ucell)target_long(value))
+#define target_cell(value) ((cell)target_long(value))
#elif BITS==64
#ifdef NATIVE_BITWIDTH_LARGER_THAN_HOST_BITWIDTH
#define target_ucell(value) ( ((ucell)target_long((value)&0xffffffff))<<32 )
@@ -108,9 +108,14 @@
#ifdef NATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH
#define pointer2cell(x) ((ucell)(x))
#define cell2pointer(x) ((u8 *)(x))
+#if BITS==32
#define FMT_CELL_x "x"
#define FMT_CELL_d "d"
+#else
+#define FMT_CELL_x "lx"
+#define FMT_CELL_d "ld"
#endif
+#endif
#ifdef NATIVE_BITWIDTH_SMALLER_THAN_HOST_BITWIDTH
extern unsigned long base_address;
Modified: openbios-devel/modules/client.c
===================================================================
--- openbios-devel/modules/client.c 2008-11-29 13:20:42 UTC (rev 271)
+++ openbios-devel/modules/client.c 2008-11-29 16:24:51 UTC (rev 272)
@@ -97,7 +97,7 @@
if( (val=POP()) ) {
dstackcnt = dstacksave;
if( val == -1 )
- printk("Unimplemented service %s ([%d] -- [%d])\n",
+ printk("Unimplemented service %s ([%ld] -- [%ld])\n",
pb->service, pb->nargs, pb->nret );
return -1;
}
1
0
Author: blueswirl
Date: 2008-11-29 14:20:42 +0100 (Sat, 29 Nov 2008)
New Revision: 271
Modified:
openbios-devel/drivers/pci.c
Log:
Restore r257 (mostly)
Modified: openbios-devel/drivers/pci.c
===================================================================
--- openbios-devel/drivers/pci.c 2008-11-29 13:18:32 UTC (rev 270)
+++ openbios-devel/drivers/pci.c 2008-11-29 13:20:42 UTC (rev 271)
@@ -16,12 +16,12 @@
#include "openbios/config.h"
#include "openbios/bindings.h"
#include "openbios/kernel.h"
+#include "openbios/pci.h"
#include "libc/byteorder.h"
#include "libc/vsprintf.h"
#include "openbios/drivers.h"
#include "timer.h"
-#include "openbios/pci.h"
#include "pci.h"
#define set_bool_property(ph, name) set_property(ph, name, NULL, 0);
@@ -56,16 +56,1231 @@
{ "close", ob_pci_close },
};
-static int ob_pci_add_properties(pci_addr addr)
+/* PCI devices database */
+typedef struct pci_class_t pci_class_t;
+typedef struct pci_subclass_t pci_subclass_t;
+typedef struct pci_iface_t pci_iface_t;
+typedef struct pci_dev_t pci_dev_t;
+
+typedef struct pci_config_t pci_config_t;
+
+struct pci_config_t {
+ char path[64];
+ uint32_t regions[7];
+ uint32_t sizes[7];
+};
+
+struct pci_iface_t {
+ uint8_t iface;
+ const char *name;
+ const char *type;
+ const pci_dev_t *devices;
+ int (*config_cb)(const pci_config_t *config);
+ const void *private;
+};
+
+struct pci_subclass_t {
+ uint8_t subclass;
+ const char *name;
+ const char *type;
+ const pci_dev_t *devices;
+ const pci_iface_t *iface;
+ int (*config_cb)(const pci_config_t *config);
+ const void *private;
+};
+
+struct pci_class_t {
+ const char *name;
+ const char *type;
+ const pci_subclass_t *subc;
+};
+
+struct pci_dev_t {
+ uint16_t vendor;
+ uint16_t product;
+ const char *type;
+ const char *name;
+ const char *model;
+ const char *compat;
+ int acells;
+ int scells;
+ int icells;
+ int (*config_cb)(const pci_config_t *config);
+ const void *private;
+};
+
+/* Current machine description */
+
+typedef struct pci_bridge_t pci_bridge_t;
+
+/* Low level access helpers */
+struct pci_ops_t {
+ uint8_t (*config_readb)(pci_bridge_t *bridge,
+ uint8_t bus, uint8_t devfn, uint8_t offset);
+ void (*config_writeb)(pci_bridge_t *bridge,
+ uint8_t bus, uint8_t devfn,
+ uint8_t offset, uint8_t val);
+ uint16_t (*config_readw)(pci_bridge_t *bridge,
+ uint8_t bus, uint8_t devfn, uint8_t offset);
+ void (*config_writew)(pci_bridge_t *bridge,
+ uint8_t bus, uint8_t devfn,
+ uint8_t offset, uint16_t val);
+ uint32_t (*config_readl)(pci_bridge_t *bridge,
+ uint8_t bus, uint8_t devfn, uint8_t offset);
+ void (*config_writel)(pci_bridge_t *bridge,
+ uint8_t bus, uint8_t devfn,
+ uint8_t offset, uint32_t val);
+};
+
+static const pci_subclass_t undef_subclass[] = {
+#if 0
+ {
+ 0x00, "misc undefined", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+#endif
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static int ide_config_cb2 (const pci_config_t *config)
{
+#if 0
+ ide_init(config->path,
+ config->regions[0] & ~0x0000000F,
+ config->regions[1] & ~0x0000000F,
+ config->regions[2] & ~0x0000000F,
+ config->regions[3] & ~0x0000000F);
+#endif
+ return 0;
+}
+
+static const pci_dev_t ide_devices[] = {
+ {
+ 0x1095, 0x0646, /* CMD646 IDE controller */
+ "pci-ide", "pci-ata", NULL, NULL,
+ 0, 0, 0,
+ ide_config_cb2, NULL,
+ },
+ {
+ 0xFFFF, 0xFFFF,
+ NULL, NULL, NULL, NULL,
+ -1, -1, -1,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t mass_subclass[] = {
+ {
+ 0x00, "SCSI bus controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "IDE controller", "ide", ide_devices, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "Floppy disk controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x03, "IPI bus controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x04, "RAID controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x05, "ATA controller", "ata", NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc mass-storage controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_dev_t eth_devices[] = {
+ { 0x10EC, 0x8029,
+ NULL, "NE2000", "NE2000 PCI", NULL,
+ 0, 0, 0,
+ NULL, "ethernet",
+ },
+ {
+ 0xFFFF, 0xFFFF,
+ NULL, NULL, NULL, NULL,
+ -1, -1, -1,
+ NULL, NULL,
+ },
+};
+
+static void eth_config_cb (const pci_config_t *config)
+{
+ phandle_t ph;
+ cell props[12];
+ int i;
+
+ ph = find_dev(config->path);
+
+ set_property(ph, "network-type", "ethernet", 9);
+ set_property(ph, "removable", "network", 8);
+ set_property(ph, "category", "net", 4);
+
+ for (i = 0; i < 7; i++)
+ {
+ props[i*2] = config->regions[i];
+ props[i*2 + 1] = config->sizes[i];
+ }
+ set_property(ph, "reg", props, i * 2 * sizeof(cell));
+}
+
+static const pci_subclass_t net_subclass[] = {
+ {
+ 0x00, "ethernet controller", NULL, eth_devices, NULL,
+ eth_config_cb, "ethernet",
+ },
+ {
+ 0x01, "token ring controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "FDDI controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x03, "ATM controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x04, "ISDN controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x05, "WordFip controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x06, "PICMG 2.14 controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc network controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_dev_t vga_devices[] = {
+ {
+ 0x1002, 0x5046,
+ NULL, "ATY", "ATY Rage128", "VGA",
+ 0, 0, 0,
+ NULL, NULL,
+ },
+ {
+ 0x1234, 0x1111,
+ NULL, "QEMU,VGA", "Qemu VGA", "VGA",
+ 0, 0, 0,
+ NULL, NULL,
+ },
+ {
+ 0xFFFF, 0xFFFF,
+ NULL, NULL, NULL, NULL,
+ -1, -1, -1,
+ NULL, NULL,
+ },
+};
+
+/* VGA configuration */
+
+static int vga_config_cb (const pci_config_t *config)
+{
+#if 0
+ if (config->regions[0] != 0x00000000)
+ vga_vbe_init(config->path, config->regions[0], config->sizes[0],
+ config->regions[1], config->sizes[1]);
+#endif
+ return 0;
+}
+
+static const struct pci_iface_t vga_iface[] = {
+ {
+ 0x00, "VGA controller", NULL,
+ vga_devices, &vga_config_cb, NULL,
+ },
+ {
+ 0x01, "8514 compatible controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_subclass_t displ_subclass[] = {
+ {
+ 0x00, "display controller", NULL, NULL, vga_iface,
+ NULL, NULL,
+ },
+ {
+ 0x01, "XGA display controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "3D display controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc display controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t media_subclass[] = {
+ {
+ 0x00, "video device", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "audio device", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "computer telephony device", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc multimedia device", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t mem_subclass[] = {
+ {
+ 0x00, "RAM controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "flash controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_dev_t grackle_fake_bridge = {
+ 0xFFFF, 0xFFFF,
+ "pci", "pci-bridge", "DEC,21154", "DEC,21154.pci-bridge",
+ -1, -1, -1,
+ NULL, NULL,
+};
+
+static const pci_dev_t uninorth_agp_fake_bridge = {
+ 0xFFFF, 0xFFFF,
+ "uni-north-agp", "uni-north-agp", NULL, "uni-north-agp",
+ -1, -1, -1,
+ NULL, NULL,
+};
+
+static const pci_dev_t uninorth_fake_bridge = {
+ 0xFFFF, 0xFFFF,
+ "uni-north", "uni-north", NULL, "uni-north",
+ -1, -1, -1,
+ NULL, NULL,
+};
+
+
+static const pci_dev_t hbrg_devices[] = {
+ {
+ 0x106B, 0x0020, NULL,
+ "pci", "AAPL,UniNorth", "uni-north",
+ 3, 2, 1,
+ NULL, &uninorth_agp_fake_bridge,
+ },
+ {
+ 0x106B, 0x001F, NULL,
+ "pci", "AAPL,UniNorth", "uni-north",
+ 3, 2, 1,
+ NULL, &uninorth_fake_bridge,
+ },
+ {
+ 0x106B, 0x001E, NULL,
+ "pci", "AAPL,UniNorth", "uni-north",
+ 3, 2, 1,
+ NULL, &uninorth_fake_bridge,
+ },
+ {
+ 0x1057, 0x0002, "pci",
+ "pci", "MOT,MPC106", "grackle",
+ 3, 2, 1,
+ NULL, &grackle_fake_bridge,
+ },
+ {
+ 0x1057, 0x4801, NULL,
+ "pci-bridge", "PREP Host PCI Bridge - Motorola Raven", NULL,
+ 3, 2, 1,
+ NULL, NULL,
+ },
+ {
+ 0xFFFF, 0xFFFF,
+ NULL, NULL, NULL, NULL,
+ -1, -1, -1,
+ NULL, NULL,
+ },
+};
+
+static const pci_dev_t PCIbrg_devices[] = {
+ {
+ 0x1011, 0x0026, NULL,
+ "pci-bridge", NULL, NULL,
+ 3, 2, 1,
+ NULL, NULL,
+ },
+ {
+ 0xFFFF, 0xFFFF,
+ NULL, NULL, NULL, NULL,
+ -1, -1, -1,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t bridg_subclass[] = {
+ {
+ 0x00, "PCI host bridge", NULL, hbrg_devices, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "ISA bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "EISA bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x03, "MCA bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x04, "PCI-to-PCI bridge", NULL, PCIbrg_devices, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x05, "PCMCIA bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x06, "NUBUS bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x07, "cardbus bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x08, "raceway bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x09, "semi-transparent PCI-to-PCI bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x0A, "infiniband-to-PCI bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc PCI bridge", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_iface_t serial_iface[] = {
+ {
+ 0x00, "XT serial controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "16450 serial controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x02, "16550 serial controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x03, "16650 serial controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x04, "16750 serial controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x05, "16850 serial controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x06, "16950 serial controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_iface_t par_iface[] = {
+ {
+ 0x00, "parallel port", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "bi-directional parallel port", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x02, "ECP 1.x parallel port", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x03, "IEEE 1284 controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFE, "IEEE 1284 device", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_iface_t modem_iface[] = {
+ {
+ 0x00, "generic modem", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "Hayes 16450 modem", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x02, "Hayes 16550 modem", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x03, "Hayes 16650 modem", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x04, "Hayes 16750 modem", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_subclass_t comm_subclass[] = {
+ {
+ 0x00, "serial controller", NULL, NULL, serial_iface,
+ NULL, NULL,
+ },
+ {
+ 0x01, "parallel port", NULL, NULL, par_iface,
+ NULL, NULL,
+ },
+ {
+ 0x02, "multiport serial controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x03, "modem", NULL, NULL, modem_iface,
+ NULL, NULL,
+ },
+ {
+ 0x04, "GPIB controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x05, "smart card", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc communication device", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_iface_t pic_iface[] = {
+ {
+ 0x00, "8259 PIC", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "ISA PIC", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x02, "EISA PIC", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x10, "I/O APIC", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x20, "I/O APIC", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_iface_t dma_iface[] = {
+ {
+ 0x00, "8237 DMA controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "ISA DMA controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x02, "EISA DMA controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_iface_t tmr_iface[] = {
+ {
+ 0x00, "8254 system timer", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "ISA system timer", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x02, "EISA system timer", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_iface_t rtc_iface[] = {
+ {
+ 0x00, "generic RTC controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "ISA RTC controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_dev_t sys_devices[] = {
+ /* IBM MPIC controller */
+ {
+ 0x1014, 0x0002,
+ "open-pic", "MPIC", NULL, "chrp,open-pic",
+ 0, 0, 2,
+ NULL, NULL,
+ },
+ /* IBM MPIC2 controller */
+ {
+ 0x1014, 0xFFFF,
+ "open-pic", "MPIC2", NULL, "chrp,open-pic",
+ 0, 0, 2,
+ NULL, NULL,
+ },
+ {
+ 0xFFFF, 0xFFFF,
+ NULL, NULL, NULL, NULL,
+ -1, -1, -1,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t sys_subclass[] = {
+ {
+ 0x00, "PIC", NULL, NULL, pic_iface,
+ NULL, NULL,
+ },
+ {
+ 0x01, "DMA controller", NULL, NULL, dma_iface,
+ NULL, NULL,
+ },
+ {
+ 0x02, "system timer", NULL, NULL, tmr_iface,
+ NULL, NULL,
+ },
+ {
+ 0x03, "RTC controller", NULL, NULL, rtc_iface,
+ NULL, NULL,
+ },
+ {
+ 0x04, "PCI hotplug controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc system peripheral", NULL, sys_devices, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t inp_subclass[] = {
+ {
+ 0x00, "keyboard controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "digitizer", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "mouse controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x03, "scanner controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x04, "gameport controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc input device", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t dock_subclass[] = {
+ {
+ 0x00, "generic docking station", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc docking station", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t cpu_subclass[] = {
+ {
+ 0x00, "i386 processor", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "i486 processor", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "pentium processor", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x10, "alpha processor", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x20, "PowerPC processor", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x30, "MIPS processor", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x40, "co-processor", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_iface_t usb_iface[] = {
+ {
+ 0x00, "UHCI USB controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x10, "OHCI USB controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x20, "EHCI USB controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x80, "misc USB controller", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFE, "USB device", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_iface_t ipmi_iface[] = {
+ {
+ 0x00, "IPMI SMIC interface", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x01, "IPMI keyboard interface", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0x02, "IPMI block transfer interface", NULL,
+ NULL, NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL,
+ NULL, NULL, NULL,
+ },
+};
+
+static const pci_subclass_t ser_subclass[] = {
+ {
+ 0x00, "Firewire bus controller", "ieee1394", NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "ACCESS bus controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "SSA controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x03, "USB controller", "usb", NULL, usb_iface,
+ NULL, NULL,
+ },
+ {
+ 0x04, "fibre channel controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x05, "SMBus controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x06, "InfiniBand controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x07, "IPMI interface", NULL, NULL, ipmi_iface,
+ NULL, NULL,
+ },
+ {
+ 0x08, "SERCOS controller", NULL, NULL, ipmi_iface,
+ NULL, NULL,
+ },
+ {
+ 0x09, "CANbus controller", NULL, NULL, ipmi_iface,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t wrl_subclass[] = {
+ {
+ 0x00, "IRDA controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "consumer IR controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x10, "RF controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x11, "bluetooth controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x12, "broadband controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc wireless controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t sat_subclass[] = {
+ {
+ 0x01, "satellite TV controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x02, "satellite audio controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x03, "satellite voice controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x04, "satellite data controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t crypt_subclass[] = {
+ {
+ 0x00, "cryptographic network controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x10, "cryptographic entertainment controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc cryptographic controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_subclass_t spc_subclass[] = {
+ {
+ 0x00, "DPIO module", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x01, "performances counters", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x10, "communication synchronisation", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x20, "management card", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0x80, "misc signal processing controller", NULL, NULL, NULL,
+ NULL, NULL,
+ },
+ {
+ 0xFF, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ },
+};
+
+static const pci_class_t pci_classes[] = {
+ /* 0x00 */
+ { "undefined", NULL, undef_subclass, },
+ /* 0x01 */
+ { "mass-storage controller", NULL, mass_subclass, },
+ /* 0x02 */
+ { "network controller", "network", net_subclass, },
+ /* 0x03 */
+ { "display controller", "display", displ_subclass, },
+ /* 0x04 */
+ { "multimedia device", NULL, media_subclass, },
+ /* 0x05 */
+ { "memory controller", "memory-controller", mem_subclass, },
+ /* 0x06 */
+ { "PCI bridge", "pci", bridg_subclass, },
+ /* 0x07 */
+ { "communication device", NULL, comm_subclass,},
+ /* 0x08 */
+ { "system peripheral", NULL, sys_subclass, },
+ /* 0x09 */
+ { "input device", NULL, inp_subclass, },
+ /* 0x0A */
+ { "docking station", NULL, dock_subclass, },
+ /* 0x0B */
+ { "processor", NULL, cpu_subclass, },
+ /* 0x0C */
+ { "serial bus controller", NULL, ser_subclass, },
+ /* 0x0D */
+ { "wireless controller", NULL, wrl_subclass, },
+ /* 0x0E */
+ { "intelligent I/O controller", NULL, NULL, },
+ /* 0x0F */
+ { "satellite communication controller", NULL, sat_subclass, },
+ /* 0x10 */
+ { "cryptographic controller", NULL, crypt_subclass, },
+ /* 0x11 */
+ { "signal processing controller", NULL, spc_subclass, },
+};
+
+phandle_t pic_handle;
+static int macio_config_cb (const pci_config_t *config)
+{
+ char buf[64];
+ phandle_t ph;
+ cell props[2];
+
+ sprintf(buf, "%s/interrupt-controller", config->path);
+ REGISTER_NAMED_NODE(ob_pci_node, buf);
+
+ ph = find_dev(buf);
+ set_property(ph, "device_type", "interrupt-controller", 21);
+ set_property(ph, "compatible", "heathrow\0mac-risc", 18);
+ set_int_property(ph, "#interrupt-cells", 1);
+ props[0]= 0x10;
+ props[1]= 0x20;
+ set_property(ph, "reg", &props, sizeof(props));
+ pic_handle = ph;
+
+#if 0
+ cuda_init(config->path, config->regions[0]);
+ macio_nvram_init(config->path, config->regions[0]);
+ ide_init(config->path,
+ config->regions[0] + 0x1f000,
+ config->regions[0] + 0x1f000 + 0x1000,
+ config->regions[0] + 0x1f000 + 0x2000,
+ config->regions[0] + 0x1f000 + 0x3000);
+#endif
+#if 0
+ OF_finalize_pci_macio(device->common.OF_private,
+ device->regions[0] & ~0x0000000F, device->sizes[0],
+ private_data);
+#endif
+ return 0;
+}
+
+static const pci_dev_t misc_pci[] = {
+ /* Paddington Mac I/O */
+ {
+ 0x106B, 0x0017,
+ "mac-io", "mac-io", "AAPL,343S1211", "paddington\1heathrow",
+ 1, 1, 1,
+ &macio_config_cb, NULL,
+ },
+ /* KeyLargo Mac I/O */
+ {
+ 0x106B, 0x0022,
+ "mac-io", "mac-io", "AAPL,Keylargo", "Keylargo",
+ 1, 1, 2,
+ &macio_config_cb, NULL,
+ },
+ {
+ 0xFFFF, 0xFFFF,
+ NULL, NULL, NULL, NULL,
+ -1, -1, -1,
+ NULL, NULL,
+ },
+};
+
+static const pci_dev_t *pci_find_device (uint8_t class, uint8_t subclass,
+ uint8_t iface, uint16_t vendor,
+ uint16_t product)
+{
+ int (*config_cb)(pci_config_t *config);
+ const pci_class_t *pclass;
+ const pci_subclass_t *psubclass;
+ const pci_iface_t *piface;
+ const pci_dev_t *dev;
+ const void *private;
+ pci_dev_t *new;
+ const char *name, *type;
+
+ name = "unknown";
+ type = "unknown";
+ config_cb = NULL;
+ private = NULL;
+
+ if (class == 0x00 && subclass == 0x01) {
+ /* Special hack for old style VGA devices */
+ class = 0x03;
+ subclass = 0x00;
+ } else if (class == 0xFF) {
+ /* Special case for misc devices */
+ dev = misc_pci;
+ goto find_device;
+ }
+ if (class > (sizeof(pci_classes) / sizeof(pci_class_t))) {
+ name = "invalid PCI device";
+ type = "invalid";
+ goto bad_device;
+ }
+ pclass = &pci_classes[class];
+ name = pclass->name;
+ type = pclass->type;
+ for (psubclass = pclass->subc; ; psubclass++) {
+ if (psubclass->subclass == 0xFF)
+ goto bad_device;
+ if (psubclass->subclass == subclass) {
+ if (psubclass->name != NULL)
+ name = psubclass->name;
+ if (psubclass->type != NULL)
+ type = psubclass->type;
+ if (psubclass->config_cb != NULL) {
+ config_cb = psubclass->config_cb;
+ }
+ if (psubclass->private != NULL)
+ private = psubclass->private;
+ if (psubclass->iface != NULL)
+ break;
+ dev = psubclass->devices;
+ goto find_device;
+ }
+ }
+ for (piface = psubclass->iface; ; piface++) {
+ if (piface->iface == 0xFF) {
+ dev = psubclass->devices;
+ break;
+ }
+ if (piface->iface == iface) {
+ if (piface->name != NULL)
+ name = piface->name;
+ if (piface->type != NULL)
+ type = piface->type;
+ if (piface->config_cb != NULL) {
+ config_cb = piface->config_cb;
+ }
+ if (piface->private != NULL)
+ private = piface->private;
+ dev = piface->devices;
+ break;
+ }
+ }
+ find_device:
+ for (;; dev++) {
+ if (dev->vendor == 0xFFFF && dev->product == 0xFFFF) {
+ goto bad_device;
+ }
+ if (dev->vendor == vendor && dev->product == product) {
+ if (dev->name != NULL)
+ name = dev->name;
+ if (dev->type != NULL)
+ type = dev->type;
+ if (dev->config_cb != NULL) {
+ config_cb = dev->config_cb;
+ }
+ if (dev->private != NULL)
+ private = dev->private;
+ new = malloc(sizeof(pci_dev_t));
+ if (new == NULL)
+ return NULL;
+ new->vendor = vendor;
+ new->product = product;
+ new->type = type;
+ new->name = name;
+ new->model = dev->model;
+ new->compat = dev->compat;
+ new->config_cb = config_cb;
+ new->private = private;
+
+ return new;
+ }
+ }
+ bad_device:
+ printk("Cannot manage '%s' PCI device type '%s':\n %x %x (%x %x %x)\n",
+ name, type, vendor, product, class, subclass, iface);
+
+ return NULL;
+}
+
+#define set_bool_property(ph, name) set_property(ph, name, NULL, 0);
+
+
+static void ob_pci_add_properties(pci_addr addr, const pci_dev_t *pci_dev,
+ const pci_config_t *config)
+{
phandle_t dev=get_cur_dev();
int status,id;
+ uint16_t vendor_id, device_id;
+ uint8_t rev;
+ vendor_id = pci_config_read16(addr, PCI_VENDOR_ID);
+ device_id = pci_config_read16(addr, PCI_DEVICE_ID);
+ rev = pci_config_read8(addr, PCI_REVISION_ID);
+
/* create properties as described in 2.5 */
- set_int_property(dev, "vendor-id", pci_config_read16(addr, PCI_VENDOR_ID));
- set_int_property(dev, "device-id", pci_config_read16(addr, PCI_DEVICE_ID));
- set_int_property(dev, "revision-id", pci_config_read8(addr, PCI_REVISION_ID));
+ printk("%s\n", pci_dev->name);
+ set_int_property(dev, "vendor-id", vendor_id);
+ set_int_property(dev, "device-id", device_id);
+ set_int_property(dev, "revision-id", rev);
set_int_property(dev, "interrupts",
pci_config_read8(addr, PCI_INTERRUPT_LINE));
@@ -95,14 +1310,32 @@
set_int_property(dev, "cache-line-size",
pci_config_read16(addr, PCI_CACHE_LINE_SIZE));
+ if (pci_dev->type) {
+ push_str(pci_dev->type);
+ fword("encode-string");
+ push_str("device_type");
+ fword("property");
+ }
+ if (pci_dev->model) {
+ push_str(pci_dev->model);
+ fword("encode-string");
+ push_str("model");
+ fword("property");
+ }
+ push_str(pci_dev->name);
+ fword("encode-string");
+ push_str("class");
+ fword("property");
+ if (pci_dev->config_cb)
+ pci_dev->config_cb(config);
}
-static int ob_pci_add_reg(pci_addr addr)
+static void ob_pci_add_reg(pci_addr addr)
{
PUSH(0);
PUSH(0);
- PUSH(addr&(~0x80000000u));
+ PUSH(addr&(~arch->cfg_base));
fword("pci-addr-encode");
PUSH(0);
PUSH(0);
@@ -112,118 +1345,6 @@
fword("property");
}
-static int ob_pci_add_class(pci_addr addr)
-{
- unsigned int class;
- char *strc;
-
- class=pci_config_read16(addr, PCI_CLASS_DEVICE);
- switch (class) {
- case 0x001: strc="display"; break;
- case 0x100: strc="scsi"; break;
- case 0x101: strc="ide"; break;
- case 0x102: strc="fdc"; break;
- case 0x103: strc="ipi"; break;
- case 0x104: strc="raid"; break;
- case 0x200: strc="ethernet"; break;
- case 0x201: strc="token-ring"; break;
- case 0x202: strc="fddi"; break;
- case 0x203: strc="atm"; break;
- case 0x400: strc="video"; break;
- case 0x401: strc="sound"; break;
- case 0x500: strc="memory"; break;
- case 0x501: strc="flash"; break;
- case 0x600: strc="host"; break;
- case 0x601: strc="isa"; break;
- case 0x602: strc="eisa"; break;
- case 0x603: strc="mca"; break;
- case 0x604: strc="pci"; break;
- case 0x605: strc="pcmcia"; break;
- case 0x606: strc="nubus"; break;
- case 0x607: strc="cardbus"; break;
- case 0x680: strc="pmu"; break; /* not in pci binding */
- case 0x700: strc="serial"; break;
- case 0x701: strc="parallel"; break;
- case 0x703: strc="modem"; break; /* not in pci binding */
- case 0x800: strc="interrupt-controller"; break;
- case 0x801: strc="dma-controller"; break;
- case 0x802: strc="timer"; break;
- case 0x803: strc="rtc"; break;
- case 0x900: strc="keyboard"; break;
- case 0x901: strc="pen"; break;
- case 0x902: strc="mouse"; break;
- case 0xC00: strc="firewire"; break;
- case 0xC01: strc="access-bus"; break;
- case 0xC02: strc="ssa"; break;
- case 0xC03: strc="usb"; break;
- case 0xC04: strc="fibre-channel"; break;
- default:
- switch (class>>8) {
- case 0x3: strc="display"; break;
- case 0xA: strc="dock"; break;
- case 0xB: strc="cpu"; break;
- default:strc="unknown"; break;
- }
- }
- if ((class>>8) == 0x03) {
- push_str(strc);
- fword("encode-string");
- push_str("device_type");
- fword("property");
- }
- push_str(strc);
- fword("encode-string");
- push_str("class");
- fword("property");
-
-
-#ifdef CONFIG_DEBUG_PCI
- printk("%s\n", strc);
-#endif
-}
-
-static void
-pci_enable_rom(pci_addr dev)
-{
- u32 rom_addr;
-
- rom_addr=pci_config_read32(dev, PCI_ROM_ADDRESS);
- rom_addr |= PCI_ROM_ADDRESS_ENABLE;
- pci_config_write32(dev, PCI_ROM_ADDRESS, rom_addr);
-}
-
-static void
-pci_disable_rom(pci_addr dev)
-{
- u32 rom_addr;
-
- rom_addr=pci_config_read32(dev, PCI_ROM_ADDRESS);
- rom_addr &= ~PCI_ROM_ADDRESS_ENABLE;
- pci_config_write32(dev, PCI_ROM_ADDRESS, rom_addr);
-}
-
-
-static void ob_pci_scan_rom(pci_addr addr)
-{
- unsigned long rom_addr=pci_config_read32(addr,PCI_ROM_ADDRESS);
- unsigned char *walk;
-
- rom_addr &= PCI_ROM_ADDRESS_MASK;
- if(rom_addr) {
- printk(" ROM found at 0x%lx\n",rom_addr);
- pci_enable_rom(addr);
- walk=phys_to_virt((unsigned char *)rom_addr);
- if (walk[0]!=0x55 || walk[1]!=0xaa) {
- printk("no pci rom\n");
- goto rom_err;
- }
-
-rom_err:
- pci_disable_rom(addr);
- }
-
-}
-
#ifdef CONFIG_XBOX
static char pci_xbox_blacklisted (int bus, int devnum, int fn)
{
@@ -263,14 +1384,92 @@
}
#endif
-static void ob_scan_pci_bus(int bus, char *path)
+static void
+ob_pci_configure(pci_arch_t *addr, pci_config_t *config, uint32_t *mem_base,
+ uint32_t *io_base)
+
{
+ uint32_t smask, omask, amask, size, reloc, min_align;
+ uint32_t *base;
+ pci_addr config_addr;
+ int reg;
+
+ omask = 0x00000000;
+ for (reg = 0; reg < 7; reg++) {
+
+ config->regions[reg] = 0x00000000;
+ config->sizes[reg] = 0x00000000;
+
+ if ((omask & 0x0000000f) == 0x4) {
+ /* 64 bits memory mapping */
+ continue;
+ }
+
+ if (reg == 6)
+ config_addr = PCI_ROM_ADDRESS;
+ else
+ config_addr = PCI_BASE_ADDR_0 + reg * 4;
+
+ /* get region size */
+
+ pci_config_write32(addr, config_addr, 0xffffffff);
+ smask = pci_config_read32(addr, config_addr);
+ if (smask == 0x00000000 || smask == 0xffffffff)
+ continue;
+
+ if (smask & 0x00000001 && reg != 6) {
+ /* I/O space */
+ base = *io_base;
+ min_align = 1 << 7;
+ amask = 0x00000001;
+ pci_config_write16(addr, PCI_COMMAND,
+ pci_config_read16(addr,
+ PCI_COMMAND) |
+ PCI_COMMAND_IO);
+ } else {
+ /* Memory Space */
+ base = *mem_base;
+ min_align = 1 << 16;
+ amask = 0x0000000F;
+ if (reg == 6) {
+ smask |= 1; /* ROM */
+ }
+ pci_config_write16(addr, PCI_COMMAND,
+ pci_config_read16(addr,
+ PCI_COMMAND) |
+ PCI_COMMAND_MEMORY);
+ }
+ omask = smask & amask;
+ smask &= ~amask;
+ size = (~smask) + 1;
+ config->sizes[reg] = size;
+ reloc = base;
+ if (size < min_align)
+ size = min_align;
+ reloc = (reloc + size -1) & ~(size - 1);
+ if (*io_base == base) {
+ *io_base = reloc + size;
+ reloc -= arch->io_base;
+ } else {
+ *mem_base = reloc + size;
+ }
+ pci_config_write32(addr, config_addr, reloc | omask);
+ config->regions[reg] = reloc;
+printk("region %08x size %08x\n", config->regions[reg], config->sizes[reg]);
+ }
+}
+
+static void ob_scan_pci_bus(int bus, unsigned long *mem_base,
+ unsigned long *io_base, const char *path)
+{
int devnum, fn, is_multi, vid, did;
unsigned int htype;
pci_addr addr;
- char * nodetemp = "%s/pci%x,%x";
- char nodebuff[32];
phandle_t dnode, dbus;
+ pci_config_t config;
+ const pci_dev_t *pci_dev;
+ uint32_t ccode;
+ uint8_t class, subclass, iface, rev;
for (devnum = 0; devnum < 32; devnum++) {
is_multi = 0;
@@ -279,13 +1478,21 @@
if (pci_xbox_blacklisted (bus, devnum, fn))
continue;
#endif
-
addr = PCI_ADDR(bus, devnum, fn);
vid = pci_config_read16(addr, PCI_VENDOR_ID);
did = pci_config_read16(addr, PCI_DEVICE_ID);
if (vid==0xffff || vid==0)
continue;
+
+ ccode = pci_config_read16(addr, PCI_CLASS_DEVICE);
+ class = ccode >> 8;
+ subclass = ccode;
+ iface = pci_config_read8(addr, PCI_CLASS_PROG);
+ rev = pci_config_read8(addr, PCI_REVISION_ID);
+
+ pci_dev = pci_find_device(class, subclass, iface, vid, did);
+
#ifdef CONFIG_DEBUG_PCI
printk("%x:%x.%x - %x:%x - ", bus, devnum, fn,
vid, did);
@@ -297,35 +1504,49 @@
activate_device(path);
dbus=get_cur_dev();
- sprintf(nodebuff, nodetemp, path, vid, did);
+ if (pci_dev == NULL || pci_dev->name == NULL)
+ sprintf(config.path, "%s/pci%x,%x", path, vid, did);
+ else
+ sprintf(config.path, "%s/%s", path, pci_dev->name);
#ifdef CONFIG_DEBUG_PCI
- printk("%s - ", nodebuff);
+ printk("%s - ", config.path);
#endif
- REGISTER_NAMED_NODE(ob_pci_node, nodebuff);
- dnode=find_dev(nodebuff);
+ REGISTER_NAMED_NODE(ob_pci_node, config.path);
+ dnode=find_dev(config.path);
activate_dev( dnode );
-
- ob_pci_add_properties(addr);
+ ob_pci_configure(addr, &config, mem_base, io_base);
+{
+ int irq_pin, irq_line;
+ static const uint8_t heathrow_pci_irqs[4] = { 0x15, 0x16, 0x17, 0x18 };
+ irq_pin = pci_config_read8(addr, PCI_INTERRUPT_PIN);
+ if (irq_pin > 0) {
+ irq_pin = (devnum + irq_pin - 1) & 3;
+ irq_line = heathrow_pci_irqs[irq_pin];
+ }
+}
+ ob_pci_add_properties(addr, pci_dev, &config);
ob_pci_add_reg(addr);
- ob_pci_add_class(addr);
- ob_pci_scan_rom(addr);
device_end();
- activate_dev( dbus );
+
}
}
}
-
int ob_pci_init(void)
{
- char *path="/pci";
- int bus;
+ int bus;
+ unsigned long mem_base, io_base;
printk("Initializing PCI devices...\n");
-
+
/* brute force bus scan */
- for (bus=0; bus<0x100; bus++) {
- ob_scan_pci_bus(bus, path);
+
+ /* Find all PCI bridges */
+
+ mem_base = arch->mem_base;
+ io_base = arch->io_base;
+ for (bus = 0; bus<0x100; bus++) {
+ ob_scan_pci_bus(bus, &mem_base, &io_base, "/pci");
}
return 0;
}
1
0

r270 - in openbios-devel: arch/ppc/qemu arch/sparc64 drivers include/openbios include/ppc include/sparc64
by svn@openbios.org Nov. 29, 2008
by svn@openbios.org Nov. 29, 2008
Nov. 29, 2008
Author: blueswirl
Date: 2008-11-29 14:18:32 +0100 (Sat, 29 Nov 2008)
New Revision: 270
Modified:
openbios-devel/arch/ppc/qemu/init.c
openbios-devel/arch/sparc64/openbios.c
openbios-devel/drivers/pci.c
openbios-devel/drivers/pci.h
openbios-devel/include/openbios/pci.h
openbios-devel/include/ppc/pci.h
openbios-devel/include/sparc64/pci.h
Log:
Use pci_arch_t also on Sparc64 (but disable PCI probing for now, hangs)
Modified: openbios-devel/arch/ppc/qemu/init.c
===================================================================
--- openbios-devel/arch/ppc/qemu/init.c 2008-11-29 13:10:17 UTC (rev 269)
+++ openbios-devel/arch/ppc/qemu/init.c 2008-11-29 13:18:32 UTC (rev 270)
@@ -61,7 +61,6 @@
0xfe000000, 0x00800000, 0xfd000000, 0x01000000,
},
};
-pci_arch_t *arch;
uint32_t isa_io_base;
void
Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c 2008-11-29 13:10:17 UTC (rev 269)
+++ openbios-devel/arch/sparc64/openbios.c 2008-11-29 13:18:32 UTC (rev 270)
@@ -16,6 +16,8 @@
#include "openbios/nvram.h"
#include "sys_info.h"
#include "openbios.h"
+#include "openbios/pci.h"
+#include "asm/pci.h"
#include "libc/byteorder.h"
#define cpu_to_be16(x) __cpu_to_be16(x)
#include "openbios/firmware_abi.h"
@@ -30,6 +32,10 @@
#define BIOS_CFG_CMD 0x510
#define BIOS_CFG_DATA 0x511
+#define APB_SPECIAL_BASE 0x1fe00000000ULL
+#define PCI_CONFIG (APB_SPECIAL_BASE + 0x1000000ULL)
+#define APB_MEM_BASE 0x1ff00000000ULL
+
static unsigned char intdict[256 * 1024];
// XXX
@@ -45,6 +51,26 @@
static uint8_t idprom[32];
+struct hwdef {
+ pci_arch_t pci;
+ uint8_t machine_id_low, machine_id_high;
+};
+
+static const struct hwdef hwdefs[] = {
+ {
+ .pci.cfg_addr = PCI_CONFIG,
+ .pci.cfg_data = 0,
+ .pci.cfg_base = 0x80000000ULL,
+ .pci.cfg_len = 0,
+ .pci.mem_base = 0,
+ .pci.mem_len = 0,
+ .pci.io_base = 0,
+ .pci.io_len = 0,
+ .machine_id_low = 0,
+ .machine_id_high = 255,
+ },
+};
+
struct cpudef {
unsigned long iu_version;
const char *name;
@@ -818,9 +844,26 @@
static void
arch_init( void )
{
+ unsigned int i;
+ uint8_t qemu_machine_type;
+ const struct hwdef *hwdef;
+
+ outw(__cpu_to_le16(FW_CFG_MACHINE_ID), BIOS_CFG_CMD);
+ qemu_machine_type = inb(BIOS_CFG_DATA);
+
+ for (i = 0; i < sizeof(hwdefs) / sizeof(struct hwdef); i++) {
+ if (hwdefs[i].machine_id_low <= qemu_machine_type &&
+ hwdefs[i].machine_id_high >= qemu_machine_type) {
+ hwdef = &hwdefs[i];
+ break;
+ }
+ }
+ if (!hwdef)
+ for(;;); // Internal inconsistency, hang
+
modules_init();
#ifdef CONFIG_DRIVER_PCI
- ob_pci_init();
+ //ob_pci_init();
#endif
#ifdef CONFIG_DRIVER_IDE
setup_timers();
Modified: openbios-devel/drivers/pci.c
===================================================================
--- openbios-devel/drivers/pci.c 2008-11-29 13:10:17 UTC (rev 269)
+++ openbios-devel/drivers/pci.c 2008-11-29 13:18:32 UTC (rev 270)
@@ -29,6 +29,8 @@
/* DECLARE data structures for the nodes. */
DECLARE_UNNAMED_NODE( ob_pci_node, INSTALL_OPEN, 2*sizeof(int) );
+pci_arch_t *arch;
+
static void
ob_pci_open(int *idx)
{
Modified: openbios-devel/drivers/pci.h
===================================================================
--- openbios-devel/drivers/pci.h 2008-11-29 13:10:17 UTC (rev 269)
+++ openbios-devel/drivers/pci.h 2008-11-29 13:18:32 UTC (rev 270)
@@ -54,8 +54,6 @@
#define PCI_MIN_GNT 0x3e /* 8 bits */
#define PCI_MAX_LAT 0x3f /* 8 bits */
-typedef uint32_t pci_addr;
-
typedef struct {
u16 signature;
u8 reserved[0x16];
Modified: openbios-devel/include/openbios/pci.h
===================================================================
--- openbios-devel/include/openbios/pci.h 2008-11-29 13:10:17 UTC (rev 269)
+++ openbios-devel/include/openbios/pci.h 2008-11-29 13:18:32 UTC (rev 270)
@@ -1,22 +1,26 @@
#ifndef _H_PCI
#define _H_PCI
+typedef uint32_t pci_addr;
+
typedef struct pci_arch_t pci_arch_t;
struct pci_arch_t {
- char * name;
- uint16_t vendor_id;
- uint16_t device_id;
- uint32_t cfg_addr;
- uint32_t cfg_data;
- uint32_t cfg_base;
- uint32_t cfg_len;
- uint32_t mem_base;
- uint32_t mem_len;
- uint32_t io_base;
- uint32_t io_len;
- uint32_t rbase;
- uint32_t rlen;
+ const char * name;
+ uint16_t vendor_id;
+ uint16_t device_id;
+ unsigned long cfg_addr;
+ unsigned long cfg_data;
+ unsigned long cfg_base;
+ unsigned long cfg_len;
+ unsigned long mem_base;
+ unsigned long mem_len;
+ unsigned long io_base;
+ unsigned long io_len;
+ unsigned long rbase;
+ unsigned long rlen;
};
+extern pci_arch_t *arch;
+
#endif /* _H_PCI */
Modified: openbios-devel/include/ppc/pci.h
===================================================================
--- openbios-devel/include/ppc/pci.h 2008-11-29 13:10:17 UTC (rev 269)
+++ openbios-devel/include/ppc/pci.h 2008-11-29 13:18:32 UTC (rev 270)
@@ -3,7 +3,7 @@
#include "asm/io.h"
-#if !(PCI_CONFIG_1 || PCI_CONFIG_2)
+#if !(defined(PCI_CONFIG_1) || defined(PCI_CONFIG_2))
#define PCI_CONFIG_1 1 /* default */
#endif
@@ -11,8 +11,6 @@
/* PCI Configuration Mechanism #1 */
-extern pci_arch_t *arch;
-
#define PCI_ADDR(bus, dev, fn) \
((pci_addr) (arch->cfg_base \
| (uint32_t) (bus) << 16 \
Modified: openbios-devel/include/sparc64/pci.h
===================================================================
--- openbios-devel/include/sparc64/pci.h 2008-11-29 13:10:17 UTC (rev 269)
+++ openbios-devel/include/sparc64/pci.h 2008-11-29 13:18:32 UTC (rev 270)
@@ -11,10 +11,8 @@
/* 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 \
+ ((pci_addr) (arch->cfg_base \
| (uint32_t) (bus) << 16 \
| (uint32_t) (dev) << 11 \
| (uint32_t) (fn) << 8))
@@ -23,46 +21,47 @@
#define PCI_DEV(pcidev) ((uint8_t) ((pcidev) >> 11) & 0x1f)
#define PCI_FN(pcidev) ((uint8_t) ((pcidev) >> 8) & 7)
-#define APB_SPECIAL_BASE 0x1fe00000000ULL
-#define PCI_CONFIG (APB_SPECIAL_BASE + 0x1000000ULL)
-#define APB_MEM_BASE 0x1ff00000000ULL
-
static inline uint8_t pci_config_read8(pci_addr dev, uint8_t reg)
{
- out_le32((void *)PCI_CONFIG, dev | (reg & ~3));
- return in_8((void *)(APB_MEM_BASE | (reg & 3)));
+ uint8_t res;
+ out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3));
+ res = in_8((unsigned char*)(arch->cfg_data + (reg & 3)));
+ return res;
}
static inline uint16_t pci_config_read16(pci_addr dev, uint8_t reg)
{
- out_le32((void *)PCI_CONFIG, dev | (reg & ~3));
- return in_le16((void *)(APB_MEM_BASE | (reg & 2)));
+ uint16_t res;
+ out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3));
+ res = in_le16((unsigned short*)(arch->cfg_data + (reg & 2)));
+ return res;
}
static inline uint32_t pci_config_read32(pci_addr dev, uint8_t reg)
{
- out_le32((void *)PCI_CONFIG, dev | reg);
- return in_le32((void *)(APB_MEM_BASE | reg));
+ uint32_t res;
+ out_le32((unsigned *)arch->cfg_addr, dev | reg);
+ res = in_le32((unsigned *)(arch->cfg_data + reg));
+ return res;
}
static inline void pci_config_write8(pci_addr dev, uint8_t reg, uint8_t val)
{
- out_le32((void *)PCI_CONFIG, dev | (reg & ~3));
- out_8((void *)(APB_MEM_BASE | (reg & 3)), val);
+ out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3));
+ out_8((unsigned char*)(arch->cfg_data + (reg & 3)), val);
}
static inline void pci_config_write16(pci_addr dev, uint8_t reg, uint16_t val)
{
- out_le32((void *)PCI_CONFIG, dev | (reg & ~3));
- out_le16((void *)(APB_MEM_BASE | (reg & 2)), val);
+ out_le32((unsigned *)arch->cfg_addr, dev | (reg & ~3));
+ out_le16((unsigned short *)(arch->cfg_data + (reg & 2)), val);
}
static inline void pci_config_write32(pci_addr dev, uint8_t reg, uint32_t val)
{
- out_le32((void *)PCI_CONFIG, dev | reg);
- out_le32((void *)(APB_MEM_BASE | reg), val);
+ out_le32((unsigned *)arch->cfg_addr, dev | reg);
+ out_le32((unsigned *)(arch->cfg_data + reg), val);
}
-
#else /* !PCI_CONFIG_1 */
#error PCI Configuration Mechanism is not specified or implemented
#endif
1
0
Author: blueswirl
Date: 2008-11-29 14:10:17 +0100 (Sat, 29 Nov 2008)
New Revision: 269
Modified:
openbios-devel/kernel/bootstrap.c
Log:
Fix some warnings
Modified: openbios-devel/kernel/bootstrap.c
===================================================================
--- openbios-devel/kernel/bootstrap.c 2008-11-28 20:28:23 UTC (rev 268)
+++ openbios-devel/kernel/bootstrap.c 2008-11-29 13:10:17 UTC (rev 269)
@@ -411,7 +411,7 @@
static void builddefer(char *name)
{
fcreate(name, DODFR); /* see dict.h for DODFR and other CFA ids */
- writecell(0);
+ writecell((ucell)0);
writecell((ucell)findword("(semis)"));
}
@@ -611,7 +611,7 @@
writecell(LIT);
writecell(pointer2cell(dict) + loco);
writecell(LIT);
- writecell(cnt);
+ writecell((ucell)cnt);
writecell(DOBRANCH);
loco = cnt + sizeof(cell) - 1;
loco &= ~(sizeof(cell) - 1);
1
0