Annotation of Net2/arch/hp300/stand/autoconf.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1988 University of Utah.
        !             3:  * Copyright (c) 1990 The Regents of the University of California.
        !             4:  * All rights reserved.
        !             5:  *
        !             6:  * This code is derived from software contributed to Berkeley by
        !             7:  * the Systems Programming Group of the University of Utah Computer
        !             8:  * Science Department.
        !             9:  *
        !            10:  * Redistribution and use in source and binary forms, with or without
        !            11:  * modification, are permitted provided that the following conditions
        !            12:  * are met:
        !            13:  * 1. Redistributions of source code must retain the above copyright
        !            14:  *    notice, this list of conditions and the following disclaimer.
        !            15:  * 2. Redistributions in binary form must reproduce the above copyright
        !            16:  *    notice, this list of conditions and the following disclaimer in the
        !            17:  *    documentation and/or other materials provided with the distribution.
        !            18:  * 3. All advertising materials mentioning features or use of this software
        !            19:  *    must display the following acknowledgement:
        !            20:  *     This product includes software developed by the University of
        !            21:  *     California, Berkeley and its contributors.
        !            22:  * 4. Neither the name of the University nor the names of its contributors
        !            23:  *    may be used to endorse or promote products derived from this software
        !            24:  *    without specific prior written permission.
        !            25:  *
        !            26:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            27:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            28:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            29:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            30:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            31:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            32:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            36:  * SUCH DAMAGE.
        !            37:  *
        !            38:  * from: Utah $Hdr: autoconf.c 1.13 91/01/21$
        !            39:  *
        !            40:  *     @(#)autoconf.c  7.5 (Berkeley) 5/7/91
        !            41:  */
        !            42: 
        !            43: #include "samachdep.h"
        !            44: #include "sys/param.h"
        !            45: 
        !            46: #include "../dev/device.h"
        !            47: #include "../dev/grfvar.h"
        !            48: 
        !            49: struct hp_hw sc_table[MAXCTLRS];
        !            50: 
        !            51: extern int internalhpib;
        !            52: 
        !            53: #if 0
        !            54: #include "rominfo.h"
        !            55: printrominfo()
        !            56: {
        !            57:        struct rominfo *rp = (struct rominfo *)ROMADDR;
        !            58:        printf("boottype %x, name %s, lowram %x, sysflag %x\n",
        !            59:               rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff);
        !            60:        printf("rambase %x, ndrives %x, sysflag2 %x, msus %x\n",
        !            61:               rp->rambase, rp->ndrives, rp->sysflag2&0xff, rp->msus);
        !            62: }
        !            63: #endif
        !            64: 
        !            65: configure()
        !            66: {
        !            67:        find_devs();
        !            68:        cninit();
        !            69: #if 0
        !            70:        printrominfo();
        !            71: #endif
        !            72:        hpibinit();
        !            73:        scsiinit();
        !            74: }
        !            75: 
        !            76: sctoaddr(sc)
        !            77:        int sc;
        !            78: {
        !            79:        if (sc == -1)
        !            80:                return(GRFIADDR);
        !            81:        if (sc == 7 && internalhpib)
        !            82:                return(internalhpib);
        !            83:        if (sc < 32)
        !            84:                return(DIOBASE + sc * DIOCSIZE);
        !            85:        if (sc >= 132)
        !            86:                return(DIOIIBASE + (sc - 132) * DIOIICSIZE);
        !            87:        return(sc);
        !            88: }
        !            89: 
        !            90: /*
        !            91:  * Probe all DIO select codes (0 - 32), the internal display address,
        !            92:  * and DIO-II select codes (132 - 256).
        !            93:  *
        !            94:  * Note that we only care about displays, SCSIs and HP-IBs.
        !            95:  */
        !            96: find_devs()
        !            97: {
        !            98:        short sc, sctop;
        !            99:        u_char *id_reg;
        !           100:        register caddr_t addr;
        !           101:        register struct hp_hw *hw;
        !           102:        extern int machineid;
        !           103: 
        !           104:        hw = sc_table;
        !           105:        sctop = machineid == HP_320 ? 32 : 256;
        !           106:        for (sc = -1; sc < sctop; sc++) {
        !           107:                if (sc >= 32 && sc < 132)
        !           108:                        continue;
        !           109:                addr = (caddr_t) sctoaddr(sc);
        !           110:                if (badaddr(addr))
        !           111:                        continue;
        !           112: 
        !           113:                id_reg = (u_char *) addr;
        !           114:                hw->hw_pa = addr;
        !           115:                if (sc >= 132)
        !           116:                        hw->hw_size = (id_reg[0x101] + 1) * 0x100000;
        !           117:                else
        !           118:                        hw->hw_size = DIOCSIZE;
        !           119:                hw->hw_kva = addr;
        !           120:                hw->hw_id = id_reg[1];
        !           121:                hw->hw_sc = sc;
        !           122: 
        !           123:                /*
        !           124:                 * Not all internal HP-IBs respond rationally to id requests
        !           125:                 * so we just go by the "internal HPIB" indicator in SYSFLAG.
        !           126:                 */
        !           127:                if (sc == 7 && internalhpib) {
        !           128:                        hw->hw_type = C_HPIB;
        !           129:                        hw++;
        !           130:                        continue;
        !           131:                }
        !           132: 
        !           133:                switch (hw->hw_id) {
        !           134:                case 5:         /* 98642A */
        !           135:                case 5+128:     /* 98642A remote */
        !           136:                        hw->hw_type = D_COMMDCM;
        !           137:                        break;
        !           138:                case 8:         /* 98625B */
        !           139:                case 128:       /* 98624A */
        !           140:                        hw->hw_type = C_HPIB;
        !           141:                        break;
        !           142:                case 57:        /* Displays */
        !           143:                        hw->hw_type = D_BITMAP;
        !           144:                        hw->hw_secid = id_reg[0x15];
        !           145:                        switch (hw->hw_secid) {
        !           146:                        case 4: /* renaissance */
        !           147:                        case 8: /* davinci */
        !           148:                                sc++;           /* occupy 2 select codes */
        !           149:                                break;
        !           150:                        }
        !           151:                        break;
        !           152:                case 9:
        !           153:                        hw->hw_type = D_KEYBOARD;
        !           154:                        break;
        !           155:                case 7:
        !           156:                case 7+32:
        !           157:                case 7+64:
        !           158:                case 7+96:
        !           159:                        hw->hw_type = C_SCSI;
        !           160:                        break;
        !           161:                default:        /* who cares */
        !           162:                        hw->hw_type = D_MISC;
        !           163:                        break;
        !           164:                }
        !           165:                hw++;
        !           166:        }
        !           167: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.