OpenBIOS
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- 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
October 2013
- 3 participants
- 6 discussions
Author: mcayland
Date: Mon Aug 19 09:40:12 2013
New Revision: 1209
URL: http://tracker.coreboot.org/trac/openbios/changeset/1209
Log:
SPARC32: fix romvec stdin/stdout field initialisation
Previously the romvec stdin/stdout ihandles were configured so that they were
set to the current stdin and stdout paths at initialisation time. Unfortunately
as stdin/stdout can be changed with the input and output words, they can end
up pointing to invalid ihandles causing a crash when trying to output to the
console.
Fix this by pointing the romvec structure to the address of the stdin/stdout
variables so that they are always in sync. Similarly we also resolve the
text path stdin/stdout variables at boot time to ensure that they will never
be stale.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
Modified:
trunk/openbios-devel/arch/sparc32/boot.c
trunk/openbios-devel/arch/sparc32/romvec.c
Modified: trunk/openbios-devel/arch/sparc32/boot.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/boot.c Mon Aug 19 09:40:10 2013 (r1208)
+++ trunk/openbios-devel/arch/sparc32/boot.c Mon Aug 19 09:40:12 2013 (r1209)
@@ -23,7 +23,7 @@
void go(void)
{
ucell address, type, size;
- int image_retval = 0, proplen, target, device;
+ int image_retval = 0, intprop, proplen, target, device;
phandle_t chosen;
char *prop, *id, *name;
static char bootpathbuf[128], bootargsbuf[128], buf[128];
@@ -40,8 +40,19 @@
needs to be set up to pass certain parameters using a C struct. Hence this section
extracts the relevant boot information and places it in obp_arg. */
- /* Get the name of the selected boot device, along with the device and unit number */
+ /* Get the stdin and stdout paths */
chosen = find_dev("/chosen");
+ intprop = get_int_property(chosen, "stdin", &proplen);
+ PUSH(intprop);
+ fword("get-instance-path");
+ ((struct linux_romvec *)romvec)->pv_stdin = pop_fstr_copy();
+
+ intprop = get_int_property(chosen, "stdout", &proplen);
+ PUSH(intprop);
+ fword("get-instance-path");
+ ((struct linux_romvec *)romvec)->pv_stdout = pop_fstr_copy();
+
+ /* Get the name of the selected boot device, along with the device and unit number */
prop = get_property(chosen, "bootpath", &proplen);
strncpy(bootpathbuf, prop, proplen);
prop = get_property(chosen, "bootargs", &proplen);
Modified: trunk/openbios-devel/arch/sparc32/romvec.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/romvec.c Mon Aug 19 09:40:10 2013 (r1208)
+++ trunk/openbios-devel/arch/sparc32/romvec.c Mon Aug 19 09:40:12 2013 (r1209)
@@ -25,7 +25,6 @@
#endif
char obp_stdin, obp_stdout;
-static int obp_fd_stdin, obp_fd_stdout;
const char *obp_stdin_path, *obp_stdout_path;
struct linux_arguments_v0 obp_arg;
@@ -498,15 +497,12 @@
romvec0.pv_v2bootargs.bootpath = &bootpath;
romvec0.pv_v2bootargs.bootargs = &obp_arg.argv[1];
- romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
- romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;
- push_str(obp_stdin_path);
- fword("open-dev");
- obp_fd_stdin = POP();
- push_str(obp_stdout_path);
- fword("open-dev");
- obp_fd_stdout = POP();
+ /* Point fd_stdin/fd_stdout to the Forth stdin/stdout variables */
+ fword("stdin");
+ romvec0.pv_v2bootargs.fd_stdin = cell2pointer(POP());
+ fword("stdout");
+ romvec0.pv_v2bootargs.fd_stdout = cell2pointer(POP());
romvec0.v3_memalloc = obp_memalloc_handler;
3
6
Oct. 31, 2013
If one is trying to compile openboot on Solaris using the Solaris C compiler the source code Makefiles' DFLAG settings will need to have "-Xs" added.
The code uses the word "restrict" in a prototype which is an ANSI C99 keyword.
------------------
More details
------------------
I was checking the options and trying to understand why an error was occuring on a valid prototype line and tried adding -Xt and eventually -Xs to the compiler options. It looks like it may be a C89/C90 versus C99 issue.
The compiler default appears to be ANSI C99 mode based upon this from the -flags output
-Xa Compile assuming ANSI C conformance, allow K & R extensions (default mode)
-Xc Compile assuming strict ANSI C conformance
-Xs Compile assuming (pre-ANSI) K & R C style code
-Xt Compile assuming K & R conformance, allow ANSI C
and in ./trunk/tools/fscope/fscope.h at line 120 this
search_t *build_searchlist(extract_t *info, search_t *root, int restrict);
appeared to be causing the error. When I added -Xs this warning was generated
"./fscope.h", line 120: warning: restrict is a keyword in ISO C99
instead of this error
"./fscope.h", line 120: Non-pointer types cannot be restrict qualified
The word argument "restrict" in the prototype appears to be culprit. I appear to have gotten a clean build Sun C 5.3.
1
0
[commit] r1232 - in trunk/openbios-devel: arch/ppc/qemu config/examples
by repository service Oct. 25, 2013
by repository service Oct. 25, 2013
Oct. 25, 2013
Author: mcayland
Date: Fri Oct 25 12:38:24 2013
New Revision: 1232
URL: http://tracker.coreboot.org/trac/openbios/changeset/1232
Log:
ppc: enable basic PReP serial console
This patch follows on from the previous patchsets and provides a basic PReP
serial console when launched under QEMU with -nographic. This is done by
including the PC serial driver as part of the PPC binary build and setting
up a prep_console_ops structure for use when PReP architecture is detected.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
CC: Andreas Färber <afaerber(a)suse.de>
CC: Hervé Poussineau <hpoussin(a)reactos.org>
Modified:
trunk/openbios-devel/arch/ppc/qemu/console.c
trunk/openbios-devel/arch/ppc/qemu/init.c
trunk/openbios-devel/arch/ppc/qemu/main.c
trunk/openbios-devel/config/examples/ppc_config.xml
Modified: trunk/openbios-devel/arch/ppc/qemu/console.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:24 2013 (r1232)
@@ -53,4 +53,36 @@
.getchar = mac_getchar
};
+static int prep_putchar(int c)
+{
+#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
+ uart_putchar(c & 0xff);
+#endif
+ return c;
+}
+
+static int prep_availchar(void)
+{
+#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
+ if (uart_charav(CONFIG_SERIAL_PORT))
+ return 1;
+#endif
+ return 0;
+}
+
+static int prep_getchar(void)
+{
+#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
+ if (uart_charav(CONFIG_SERIAL_PORT))
+ return (uart_getchar(CONFIG_SERIAL_PORT));
+#endif
+ return 0;
+}
+
+struct _console_ops prep_console_ops = {
+ .putchar = prep_putchar,
+ .availchar = prep_availchar,
+ .getchar = prep_getchar
+};
+
#endif // CONFIG_DEBUG_CONSOLE
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/init.c Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/arch/ppc/qemu/init.c Fri Oct 25 12:38:24 2013 (r1232)
@@ -163,7 +163,7 @@
};
unsigned long isa_io_base;
-extern struct _console_ops mac_console_ops;
+extern struct _console_ops mac_console_ops, prep_console_ops;
void
entry(void)
@@ -188,7 +188,11 @@
isa_io_base = arch->io_base;
#ifdef CONFIG_DEBUG_CONSOLE
- init_console(mac_console_ops);
+ if (is_apple()) {
+ init_console(mac_console_ops);
+ } else {
+ init_console(prep_console_ops);
+ }
#endif
if (temp != 1) {
@@ -658,6 +662,11 @@
ofmem_t *ofmem = ofmem_arch_get_private();
+ if (!is_apple()) {
+ /* Initialise PReP serial port */
+ ob_pc_serial_init("", "serial", arch->io_base, 0x3f8ULL, 0);
+ }
+
openbios_init();
modules_init();
setup_timers();
@@ -823,12 +832,17 @@
#endif
if (fw_cfg_read_i16(FW_CFG_NOGRAPHIC)) {
- if (CONFIG_SERIAL_PORT) {
- stdin_path = "scca";
- stdout_path = "scca";
+ if (is_apple()) {
+ if (CONFIG_SERIAL_PORT) {
+ stdin_path = "scca";
+ stdout_path = "scca";
+ } else {
+ stdin_path = "sccb";
+ stdout_path = "sccb";
+ }
} else {
- stdin_path = "sccb";
- stdout_path = "sccb";
+ stdin_path = "/serial";
+ stdout_path = "/serial";
}
/* Some bootloaders force the output to the screen device, so
Modified: trunk/openbios-devel/arch/ppc/qemu/main.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/main.c Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/arch/ppc/qemu/main.c Fri Oct 25 12:38:24 2013 (r1232)
@@ -22,6 +22,7 @@
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "kernel.h"
+#include "drivers/drivers.h"
#include "libopenbios/ofmem.h"
#define NO_QEMU_PROTOS
#include "arch/common/fw_cfg.h"
@@ -78,5 +79,7 @@
check_preloaded_kernel();
}
- update_nvram();
+ if (is_apple()) {
+ update_nvram();
+ }
}
Modified: trunk/openbios-devel/config/examples/ppc_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/ppc_config.xml Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/config/examples/ppc_config.xml Fri Oct 25 12:38:24 2013 (r1232)
@@ -8,6 +8,7 @@
<option name="CONFIG_DEBUG_INTERPRETER" type="boolean" value="false"/>
<option name="CONFIG_DEBUG_CONSOLE" type="boolean" value="true"/>
<option name="CONFIG_DEBUG_CONSOLE_SERIAL" type="boolean" value="true"/>
+ <option name="CONFIG_DRIVER_PC_SERIAL" type="boolean" value="true"/>
<option name="CONFIG_SERIAL_PORT" type="integer" value="0"/>
<option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/>
<option name="CONFIG_DEBUG_CONSOLE_VGA" type="boolean" value="true"/>
1
0
[commit] r1231 - in trunk/openbios-devel: arch/ppc/qemu arch/sparc32 arch/sparc64 drivers include/drivers
by repository service Oct. 25, 2013
by repository service Oct. 25, 2013
Oct. 25, 2013
Author: mcayland
Date: Fri Oct 25 12:38:14 2013
New Revision: 1231
URL: http://tracker.coreboot.org/trac/openbios/changeset/1231
Log:
escc/pc_serial: separate uart_* functions into separate namespaces
In order to allow architectures to support both ESCC and PC serial, add an
escc_ prefix to the ESCC serial functions so that they can both co-exist
within the same binary.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
CC: Andreas Färber <afaerber(a)suse.de>
CC: Hervé Poussineau <hpoussin(a)reactos.org>
Modified:
trunk/openbios-devel/arch/ppc/qemu/console.c
trunk/openbios-devel/arch/sparc32/console.c
trunk/openbios-devel/arch/sparc32/openbios.c
trunk/openbios-devel/arch/sparc64/console.c
trunk/openbios-devel/drivers/escc.c
trunk/openbios-devel/drivers/pc_serial.c
trunk/openbios-devel/include/drivers/drivers.h
Modified: trunk/openbios-devel/arch/ppc/qemu/console.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:08 2013 (r1230)
+++ trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:14 2013 (r1231)
@@ -24,7 +24,7 @@
static int mac_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- serial_putchar(c);
+ escc_uart_putchar(c & 0xff);
#endif
return c;
}
@@ -32,7 +32,7 @@
static int mac_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- if (uart_charav(CONFIG_SERIAL_PORT))
+ if (escc_uart_charav(CONFIG_SERIAL_PORT))
return 1;
#endif
return 0;
@@ -41,8 +41,8 @@
static int mac_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- if (uart_charav(CONFIG_SERIAL_PORT))
- return (uart_getchar(CONFIG_SERIAL_PORT));
+ if (escc_uart_charav(CONFIG_SERIAL_PORT))
+ return (escc_uart_getchar(CONFIG_SERIAL_PORT));
#endif
return 0;
}
Modified: trunk/openbios-devel/arch/sparc32/console.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/console.c Fri Oct 25 12:38:08 2013 (r1230)
+++ trunk/openbios-devel/arch/sparc32/console.c Fri Oct 25 12:38:14 2013 (r1231)
@@ -22,7 +22,7 @@
static int arch_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- serial_putchar(c);
+ escc_uart_putchar(c);
#endif
return c;
}
@@ -30,7 +30,7 @@
static int arch_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- if (uart_charav(CONFIG_SERIAL_PORT))
+ if (escc_uart_charav(CONFIG_SERIAL_PORT))
return 1;
#endif
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
@@ -43,8 +43,8 @@
static int arch_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- if (uart_charav(CONFIG_SERIAL_PORT))
- return (uart_getchar(CONFIG_SERIAL_PORT));
+ if (escc_uart_charav(CONFIG_SERIAL_PORT))
+ return (escc_uart_getchar(CONFIG_SERIAL_PORT));
#endif
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
if (keyboard_dataready())
Modified: trunk/openbios-devel/arch/sparc32/openbios.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/openbios.c Fri Oct 25 12:38:08 2013 (r1230)
+++ trunk/openbios-devel/arch/sparc32/openbios.c Fri Oct 25 12:38:14 2013 (r1231)
@@ -941,7 +941,7 @@
#endif
#ifdef CONFIG_DEBUG_CONSOLE
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- uart_init(hwdef->serial_base | (CONFIG_SERIAL_PORT? 0ULL: 4ULL),
+ escc_uart_init(hwdef->serial_base | (CONFIG_SERIAL_PORT? 0ULL: 4ULL),
CONFIG_SERIAL_SPEED);
#endif
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
Modified: trunk/openbios-devel/arch/sparc64/console.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/console.c Fri Oct 25 12:38:08 2013 (r1230)
+++ trunk/openbios-devel/arch/sparc64/console.c Fri Oct 25 12:38:14 2013 (r1231)
@@ -28,7 +28,7 @@
static int arch_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- serial_putchar(c);
+ uart_putchar(c);
#endif
return c;
}
Modified: trunk/openbios-devel/drivers/escc.c
==============================================================================
--- trunk/openbios-devel/drivers/escc.c Fri Oct 25 12:38:08 2013 (r1230)
+++ trunk/openbios-devel/drivers/escc.c Fri Oct 25 12:38:14 2013 (r1231)
@@ -11,7 +11,7 @@
* serial console functions
* ****************************************************************** */
-static volatile unsigned char *serial_dev;
+static volatile unsigned char *escc_serial_dev;
#define CTRL(addr) (*(volatile unsigned char *)(uintptr_t)(addr))
#ifdef CONFIG_DRIVER_ESCC_SUN
@@ -54,25 +54,25 @@
#define Rx_CH_AV 0x1 /* Rx Character Available */
#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */
-int uart_charav(uintptr_t port)
+int escc_uart_charav(uintptr_t port)
{
return (CTRL(port) & Rx_CH_AV) != 0;
}
-char uart_getchar(uintptr_t port)
+char escc_uart_getchar(uintptr_t port)
{
- while (!uart_charav(port))
+ while (!escc_uart_charav(port))
;
return DATA(port) & 0177;
}
-static void uart_putchar(uintptr_t port, unsigned char c)
+static void escc_uart_port_putchar(uintptr_t port, unsigned char c)
{
- if (!serial_dev)
+ if (!escc_serial_dev)
return;
if (c == '\n')
- uart_putchar(port, '\r');
+ escc_uart_port_putchar(port, '\r');
while (!(CTRL(port) & Tx_BUF_EMP))
;
DATA(port) = c;
@@ -102,31 +102,31 @@
}
-int uart_init(phys_addr_t port, unsigned long speed)
+int escc_uart_init(phys_addr_t port, unsigned long speed)
{
#ifdef CONFIG_DRIVER_ESCC_SUN
- serial_dev = (unsigned char *)ofmem_map_io(port & ~7ULL, ZS_REGS);
- serial_dev += port & 7ULL;
+ escc_serial_dev = (unsigned char *)ofmem_map_io(port & ~7ULL, ZS_REGS);
+ escc_serial_dev += port & 7ULL;
#else
- serial_dev = (unsigned char *)(uintptr_t)port;
+ escc_serial_dev = (unsigned char *)(uintptr_t)port;
#endif
- uart_init_line(serial_dev, speed);
+ uart_init_line(escc_serial_dev, speed);
return -1;
}
-void serial_putchar(int c)
+void escc_uart_putchar(int c)
{
- uart_putchar((uintptr_t)serial_dev, (unsigned char) (c & 0xff));
+ escc_uart_port_putchar((uintptr_t)escc_serial_dev, (unsigned char) (c & 0xff));
}
void serial_cls(void)
{
- serial_putchar(27);
- serial_putchar('[');
- serial_putchar('H');
- serial_putchar(27);
- serial_putchar('[');
- serial_putchar('J');
+ escc_uart_putchar(27);
+ escc_uart_putchar('[');
+ escc_uart_putchar('H');
+ escc_uart_putchar(27);
+ escc_uart_putchar('[');
+ escc_uart_putchar('J');
}
/* ( addr len -- actual ) */
@@ -142,8 +142,8 @@
if (len < 1)
printk("escc_read: bad len, addr %p len %x\n", addr, len);
- if (uart_charav(*address)) {
- *addr = (char)uart_getchar(*address);
+ if (escc_uart_charav(*address)) {
+ *addr = (char)escc_uart_getchar(*address);
PUSH(1);
} else {
PUSH(0);
@@ -161,7 +161,7 @@
addr = (unsigned char *)cell2pointer(POP());
for (i = 0; i < len; i++) {
- uart_putchar(*address, addr[i]);
+ escc_uart_port_putchar(*address, addr[i]);
}
PUSH(len);
}
@@ -194,7 +194,7 @@
free(args);
}
#else
- *address = (unsigned long)serial_dev; // XXX
+ *address = (unsigned long)escc_serial_dev; // XXX
#endif
RET ( -1 );
}
@@ -470,7 +470,7 @@
escc_add_channel(buf, "a", addr, 1);
escc_add_channel(buf, "b", addr, 0);
- serial_dev = (unsigned char *)addr + IO_ESCC_OFFSET +
+ escc_serial_dev = (unsigned char *)addr + IO_ESCC_OFFSET +
(CONFIG_SERIAL_PORT ? 0 : 0x20);
}
#endif
Modified: trunk/openbios-devel/drivers/pc_serial.c
==============================================================================
--- trunk/openbios-devel/drivers/pc_serial.c Fri Oct 25 12:38:08 2013 (r1230)
+++ trunk/openbios-devel/drivers/pc_serial.c Fri Oct 25 12:38:14 2013 (r1231)
@@ -40,10 +40,10 @@
return ((char) inb(RBR(port)) & 0177);
}
-static void uart_putchar(int port, unsigned char c)
+static void uart_port_putchar(int port, unsigned char c)
{
if (c == '\n')
- uart_putchar(port, '\r');
+ uart_port_putchar(port, '\r');
while (!(inb(LSR(port)) & 0x20));
outb(c, THR(port));
}
@@ -91,9 +91,9 @@
return -1;
}
-void serial_putchar(int c)
+void uart_putchar(int c)
{
- uart_putchar(CONFIG_SERIAL_PORT, (unsigned char) (c & 0xff));
+ uart_port_putchar(CONFIG_SERIAL_PORT, (unsigned char) (c & 0xff));
}
#endif
@@ -129,7 +129,7 @@
addr = (unsigned char *)POP();
for (i = 0; i < len; i++) {
- uart_putchar(*address, addr[i]);
+ uart_port_putchar(*address, addr[i]);
}
PUSH(len);
}
Modified: trunk/openbios-devel/include/drivers/drivers.h
==============================================================================
--- trunk/openbios-devel/include/drivers/drivers.h Fri Oct 25 12:38:08 2013 (r1230)
+++ trunk/openbios-devel/include/drivers/drivers.h Fri Oct 25 12:38:14 2013 (r1231)
@@ -109,13 +109,13 @@
int uart_init(int port, unsigned long speed);
int uart_charav(int port);
char uart_getchar(int port);
-void serial_putchar(int c);
+void uart_putchar(int c);
#endif
#ifdef CONFIG_DRIVER_ESCC
-int uart_init(phys_addr_t port, unsigned long speed);
-int uart_charav(uintptr_t port);
-char uart_getchar(uintptr_t port);
-void serial_putchar(int c);
+int escc_uart_init(phys_addr_t port, unsigned long speed);
+int escc_uart_charav(uintptr_t port);
+char escc_uart_getchar(uintptr_t port);
+void escc_uart_putchar(int c);
void serial_cls(void);
#ifdef CONFIG_DRIVER_ESCC_SUN
int keyboard_dataready(void);
1
0
[commit] r1230 - in trunk/openbios-devel: arch/amd64 arch/ppc/qemu arch/sparc32 arch/sparc64 arch/unix arch/x86 include/libopenbios libopenbios
by repository service Oct. 25, 2013
by repository service Oct. 25, 2013
Oct. 25, 2013
Author: mcayland
Date: Fri Oct 25 12:38:08 2013
New Revision: 1230
URL: http://tracker.coreboot.org/trac/openbios/changeset/1230
Log:
libopenbios: move console selection from compile-time to runtime
Some architectures require different console configurations depending upon the
machine type. This commit moves the console handlers into a struct _console_ops
structure held within libopenbios and switches all our supported architectures
over to use it.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
CC: Andreas Färber <afaerber(a)suse.de>
CC: Hervé Poussineau <hpoussin(a)reactos.org>
Added:
trunk/openbios-devel/include/libopenbios/console.h
trunk/openbios-devel/libopenbios/console.c
- copied, changed from r1229, trunk/openbios-devel/arch/ppc/qemu/console.c
Modified:
trunk/openbios-devel/arch/amd64/console.c
trunk/openbios-devel/arch/amd64/openbios.c
trunk/openbios-devel/arch/ppc/qemu/console.c
trunk/openbios-devel/arch/ppc/qemu/init.c
trunk/openbios-devel/arch/sparc32/console.c
trunk/openbios-devel/arch/sparc32/openbios.c
trunk/openbios-devel/arch/sparc64/console.c
trunk/openbios-devel/arch/sparc64/openbios.c
trunk/openbios-devel/arch/unix/unix.c
trunk/openbios-devel/arch/x86/console.c
trunk/openbios-devel/arch/x86/openbios.c
trunk/openbios-devel/libopenbios/build.xml
Modified: trunk/openbios-devel/arch/amd64/console.c
==============================================================================
--- trunk/openbios-devel/arch/amd64/console.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/amd64/console.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -361,7 +361,7 @@
* common functions, implementing simple concurrent console
* ****************************************************************** */
-int putchar(int c)
+int arch_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
serial_putchar(c);
@@ -372,7 +372,7 @@
return c;
}
-int availchar(void)
+int arch_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -385,7 +385,7 @@
return 0;
}
-int getchar(void)
+int arch_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -408,5 +408,10 @@
#endif
}
+struct _console_ops arch_console_ops = {
+ .putchar = arch_putchar,
+ .availchar = arch_availchar,
+ .getchar = arch_getchar
+};
#endif // CONFIG_DEBUG_CONSOLE
Modified: trunk/openbios-devel/arch/amd64/openbios.c
==============================================================================
--- trunk/openbios-devel/arch/amd64/openbios.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/amd64/openbios.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -50,9 +50,12 @@
bind_func("platform-boot", boot );
}
+extern struct _console_ops arch_console_ops;
+
int openbios(void)
{
#ifdef CONFIG_DEBUG_CONSOLE
+ init_console(arch_console_ops);
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
uart_init(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED);
#endif
Modified: trunk/openbios-devel/arch/ppc/qemu/console.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/console.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -13,6 +13,7 @@
#include "config.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "drivers/drivers.h"
#ifdef CONFIG_DEBUG_CONSOLE
@@ -20,7 +21,7 @@
* common functions, implementing simple concurrent console
* ****************************************************************** */
-int putchar(int c)
+static int mac_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
serial_putchar(c);
@@ -28,7 +29,7 @@
return c;
}
-int availchar(void)
+static int mac_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -37,7 +38,7 @@
return 0;
}
-int getchar(void)
+static int mac_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -45,4 +46,11 @@
#endif
return 0;
}
+
+struct _console_ops mac_console_ops = {
+ .putchar = mac_putchar,
+ .availchar = mac_availchar,
+ .getchar = mac_getchar
+};
+
#endif // CONFIG_DEBUG_CONSOLE
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/init.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/ppc/qemu/init.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -23,6 +23,7 @@
#include "config.h"
#include "libopenbios/openbios.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "drivers/pci.h"
#include "arch/common/nvram.h"
#include "drivers/drivers.h"
@@ -162,6 +163,8 @@
};
unsigned long isa_io_base;
+extern struct _console_ops mac_console_ops;
+
void
entry(void)
{
@@ -184,6 +187,10 @@
isa_io_base = arch->io_base;
+#ifdef CONFIG_DEBUG_CONSOLE
+ init_console(mac_console_ops);
+#endif
+
if (temp != 1) {
printk("Incompatible configuration device version, freezing\n");
for (;;) {
Modified: trunk/openbios-devel/arch/sparc32/console.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/console.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/sparc32/console.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -9,6 +9,7 @@
#include "kernel/kernel.h"
#include "drivers/drivers.h"
#include "openbios.h"
+#include "libopenbios/console.h"
#include "libopenbios/ofmem.h"
#include "libopenbios/video.h"
@@ -18,7 +19,7 @@
* common functions, implementing simple concurrent console
* ****************************************************************** */
-int putchar(int c)
+static int arch_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
serial_putchar(c);
@@ -26,7 +27,7 @@
return c;
}
-int availchar(void)
+static int arch_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -39,7 +40,7 @@
return 0;
}
-int getchar(void)
+static int arch_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -52,4 +53,10 @@
return 0;
}
+struct _console_ops arch_console_ops = {
+ .putchar = arch_putchar,
+ .availchar = arch_availchar,
+ .getchar = arch_getchar
+};
+
#endif // CONFIG_DEBUG_CONSOLE
Modified: trunk/openbios-devel/arch/sparc32/openbios.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/openbios.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/sparc32/openbios.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -9,6 +9,7 @@
#include "config.h"
#include "libopenbios/openbios.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "drivers/drivers.h"
#include "asm/types.h"
#include "dict.h"
@@ -913,6 +914,8 @@
setup_uuid();
}
+extern struct _console_ops arch_console_ops;
+
int openbios(void)
{
unsigned int i;
@@ -927,6 +930,9 @@
if (!hwdef)
for(;;); // Internal inconsistency, hang
+#ifdef CONFIG_DEBUG_CONSOLE
+ init_console(arch_console_ops);
+#endif
/* Make sure we setup OFMEM before the MMU as we need malloc() to setup page tables */
ofmem_init();
Modified: trunk/openbios-devel/arch/sparc64/console.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/console.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/sparc64/console.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -7,6 +7,7 @@
#include "config.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "kernel/kernel.h"
#include "drivers/drivers.h"
#include "libopenbios/fontdata.h"
@@ -24,7 +25,7 @@
* common functions, implementing simple concurrent console
* ****************************************************************** */
-int putchar(int c)
+static int arch_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
serial_putchar(c);
@@ -32,7 +33,7 @@
return c;
}
-int availchar(void)
+static int arch_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -45,7 +46,7 @@
return 0;
}
-int getchar(void)
+static int arch_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -58,4 +59,10 @@
return 0;
}
+struct _console_ops arch_console_ops = {
+ .putchar = arch_putchar,
+ .availchar = arch_availchar,
+ .getchar = arch_getchar
+};
+
#endif // CONFIG_DEBUG_CONSOLE
Modified: trunk/openbios-devel/arch/sparc64/openbios.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/openbios.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/sparc64/openbios.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -9,6 +9,7 @@
#include "config.h"
#include "libopenbios/openbios.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "drivers/drivers.h"
#include "dict.h"
#include "arch/common/nvram.h"
@@ -577,6 +578,8 @@
unsigned long isa_io_base;
+extern struct _console_ops arch_console_ops;
+
int openbios(void)
{
unsigned int i;
@@ -598,6 +601,7 @@
for(;;); // Internal inconsistency, hang
#ifdef CONFIG_DEBUG_CONSOLE
+ init_console(arch_console_ops);
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
uart_init(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED);
#endif
Modified: trunk/openbios-devel/arch/unix/unix.c
==============================================================================
--- trunk/openbios-devel/arch/unix/unix.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/unix/unix.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -32,6 +32,7 @@
#include "kernel/stack.h"
#include "arch/unix/plugins.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "libopenbios/openbios.h"
#include "openbios-version.h"
@@ -179,7 +180,7 @@
* functions used by primitives
*/
-int availchar(void)
+static int unix_availchar(void)
{
int tmp = getc(stdin);
if (tmp != EOF) {
@@ -189,6 +190,23 @@
return 0;
}
+static int unix_putchar(int c)
+{
+ putc(c, stdout);
+ return c;
+}
+
+static int unix_getchar(void)
+{
+ return getc(stdin);
+}
+
+static struct _console_ops unix_console_ops = {
+ .putchar = unix_putchar,
+ .availchar = unix_availchar,
+ .getchar = unix_getchar
+};
+
u8 inb(u32 reg)
{
#ifdef CONFIG_PLUGINS
@@ -498,6 +516,9 @@
return 1;
}
+ /* Initialise console */
+ init_console(unix_console_ops);
+
if ((dict = (unsigned char *) malloc(DICTIONARY_SIZE)) == NULL) {
printk("panic: not enough memory.\n");
return 1;
Modified: trunk/openbios-devel/arch/x86/console.c
==============================================================================
--- trunk/openbios-devel/arch/x86/console.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/x86/console.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -8,6 +8,7 @@
#include "config.h"
#include "kernel/kernel.h"
#include "openbios.h"
+#include "libopenbios/console.h"
#ifdef CONFIG_DEBUG_CONSOLE
@@ -361,7 +362,7 @@
* common functions, implementing simple concurrent console
* ****************************************************************** */
-int putchar(int c)
+static int arch_putchar(int c)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
serial_putchar(c);
@@ -372,7 +373,7 @@
return c;
}
-int availchar(void)
+static int arch_availchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -385,7 +386,7 @@
return 0;
}
-int getchar(void)
+static int arch_getchar(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
if (uart_charav(CONFIG_SERIAL_PORT))
@@ -408,5 +409,10 @@
#endif
}
+struct _console_ops arch_console_ops = {
+ .putchar = arch_putchar,
+ .availchar = arch_availchar,
+ .getchar = arch_getchar
+};
#endif // CONFIG_DEBUG_CONSOLE
Modified: trunk/openbios-devel/arch/x86/openbios.c
==============================================================================
--- trunk/openbios-devel/arch/x86/openbios.c Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/arch/x86/openbios.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -9,6 +9,7 @@
#include "config.h"
#include "libopenbios/openbios.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "asm/types.h"
#include "dict.h"
#include "kernel/kernel.h"
@@ -75,9 +76,12 @@
bind_func("(go)", go );
}
+extern struct _console_ops arch_console_ops;
+
int openbios(void)
{
#ifdef CONFIG_DEBUG_CONSOLE
+ init_console(arch_console_ops);
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
uart_init(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED);
#endif
Added: trunk/openbios-devel/include/libopenbios/console.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/openbios-devel/include/libopenbios/console.h Fri Oct 25 12:38:08 2013 (r1230)
@@ -0,0 +1,25 @@
+/*
+ * <console.h>
+ *
+ * Shared console routines
+ *
+ * Copyright (C) 2013 Mark Cave-Ayland (mark.cave-ayland(a)ilande.co.uk)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation
+ *
+ */
+
+#ifndef _H_CONSOLE
+#define _H_CONSOLE
+
+struct _console_ops {
+ int (*putchar)(int c);
+ int (*availchar)(void);
+ int (*getchar)(void);
+};
+
+void init_console(struct _console_ops ops);
+
+#endif /* _H_CONSOLE */
Modified: trunk/openbios-devel/libopenbios/build.xml
==============================================================================
--- trunk/openbios-devel/libopenbios/build.xml Fri Sep 13 16:16:01 2013 (r1229)
+++ trunk/openbios-devel/libopenbios/build.xml Fri Oct 25 12:38:08 2013 (r1230)
@@ -6,6 +6,7 @@
<object source="bootcode_load.c" condition="LOADER_BOOTCODE"/>
<object source="bootinfo_load.c" condition="LOADER_BOOTINFO"/>
<object source="client.c"/>
+ <object source="console.c"/>
<object source="elf_info.c" />
<object source="elf_load.c" condition="LOADER_ELF"/>
<object source="font_8x8.c" condition="FONT_8X8"/>
Copied and modified: trunk/openbios-devel/libopenbios/console.c (from r1229, trunk/openbios-devel/arch/ppc/qemu/console.c)
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/console.c Fri Sep 13 16:16:01 2013 (r1229, copy source)
+++ trunk/openbios-devel/libopenbios/console.c Fri Oct 25 12:38:08 2013 (r1230)
@@ -4,6 +4,7 @@
* Simple text console
*
* Copyright (C) 2005 Stefan Reinauer <stepan(a)openbios.org>
+ * Copyright (C) 2013 Mark Cave-Ayland <mark.cave-ayland(a)ilande.co.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -13,36 +14,55 @@
#include "config.h"
#include "libopenbios/bindings.h"
+#include "libopenbios/console.h"
#include "drivers/drivers.h"
-#ifdef CONFIG_DEBUG_CONSOLE
/* ******************************************************************
* common functions, implementing simple concurrent console
* ****************************************************************** */
+/* Dummy routines for when console is unassigned */
+
+static int dummy_putchar(int c)
+{
+ return c;
+}
+
+static int dummy_availchar(void)
+{
+ return 0;
+}
+
+static int dummy_getchar(void)
+{
+ return 0;
+}
+
+struct _console_ops console_ops = {
+ .putchar = dummy_putchar,
+ .availchar = dummy_availchar,
+ .getchar = dummy_getchar
+};
+
+#ifdef CONFIG_DEBUG_CONSOLE
+
+void init_console(struct _console_ops ops)
+{
+ console_ops = ops;
+}
+
int putchar(int c)
{
-#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- serial_putchar(c);
-#endif
- return c;
+ return (*console_ops.putchar)(c);
}
int availchar(void)
{
-#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- if (uart_charav(CONFIG_SERIAL_PORT))
- return 1;
-#endif
- return 0;
+ return (*console_ops.availchar)();
}
int getchar(void)
{
-#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
- if (uart_charav(CONFIG_SERIAL_PORT))
- return (uart_getchar(CONFIG_SERIAL_PORT));
-#endif
- return 0;
+ return (*console_ops.getchar)();
}
-#endif // CONFIG_DEBUG_CONSOLE
+#endif // CONFIG_DEBUG_CONSOLE
1
0
This patchset, when applied against Hervé's QEMU raven branch, provides a basic
serial console for PReP machines when launched from QEMU with -nographic.
There is still some further work to be done with setting up a proper ISA bridge
device but it seemed worthwhile handling the required console changes first as
a self-contained patchset.
Mark Cave-Ayland (3):
libopenbios: move console selection from compile-time to runtime
escc/pc_serial: separate uart_* functions into separate namespaces
ppc: enable basic PReP serial console
openbios-devel/arch/amd64/console.c | 11 ++--
openbios-devel/arch/amd64/openbios.c | 3 ++
openbios-devel/arch/ppc/qemu/console.c | 50 ++++++++++++++++--
openbios-devel/arch/ppc/qemu/init.c | 31 +++++++++--
openbios-devel/arch/ppc/qemu/main.c | 5 +-
openbios-devel/arch/sparc32/console.c | 21 +++++---
openbios-devel/arch/sparc32/openbios.c | 8 ++-
openbios-devel/arch/sparc64/console.c | 15 ++++--
openbios-devel/arch/sparc64/openbios.c | 4 ++
openbios-devel/arch/unix/unix.c | 23 ++++++++-
openbios-devel/arch/x86/console.c | 12 +++--
openbios-devel/arch/x86/openbios.c | 4 ++
openbios-devel/config/examples/ppc_config.xml | 1 +
openbios-devel/drivers/escc.c | 50 +++++++++---------
openbios-devel/drivers/pc_serial.c | 10 ++--
openbios-devel/include/drivers/drivers.h | 10 ++--
openbios-devel/include/libopenbios/console.h | 25 +++++++++
openbios-devel/libopenbios/build.xml | 1 +
openbios-devel/libopenbios/console.c | 68 +++++++++++++++++++++++++
19 files changed, 287 insertions(+), 65 deletions(-)
create mode 100644 openbios-devel/include/libopenbios/console.h
create mode 100644 openbios-devel/libopenbios/console.c
--
1.7.10.4
1
3