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 2000-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 static fstack_t 39*7c478bd9Sstevel@tonic-gate mem_map_in(fcode_env_t *env, fstack_t hi, fstack_t mid, fstack_t lo, 40*7c478bd9Sstevel@tonic-gate fstack_t requested_len) 41*7c478bd9Sstevel@tonic-gate { 42*7c478bd9Sstevel@tonic-gate private_data_t *cdp = DEVICE_PRIVATE(env); 43*7c478bd9Sstevel@tonic-gate int error; 44*7c478bd9Sstevel@tonic-gate fc_cell_t requested_virt, adjusted_virt; 45*7c478bd9Sstevel@tonic-gate char *service = "map-in"; 46*7c478bd9Sstevel@tonic-gate fstack_t mcookie = NULL; 47*7c478bd9Sstevel@tonic-gate int pa_offset = 0, va_offset = 0; 48*7c478bd9Sstevel@tonic-gate fstack_t adjusted_len = 0; 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate pa_offset = lo & PAGEOFFSET; 51*7c478bd9Sstevel@tonic-gate lo &= PAGEMASK; 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate /* adjust the requested_len to a multiple of a pagesize */ 54*7c478bd9Sstevel@tonic-gate requested_len = (requested_len + pa_offset + PAGEOFFSET) & PAGEMASK; 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate error = fc_run_priv(cdp->common, service, 4, 1, 57*7c478bd9Sstevel@tonic-gate fc_size2cell(requested_len), fc_uint32_t2cell(hi), 58*7c478bd9Sstevel@tonic-gate fc_uint32_t2cell(mid), fc_uint32_t2cell(lo), &requested_virt); 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate if (error) 61*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "pci:%s: failed\n", service); 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate /* 64*7c478bd9Sstevel@tonic-gate * Check the requested_virt address and ensure that 65*7c478bd9Sstevel@tonic-gate * it starts at a page boundary. 66*7c478bd9Sstevel@tonic-gate */ 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate va_offset = requested_virt & PAGEOFFSET; 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate if (va_offset != 0) { 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* 73*7c478bd9Sstevel@tonic-gate * Align the virtual address to a page boundary 74*7c478bd9Sstevel@tonic-gate * before mapping it to a mcookie. Recalcuate the 75*7c478bd9Sstevel@tonic-gate * length and round it up to the next multiple of a pagesize. 76*7c478bd9Sstevel@tonic-gate */ 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate adjusted_virt = requested_virt & PAGEMASK; 79*7c478bd9Sstevel@tonic-gate adjusted_len = (requested_len + va_offset + PAGEOFFSET) 80*7c478bd9Sstevel@tonic-gate & PAGEMASK; 81*7c478bd9Sstevel@tonic-gate } 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate mcookie = mapping_to_mcookie(requested_virt, requested_len, 84*7c478bd9Sstevel@tonic-gate adjusted_virt, adjusted_len); 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate if (mcookie == NULL) 87*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "pci-mapin-> pci:%s:" 88*7c478bd9Sstevel@tonic-gate " mapping_to_mcookie failed\n", service); 89*7c478bd9Sstevel@tonic-gate /* 90*7c478bd9Sstevel@tonic-gate * Recalculate the address of the mcookie. 91*7c478bd9Sstevel@tonic-gate */ 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate mcookie += va_offset + pa_offset; 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "pci:map-in: %llx -> %x\n", 96*7c478bd9Sstevel@tonic-gate (uint64_t)requested_virt, (uint32_t)mcookie); 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate return (mcookie); 99*7c478bd9Sstevel@tonic-gate } 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate static void 102*7c478bd9Sstevel@tonic-gate mem_map_out(fcode_env_t *env, fstack_t mcookie, fstack_t requested_len) 103*7c478bd9Sstevel@tonic-gate { 104*7c478bd9Sstevel@tonic-gate private_data_t *cdp = DEVICE_PRIVATE(env); 105*7c478bd9Sstevel@tonic-gate char *service = "map-out"; 106*7c478bd9Sstevel@tonic-gate fc_cell_t requested_virt; 107*7c478bd9Sstevel@tonic-gate int error; 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate if (!is_mcookie(mcookie)) { 110*7c478bd9Sstevel@tonic-gate log_message(MSG_ERROR, "pci:%s: %x not mcookie!\n", service, 111*7c478bd9Sstevel@tonic-gate (uint32_t)mcookie); 112*7c478bd9Sstevel@tonic-gate requested_virt = mcookie; 113*7c478bd9Sstevel@tonic-gate } else { 114*7c478bd9Sstevel@tonic-gate requested_virt = mcookie_to_rvirt(mcookie); 115*7c478bd9Sstevel@tonic-gate requested_len = mcookie_to_rlen(mcookie); 116*7c478bd9Sstevel@tonic-gate delete_mapping(mcookie); 117*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "pci:%s: %x -> %llx\n", service, 118*7c478bd9Sstevel@tonic-gate (uint32_t)mcookie, (uint64_t)requested_virt); 119*7c478bd9Sstevel@tonic-gate } 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate error = fc_run_priv(cdp->common, service, 2, 0, 122*7c478bd9Sstevel@tonic-gate fc_size2cell(requested_len), requested_virt); 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate if (error) 125*7c478bd9Sstevel@tonic-gate log_message(MSG_ERROR, "pci:%s: failed\n", service); 126*7c478bd9Sstevel@tonic-gate } 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate static void 129*7c478bd9Sstevel@tonic-gate pci_config_fetch(fcode_env_t *env, char *service) 130*7c478bd9Sstevel@tonic-gate { 131*7c478bd9Sstevel@tonic-gate uint32_t cfgadd; 132*7c478bd9Sstevel@tonic-gate fc_cell_t value; 133*7c478bd9Sstevel@tonic-gate private_data_t *h = DEVICE_PRIVATE(env); 134*7c478bd9Sstevel@tonic-gate int error; 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate ASSERT(h); 137*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 1, service); 138*7c478bd9Sstevel@tonic-gate cfgadd = POP(DS); 139*7c478bd9Sstevel@tonic-gate error = fc_run_priv(h->common, service, 1, 1, fc_uint32_t2cell(cfgadd), 140*7c478bd9Sstevel@tonic-gate &value); 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate if (error) 143*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "pci:%s ( %x ) FAIL\n", service, 144*7c478bd9Sstevel@tonic-gate cfgadd); 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate PUSH(DS, value); 147*7c478bd9Sstevel@tonic-gate } 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate static void 150*7c478bd9Sstevel@tonic-gate pci_config_store(fcode_env_t *env, char *service) 151*7c478bd9Sstevel@tonic-gate { 152*7c478bd9Sstevel@tonic-gate uint32_t cfgadd; 153*7c478bd9Sstevel@tonic-gate fc_cell_t value; 154*7c478bd9Sstevel@tonic-gate private_data_t *h = DEVICE_PRIVATE(env); 155*7c478bd9Sstevel@tonic-gate int error; 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate ASSERT(h); 158*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, service); 159*7c478bd9Sstevel@tonic-gate cfgadd = POP(DS); 160*7c478bd9Sstevel@tonic-gate value = POP(DS); 161*7c478bd9Sstevel@tonic-gate error = fc_run_priv(h->common, service, 2, 0, fc_uint32_t2cell(cfgadd), 162*7c478bd9Sstevel@tonic-gate fc_uint32_t2cell(value)); 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate if (error) 165*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "pci:%s ( %x %x ) FAIL\n", service, 166*7c478bd9Sstevel@tonic-gate cfgadd, value); 167*7c478bd9Sstevel@tonic-gate } 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gate static void 170*7c478bd9Sstevel@tonic-gate config_lfetch(fcode_env_t *env) 171*7c478bd9Sstevel@tonic-gate { 172*7c478bd9Sstevel@tonic-gate pci_config_fetch(env, "config-l@"); 173*7c478bd9Sstevel@tonic-gate } 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate static void 176*7c478bd9Sstevel@tonic-gate config_lstore(fcode_env_t *env) 177*7c478bd9Sstevel@tonic-gate { 178*7c478bd9Sstevel@tonic-gate pci_config_store(env, "config-l!"); 179*7c478bd9Sstevel@tonic-gate } 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate static void 182*7c478bd9Sstevel@tonic-gate config_wfetch(fcode_env_t *env) 183*7c478bd9Sstevel@tonic-gate { 184*7c478bd9Sstevel@tonic-gate pci_config_fetch(env, "config-w@"); 185*7c478bd9Sstevel@tonic-gate } 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate static void 188*7c478bd9Sstevel@tonic-gate config_wstore(fcode_env_t *env) 189*7c478bd9Sstevel@tonic-gate { 190*7c478bd9Sstevel@tonic-gate pci_config_store(env, "config-w!"); 191*7c478bd9Sstevel@tonic-gate } 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate static void 194*7c478bd9Sstevel@tonic-gate config_bfetch(fcode_env_t *env) 195*7c478bd9Sstevel@tonic-gate { 196*7c478bd9Sstevel@tonic-gate pci_config_fetch(env, "config-b@"); 197*7c478bd9Sstevel@tonic-gate } 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate static void 200*7c478bd9Sstevel@tonic-gate config_bstore(fcode_env_t *env) 201*7c478bd9Sstevel@tonic-gate { 202*7c478bd9Sstevel@tonic-gate pci_config_store(env, "config-b!"); 203*7c478bd9Sstevel@tonic-gate } 204*7c478bd9Sstevel@tonic-gate 205*7c478bd9Sstevel@tonic-gate static void 206*7c478bd9Sstevel@tonic-gate do_map_in(fcode_env_t *env) 207*7c478bd9Sstevel@tonic-gate { 208*7c478bd9Sstevel@tonic-gate fstack_t phi, pmid, plo, len, addr; 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 4, "pci:map-in"); 211*7c478bd9Sstevel@tonic-gate len = POP(DS); 212*7c478bd9Sstevel@tonic-gate phi = POP(DS); 213*7c478bd9Sstevel@tonic-gate pmid = POP(DS); 214*7c478bd9Sstevel@tonic-gate plo = POP(DS); 215*7c478bd9Sstevel@tonic-gate addr = mem_map_in(env, phi, pmid, plo, len); 216*7c478bd9Sstevel@tonic-gate PUSH(DS, addr); 217*7c478bd9Sstevel@tonic-gate } 218*7c478bd9Sstevel@tonic-gate 219*7c478bd9Sstevel@tonic-gate static void 220*7c478bd9Sstevel@tonic-gate do_map_out(fcode_env_t *env) 221*7c478bd9Sstevel@tonic-gate { 222*7c478bd9Sstevel@tonic-gate fstack_t addr, len; 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "pci:map-out"); 225*7c478bd9Sstevel@tonic-gate len = POP(DS); 226*7c478bd9Sstevel@tonic-gate addr = POP(DS); 227*7c478bd9Sstevel@tonic-gate mem_map_out(env, addr, len); 228*7c478bd9Sstevel@tonic-gate } 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate static void 231*7c478bd9Sstevel@tonic-gate do_encode_unit(fcode_env_t *env) 232*7c478bd9Sstevel@tonic-gate { 233*7c478bd9Sstevel@tonic-gate char enc_buf[64]; 234*7c478bd9Sstevel@tonic-gate uint32_t hi; 235*7c478bd9Sstevel@tonic-gate int dev, fn; 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 3, "pci:encode-unit"); 238*7c478bd9Sstevel@tonic-gate hi = POP(DS); 239*7c478bd9Sstevel@tonic-gate (void) POP(DS); 240*7c478bd9Sstevel@tonic-gate (void) POP(DS); 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate fn = ((hi >> 8) & 0x7); 243*7c478bd9Sstevel@tonic-gate dev = ((hi >> 11) & 0x1f); 244*7c478bd9Sstevel@tonic-gate 245*7c478bd9Sstevel@tonic-gate if (fn) { 246*7c478bd9Sstevel@tonic-gate sprintf(enc_buf, "%x,%x", dev, fn); 247*7c478bd9Sstevel@tonic-gate } else { 248*7c478bd9Sstevel@tonic-gate sprintf(enc_buf, "%x", dev); 249*7c478bd9Sstevel@tonic-gate } 250*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "pci:encode-unit ( %x ) -> %s\n", 251*7c478bd9Sstevel@tonic-gate hi, enc_buf); 252*7c478bd9Sstevel@tonic-gate push_a_string(env, STRDUP(enc_buf)); 253*7c478bd9Sstevel@tonic-gate } 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate static void 256*7c478bd9Sstevel@tonic-gate do_decode_unit(fcode_env_t *env) 257*7c478bd9Sstevel@tonic-gate { 258*7c478bd9Sstevel@tonic-gate int lo, hi, unit; 259*7c478bd9Sstevel@tonic-gate char *buf; 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 2, "pci:decode-unit"); 262*7c478bd9Sstevel@tonic-gate buf = pop_a_string(env, NULL); 263*7c478bd9Sstevel@tonic-gate if (sscanf(buf, "%x,%x", &hi, &lo) != 2) { 264*7c478bd9Sstevel@tonic-gate throw_from_fclib(env, 1, "pci:decode-unit: '%s'", buf); 265*7c478bd9Sstevel@tonic-gate } 266*7c478bd9Sstevel@tonic-gate unit = ((hi & 0x1f) << 11); 267*7c478bd9Sstevel@tonic-gate unit |= ((lo & 0x7) << 8); 268*7c478bd9Sstevel@tonic-gate debug_msg(DEBUG_REG_ACCESS, "pci:decode-unit ( '%s' ) -> 0 0 %x\n", 269*7c478bd9Sstevel@tonic-gate buf, unit); 270*7c478bd9Sstevel@tonic-gate PUSH(DS, 0); 271*7c478bd9Sstevel@tonic-gate PUSH(DS, 0); 272*7c478bd9Sstevel@tonic-gate PUSH(DS, unit); 273*7c478bd9Sstevel@tonic-gate } 274*7c478bd9Sstevel@tonic-gate 275*7c478bd9Sstevel@tonic-gate static void 276*7c478bd9Sstevel@tonic-gate do_device_id(fcode_env_t *env) 277*7c478bd9Sstevel@tonic-gate { 278*7c478bd9Sstevel@tonic-gate uint32_t cfgadd; 279*7c478bd9Sstevel@tonic-gate uint16_t ven_id, dev_id; 280*7c478bd9Sstevel@tonic-gate char buf[40]; 281*7c478bd9Sstevel@tonic-gate 282*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 3, "pci:device-id"); 283*7c478bd9Sstevel@tonic-gate cfgadd = POP(DS); 284*7c478bd9Sstevel@tonic-gate (void) POP(DS); 285*7c478bd9Sstevel@tonic-gate (void) POP(DS); 286*7c478bd9Sstevel@tonic-gate PUSH(DS, cfgadd + PCI_CONF_VENID); 287*7c478bd9Sstevel@tonic-gate config_wfetch(env); 288*7c478bd9Sstevel@tonic-gate ven_id = POP(DS); 289*7c478bd9Sstevel@tonic-gate PUSH(DS, cfgadd + PCI_CONF_DEVID); 290*7c478bd9Sstevel@tonic-gate config_wfetch(env); 291*7c478bd9Sstevel@tonic-gate dev_id = POP(DS); 292*7c478bd9Sstevel@tonic-gate sprintf(buf, "pci%x,%x", ven_id, dev_id); 293*7c478bd9Sstevel@tonic-gate push_a_string(env, STRDUP(buf)); 294*7c478bd9Sstevel@tonic-gate } 295*7c478bd9Sstevel@tonic-gate 296*7c478bd9Sstevel@tonic-gate static void 297*7c478bd9Sstevel@tonic-gate do_class_id(fcode_env_t *env) 298*7c478bd9Sstevel@tonic-gate { 299*7c478bd9Sstevel@tonic-gate uint32_t cfgadd; 300*7c478bd9Sstevel@tonic-gate uint8_t basclass, subclass, progclass; 301*7c478bd9Sstevel@tonic-gate char buf[40]; 302*7c478bd9Sstevel@tonic-gate 303*7c478bd9Sstevel@tonic-gate CHECK_DEPTH(env, 3, "pci:class-id"); 304*7c478bd9Sstevel@tonic-gate cfgadd = POP(DS); 305*7c478bd9Sstevel@tonic-gate (void) POP(DS); 306*7c478bd9Sstevel@tonic-gate (void) POP(DS); 307*7c478bd9Sstevel@tonic-gate PUSH(DS, cfgadd + PCI_CONF_BASCLASS); 308*7c478bd9Sstevel@tonic-gate config_bfetch(env); 309*7c478bd9Sstevel@tonic-gate basclass = POP(DS); 310*7c478bd9Sstevel@tonic-gate PUSH(DS, cfgadd + PCI_CONF_SUBCLASS); 311*7c478bd9Sstevel@tonic-gate config_bfetch(env); 312*7c478bd9Sstevel@tonic-gate subclass = POP(DS); 313*7c478bd9Sstevel@tonic-gate PUSH(DS, cfgadd + PCI_CONF_PROGCLASS); 314*7c478bd9Sstevel@tonic-gate config_bfetch(env); 315*7c478bd9Sstevel@tonic-gate progclass = POP(DS); 316*7c478bd9Sstevel@tonic-gate sprintf(buf, "pciclass%02x%02x%02x", basclass, subclass, progclass); 317*7c478bd9Sstevel@tonic-gate push_a_string(env, STRDUP(buf)); 318*7c478bd9Sstevel@tonic-gate } 319*7c478bd9Sstevel@tonic-gate 320*7c478bd9Sstevel@tonic-gate #pragma init(_init) 321*7c478bd9Sstevel@tonic-gate 322*7c478bd9Sstevel@tonic-gate static void 323*7c478bd9Sstevel@tonic-gate _init(void) 324*7c478bd9Sstevel@tonic-gate { 325*7c478bd9Sstevel@tonic-gate fcode_env_t *env = initial_env; 326*7c478bd9Sstevel@tonic-gate 327*7c478bd9Sstevel@tonic-gate ASSERT(env); 328*7c478bd9Sstevel@tonic-gate ASSERT(env->current_device); 329*7c478bd9Sstevel@tonic-gate NOTICE; 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate FORTH(0, "config-l@", config_lfetch); 332*7c478bd9Sstevel@tonic-gate FORTH(0, "config-l!", config_lstore); 333*7c478bd9Sstevel@tonic-gate FORTH(0, "config-w@", config_wfetch); 334*7c478bd9Sstevel@tonic-gate FORTH(0, "config-w!", config_wstore); 335*7c478bd9Sstevel@tonic-gate FORTH(0, "config-b@", config_bfetch); 336*7c478bd9Sstevel@tonic-gate FORTH(0, "config-b!", config_bstore); 337*7c478bd9Sstevel@tonic-gate FORTH(0, "map-in", do_map_in); 338*7c478bd9Sstevel@tonic-gate FORTH(0, "map-out", do_map_out); 339*7c478bd9Sstevel@tonic-gate FORTH(0, "decode-unit", do_decode_unit); 340*7c478bd9Sstevel@tonic-gate FORTH(0, "encode-unit", do_encode_unit); 341*7c478bd9Sstevel@tonic-gate FORTH(0, "device-id", do_device_id); 342*7c478bd9Sstevel@tonic-gate FORTH(0, "class-id", do_class_id); 343*7c478bd9Sstevel@tonic-gate 344*7c478bd9Sstevel@tonic-gate install_dma_methods(env); 345*7c478bd9Sstevel@tonic-gate } 346