Annotation of kernel/machdep/ppc/powermac.h, revision 1.1.1.2

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: #ifndef _POWERMAC_H_
                     25: #define _POWERMAC_H_
                     26: 
                     27: #ifndef __ASSEMBLER__
                     28: 
                     29: #include <mach/ppc/vm_types.h>
                     30: #include <machdep/ppc/boot.h>
                     31: #include <machdep/ppc/dbdma.h>
                     32: 
                     33: /*
                     34:  * Machine class 
                     35:  */
                     36: 
                     37: #define        POWERMAC_CLASS_PDM              1       /* PowerMac 61/71/8100 */
                     38: #define        POWERMAC_CLASS_PERFORMA         2       /* PowerMac 52/6200 */
                     39: #define        POWERMAC_CLASS_POWERSURGE       3       /* PowerMac 72/75/85/9500 */
                     40: #define        POWERMAC_CLASS_POWEREXPRESS     4       /* PowerMac 9700 */
                     41: #define        POWERMAC_CLASS_POWERBOOK        5       /* PowerBook 2300/5300 */
                     42: #define        POWERMAC_CLASS_GOSSAMER         6       /* PowerMac G3 Desk/Mini-Twr */
                     43: #define        POWERMAC_CLASS_POWERSTAR        7       /* PowerBook 2400/3400/G3 */
                     44: #define        POWERMAC_CLASS_YOSEMITE         8       /* 1st Gen New World */
1.1.1.2 ! root       45: #define        POWERMAC_CLASS_SAWTOOTH         9       /* Core99 */
1.1       root       46: 
                     47: /* Some macros for easy machine identification */
                     48: #define IsPowerSurge() (powermac_info.class == POWERMAC_CLASS_POWERSURGE)
                     49:  
                     50: #define IsPEx()                (powermac_info.class == POWERMAC_CLASS_POWEREXPRESS)
                     51: 
                     52: #define IsPowerBook()  (powermac_info.class == POWERMAC_CLASS_POWERBOOK)
                     53:  
                     54: #define IsGossamer()   (powermac_info.class == POWERMAC_CLASS_GOSSAMER)
                     55: 
                     56: #define IsPowerStar()  (powermac_info.class == POWERMAC_CLASS_POWERSTAR)
                     57: 
                     58: #define IsYosemite()   (powermac_info.class == POWERMAC_CLASS_YOSEMITE)
                     59: 
1.1.1.2 ! root       60: #define IsSawtooth()   (powermac_info.class == POWERMAC_CLASS_SAWTOOTH)
        !            61: 
