Annotation of coherent/d/kernel/USRSRC/coh/main.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Coherent.
        !             3:  *
        !             4:  * $Log:       main.c,v $
        !             5:  * Revision 1.5  91/11/12  07:51:59  bin
        !             6:  * 3204 kernel source for use with piggy's tboot code.
        !             7:  * 
        !             8:  * Revision 1.2  91/11/11  12:27:07  hal
        !             9:  * Add atcount & global n_atdr.
        !            10:  * 
        !            11:  * Revision 1.2        88/06/29  12:00:29      src
        !            12:  * Real/Protected mode status now printed during boot sequence.
        !            13:  * Three part serial numbers now supported, moved to optional fourth line.
        !            14:  * 
        !            15:  * Revision 1.1        88/03/24  16:13:58      src
        !            16:  * Initial revision
        !            17:  * 
        !            18:  * 87/04/09    Allan Cornish           /usr/src/sys/coh/main.c
        !            19:  * Serial numbers changed to support group.
        !            20:  *
        !            21:  * 87/01/05    Allan Cornish           /usr/src/sys/coh/main.c
        !            22:  * Copyright notice revised to include 1987.
        !            23:  */
        !            24: #include <sys/coherent.h>
        !            25: #include <sys/proc.h>
        !            26: #include <sys/seg.h>
        !            27: #include <sys/uproc.h>
        !            28: 
        !            29: #ifndef VERSION                /* This should be specified at compile time */
        !            30: #define VERSION        "..."
        !            31: #endif
        !            32: 
        !            33: unsigned long  _entry = 0;             /* really the serial number */
        !            34: unsigned long  __ = 0;                 /* really the serial number also */
        !            35: 
        !            36: /*
        !            37:  * Initialise various things.  When we return we will return to user mode.
        !            38:  */
        !            39: char version[] = VERSION;
        !            40: char copyright[] = "\
        !            41: Copyright (c) 1982, 1991 by Mark Williams Company\n\
        !            42: ";
        !            43: 
        !            44: #define        CMOSA   0x70            /* write cmos address to this port */
        !            45: #define        CMOSD   0x71            /* read cmos data through this port */
        !            46: 
        !            47: short n_atdr;
        !            48: 
        !            49: static void atcount();
        !            50: 
        !            51: main()
        !            52: {
        !            53:        register SEG *sp;
        !            54:        extern int realmode;    /* real addressing mode - as2.s */
        !            55: 
        !            56:        u.u_error = 0;
        !            57:        bufinit();
        !            58:        cltinit();
        !            59:        pcsinit();
        !            60:        seginit();
        !            61:        atcount();      /* count "at" drives; put into n_atdr */
        !            62:        devinit();
        !            63:        printf("\Mark Williams COHERENT Version %s - %s Mode (mem=%u Kbytes)\n",
        !            64:                version, (realmode ? "Real" : "Protected"), msize );
        !            65:        printf(copyright);
        !            66: 
        !            67:        if ( _entry ) {
        !            68:                printf("Serial Number ");
        !            69:                printf("%U\n", _entry);
        !            70:        }
        !            71: 
        !            72:        /*
        !            73:         * Verify correct serial number
        !            74:         */
        !            75:        if (_entry != __)
        !            76:                panic("Verification error - call Mark Williams Company at 1-800-MARK-WMS\n");
        !            77: 
        !            78:        /*
        !            79:         * Turn on clock, start off processes, mount root device
        !            80:         * and return.
        !            81:         */
        !            82:        batflag = 1;
        !            83:        if ((sp=salloc((fsize_t)UPASIZE, SFNCLR|SFNSWP)) == NULL)
        !            84:                panic("Cannot allocate user area");
        !            85:        if ((iprocp=process(idle))==NULL || (eprocp=process(NULL))==NULL)
        !            86:                panic("Cannot create process");
        !            87:        eveinit(sp);
        !            88:        fsminit();
        !            89: }
        !            90: 
        !            91: /*
        !            92:  * atcount()
        !            93:  *
        !            94:  * Read CMOS and return 0,1, or 2 as number of installed "at" drives.
        !            95:  */
        !            96: static void atcount()
        !            97: {
        !            98:        int u;
        !            99:        n_atdr = 0;
        !           100: 
        !           101:        /*
        !           102:         * Count nonzero drive types.
        !           103:         *
        !           104:         *      High nibble of CMOS 0x12 is drive 0's type.
        !           105:         *      Low  nibble of CMOS 0x12 is drive 1's type.
        !           106:         */
        !           107:        outb(CMOSA, 0x12);
        !           108:        /* delay */
        !           109:        u = inb(CMOSD);
        !           110:        if (u & 0x00F0)
        !           111:                n_atdr++;
        !           112:        if (u & 0x000F)
        !           113:                n_atdr++;
        !           114: }

unix.superglobalmegacorp.com

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