[BACK]Return to tga_conf.c CVS log [TXT][DIR] Up to [local] / sys / dev / pci

Annotation of sys/dev/pci/tga_conf.c, Revision 1.1

1.1     ! nbrk        1: /* $OpenBSD: tga_conf.c,v 1.5 2002/04/01 11:26:32 matthieu Exp $ */
        !             2: /* $NetBSD: tga_conf.c,v 1.5 2001/11/13 07:48:49 lukem Exp $ */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * Author: Chris G. Demetriou
        !             9:  *
        !            10:  * Permission to use, copy, modify and distribute this software and
        !            11:  * its documentation is hereby granted, provided that both the copyright
        !            12:  * notice and this permission notice appear in all copies of the
        !            13:  * software, derivative works or modified versions, and any portions
        !            14:  * thereof, and that both notices appear in supporting documentation.
        !            15:  *
        !            16:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
        !            17:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
        !            18:  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
        !            19:  *
        !            20:  * Carnegie Mellon requests users of this software to return to
        !            21:  *
        !            22:  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
        !            23:  *  School of Computer Science
        !            24:  *  Carnegie Mellon University
        !            25:  *  Pittsburgh PA 15213-3890
        !            26:  *
        !            27:  * any improvements or extensions that they make and grant Carnegie the
        !            28:  * rights to redistribute these changes.
        !            29:  */
        !            30:
        !            31: #include <sys/param.h>
        !            32: #include <sys/device.h>
        !            33:
        !            34: #include <dev/pci/pcivar.h>
        !            35: #include <dev/pci/tgareg.h>
        !            36: #include <dev/pci/tgavar.h>
        !            37:
        !            38: #include <dev/ic/bt485var.h>
        !            39: #include <dev/ic/bt463var.h>
        !            40: #include <dev/ic/ibm561var.h>
        !            41:
        !            42: #undef KB
        !            43: #define KB             * 1024
        !            44: #undef MB
        !            45: #define        MB              * 1024 * 1024
        !            46:
        !            47: static const struct tga_conf tga_configs[TGA_TYPE_UNKNOWN] = {
        !            48:        /* TGA_TYPE_T8_01 */
        !            49:        {
        !            50:                "T8-01",
        !            51:                bt485_funcs,
        !            52:                8,
        !            53:                4 MB,
        !            54:                2 KB,
        !            55:                1,      {  2 MB,     0 },       { 1 MB,    0 },
        !            56:                0,      {     0,     0 },       {    0,    0 },
        !            57:        },
        !            58:        /* TGA_TYPE_T8_02 */
        !            59:        {
        !            60:                "T8-02",
        !            61:                bt485_funcs,
        !            62:                8,
        !            63:                4 MB,
        !            64:                4 KB,
        !            65:                1,      {  2 MB,     0 },       { 2 MB,    0 },
        !            66:                0,      {     0,     0 },       {    0,    0 },
        !            67:        },
        !            68:        /* TGA_TYPE_T8_22 */
        !            69:        {
        !            70:                "T8-22",
        !            71:                bt485_funcs,
        !            72:                8,
        !            73:                8 MB,
        !            74:                4 KB,
        !            75:                1,      {  4 MB,     0 },       { 2 MB,    0 },
        !            76:                1,      {  6 MB,     0 },       { 2 MB,    0 },
        !            77:        },
        !            78:        /* TGA_TYPE_T8_44 */
        !            79:        {
        !            80:                "T8-44",
        !            81:                bt485_funcs,
        !            82:                8,
        !            83:                16 MB,
        !            84:                4 KB,
        !            85:                2,      {  8 MB, 12 MB },       { 2 MB, 2 MB },
        !            86:                2,      { 10 MB, 14 MB },       { 2 MB, 2 MB },
        !            87:        },
        !            88:        /* TGA_TYPE_T32_04 */
        !            89:        {
        !            90:                "T32-04",
        !            91:                bt463_funcs,
        !            92:                32,
        !            93:                16 MB,
        !            94:                8 KB,
        !            95:                1,      {  8 MB,     0 },       { 4 MB,    0 },
        !            96:                0,      {     0,     0 },       {    0,    0 },
        !            97:        },
        !            98:        /* TGA_TYPE_T32_08 */
        !            99:        {
        !           100:                "T32-08",
        !           101:                bt463_funcs,
        !           102:                32,
        !           103:                16 MB,
        !           104:                16 KB,
        !           105:                1,      {  8 MB,    0 },        { 8 MB,    0 },
        !           106:                0,      {     0,    0 },        {    0,    0 },
        !           107:        },
        !           108:        /* TGA_TYPE_T32_88 */
        !           109:        {
        !           110:                "T32-88",
        !           111:                bt463_funcs,
        !           112:                32,
        !           113:                32 MB,
        !           114:                16 KB,
        !           115:                1,      { 16 MB,    0 },        { 8 MB,    0 },
        !           116:                1,      { 24 MB,    0 },        { 8 MB,    0 },
        !           117:        },
        !           118:        /* TGA_TYPE_POWERSTORM_4D20 */
        !           119:        /* XXX: These numbers may be incorrect */
        !           120:        {
        !           121:                "PS4d20",
        !           122:                ibm561_funcs,
        !           123:                32,
        !           124:                32 MB,
        !           125:                16 KB,
        !           126:                1,      { 16 MB,    0 },        { 8 MB,    0 },
        !           127:                1,      { 24 MB,    0 },        { 8 MB,    0 },
        !           128:        },
        !           129: };
        !           130:
        !           131: #undef KB
        !           132: #undef MB
        !           133:
        !           134: int
        !           135: tga_identify(dc)
        !           136:        struct tga_devconfig *dc;
        !           137: {
        !           138:        int type;
        !           139:        int gder;
        !           140:        int grev;
        !           141:        int deep, addrmask, wide;
        !           142:        int tga2;
        !           143:
        !           144:        gder = TGARREG(dc, TGA_REG_GDER);
        !           145:        grev = TGARREG(dc, TGA_REG_GREV);
        !           146:
        !           147:        deep = (gder & 0x1) != 0; /* XXX */
        !           148:        addrmask = (gder >> 2) & 0x7; /* XXX */
        !           149:        wide = (gder & 0x200) == 0; /* XXX */
        !           150:        tga2 = (grev & 0x20) != 0;
        !           151:
        !           152:
        !           153:        type = TGA_TYPE_UNKNOWN;
        !           154:
        !           155:        if (!deep) {
        !           156:                /* 8bpp frame buffer */
        !           157:
        !           158:                if (addrmask == 0x0) {
        !           159:                        /* 4MB core map; T8-01 or T8-02 */
        !           160:
        !           161:                        if (!wide)
        !           162:                                type = TGA_TYPE_T8_01;
        !           163:                        else
        !           164:                                type = TGA_TYPE_T8_02;
        !           165:                } else if (addrmask == 0x1) {
        !           166:                        /* 8MB core map; T8-22 */
        !           167:
        !           168:                        if (wide)                       /* sanity */
        !           169:                                type = TGA_TYPE_T8_22;
        !           170:                } else if (addrmask == 0x3) {
        !           171:                        /* 16MB core map; T8-44 */
        !           172:
        !           173:                        if (wide)                       /* sanity */
        !           174:                                type = TGA_TYPE_T8_44;
        !           175:                }
        !           176:        } else {
        !           177:                /* 32bpp frame buffer */
        !           178:                if (addrmask == 0x00 && tga2 && wide) {
        !           179:                        /* My PowerStorm 4d20 shows up this way? */
        !           180:                        type = TGA_TYPE_POWERSTORM_4D20;
        !           181:                }
        !           182:
        !           183:                if (addrmask == 0x3) {
        !           184:                        /* 16MB core map; T32-04 or T32-08 */
        !           185:
        !           186:                        if (!wide)
        !           187:                                type = TGA_TYPE_T32_04;
        !           188:                        else
        !           189:                                type = TGA_TYPE_T32_08;
        !           190:                } else if (addrmask == 0x7) {
        !           191:                        /* 32MB core map; T32-88 */
        !           192:
        !           193:                        if (wide && !tga2)                      /* sanity */
        !           194:                                type = TGA_TYPE_T32_88;
        !           195:                }
        !           196:        }
        !           197:
        !           198:        return (type);
        !           199: }
        !           200:
        !           201: const struct tga_conf *
        !           202: tga_getconf(type)
        !           203:        int type;
        !           204: {
        !           205:
        !           206:        if (type >= 0 && type < TGA_TYPE_UNKNOWN)
        !           207:                return &tga_configs[type];
        !           208:
        !           209:        return (NULL);
        !           210: }

CVSweb