[BACK]Return to pci_machdep.c CVS log [TXT][DIR] Up to [local] / sys / arch / alpha / pci

Annotation of sys/arch/alpha/pci/pci_machdep.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: pci_machdep.c,v 1.16 2002/03/14 01:26:27 millert Exp $        */
                      2: /*     $NetBSD: pci_machdep.c,v 1.7 1996/11/19 04:57:32 cgd 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: /*
                     32:  * Machine-specific functions for PCI autoconfiguration.
                     33:  */
                     34:
                     35: #include <sys/types.h>
                     36: #include <sys/param.h>
                     37: #include <sys/time.h>
                     38: #include <sys/systm.h>
                     39: #include <sys/errno.h>
                     40: #include <sys/device.h>
                     41: #include <uvm/uvm_extern.h>
                     42: #include <machine/cpu.h>
                     43: #include <sys/sysctl.h>
                     44:
                     45: #include <dev/isa/isavar.h>
                     46: #include <dev/pci/pcireg.h>
                     47: #include <dev/pci/pcivar.h>
                     48: #include <dev/pci/pcidevs.h>
                     49:
                     50: #include "vga.h"
                     51: #if NVGA_PCI
                     52: #include <dev/pci/vga_pcivar.h>
                     53: #endif
                     54:
                     55: #include "tga.h"
                     56: #if NTGA
                     57: #include <dev/pci/tgavar.h>
                     58: #endif
                     59:
                     60: struct alpha_pci_chipset *alpha_pci_chipset;
                     61:
                     62: void
                     63: pci_display_console(iot, memt, pc, bus, device, function)
                     64:        bus_space_tag_t iot, memt;
                     65:        pci_chipset_tag_t pc;
                     66:        int bus, device, function;
                     67: {
                     68:        pcitag_t tag;
                     69:        pcireg_t id, class;
                     70:        int match;
                     71: #if NVGA_PCI || NTGA
                     72:        int nmatch;
                     73: #endif
                     74:        int (*fn)(bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t,
                     75:            int, int, int);
                     76:
                     77:        tag = pci_make_tag(pc, bus, device, function);
                     78:        id = pci_conf_read(pc, tag, PCI_ID_REG);
                     79:        if (id == 0 || id == 0xffffffff)
                     80:                panic("pci_display_console: no device at %d/%d/%d",
                     81:                    bus, device, function);
                     82:        class = pci_conf_read(pc, tag, PCI_CLASS_REG);
                     83:
                     84:        match = 0;
                     85:        fn = NULL;
                     86:
                     87: #if NVGA_PCI
                     88:        nmatch = DEVICE_IS_VGA_PCI(class, id);
                     89:        if (nmatch > match) {
                     90:                match = nmatch;
                     91:                fn = vga_pci_cnattach;
                     92:        }
                     93: #endif
                     94: #if NTGA
                     95:        nmatch = DEVICE_IS_TGA(class, id);
                     96:        if (nmatch > match) {
                     97:                match = nmatch;
                     98:                fn = tga_cnattach;
                     99:        }
                    100: #endif
                    101:
                    102:        if (fn != NULL)
                    103:                (*fn)(iot, memt, pc, bus, device, function);
                    104:        else
                    105:                panic("pci_display_console: unconfigured device at %d/%d/%d",
                    106:                    bus, device, function);
                    107: }
                    108:
                    109: int
                    110: alpha_sysctl_chipset(int *name, u_int namelen, char *where, size_t *sizep)
                    111: {
                    112:        if (namelen != 1)
                    113:                return (ENOTDIR);
                    114:
                    115:        if (alpha_pci_chipset == NULL)
                    116:                return (EOPNOTSUPP);
                    117:
                    118:        switch (name[0]) {
                    119:        case CPU_CHIPSET_TYPE:
                    120:                return (sysctl_rdstring(where, sizep, NULL,
                    121:                    alpha_pci_chipset->pc_name));
                    122:        case CPU_CHIPSET_BWX:
                    123:                return (sysctl_rdint(where, sizep, NULL,
                    124:                    alpha_pci_chipset->pc_bwx));
                    125:        case CPU_CHIPSET_MEM:
                    126:                return (sysctl_rdquad(where, sizep, NULL,
                    127:                    alpha_pci_chipset->pc_mem));
                    128:        case CPU_CHIPSET_DENSE:
                    129:                return (sysctl_rdquad(where, sizep, NULL,
                    130:                    alpha_pci_chipset->pc_dense));
                    131:        case CPU_CHIPSET_PORTS:
                    132:                return (sysctl_rdquad(where, sizep, NULL,
                    133:                    alpha_pci_chipset->pc_ports));
                    134:        case CPU_CHIPSET_HAE_MASK:
                    135:                return (sysctl_rdquad(where, sizep, NULL,
                    136:                    alpha_pci_chipset->pc_hae_mask));
                    137:        default:
                    138:                return (EOPNOTSUPP);
                    139:        }
                    140:        /* NOTREACHED */
                    141: }

CVSweb