--- src/sys/boot/i386/boot2/Attic/sio.s 2003/11/10 06:08:35 1.3 +++ src/sys/boot/i386/boot2/Attic/sio.s 2004/06/26 23:41:06 1.4 @@ -29,18 +29,20 @@ # void sio_init(void) sio_init: movw $SIO_PRT+0x3,%dx # Data format reg - movb $SIO_FMT|0x80,%al # Set format - outb %al,(%dx) # and DLAB - pushl %edx # Save - subb $0x3,%dl # Divisor latch reg - movw $SIO_DIV,%ax # Set - outw %ax,(%dx) # BPS - popl %edx # Restore - movb $SIO_FMT,%al # Clear - outb %al,(%dx) # DLAB - incl %edx # Modem control reg - movb $0x3,%al # Set RTS, - outb %al,(%dx) # DTR + movb $SIO_FMT|0x80,%al # Set format and DLAB + outb %al,(%dx) # BASE+3 + subb $0x3,%dl + movw $SIO_DIV,%ax # divisor + outw %ax,(%dx) # BASE+0 (divisor w/ DLAB set) + movw $SIO_PRT+0x2,%dx + movb $0x01,%al # Enable FIFO + outb %al,(%dx) # BASE+2 + incl %edx + movb $SIO_FMT,%al # Clear DLAB + outb %al,(%dx) # BASE+3 + incl %edx + movb $0x3,%al # RTS+DTR + outb %al,(%dx) # BASE+4 incl %edx # Line status reg # void sio_flush(void) @@ -48,21 +50,21 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data sio_flush.0: call sio_getc.1 # Get character sio_flush: call sio_ischar # Check for character jnz sio_flush.0 # Till none - ret # To caller + ret # void sio_putc(int c) sio_putc: movw $SIO_PRT+0x5,%dx # Line status reg - xor %ecx,%ecx # Timeout - movb $0x40,%ch # counter -sio_putc.1: inb (%dx),%al # Transmitter - testb $0x20,%al # buffer empty? + movb $0x40,%ch # Timeout counter. Allow %cl + # to contain garbage. +sio_putc.1: inb (%dx),%al # Transmitter buffer empty? + testb $0x20,%al loopz sio_putc.1 # No jz sio_putc.2 # If timeout movb 0x4(%esp,1),%al # Get character subb $0x5,%dl # Transmitter hold reg outb %al,(%dx) # Write character -sio_putc.2: ret $0x4 # To caller +sio_putc.2: ret $0x4 # int sio_getc(void) @@ -70,12 +72,12 @@ sio_getc: call sio_ischar # Character jz sio_getc # No sio_getc.1: subb $0x5,%dl # Receiver buffer reg inb (%dx),%al # Read character - ret # To caller + ret # int sio_ischar(void) sio_ischar: movw $SIO_PRT+0x5,%dx # Line status register xorl %eax,%eax # Zero - inb (%dx),%al # Received data - andb $0x1,%al # ready? - ret # To caller + inb (%dx),%al # Received data ready? + andb $0x1,%al + ret