1.1       root       62: // This is not safe until the PMU or Cuda driver have been set up.
                     63: #define HasPMU()        (powermac_info.hasPMU)
                     64: 
                     65: typedef struct powermac_info {
                     66:        int             class;                  /* Machine type */
                     67: 
                     68:        unsigned int    bus_clock_rate_hz;      /* Bus frequency */
                     69:         unsigned int    dec_clock_period;       /* Fixed point number 8.24 */
                     70: 
                     71:         /* to convert from real time ticks to nsec convert by this*/
                     72:        unsigned int    proc_clock_to_nsec_numerator; 
                     73:        unsigned int    proc_clock_to_nsec_denominator; 
                     74:        
                     75:        int             machine;                /* Gestalt value .. */
                     76:        int             hasPMU;                 // Flag for machines with PMU
                     77:        int             viaIRQ;                 // irq number for the via
                     78: } powermac_info_t;
                     79: 
                     80: extern powermac_info_t powermac_info;
                     81: 
                     82: /* This may be merged in struct powermac_info in the future */
                     83: typedef struct powermac_machine_info {
                     84:        unsigned long   dcache_block_size;  /* number of bytes */
                     85:        unsigned long   dcache_size;        /* number of bytes */
                     86:        unsigned long   icache_size;        /* number of bytes */
                     87:        unsigned long   caches_unified;     /* boolean_t */
                     88:        unsigned long   processor_version;  /* contents of PVR */
                     89:        unsigned long   cpu_clock_rate_hz;
                     90:        unsigned long   dec_clock_rate_hz;
                     91:        unsigned long   bus_clock_rate_hz;
                     92:        unsigned long   l2_clock_rate_hz;
                     93:        unsigned long   bus_clock_rate_hz_num;
                     94:        unsigned long   bus_clock_rate_hz_den;
                     95:        unsigned long   cpu_pll;                /* cpu pll mode * 2 */
                     96:        unsigned long   l2_pll;                 /* l2 pll mode * 2 */
                     97:        unsigned long   l2_cache_size;
                     98:        unsigned long   l2_cache_type;
                     99: } powermac_machine_info_t;
                    100: 
                    101: extern powermac_machine_info_t powermac_machine_info;
                    102: 
                    103: // Types of L2 Caches
                    104: #define L2_CACHE_NONE     (0)
                    105: #define L2_CACHE_MB       (1)
                    106: #define L2_CACHE_INLINE   (2)
                    107: #define L2_CACHE_BACKSIDE (3)
                    108: 
                    109: 
                    110: typedef struct powermac_io_info {
                    111:        int             io_size;
                    112:         vm_offset_t     io_base_phys;            /* IO region */
                    113:         vm_offset_t     io_base_virt;            /* IO region */
                    114: 
                    115:         vm_offset_t     io_base2;                // IO region for O'Hare 2
                    116: 
                    117:         vm_offset_t     mem_cntlr_base_phys;
                    118:         vm_offset_t     int_cntlr_base_phys;
                    119: 
                    120:         vm_offset_t     dma_base_phys;
                    121: 
                    122:   /* Remove All this dma stuff later */
                    123:        int             dma_buffer_alignment;   /* preallocated DMA region */
                    124:        int             dma_buffer_size;        /* preallocated DMA region */
                    125:        vm_offset_t     dma_buffer_phys;        /* preallocated DMA region */
                    126:        vm_offset_t     dma_buffer_virt;        /* preallocated DMA region */
                    127: 
                    128:         vm_offset_t     serial_base_phys;
                    129:         vm_offset_t     scsi_int_base_phys;
                    130:         vm_offset_t     scsi_int_dma_base_phys;
                    131:         vm_offset_t     scsi_ext_base_phys;
                    132:         vm_offset_t     audio_base_phys;
                    133:         vm_offset_t     floppy_base_phys;
                    134:         vm_offset_t     ethernet_base_phys;
                    135:         vm_offset_t     via_base_phys;
                    136: 
                    137:         vm_offset_t     nvram_addr_reg_phys;
                    138:         vm_offset_t     nvram_data_reg_phys;
                    139: 
                    140:         vm_offset_t     ide0_base_phys;
                    141:         vm_offset_t     ide1_base_phys;
                    142:        int             nvram_XPRAM_NVPartition;
                    143:        int             nvram_NameRegistry_NVPartition;
                    144:        int             nvram_OpenFirmware_NVPartition;
                    145: } powermac_io_info_t;
                    146: 
                    147: extern powermac_io_info_t powermac_io_info;
                    148: 
                    149: /* For compatability right now, keep these defines */
                    150: #define PCI_IO_BASE_PHYS        (powermac_io_info.io_base_phys)
                    151: 
                    152: #define PCI_DMA_BASE_PHYS       (powermac_io_info.dma_base_phys)
                    153: 
                    154: /* SCC registers (serial line) - physical addr is for probe */
                    155: #define PCI_SCC_BASE_PHYS       (powermac_io_info.serial_base_phys)
                    156: 
                    157: /* ASC registers (external scsi) - physical address for probe */
                    158: #define PCI_ASC_BASE_PHYS       (powermac_io_info.scsi_ext_base_phys)
                    159: 
                    160: /* MESH (internal scsi) controller */
                    161: #define PCI_MESH_BASE_PHYS      (powermac_io_info.scsi_int_base_phys)
                    162: #define PCI_MESH_DMA_BASE_PHYS  (powermac_io_info.scsi_int_dma_base_phys)
                    163: 
                    164: /* audio controller */
                    165: #define PCI_AUDIO_BASE_PHYS     (powermac_io_info.audio_base_phys)
                    166: 
                    167: /* floppy controller */
                    168: #define PCI_FLOPPY_BASE_PHYS    (powermac_io_info.floppy_base_phys)
                    169: 
                    170: /* Ethernet controller */
                    171: #define PCI_ETHERNET_BASE_PHYS  (powermac_io_info.ethernet_base_phys)
                    172: #define PCI_ETHERNET_ADDR_PHYS  (0xF3019000)
                    173: 
                    174: /* VIA controls, misc stuff (including CUDA) */
                    175: #define PCI_VIA_BASE_PHYS       (powermac_io_info.via_base_phys)
                    176: 
                    177: #define        PCI_VIA1_AUXCONTROL     (POWERMAC_IO(powermac_io_info.via_base_phys + 0x01600))
                    178: #define        PCI_VIA1_T1COUNTERLOW   (POWERMAC_IO(powermac_io_info.via_base_phys + 0x00800))
                    179: #define        PCI_VIA1_T1COUNTERHIGH  (POWERMAC_IO(powermac_io_info.via_base_phys + 0x00A00))
                    180: #define        PCI_VIA1_T1LATCHLOW     (POWERMAC_IO(powermac_io_info.via_base_phys + 0x00C00))
                    181: #define        PCI_VIA1_T1LATCHHIGH    (POWERMAC_IO(powermac_io_info.via_base_phys + 0x00E00))
                    182: #define PCI_VIA1_IER            (POWERMAC_IO(powermac_io_info.via_base_phys + 0x01c00))
                    183: #define PCI_VIA1_IFR            (POWERMAC_IO(powermac_io_info.via_base_phys + 0x01a00))
                    184: #define PCI_VIA1_PCR            (POWERMAC_IO(powermac_io_info.via_base_phys + 0x01800))
                    185: 
                    186: /* NVRAM Addrs and Partitions */
                    187: #define PCI_NVRAM_ADDR_PHYS     (powermac_io_info.nvram_addr_reg_phys)
                    188: #define PCI_NVRAM_DATA_PHYS     (powermac_io_info.nvram_data_reg_phys)
                    189: 
                    190: #define NVRAM_XPRAM_Offset (powermac_io_info.nvram_XPRAM_NVPartition)
                    191: #define NVRAM_NameRegistry_Offset (powermac_io_info.nvram_NameRegistry_NVPartition)
                    192: #define NVRAM_OpenFirmware_Offset (powermac_io_info.nvram_OpenFirmware_NVPartition)
                    193: 
                    194: 
                    195: 
                    196: /* IDE controller */
                    197: #define PCI_IDE0_BASE_PHYS     (powermac_io_info.ide0_base_phys)
                    198: #define PCI_IDE1_BASE_PHYS     (powermac_io_info.ide1_base_phys)
                    199: 
                    200: 
                    201: extern void NO_ENTRY(void);
                    202: 
                    203: typedef struct {
                    204:        void (*configure_machine)(void);
                    205:        void (*machine_initialize_interrupt)(void);
                    206:        void (*machine_initialize_network)(void);
                    207:        void (*machine_initialize_processors)(boot_args *args);
                    208:        int  (*machine_initialize_rtclock)(void);
                    209:        powermac_dbdma_channels_t *powermac_dbdma_channels;
                    210: } powermac_init_t;
                    211: 
                    212: extern powermac_init_t *powermac_init_p;
                    213: 
                    214: 
                    215: /* Macro to convert from a physical I/O address into a virtual I/O address */
                    216: #define POWERMAC_IO(addr)      (powermac_io_info.io_base_virt +        \
                    217:                                 (addr - powermac_io_info.io_base_phys))
                    218: 
                    219: /*
                    220:  * prototypes
                    221:  */
                    222: 
                    223: /* Used to initialise IO once DMA and IO virtual space has been assigned */
                    224: extern void powermac_io_init(vm_offset_t powermac_io_base_v);
                    225: 
                    226: extern void powermac_powerdown(void);
                    227: extern void powermac_reboot(void);
                    228: 
                    229: /* Non-cached version of bcopy */
                    230: extern void    bcopy_nc(char *from, char *to, int size);
                    231: 
                    232: /* Some useful typedefs for accessing control registers */
                    233: 
                    234: typedef volatile unsigned char v_u_char;
                    235: typedef volatile unsigned short v_u_short;
                    236: typedef volatile unsigned int  v_u_int;
                    237: typedef volatile unsigned long  v_u_long;
                    238: 
                    239: /* And some useful defines for reading 'volatile' structures,
                    240:  * don't forget to be be careful about sync()s and eieio()s
                    241:  */
                    242: #define reg8(reg) (*(v_u_char *)reg)
                    243: #define reg16(reg) (*(v_u_short *)reg)
                    244: #define reg32(reg) (*(v_u_int *)reg)
                    245: 
                    246: /* VIA1_AUXCONTROL values same across several powermacs */
                    247: #define        VIA1_AUX_AUTOT1LATCH 0x40       /* Autoreload of T1 from latches */
                    248: 
                    249: #endif /* !(__ASSEMBLER__) */
                    250: #endif /* _POWERMAC_H_ */

unix.superglobalmegacorp.com

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