DOCUMENT ID:  1554-02

SYNOPSIS:     adb script to determine serial com chip

KEYWORDS:     16550 16450 8250 serial communication asy port

OS RELEASE:   2.4, 2.5

PRODUCT:      Solaris x86


DESCRIPTION:

Background

There are two types of serial communication integrated circuits (chips)
used to implement the Intel platform "com ports": buffered and
non-buffered.  The original IBM personal computer used the now familiar
8250 chip.  As the pc evolved to the At class machines IBM recommended
using the first buffered chip the 16450, only a 1 character buffer at
that.  The new buffered chip allowed for the increase performance of the
AT.  National Semiconductor enhanced the design even more with the 16550
and with a recent arrival of the 16750. The 16550 features 16 character
buffering on both received and transmit while the 16750 has 64
characters. 

The asy driver determines the type of chip on a com port during the
"probe" phase of driver attachment.  The status reurned by the chip
indicates the chip type.  Currently three types are recognized: 16550,
82150 and 8250.  The default is an 8250.  Some 16550 clone chips don't
return the correct status and are hence classified as 8250s. 
 
It is important to determine what driver is loaded using the prtconf
command.  If a window manager is being used it is almost guaranteed the
driver is loaded when a serial mouse is in use.  Each attached asy port
has an associated asycom structure.  Not all parts of the structure are
meaning full outside the context of the Unix kernel environment.  An
extraction of the structure from /usr/include/asy.h is included here for
examination.  The size of the structure is 48 bytes. 

 ============================================
 struct asycom {
        int        asy_flags;       /* random flags  */
                                    /* protected by asy_excl_hi lock */
        u_int      asy_hwtype;      /* HW type: ASY82510, etc. */
        u_int      asy_use_fifo;    /* HW FIFO use it or not ?? */
        u_int      asy_fifo_buf;    /* With FIFO = 16, otherwise = 1 */
        u_int      asy_ioaddr;      /* i/o address of ASY port */
        u_int      asy_vect;        /* IRQ number */
        caddr_t    asy_priv;        /* protocol private data */
        dev_info_t *asy_dip;        /* dev_info */
        long       asy_unit;        /* which port */
        ddi_iblock_cookie_t asy_iblock;
        kmutex_t   *asy_excl;       /* asy adaptive mutex */
        kmutex_t   *asy_excl_hi;    /* asy spinlock mutex */
 };
 ============================================

 Adb script to determine serial com chip                         Page 2


Adb Script

Adb is a debugger utilized to patch and examine user programs.  By using
the "-k" option the kernel may be examined.  The symbol asycom is a
pointer to the kernel memory allocated for the asy asycom structures. 
If multiple asy ports are attached, the pointer and some simple math
will allow access to each structure.  The script will produce a report
resembling the structure elements.  The script is all one line, but as
several due to space limitations. 


 *asycom?"flags   "Xn"hwtype   "X" 1= 82510, 2 = 16550, 3 = 8250"n"use_fifo "X
 " 1 = enabled"n"fifo     "D" bytes"n"i/o      "X

For illustative purposes a file "asyrpt.adb" contains the line will be
used.  The kernel may be accessed only by root.  A sample
command sequence and output might be:

 su
 password:

adb -k < asyrpt.adb

Current	registers belong to a snapshot of
    kernel thread at: 0xf593e060 on  cpu[0]   at: 0xe0108d38
    Use thread_addr$t or proc_addr$p to change the snapshot.
pcfs_minor+0x2c88:      flags    0
                        hwtype   2  1= 82510, 2 = 16550, 3 = 8250
                        use_fifo 1  1 = enabled
                        fifo     16  bytes
                        i/o      3f8

NOTE: The label pcfs_minor is the first one encountered and is
      meaningless.  Keep in mind the fact "asycom" is a pointer to allocated
      space. 


DATE APPROVED: 11/27/95