Subject: Re: serial ports/ttys on pmax
To: Charles M. Hannum <mycroft@MIT.EDU>
From: Anthony D'Atri <aad@nwnet.net>
List: port-pmax
Date: 03/15/1996 09:41:27
>Can SunOS set the port to 57600 at all?

Stock SunOS can't, at least up to 5.3.  There's a hack to muck with the
divisor table, but I've read reports that this often doesn't work well. 
Conventional wisdom in many Sun circles is that if one wishes to do
higher-speed serial comms with real hardware handshaking, the way to go
is to just get an Sbus/VME/SCSI device, eg. from Aurora.

From: schneck@Physik.TU-Muenchen.DE (Bernhard Schneck)
Newsgroups: comp.sys.sun.admin
Subject: Re: v32bis modems @ 14,400 bps on desktop Sparcs
Date: 6 Jul 92 11:10:19 GMT
References: <1992Jun29.183146.22097@samba.oit.unc.edu>
<BOB.92Jun29172708@volitan
s.MorningStar.Com> <1992Jun29.221236.17474@src.umd.edu>
<schneck.709948135@Physik
.TU-Muenchen.DE> <1992Jul5.172754.17748@edsr.eds.com>
Organization: Leibniz-Rechenzentrum, Muenchen (Germany)

cheeks@edsr.eds.com (Mark Costlow) writes:

>Could you be more specific about how you did this?

The following is from two postings from wolfgang@wsrcc.com (Wolfgang S.
Rupprecht) and adrie@ica.philips.nl (Adrie Koolen):

The serial (rs232 / 422) controller in the SparcStation 1, 1+ and IPC is
a Zilog Z8530, driven at 4915200 Hz. The baud-rate depends on a divisor
register, which is calculated as follows:

        divisor = 4915200 / (2 * baud_rate * 16) - 2;
or
        baud_rate = 4915200 / ((divisor + 2) * 2 * 16)

So:     divisor         baud_rate
        510             300
        62              2400
        14              9600
        6               19200
        2               38400
        1               51200
        0               76800

Now take at a look at the zs_speeds table in your /vmunix:

# adb -k /vmunix /dev/mem
physmem 27f4
zs_speeds/16d
_zs_speeds:
_zs_speeds:     0       3070    2046    1394    1140    1022    766     510
                254     126     83      62      30      14      6       2
$q

These are the divisors which are loaded into the Z8530 when you request
a certain baud rate (the first entry is used for B0 == HANGUP which is
handled by special code).  All you have to do is change one of these
fields to the value you want:

# adb -w -k /vmunix /dev/mem
physmem 27f4
zs_speeds+2/w 0
_zs_speeds+2:   0xbfe   =       0x0
zs_speeds/16d
_zs_speeds:
_zs_speeds:     0       0       2046    1394    1140    1022    766     510
                254     126     83      62      30      14      6       2
$q

Now the entry for B50 will load 0 into the divisor register, thus you get
76.8kbaud if you use 'stty 50'.

The adb commands as shown above will only change the running kernel (ie.
/dev/mem), the speed table will be restored to the original at the next
reboot.  You can use "?" to change the table in /vmunix itself, so it
will survive reboots, or you can change /usr/kvm/sys/sun4c/OBJ/zs_async.o
to get the modified table into newly built kernels (be sure to save a copy
of the original).