1 1.5 skrll /* $NetBSD: podulebus_machdep.h,v 1.5 2012/05/10 10:27:10 skrll Exp $ */ 2 1.1 reinoud 3 1.1 reinoud /* 4 1.1 reinoud * Copyright (c) 1995 Mark Brinicombe. 5 1.1 reinoud * Copyright (c) 1995 Brini. 6 1.1 reinoud * All rights reserved. 7 1.1 reinoud * 8 1.1 reinoud * Redistribution and use in source and binary forms, with or without 9 1.1 reinoud * modification, are permitted provided that the following conditions 10 1.1 reinoud * are met: 11 1.1 reinoud * 1. Redistributions of source code must retain the above copyright 12 1.1 reinoud * notice, this list of conditions and the following disclaimer. 13 1.1 reinoud * 2. Redistributions in binary form must reproduce the above copyright 14 1.1 reinoud * notice, this list of conditions and the following disclaimer in the 15 1.1 reinoud * documentation and/or other materials provided with the distribution. 16 1.1 reinoud * 3. All advertising materials mentioning features or use of this software 17 1.1 reinoud * must display the following acknowledgement: 18 1.1 reinoud * This product includes software developed by Brini. 19 1.1 reinoud * 4. The name of the company nor the name of the author may be used to 20 1.1 reinoud * endorse or promote products derived from this software without specific 21 1.1 reinoud * prior written permission. 22 1.1 reinoud * 23 1.1 reinoud * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 1.1 reinoud * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 1.1 reinoud * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 1.1 reinoud * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 1.1 reinoud * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 1.1 reinoud * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 1.1 reinoud * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 1.1 reinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 1.1 reinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 1.1 reinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 1.1 reinoud * SUCH DAMAGE. 34 1.1 reinoud * 35 1.1 reinoud * RiscBSD kernel project 36 1.1 reinoud * 37 1.1 reinoud * podulebus.h 38 1.1 reinoud * 39 1.1 reinoud * Podule bus header file 40 1.1 reinoud * 41 1.1 reinoud * Created : 26/04/95 42 1.1 reinoud */ 43 1.1 reinoud 44 1.1 reinoud #include <sys/param.h> 45 1.4 dyoung #include <sys/bus.h> 46 1.1 reinoud #include <machine/io.h> 47 1.1 reinoud 48 1.1 reinoud /* Define the structure used to describe a podule */ 49 1.1 reinoud 50 1.1 reinoud #define PODULE_DESCRIPTION_LENGTH 63 51 1.1 reinoud 52 1.1 reinoud typedef struct { 53 1.1 reinoud /* The podule header, read from the on board ROM */ 54 1.1 reinoud 55 1.1 reinoud u_char flags0; 56 1.1 reinoud u_char flags1; 57 1.1 reinoud u_char reserved; 58 1.1 reinoud u_short product; 59 1.1 reinoud u_short manufacturer; 60 1.1 reinoud u_char country; 61 1.1 reinoud u_int irq_addr; 62 1.1 reinoud u_int irq_mask; 63 1.1 reinoud u_int fiq_addr; 64 1.1 reinoud u_int fiq_mask; 65 1.1 reinoud 66 1.1 reinoud /* The base addresses for this podule */ 67 1.1 reinoud 68 1.1 reinoud u_int fast_base; 69 1.1 reinoud u_int medium_base; 70 1.1 reinoud u_int slow_base; 71 1.1 reinoud u_int sync_base; 72 1.1 reinoud u_int mod_base; 73 1.1 reinoud u_int easi_base; 74 1.1 reinoud 75 1.1 reinoud /* Flags */ 76 1.1 reinoud 77 1.1 reinoud int podulenum; 78 1.1 reinoud int slottype; 79 1.1 reinoud int attached; 80 1.1 reinoud 81 1.1 reinoud /* Other info */ 82 1.1 reinoud 83 1.1 reinoud char description[PODULE_DESCRIPTION_LENGTH + 1]; 84 1.1 reinoud u_int (*read_rom)(u_int, int); 85 1.1 reinoud 86 1.1 reinoud /* podule specific information provided by podulebus */ 87 1.1 reinoud 88 1.1 reinoud int interrupt; 89 1.1 reinoud 90 1.1 reinoud int dma_channel; 91 1.1 reinoud int dma_interrupt; 92 1.1 reinoud } podule_t; 93 1.1 reinoud 94 1.1 reinoud #define PODULE_FLAGS_CD 0x01 95 1.1 reinoud #define PODULE_FLAGS_IS 0x02 96 1.1 reinoud 97 1.1 reinoud #define SLOT_NONE 0x00 98 1.1 reinoud #define SLOT_POD 0x01 99 1.1 reinoud #define SLOT_NET 0x02 100 1.1 reinoud 101 1.1 reinoud typedef int podulebus_intr_handle_t; 102 1.1 reinoud 103 1.1 reinoud #define podulebus_attach_args podule_attach_args 104 1.1 reinoud 105 1.1 reinoud struct podule_attach_args { 106 1.1 reinoud podule_t *pa_podule; /* podule descriptor */ 107 1.1 reinoud int pa_podule_number; /* podule number */ 108 1.1 reinoud int pa_slottype; /* podule slot type */ 109 1.1 reinoud bus_space_tag_t pa_iot; /* bus space tag */ 110 1.1 reinoud 111 1.1 reinoud #define pa_easi_t pa_iot 112 1.1 reinoud #define pa_mod_t pa_iot 113 1.1 reinoud #define pa_fast_t pa_iot 114 1.1 reinoud #define pa_medium_t pa_iot 115 1.1 reinoud #define pa_slow_t pa_iot 116 1.1 reinoud #define pa_sync_t pa_iot 117 1.1 reinoud 118 1.1 reinoud #define pa_easi_base pa_podule->easi_base 119 1.1 reinoud #define pa_mod_base pa_podule->mod_base 120 1.1 reinoud #define pa_fast_base pa_podule->fast_base 121 1.1 reinoud #define pa_medium_base pa_podule->medium_base 122 1.1 reinoud #define pa_slow_base pa_podule->slow_base 123 1.1 reinoud #define pa_sync_base pa_podule->sync_base 124 1.1 reinoud 125 1.1 reinoud podulebus_intr_handle_t pa_ih; /* interrupt handle */ 126 1.1 reinoud 127 1.1 reinoud #define pa_manufacturer pa_podule->manufacturer 128 1.1 reinoud #define pa_product pa_podule->product 129 1.1 reinoud #define pa_descr pa_podule->description 130 1.1 reinoud }; 131 1.1 reinoud 132 1.1 reinoud /* Useful macros */ 133 1.1 reinoud 134 1.1 reinoud /* EASI space cycle control */ 135 1.1 reinoud 136 1.1 reinoud 137 1.1 reinoud #define IS_PODULE(pa, man, prod) \ 138 1.1 reinoud (pa->pa_manufacturer == man && pa->pa_product == prod) 139 1.1 reinoud 140 1.1 reinoud 141 1.1 reinoud 142 1.1 reinoud #define EASI_CYCLE_TYPE_A 0x00 143 1.1 reinoud #define EASI_CYCLE_TYPE_C 0x01 144 1.1 reinoud #define set_easi_cycle_type(podule, type) \ 145 1.1 reinoud IOMD_WRITE_BYTE(IOMD_ECTCR, (IOMD_READ_BYTE(IOMD_ECTCR) & ~(1 << podule)) | (1 << type)) 146 1.1 reinoud 147 1.1 reinoud #ifdef _KERNEL 148 1.1 reinoud 149 1.1 reinoud /* Array of podule structures, one per possible podule */ 150 1.1 reinoud 151 1.1 reinoud extern podule_t podules[MAX_PODULES + MAX_NETSLOTS]; 152 1.1 reinoud 153 1.2 dsl int matchpodule(struct podule_attach_args *pa, 154 1.2 dsl int manufacturer, int product, int required_slot); 155 1.1 reinoud 156 1.5 skrll void netslot_ea(uint8_t *buffer); 157 1.1 reinoud 158 1.2 dsl extern void *podulebus_irq_establish(podulebus_intr_handle_t, int, 159 1.2 dsl int (*)(void *), void *, struct evcnt *); 160 1.2 dsl extern void podulebus_shift_tag(bus_space_tag_t, u_int, 161 1.2 dsl bus_space_tag_t *); 162 1.1 reinoud 163 1.1 reinoud /* Used internally by the podulebus code */ 164 1.3 matt extern void netslotscan(device_t); 165 1.3 matt extern void poduleexamine(podule_t *, device_t, int); 166 1.1 reinoud 167 1.1 reinoud #endif 168 1.1 reinoud 169 1.1 reinoud /* End of podulebus.h */ 170