1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #include <stdio.h> 30*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 31*7c478bd9Sstevel@tonic-gate #include <strings.h> 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #include <fcode/private.h> 34*7c478bd9Sstevel@tonic-gate #include <fcode/log.h> 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <fcdriver/fcdriver.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate fstack_t 39*7c478bd9Sstevel@tonic-gate mem_map_in(fcode_env_t *env, fstack_t hi, fstack_t lo, fstack_t len) 40*7c478bd9Sstevel@tonic-gate { 41*7c478bd9Sstevel@tonic-gate private_data_t *pdp = DEVICE_PRIVATE(env); 42*7c478bd9Sstevel@tonic-gate fc_cell_t virt; 43*7c478bd9Sstevel@tonic-gate fstack_t mcookie = NULL; 44*7c478bd9Sstevel@tonic-gate char *service = "map-in"; 45*7c478bd9Sstevel@tonic-gate int error; 46*7c478bd9Sstevel@tonic-gate int offset = 0; 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* 49*7c478bd9Sstevel@tonic-gate * The calculation of the offset, lo and len are left here 50*7c478bd9Sstevel@tonic-gate * due to historical precedence. 51*7c478bd9Sstevel@tonic-gate */ 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate offset = lo & PAGEOFFSET; 54*7c478bd9Sstevel@tonic-gate lo &= PAGEMASK; 55*7c478bd9Sstevel@tonic-gate len = (len + offset + PAGEOFFSET) & PAGEMASK; 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate error = fc_run_priv(pdp->common, service, 3, 1, fc_size2cell(len), 58*7c478bd9Sstevel@tonic-gate fc_uint32_t2cell(hi), fc_uint32_t2cell(lo), &virt); 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate if (error) 61*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "gp2:%s: failed\n", service); 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate mcookie = mapping_to_mcookie(virt, len, NULL, NULL); 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate if (mcookie == NULL) 66*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "gp2:%s: mapping_to_mcookie failed\n", 67*7c478bd9Sstevel@tonic-gate service); 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate mcookie += offset; 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:%s: %llx -> %x\n", service, 72*7c478bd9Sstevel@tonic-gate (uint64_t)virt, (uint32_t)mcookie); 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate return (mcookie); 75*7c478bd9Sstevel@tonic-gate } 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate static void 78*7c478bd9Sstevel@tonic-gate mem_map_out(fcode_env_t *env, fstack_t mcookie, fstack_t len) 79*7c478bd9Sstevel@tonic-gate { 80*7c478bd9Sstevel@tonic-gate private_data_t *pdp = DEVICE_PRIVATE(env); 81*7c478bd9Sstevel@tonic-gate fc_cell_t virt; 82*7c478bd9Sstevel@tonic-gate char *service = "map-out"; 83*7c478bd9Sstevel@tonic-gate int error; 84*7c478bd9Sstevel@tonic-gate int offset; 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate /* 87*7c478bd9Sstevel@tonic-gate * The calculation of the offset, lo and len are left here 88*7c478bd9Sstevel@tonic-gate * due to historical precedence. 89*7c478bd9Sstevel@tonic-gate */ 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate offset = mcookie & PAGEOFFSET; 92*7c478bd9Sstevel@tonic-gate mcookie &= PAGEMASK; 93*7c478bd9Sstevel@tonic-gate len = (len + offset + PAGEOFFSET) & PAGEMASK; 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate if (!is_mcookie(mcookie)) { 96*7c478bd9Sstevel@tonic-gate log_message(MSG_ERROR, "gp2:%s: %x not an mcookie!\n", 97*7c478bd9Sstevel@tonic-gate service, (int)mcookie); 98*7c478bd9Sstevel@tonic-gate virt = mcookie; 99*7c478bd9Sstevel@tonic-gate } else { 100*7c478bd9Sstevel@tonic-gate virt = mcookie_to_addr(mcookie); 101*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:%s: %x -> %llx\n", service, 102*7c478bd9Sstevel@tonic-gate (int)mcookie, (uint64_t)virt); 103*7c478bd9Sstevel@tonic-gate delete_mapping(mcookie); 104*7c478bd9Sstevel@tonic-gate } 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate error = fc_run_priv(pdp->common, service, 2, 0, fc_size2cell(len), 107*7c478bd9Sstevel@tonic-gate virt); 108*7c478bd9Sstevel@tonic-gate if (error) 109*7c478bd9Sstevel@tonic-gate log_message(MSG_ERROR, "gp2:%s: failed\n", service); 110*7c478bd9Sstevel@tonic-gate } 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate static void 113*7c478bd9Sstevel@tonic-gate do_get_portid(fcode_env_t *env) 114*7c478bd9Sstevel@tonic-gate { 115*7c478bd9Sstevel@tonic-gate fstack_t phi, plo, portid; 116*7c478bd9Sstevel@tonic-gate private_data_t *pdp = DEVICE_PRIVATE(env); 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "gp2:get-portid"); 119*7c478bd9Sstevel@tonic-gate phi = POP(DS); 120*7c478bd9Sstevel@tonic-gate plo = POP(DS); 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate portid = ((plo & 0xff800000) >> 23) | ((phi & 1) << 9); 123*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:get-portid ( %x %x ) -> %x\n", 124*7c478bd9Sstevel@tonic-gate (int)phi, (int)plo, (int)portid); 125*7c478bd9Sstevel@tonic-gate PUSH(DS, portid); 126*7c478bd9Sstevel@tonic-gate } 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate static void 129*7c478bd9Sstevel@tonic-gate do_map_in(fcode_env_t *env) 130*7c478bd9Sstevel@tonic-gate { 131*7c478bd9Sstevel@tonic-gate fstack_t phi, pmid, plo, len, addr; 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 3, "gp2:map-in"); 134*7c478bd9Sstevel@tonic-gate len = POP(DS); 135*7c478bd9Sstevel@tonic-gate phi = POP(DS); 136*7c478bd9Sstevel@tonic-gate plo = POP(DS); 137*7c478bd9Sstevel@tonic-gate addr = mem_map_in(env, phi, plo, len); 138*7c478bd9Sstevel@tonic-gate PUSH(DS, addr); 139*7c478bd9Sstevel@tonic-gate } 140*7c478bd9Sstevel@tonic-gate 141*7c478bd9Sstevel@tonic-gate static void 142*7c478bd9Sstevel@tonic-gate do_map_out(fcode_env_t *env) 143*7c478bd9Sstevel@tonic-gate { 144*7c478bd9Sstevel@tonic-gate fstack_t addr, len; 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "gp2:map-out"); 147*7c478bd9Sstevel@tonic-gate len = POP(DS); 148*7c478bd9Sstevel@tonic-gate addr = POP(DS); 149*7c478bd9Sstevel@tonic-gate mem_map_out(env, addr, len); 150*7c478bd9Sstevel@tonic-gate } 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate static void 153*7c478bd9Sstevel@tonic-gate do_encode_unit(fcode_env_t *env) 154*7c478bd9Sstevel@tonic-gate { 155*7c478bd9Sstevel@tonic-gate char enc_buf[64]; 156*7c478bd9Sstevel@tonic-gate fstack_t hi, mid, lo; 157*7c478bd9Sstevel@tonic-gate int id, off; 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "gp2:encode-unit"); 160*7c478bd9Sstevel@tonic-gate hi = POP(DS); 161*7c478bd9Sstevel@tonic-gate lo = POP(DS); 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate hi = (hi & 0x00000001); /* get high order agent id bit */ 164*7c478bd9Sstevel@tonic-gate id = (hi << 9) | (lo >> 23); /* build extended agent id */ 165*7c478bd9Sstevel@tonic-gate off = lo & 0x7fffff; /* build config offset */ 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate if (off) { 168*7c478bd9Sstevel@tonic-gate sprintf(enc_buf, "%x,%x", id, off); 169*7c478bd9Sstevel@tonic-gate } else { 170*7c478bd9Sstevel@tonic-gate sprintf(enc_buf, "%x", id); 171*7c478bd9Sstevel@tonic-gate } 172*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:encode_unit ( %x %x ) -> '%s'\n", 173*7c478bd9Sstevel@tonic-gate (int)hi, (int)lo, enc_buf); 174*7c478bd9Sstevel@tonic-gate push_a_string(env, STRDUP(enc_buf)); 175*7c478bd9Sstevel@tonic-gate } 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate static void 178*7c478bd9Sstevel@tonic-gate do_decode_unit(fcode_env_t *env) 179*7c478bd9Sstevel@tonic-gate { 180*7c478bd9Sstevel@tonic-gate uint32_t lo, hi; 181*7c478bd9Sstevel@tonic-gate int agent, offset; 182*7c478bd9Sstevel@tonic-gate char *buf; 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "gp2:decode-unit"); 185*7c478bd9Sstevel@tonic-gate buf = pop_a_string(env, NULL); 186*7c478bd9Sstevel@tonic-gate if (sscanf(buf, "%x,%x", &agent, &offset) != 2) { 187*7c478bd9Sstevel@tonic-gate if (sscanf(buf, "%x", &agent) != 1) { 188*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "gp2:decode_unit:%s", buf); 189*7c478bd9Sstevel@tonic-gate } 190*7c478bd9Sstevel@tonic-gate offset = 0; 191*7c478bd9Sstevel@tonic-gate } 192*7c478bd9Sstevel@tonic-gate lo = offset | (agent << 23); 193*7c478bd9Sstevel@tonic-gate hi = (agent >> 9) | 0x400; 194*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:decode_unit ( '%s' ) -> %x %x\n", buf, 195*7c478bd9Sstevel@tonic-gate hi, lo); 196*7c478bd9Sstevel@tonic-gate PUSH(DS, lo); 197*7c478bd9Sstevel@tonic-gate PUSH(DS, hi); 198*7c478bd9Sstevel@tonic-gate } 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate static void 201*7c478bd9Sstevel@tonic-gate do_claim_addr(fcode_env_t *env) 202*7c478bd9Sstevel@tonic-gate { 203*7c478bd9Sstevel@tonic-gate fstack_t portid, bar, align, type, size_hi, size_lo; 204*7c478bd9Sstevel@tonic-gate fc_cell_t lo, hi; 205*7c478bd9Sstevel@tonic-gate private_data_t *pdp = DEVICE_PRIVATE(env); 206*7c478bd9Sstevel@tonic-gate char *service = "claim-address"; 207*7c478bd9Sstevel@tonic-gate int error; 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 6, "gp2:claim-address"); 210*7c478bd9Sstevel@tonic-gate portid = POP(DS); 211*7c478bd9Sstevel@tonic-gate bar = POP(DS); 212*7c478bd9Sstevel@tonic-gate align = POP(DS); 213*7c478bd9Sstevel@tonic-gate type = POP(DS); 214*7c478bd9Sstevel@tonic-gate size_hi = POP(DS); 215*7c478bd9Sstevel@tonic-gate size_lo = POP(DS); 216*7c478bd9Sstevel@tonic-gate 217*7c478bd9Sstevel@tonic-gate error = fc_run_priv(pdp->common, service, 6, 2, 218*7c478bd9Sstevel@tonic-gate fc_int2cell(portid), fc_int2cell(bar), fc_int2cell(align), 219*7c478bd9Sstevel@tonic-gate fc_int2cell(type), fc_int2cell(size_hi), fc_int2cell(size_lo), 220*7c478bd9Sstevel@tonic-gate &lo, &hi); 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate if (error) 223*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "gp2:%s: failed\n", service); 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, 226*7c478bd9Sstevel@tonic-gate "gp2:%s ( %x %x %x %x %x %x ) -> %x %x\n", service, (int)portid, 227*7c478bd9Sstevel@tonic-gate (int)bar, (int)align, (int)type, (int)size_hi, (int)size_lo, 228*7c478bd9Sstevel@tonic-gate (uint32_t)hi, (uint32_t)lo); 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate PUSH(DS, (uint32_t)lo); 231*7c478bd9Sstevel@tonic-gate PUSH(DS, (uint32_t)hi); 232*7c478bd9Sstevel@tonic-gate } 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate static void 235*7c478bd9Sstevel@tonic-gate do_master_interrupt(fcode_env_t *env) 236*7c478bd9Sstevel@tonic-gate { 237*7c478bd9Sstevel@tonic-gate int portid; 238*7c478bd9Sstevel@tonic-gate token_t xt; 239*7c478bd9Sstevel@tonic-gate 240*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "gp2:master-interrput"); 241*7c478bd9Sstevel@tonic-gate portid = POP(DS); 242*7c478bd9Sstevel@tonic-gate xt = POP(DS); 243*7c478bd9Sstevel@tonic-gate PUSH(DS, FALSE); 244*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:master-interrupt ( %x %x ) -> %x\n", 245*7c478bd9Sstevel@tonic-gate portid, xt, (int)FALSE); 246*7c478bd9Sstevel@tonic-gate } 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate static void 249*7c478bd9Sstevel@tonic-gate do_register_vectory_entry(fcode_env_t *env) 250*7c478bd9Sstevel@tonic-gate { 251*7c478bd9Sstevel@tonic-gate int ign, ino, level; 252*7c478bd9Sstevel@tonic-gate 253*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 3, "gp2:register-vector-entry"); 254*7c478bd9Sstevel@tonic-gate ign = POP(DS); 255*7c478bd9Sstevel@tonic-gate ino = POP(DS); 256*7c478bd9Sstevel@tonic-gate level = POP(DS); 257*7c478bd9Sstevel@tonic-gate PUSH(DS, FALSE); 258*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:register-vector-entry ( %x %x %x ) ->" 259*7c478bd9Sstevel@tonic-gate " %x\n", ign, ino, level, (int)FALSE); 260*7c478bd9Sstevel@tonic-gate } 261*7c478bd9Sstevel@tonic-gate 262*7c478bd9Sstevel@tonic-gate static void 263*7c478bd9Sstevel@tonic-gate do_get_interrupt_target(fcode_env_t *env) 264*7c478bd9Sstevel@tonic-gate { 265*7c478bd9Sstevel@tonic-gate int mid = 0; 266*7c478bd9Sstevel@tonic-gate 267*7c478bd9Sstevel@tonic-gate PUSH(DS, mid); 268*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "gp2:get-interrupt-target ( ) -> %x\n", 269*7c478bd9Sstevel@tonic-gate mid); 270*7c478bd9Sstevel@tonic-gate } 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate static void 273*7c478bd9Sstevel@tonic-gate do_device_id(fcode_env_t *env) 274*7c478bd9Sstevel@tonic-gate { 275*7c478bd9Sstevel@tonic-gate fstack_t phi, plo, addr; 276*7c478bd9Sstevel@tonic-gate fc_cell_t virtaddr; 277*7c478bd9Sstevel@tonic-gate private_data_t *pdp = DEVICE_PRIVATE(env); 278*7c478bd9Sstevel@tonic-gate uint64_t wci_id_reg; 279*7c478bd9Sstevel@tonic-gate int rc, parid; 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "gp2:device-id"); 282*7c478bd9Sstevel@tonic-gate phi = POP(DS); 283*7c478bd9Sstevel@tonic-gate plo = POP(DS); 284*7c478bd9Sstevel@tonic-gate 285*7c478bd9Sstevel@tonic-gate PUSH(DS, plo); 286*7c478bd9Sstevel@tonic-gate PUSH(DS, phi); 287*7c478bd9Sstevel@tonic-gate PUSH(DS, 0x100); 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate do_map_in(env); 290*7c478bd9Sstevel@tonic-gate 291*7c478bd9Sstevel@tonic-gate addr = POP(DS); 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate virtaddr = mcookie_to_addr(addr); 294*7c478bd9Sstevel@tonic-gate 295*7c478bd9Sstevel@tonic-gate /* Try to read the wci_id register */ 296*7c478bd9Sstevel@tonic-gate rc = fc_run_priv(pdp->common, "rx@", 1, 1, virtaddr + 0xe0, 297*7c478bd9Sstevel@tonic-gate &wci_id_reg); 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate mem_map_out(env, addr, 0x100); 300*7c478bd9Sstevel@tonic-gate 301*7c478bd9Sstevel@tonic-gate /* 302*7c478bd9Sstevel@tonic-gate * Get the part id from the jtag ID register 303*7c478bd9Sstevel@tonic-gate */ 304*7c478bd9Sstevel@tonic-gate parid = ((wci_id_reg >> 12) & 0xffff); 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate if (!rc && parid == 0x4478) { 307*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_FIND_FCODE, "gp2: do_device_id: gp2-wci\n"); 308*7c478bd9Sstevel@tonic-gate push_a_string(env, "SUNW,wci"); 309*7c478bd9Sstevel@tonic-gate } else { 310*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_FIND_FCODE, "gp2: do_device_id: gp2-pci\n"); 311*7c478bd9Sstevel@tonic-gate push_a_string(env, "gp2-pci"); 312*7c478bd9Sstevel@tonic-gate } 313*7c478bd9Sstevel@tonic-gate } 314*7c478bd9Sstevel@tonic-gate 315*7c478bd9Sstevel@tonic-gate #pragma init(_init) 316*7c478bd9Sstevel@tonic-gate 317*7c478bd9Sstevel@tonic-gate static void 318*7c478bd9Sstevel@tonic-gate _init(void) 319*7c478bd9Sstevel@tonic-gate { 320*7c478bd9Sstevel@tonic-gate fcode_env_t *env = initial_env; 321*7c478bd9Sstevel@tonic-gate 322*7c478bd9Sstevel@tonic-gate ASSERT(env); 323*7c478bd9Sstevel@tonic-gate ASSERT(env->current_device); 324*7c478bd9Sstevel@tonic-gate NOTICE; 325*7c478bd9Sstevel@tonic-gate 326*7c478bd9Sstevel@tonic-gate create_int_prop(env, "#address-cells", 2); 327*7c478bd9Sstevel@tonic-gate 328*7c478bd9Sstevel@tonic-gate FORTH(0, "map-in", do_map_in); 329*7c478bd9Sstevel@tonic-gate FORTH(0, "get-portid", do_get_portid); 330*7c478bd9Sstevel@tonic-gate FORTH(0, "map-out", do_map_out); 331*7c478bd9Sstevel@tonic-gate FORTH(0, "decode-unit", do_decode_unit); 332*7c478bd9Sstevel@tonic-gate FORTH(0, "encode-unit", do_encode_unit); 333*7c478bd9Sstevel@tonic-gate FORTH(0, "claim-address", do_claim_addr); 334*7c478bd9Sstevel@tonic-gate FORTH(0, "master-interrupt", do_master_interrupt); 335*7c478bd9Sstevel@tonic-gate FORTH(0, "register-vector-entry", do_register_vectory_entry); 336*7c478bd9Sstevel@tonic-gate FORTH(0, "get-interrupt-target", do_get_interrupt_target); 337*7c478bd9Sstevel@tonic-gate FORTH(0, "device-id", do_device_id); 338*7c478bd9Sstevel@tonic-gate 339*7c478bd9Sstevel@tonic-gate install_dma_methods(env); 340*7c478bd9Sstevel@tonic-gate 341*7c478bd9Sstevel@tonic-gate } 342