Skip to contentSkip to conversation

Accessing the serial port from proll

Qemu-devel Blue Swirl 2 participants 3 messages Nov 20, 2005

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Hi,

I guess you are not using Qemu's -nographic option. The flag is passed on to Proll, which then initialises either serial port or frame buffer accordingly.

For example, the following code echoes serial port data back:

qemu/main.c 2005-11-20 08:50:57.000000000 +0000 renamed from qemu/main.c 2005-08-14 10:07:48.000000000 +0000 +7 -0
diff -ru proll-patch-16/qemu/main.c proll-patch-16b/qemu/main.c
@@ -79,6 +79,13 @@
       ram_size = ld_bypass(PHYS_JJ_EEPROM + 0x30);
       printk("%d MB total\n", ram_size/(1024*1024));
 
+       for (;;) {
+               int ch;
+
+               ch = vcon_zs_getch(&dp0);
+               vcon_zs_putch(&dp0, ch);
+       }
+
       bb.nbanks = 1;
       bb.bankv[0].start = 0;
       bb.bankv[0].length = ram_size;

I think serial loader would be nice addition, though there is already CD/HD (no FD) and network boot options. If you don't care about Sun OBP compatibility, I'd suggest reusing GDB remote debugging code.

Or are you trying to use Proll on Sparc64? In that case the serial port is not Zilog one, but PC-compatible (vcons_su).

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

#1 lore raw

Hi,

Thanks for the help. I've actually tried using the function you suggest, but gotten the following error:

sparc-elf-gcc -O1 -W -Wall -DPROLBASE=0xffd00000 -DPROLDATA=0xffd0b000 -DPROLRODATA=0xffd08000 -D__ANSI__=1 -I../src -mcpu=hypersparc -Wa,-xarch=v8 -g -DQEMU -m32 -fno-builtin -c main.c
sparc-elf-ld -N -Ttext 0xffd00000 --section-start .rodata=0xffd08000 -Tdata 0xffd0b000 -Tbss 0xffd0b000 -o proll.elf head.o wuf.o wof.o main.o printf.o le.o system_qemu.o iommu.o arp.o netinit.o bootp.o packet.o tftp.o udp.o sched_4m.o openprom.o vconsole.o hconsole.o rconsole.o vcons_zs.o esp.o
sparc-elf-ld: section .rodata [00000000ffd08000 -> 00000000ffd0a129] overlaps section .text [00000000ffd00000 -> 00000000ffd08077]
sparc-elf-ld: proll.elf: section .rodata lma 0xffd08000 overlaps previous sections
make: *** [proll.elf] Error 1

However when I tried your code snippet it works fine. It seems that it only works if I call that function from an infinite loop (big loop or loops with a break statement don't compile either), which is driving me nuts. Do you know why this is?

Also, some additional background info. I am actually using the -nographic option. This project is for a grad class on computer architecture. The prof. says he has a sparc processor implemented on an fpga and wants to load linux on it, but it doesn't have a hard drive or network connection, so that is why I'm writing a serial loader.

-Doug

author
#2 lore raw
Quoted 1 line

sparc-elf-ld: section .rodata [00000000ffd08000 -> 00000000ffd0a129] overlaps section .text [00000000ffd00000 -> 00000000ffd08077]

This means that the space reserved for code is full. You can adjust it like this:

qemu/Makefile 2005-11-20 12:23:46.000000000 +0000 renamed from qemu/Makefile 2005-08-14 10:25:06.000000000 +0000 +0 -0
diff -ru proll-patch-16/qemu/Makefile proll-patch-16b/qemu/Makefile
@@ -27,8 +27,8 @@
# want to shift it to form a PGD entry. A relocatable label will not work.
# Linux kernel expects us to be at LINUX_OPPROM_BEGVM <asm-sparc/openprom.h>.
PROLBASE =   0xffd00000
-PROLRODATA = 0xffd08000
-PROLDATA =   0xffd0b000
+PROLRODATA = 0xffd09000
+PROLDATA =   0xffd0c000
PROLSIZE = 240*1024

# Linux

Quoted 1 line

Also, some additional background info. I am actually using the -nographic option. This project is for a grad class on computer architecture. The prof. says he has a sparc processor implemented on an fpga and wants to load linux on it, but it doesn't have a hard drive or network connection, so that is why I'm writing a serial loader.

Real serial port hardware needs a bit more initialising than Qemu, for example programming the baud rate. In the original JavaStation case where Proll was first used, the real OBP did this before Proll booted, so Proll didn't have to do everything.

There are probably other similar gaps elsewhere, like setting up DRAM controllers, clearing special boot modes, initialising bridge devices, loading firmware etc. If you have complete specs for the hardware, these should not be too difficult to add if even necessary.

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/