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 (c) 1999-2000 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 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 /* 30*7c478bd9Sstevel@tonic-gate * s1394_csr.c 31*7c478bd9Sstevel@tonic-gate * 1394 Services Layer CSR and Config ROM Routines 32*7c478bd9Sstevel@tonic-gate * Contains all of the CSR callback routines for various required 33*7c478bd9Sstevel@tonic-gate * CSR registers. Also contains routines for their initialization 34*7c478bd9Sstevel@tonic-gate * and destruction, as well as routines to handle the processing 35*7c478bd9Sstevel@tonic-gate * of Config ROM update requests. 36*7c478bd9Sstevel@tonic-gate */ 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #include <sys/conf.h> 39*7c478bd9Sstevel@tonic-gate #include <sys/ddi.h> 40*7c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 41*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 42*7c478bd9Sstevel@tonic-gate #include <sys/kmem.h> 43*7c478bd9Sstevel@tonic-gate #include <sys/tnf_probe.h> 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate #include <sys/1394/t1394.h> 46*7c478bd9Sstevel@tonic-gate #include <sys/1394/s1394.h> 47*7c478bd9Sstevel@tonic-gate #include <sys/1394/h1394.h> 48*7c478bd9Sstevel@tonic-gate #include <sys/1394/ieee1394.h> 49*7c478bd9Sstevel@tonic-gate #include <sys/1394/ieee1212.h> 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate static void s1394_CSR_state_clear(cmd1394_cmd_t *req); 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate static void s1394_CSR_state_set(cmd1394_cmd_t *req); 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate static void s1394_CSR_node_ids(cmd1394_cmd_t *req); 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate static void s1394_CSR_reset_start(cmd1394_cmd_t *req); 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate static void s1394_CSR_split_timeout(cmd1394_cmd_t *req); 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate static void s1394_CSR_argument_regs(cmd1394_cmd_t *req); 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate static void s1394_CSR_test_regs(cmd1394_cmd_t *req); 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate static void s1394_CSR_interrupt_regs(cmd1394_cmd_t *req); 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate static void s1394_CSR_clock_regs(cmd1394_cmd_t *req); 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate static void s1394_CSR_message_regs(cmd1394_cmd_t *req); 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate static void s1394_CSR_cycle_time(cmd1394_cmd_t *req); 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate static void s1394_CSR_bus_time(cmd1394_cmd_t *req); 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate static void s1394_CSR_busy_timeout(cmd1394_cmd_t *req); 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate static void s1394_CSR_IRM_regs(cmd1394_cmd_t *req); 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate static void s1394_CSR_topology_map(cmd1394_cmd_t *req); 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate static void s1394_common_CSR_routine(s1394_hal_t *hal, cmd1394_cmd_t *req); 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate static int s1394_init_config_rom_structures(s1394_hal_t *hal); 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate static int s1394_destroy_config_rom_structures(s1394_hal_t *hal); 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate /* 88*7c478bd9Sstevel@tonic-gate * s1394_setup_CSR_space() 89*7c478bd9Sstevel@tonic-gate * setups up the local host's CSR registers and callback routines. 90*7c478bd9Sstevel@tonic-gate */ 91*7c478bd9Sstevel@tonic-gate int 92*7c478bd9Sstevel@tonic-gate s1394_setup_CSR_space(s1394_hal_t *hal) 93*7c478bd9Sstevel@tonic-gate { 94*7c478bd9Sstevel@tonic-gate s1394_addr_space_blk_t *curr_blk; 95*7c478bd9Sstevel@tonic-gate t1394_alloc_addr_t addr; 96*7c478bd9Sstevel@tonic-gate t1394_addr_enable_t rw_flags; 97*7c478bd9Sstevel@tonic-gate int result; 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_enter, S1394_TNF_SL_CSR_STACK, 100*7c478bd9Sstevel@tonic-gate ""); 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate /* 103*7c478bd9Sstevel@tonic-gate * Although they are not freed up in this routine, if 104*7c478bd9Sstevel@tonic-gate * one of the s1394_claim_addr_blk() routines fails, 105*7c478bd9Sstevel@tonic-gate * all of the previously successful claims will be 106*7c478bd9Sstevel@tonic-gate * freed up in s1394_destroy_addr_space() upon returning 107*7c478bd9Sstevel@tonic-gate * DDI_FAILURE from this routine. 108*7c478bd9Sstevel@tonic-gate */ 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate rw_flags = T1394_ADDR_RDENBL | T1394_ADDR_WRENBL; 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate * STATE_CLEAR 114*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.1 or 115*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.1 116*7c478bd9Sstevel@tonic-gate */ 117*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_STATE_CLEAR; 118*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 119*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 120*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 121*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_state_clear; 122*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_state_clear; 123*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 124*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 125*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 126*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 127*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 128*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 129*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 130*7c478bd9Sstevel@tonic-gate "STATE_CLEAR: CSR setup failed"); 131*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 132*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 133*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 134*7c478bd9Sstevel@tonic-gate } 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate /* 137*7c478bd9Sstevel@tonic-gate * STATE_SET 138*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.2 or 139*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.2 140*7c478bd9Sstevel@tonic-gate */ 141*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_STATE_SET; 142*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 143*7c478bd9Sstevel@tonic-gate addr.aa_enable = T1394_ADDR_WRENBL; 144*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 145*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = NULL; 146*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_state_set; 147*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 148*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 149*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 150*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 151*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 152*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 153*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 154*7c478bd9Sstevel@tonic-gate "STATE_SET: CSR setup failed"); 155*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 156*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 157*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 158*7c478bd9Sstevel@tonic-gate } 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate /* 161*7c478bd9Sstevel@tonic-gate * NODE_IDS 162*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.3 or 163*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.3 164*7c478bd9Sstevel@tonic-gate */ 165*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_NODE_IDS; 166*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 167*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 168*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 169*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_node_ids; 170*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_node_ids; 171*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 172*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 173*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 174*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 175*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 176*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 177*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 178*7c478bd9Sstevel@tonic-gate "NODE_IDS: CSR setup failed"); 179*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 180*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 181*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 182*7c478bd9Sstevel@tonic-gate } 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate /* 185*7c478bd9Sstevel@tonic-gate * RESET_START 186*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.4 or 187*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.4 188*7c478bd9Sstevel@tonic-gate */ 189*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_RESET_START; 190*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 191*7c478bd9Sstevel@tonic-gate addr.aa_enable = T1394_ADDR_WRENBL; 192*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 193*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = NULL; 194*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_reset_start; 195*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 196*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 197*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 198*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 199*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 200*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 201*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 202*7c478bd9Sstevel@tonic-gate "RESET_START: CSR setup failed"); 203*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 204*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 205*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 206*7c478bd9Sstevel@tonic-gate } 207*7c478bd9Sstevel@tonic-gate 208*7c478bd9Sstevel@tonic-gate /* 209*7c478bd9Sstevel@tonic-gate * SPLIT_TIMEOUT 210*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.6 or 211*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.7 212*7c478bd9Sstevel@tonic-gate */ 213*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_SPLIT_TIMEOUT_HI; 214*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_OCTLET; 215*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 216*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 217*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_split_timeout; 218*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_split_timeout; 219*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 220*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 221*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 222*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 223*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 224*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 225*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 226*7c478bd9Sstevel@tonic-gate "SPLIT_TIMEOUT: CSR setup failed"); 227*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 228*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 229*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 230*7c478bd9Sstevel@tonic-gate } 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate /* 233*7c478bd9Sstevel@tonic-gate * ARGUMENT_HI and ARGUMENT_LO 234*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.7 or 235*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.8 236*7c478bd9Sstevel@tonic-gate */ 237*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_ARG_HI; 238*7c478bd9Sstevel@tonic-gate addr.aa_length = 2 * (IEEE1394_QUADLET); 239*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 240*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 241*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_argument_regs; 242*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_argument_regs; 243*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 244*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 245*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 246*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 247*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 248*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 249*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 250*7c478bd9Sstevel@tonic-gate "ARGUMENT registers: CSR setup failed"); 251*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 252*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 253*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 254*7c478bd9Sstevel@tonic-gate } 255*7c478bd9Sstevel@tonic-gate 256*7c478bd9Sstevel@tonic-gate /* 257*7c478bd9Sstevel@tonic-gate * TEST_START and TEST_STATUS 258*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.7 or 259*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.9 - 7.4.10 260*7c478bd9Sstevel@tonic-gate */ 261*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_TEST_START; 262*7c478bd9Sstevel@tonic-gate addr.aa_length = 2 * (IEEE1394_QUADLET); 263*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 264*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 265*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_test_regs; 266*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_test_regs; 267*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 268*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 269*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 270*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 271*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 272*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 273*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 274*7c478bd9Sstevel@tonic-gate "TEST registers: CSR setup failed"); 275*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 276*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 277*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 278*7c478bd9Sstevel@tonic-gate } 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate /* 281*7c478bd9Sstevel@tonic-gate * INTERRUPT_TARGET and INTERRUPT_MASK 282*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.9 or 283*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.15 - 7.4.16 284*7c478bd9Sstevel@tonic-gate */ 285*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_INTERRUPT_TARGET; 286*7c478bd9Sstevel@tonic-gate addr.aa_length = 2 * (IEEE1394_QUADLET); 287*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 288*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 289*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_interrupt_regs; 290*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_interrupt_regs; 291*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 292*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 293*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 294*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 295*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 296*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 297*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 298*7c478bd9Sstevel@tonic-gate "INTERRUPT registers: CSR setup failed"); 299*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 300*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 301*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 302*7c478bd9Sstevel@tonic-gate } 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate /* 305*7c478bd9Sstevel@tonic-gate * CLOCK_VALUE, CLOCK_TICK_PERIOD, CLOCK_INFO, etc. 306*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.10 or 307*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.17 - 7.4.20 308*7c478bd9Sstevel@tonic-gate */ 309*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_CLOCK_VALUE; 310*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_CSR_CLOCK_VALUE_SZ; 311*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 312*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 313*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_clock_regs; 314*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_clock_regs; 315*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 316*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 317*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 318*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 319*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 320*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 321*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 322*7c478bd9Sstevel@tonic-gate "CLOCK registers: CSR setup failed"); 323*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 324*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 325*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 326*7c478bd9Sstevel@tonic-gate } 327*7c478bd9Sstevel@tonic-gate 328*7c478bd9Sstevel@tonic-gate /* 329*7c478bd9Sstevel@tonic-gate * MESSAGE_REQUEST and MESSAGE_RESPONSE 330*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.2.11 or 331*7c478bd9Sstevel@tonic-gate * IEEE 1212-1994, Section 7.4.21 332*7c478bd9Sstevel@tonic-gate */ 333*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CSR_MESSAGE_REQUEST; 334*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_CSR_MESSAGE_REQUEST_SZ; 335*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 336*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 337*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_message_regs; 338*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_message_regs; 339*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 340*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 341*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 342*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 343*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 344*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 345*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 346*7c478bd9Sstevel@tonic-gate "MESSAGE registers: CSR setup failed"); 347*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 348*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 349*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 350*7c478bd9Sstevel@tonic-gate } 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate /* 353*7c478bd9Sstevel@tonic-gate * CYCLE_TIME 354*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.3.1 355*7c478bd9Sstevel@tonic-gate */ 356*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_SCSR_CYCLE_TIME; 357*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 358*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 359*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 360*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_cycle_time; 361*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_cycle_time; 362*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 363*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 364*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 365*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 366*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 367*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 368*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 369*7c478bd9Sstevel@tonic-gate "CYCLE_TIME: CSR setup failed"); 370*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 371*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 372*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 373*7c478bd9Sstevel@tonic-gate } 374*7c478bd9Sstevel@tonic-gate 375*7c478bd9Sstevel@tonic-gate /* 376*7c478bd9Sstevel@tonic-gate * BUS_TIME 377*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.3.2 378*7c478bd9Sstevel@tonic-gate */ 379*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_SCSR_BUS_TIME; 380*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 381*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 382*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 383*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_bus_time; 384*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_bus_time; 385*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 386*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 387*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 388*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 389*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 390*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 391*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 392*7c478bd9Sstevel@tonic-gate "BUS_TIME: CSR setup failed"); 393*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 394*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 395*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 396*7c478bd9Sstevel@tonic-gate } 397*7c478bd9Sstevel@tonic-gate 398*7c478bd9Sstevel@tonic-gate /* 399*7c478bd9Sstevel@tonic-gate * BUSY_TIMEOUT 400*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.3.5 401*7c478bd9Sstevel@tonic-gate */ 402*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_SCSR_BUSY_TIMEOUT; 403*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 404*7c478bd9Sstevel@tonic-gate addr.aa_enable = rw_flags; 405*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 406*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_busy_timeout; 407*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = s1394_CSR_busy_timeout; 408*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 409*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 410*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 411*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 412*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 413*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 414*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 415*7c478bd9Sstevel@tonic-gate "BUSY_TIMEOUT: CSR setup failed"); 416*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 417*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 418*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 419*7c478bd9Sstevel@tonic-gate } 420*7c478bd9Sstevel@tonic-gate 421*7c478bd9Sstevel@tonic-gate /* 422*7c478bd9Sstevel@tonic-gate * BUS_MANAGER_ID 423*7c478bd9Sstevel@tonic-gate * BANDWIDTH_AVAILABLE 424*7c478bd9Sstevel@tonic-gate * CHANNELS_AVAILABLE 425*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.3.6 - 8.3.2.3.8 426*7c478bd9Sstevel@tonic-gate */ 427*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_SCSR_BUSMGR_ID; 428*7c478bd9Sstevel@tonic-gate addr.aa_length = 3 * (IEEE1394_QUADLET); 429*7c478bd9Sstevel@tonic-gate addr.aa_enable = T1394_ADDR_RDENBL | T1394_ADDR_LKENBL; 430*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 431*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_IRM_regs; 432*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = NULL; 433*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = s1394_CSR_IRM_regs; 434*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = NULL; 435*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 436*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 437*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 438*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 439*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 440*7c478bd9Sstevel@tonic-gate "IRM registers: CSR setup failed"); 441*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 442*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 443*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 444*7c478bd9Sstevel@tonic-gate } 445*7c478bd9Sstevel@tonic-gate 446*7c478bd9Sstevel@tonic-gate /* 447*7c478bd9Sstevel@tonic-gate * Reserved for Configuration ROM 448*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.5.3 449*7c478bd9Sstevel@tonic-gate */ 450*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_CONFIG_ROM_ADDR; 451*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_CONFIG_ROM_SZ; 452*7c478bd9Sstevel@tonic-gate result = s1394_reserve_addr_blk(hal, &addr); 453*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 454*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 455*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 456*7c478bd9Sstevel@tonic-gate "Unable to reserve Config ROM"); 457*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 458*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 459*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 460*7c478bd9Sstevel@tonic-gate } 461*7c478bd9Sstevel@tonic-gate 462*7c478bd9Sstevel@tonic-gate /* 463*7c478bd9Sstevel@tonic-gate * TOPOLOGY_MAP 464*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.4.1 465*7c478bd9Sstevel@tonic-gate */ 466*7c478bd9Sstevel@tonic-gate hal->CSR_topology_map = kmem_zalloc(IEEE1394_UCSR_TOPOLOGY_MAP_SZ, 467*7c478bd9Sstevel@tonic-gate KM_SLEEP); 468*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_UCSR_TOPOLOGY_MAP; 469*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_UCSR_TOPOLOGY_MAP_SZ; 470*7c478bd9Sstevel@tonic-gate addr.aa_enable = T1394_ADDR_RDENBL; 471*7c478bd9Sstevel@tonic-gate addr.aa_type = T1394_ADDR_FIXED; 472*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_read_request = s1394_CSR_topology_map; 473*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_write_request = NULL; 474*7c478bd9Sstevel@tonic-gate addr.aa_evts.recv_lock_request = NULL; 475*7c478bd9Sstevel@tonic-gate addr.aa_kmem_bufp = (caddr_t)hal->CSR_topology_map; 476*7c478bd9Sstevel@tonic-gate addr.aa_arg = hal; 477*7c478bd9Sstevel@tonic-gate result = s1394_claim_addr_blk(hal, &addr); 478*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 479*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->CSR_topology_map, 480*7c478bd9Sstevel@tonic-gate IEEE1394_UCSR_TOPOLOGY_MAP_SZ); 481*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 482*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 483*7c478bd9Sstevel@tonic-gate "TOPOLOGY_MAP: CSR setup failed"); 484*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 485*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 486*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 487*7c478bd9Sstevel@tonic-gate } 488*7c478bd9Sstevel@tonic-gate curr_blk = (s1394_addr_space_blk_t *)(addr.aa_hdl); 489*7c478bd9Sstevel@tonic-gate /* Set up the block so that we free kmem_bufp at detach */ 490*7c478bd9Sstevel@tonic-gate curr_blk->free_kmem_bufp = B_TRUE; 491*7c478bd9Sstevel@tonic-gate 492*7c478bd9Sstevel@tonic-gate /* 493*7c478bd9Sstevel@tonic-gate * Reserve the SPEED_MAP 494*7c478bd9Sstevel@tonic-gate * see IEEE 1394-1995, Section 8.3.2.4.1 495*7c478bd9Sstevel@tonic-gate * (obsoleted in P1394A) 496*7c478bd9Sstevel@tonic-gate */ 497*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_UCSR_SPEED_MAP; 498*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_UCSR_SPEED_MAP_SZ; 499*7c478bd9Sstevel@tonic-gate result = s1394_reserve_addr_blk(hal, &addr); 500*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 501*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 502*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 503*7c478bd9Sstevel@tonic-gate "SPEED_MAP: CSR setup failed"); 504*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 505*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 506*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 507*7c478bd9Sstevel@tonic-gate } 508*7c478bd9Sstevel@tonic-gate 509*7c478bd9Sstevel@tonic-gate /* 510*7c478bd9Sstevel@tonic-gate * Reserved - Boundary between reserved Serial Bus 511*7c478bd9Sstevel@tonic-gate * dependent registers and other CSR register space. 512*7c478bd9Sstevel@tonic-gate * See IEEE 1394-1995, Table 8-4 for this address. 513*7c478bd9Sstevel@tonic-gate * 514*7c478bd9Sstevel@tonic-gate * This quadlet is reserved as a way of preventing 515*7c478bd9Sstevel@tonic-gate * the inadvertant allocation of a part of CSR space 516*7c478bd9Sstevel@tonic-gate * that will likely be used by future specifications 517*7c478bd9Sstevel@tonic-gate */ 518*7c478bd9Sstevel@tonic-gate addr.aa_address = IEEE1394_UCSR_RESERVED_BOUNDARY; 519*7c478bd9Sstevel@tonic-gate addr.aa_length = IEEE1394_QUADLET; 520*7c478bd9Sstevel@tonic-gate result = s1394_reserve_addr_blk(hal, &addr); 521*7c478bd9Sstevel@tonic-gate if (result != DDI_SUCCESS) { 522*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_setup_CSR_space_error, 523*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_ERROR, "", tnf_string, msg, 524*7c478bd9Sstevel@tonic-gate "Unable to reserve boundary quadlet"); 525*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, 526*7c478bd9Sstevel@tonic-gate "stacktrace 1394 s1394", ""); 527*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 528*7c478bd9Sstevel@tonic-gate } 529*7c478bd9Sstevel@tonic-gate 530*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_setup_CSR_space_exit, S1394_TNF_SL_CSR_STACK, 531*7c478bd9Sstevel@tonic-gate ""); 532*7c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 533*7c478bd9Sstevel@tonic-gate } 534*7c478bd9Sstevel@tonic-gate 535*7c478bd9Sstevel@tonic-gate /* 536*7c478bd9Sstevel@tonic-gate * s1394_CSR_state_clear() 537*7c478bd9Sstevel@tonic-gate * handles all requests to the STATE_CLEAR CSR register. It enforces 538*7c478bd9Sstevel@tonic-gate * that certain bits that can be twiddled only by a given node (IRM or 539*7c478bd9Sstevel@tonic-gate * Bus Manager). 540*7c478bd9Sstevel@tonic-gate */ 541*7c478bd9Sstevel@tonic-gate static void 542*7c478bd9Sstevel@tonic-gate s1394_CSR_state_clear(cmd1394_cmd_t *req) 543*7c478bd9Sstevel@tonic-gate { 544*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 545*7c478bd9Sstevel@tonic-gate uint32_t data; 546*7c478bd9Sstevel@tonic-gate uint_t offset; 547*7c478bd9Sstevel@tonic-gate uint_t is_from; 548*7c478bd9Sstevel@tonic-gate uint_t should_be_from; 549*7c478bd9Sstevel@tonic-gate int result; 550*7c478bd9Sstevel@tonic-gate 551*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_state_clear_enter, S1394_TNF_SL_CSR_STACK, 552*7c478bd9Sstevel@tonic-gate ""); 553*7c478bd9Sstevel@tonic-gate 554*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 555*7c478bd9Sstevel@tonic-gate 556*7c478bd9Sstevel@tonic-gate /* Register offset */ 557*7c478bd9Sstevel@tonic-gate offset = req->cmd_addr & IEEE1394_CSR_OFFSET_MASK; 558*7c478bd9Sstevel@tonic-gate 559*7c478bd9Sstevel@tonic-gate /* Verify that request is quadlet aligned */ 560*7c478bd9Sstevel@tonic-gate if ((offset & 0x3) != 0) { 561*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 562*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 563*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_state_clear_exit, 564*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 565*7c478bd9Sstevel@tonic-gate return; 566*7c478bd9Sstevel@tonic-gate } 567*7c478bd9Sstevel@tonic-gate 568*7c478bd9Sstevel@tonic-gate /* Only writes from IRM or Bus Mgr allowed (in some cases) */ 569*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->topology_tree_mutex); 570*7c478bd9Sstevel@tonic-gate is_from = IEEE1394_NODE_NUM(req->nodeID); 571*7c478bd9Sstevel@tonic-gate if (hal->bus_mgr_node != -1) 572*7c478bd9Sstevel@tonic-gate should_be_from = IEEE1394_NODE_NUM(hal->bus_mgr_node); 573*7c478bd9Sstevel@tonic-gate else if (hal->IRM_node != -1) 574*7c478bd9Sstevel@tonic-gate should_be_from = IEEE1394_NODE_NUM(hal->IRM_node); 575*7c478bd9Sstevel@tonic-gate else 576*7c478bd9Sstevel@tonic-gate should_be_from = S1394_INVALID_NODE_NUM; 577*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->topology_tree_mutex); 578*7c478bd9Sstevel@tonic-gate 579*7c478bd9Sstevel@tonic-gate switch (req->cmd_type) { 580*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_RD_QUAD: 581*7c478bd9Sstevel@tonic-gate /* 582*7c478bd9Sstevel@tonic-gate * The csr_read() call can return DDI_FAILURE if the HAL 583*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 584*7c478bd9Sstevel@tonic-gate * unimplemented. But although the STATE_CLEAR register 585*7c478bd9Sstevel@tonic-gate * is required to be implemented and readable, we will 586*7c478bd9Sstevel@tonic-gate * return IEEE1394_RESP_ADDRESS_ERROR in the response if 587*7c478bd9Sstevel@tonic-gate * we ever see this error. 588*7c478bd9Sstevel@tonic-gate */ 589*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, 590*7c478bd9Sstevel@tonic-gate offset, &data); 591*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 592*7c478bd9Sstevel@tonic-gate req->cmd_u.q.quadlet_data = data; 593*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 594*7c478bd9Sstevel@tonic-gate } else { 595*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 596*7c478bd9Sstevel@tonic-gate } 597*7c478bd9Sstevel@tonic-gate break; 598*7c478bd9Sstevel@tonic-gate 599*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_WR_QUAD: 600*7c478bd9Sstevel@tonic-gate data = req->cmd_u.q.quadlet_data; 601*7c478bd9Sstevel@tonic-gate 602*7c478bd9Sstevel@tonic-gate /* CMSTR bit - request must be from bus_mgr/IRM */ 603*7c478bd9Sstevel@tonic-gate if (is_from != should_be_from) { 604*7c478bd9Sstevel@tonic-gate data = data & ~IEEE1394_CSR_STATE_CMSTR; 605*7c478bd9Sstevel@tonic-gate } 606*7c478bd9Sstevel@tonic-gate 607*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->topology_tree_mutex); 608*7c478bd9Sstevel@tonic-gate /* DREQ bit - disabling DREQ can come from anyone */ 609*7c478bd9Sstevel@tonic-gate if (data & IEEE1394_CSR_STATE_DREQ) { 610*7c478bd9Sstevel@tonic-gate hal->disable_requests_bit = 0; 611*7c478bd9Sstevel@tonic-gate if (hal->hal_state == S1394_HAL_DREQ) 612*7c478bd9Sstevel@tonic-gate hal->hal_state = S1394_HAL_NORMAL; 613*7c478bd9Sstevel@tonic-gate } 614*7c478bd9Sstevel@tonic-gate 615*7c478bd9Sstevel@tonic-gate /* ABDICATE bit */ 616*7c478bd9Sstevel@tonic-gate if (data & IEEE1394_CSR_STATE_ABDICATE) { 617*7c478bd9Sstevel@tonic-gate hal->abdicate_bus_mgr_bit = 0; 618*7c478bd9Sstevel@tonic-gate } 619*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->topology_tree_mutex); 620*7c478bd9Sstevel@tonic-gate /* 621*7c478bd9Sstevel@tonic-gate * The csr_write() call can return DDI_FAILURE if the HAL 622*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 623*7c478bd9Sstevel@tonic-gate * unimplemented. But although the STATE_CLEAR register 624*7c478bd9Sstevel@tonic-gate * is required to be implemented and writeable, we will 625*7c478bd9Sstevel@tonic-gate * return IEEE1394_RESP_ADDRESS_ERROR in the response if 626*7c478bd9Sstevel@tonic-gate * we ever see this error. 627*7c478bd9Sstevel@tonic-gate */ 628*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, 629*7c478bd9Sstevel@tonic-gate offset, data); 630*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 631*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 632*7c478bd9Sstevel@tonic-gate } else { 633*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 634*7c478bd9Sstevel@tonic-gate } 635*7c478bd9Sstevel@tonic-gate break; 636*7c478bd9Sstevel@tonic-gate 637*7c478bd9Sstevel@tonic-gate default: 638*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 639*7c478bd9Sstevel@tonic-gate } 640*7c478bd9Sstevel@tonic-gate 641*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 642*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_state_clear_exit, S1394_TNF_SL_CSR_STACK, 643*7c478bd9Sstevel@tonic-gate ""); 644*7c478bd9Sstevel@tonic-gate } 645*7c478bd9Sstevel@tonic-gate 646*7c478bd9Sstevel@tonic-gate /* 647*7c478bd9Sstevel@tonic-gate * s1394_CSR_state_set() 648*7c478bd9Sstevel@tonic-gate * handles all requests to the STATE_SET CSR register. It enforces that 649*7c478bd9Sstevel@tonic-gate * certain bits that can be twiddled only by a given node (IRM or Bus 650*7c478bd9Sstevel@tonic-gate * Manager). 651*7c478bd9Sstevel@tonic-gate */ 652*7c478bd9Sstevel@tonic-gate static void 653*7c478bd9Sstevel@tonic-gate s1394_CSR_state_set(cmd1394_cmd_t *req) 654*7c478bd9Sstevel@tonic-gate { 655*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 656*7c478bd9Sstevel@tonic-gate uint32_t data; 657*7c478bd9Sstevel@tonic-gate uint_t offset; 658*7c478bd9Sstevel@tonic-gate uint_t is_from; 659*7c478bd9Sstevel@tonic-gate uint_t should_be_from; 660*7c478bd9Sstevel@tonic-gate uint_t hal_node_num; 661*7c478bd9Sstevel@tonic-gate uint_t hal_number_of_nodes; 662*7c478bd9Sstevel@tonic-gate int result; 663*7c478bd9Sstevel@tonic-gate 664*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_state_set_enter, S1394_TNF_SL_CSR_STACK, 665*7c478bd9Sstevel@tonic-gate ""); 666*7c478bd9Sstevel@tonic-gate 667*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 668*7c478bd9Sstevel@tonic-gate 669*7c478bd9Sstevel@tonic-gate /* Register offset */ 670*7c478bd9Sstevel@tonic-gate offset = req->cmd_addr & IEEE1394_CSR_OFFSET_MASK; 671*7c478bd9Sstevel@tonic-gate 672*7c478bd9Sstevel@tonic-gate /* Verify that request is quadlet aligned */ 673*7c478bd9Sstevel@tonic-gate if ((offset & 0x3) != 0) { 674*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 675*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 676*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_state_set_exit, 677*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 678*7c478bd9Sstevel@tonic-gate return; 679*7c478bd9Sstevel@tonic-gate } 680*7c478bd9Sstevel@tonic-gate 681*7c478bd9Sstevel@tonic-gate /* Only writes from IRM or Bus Mgr allowed (in some cases) */ 682*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->topology_tree_mutex); 683*7c478bd9Sstevel@tonic-gate is_from = IEEE1394_NODE_NUM(req->nodeID); 684*7c478bd9Sstevel@tonic-gate if (hal->bus_mgr_node != -1) 685*7c478bd9Sstevel@tonic-gate should_be_from = IEEE1394_NODE_NUM(hal->bus_mgr_node); 686*7c478bd9Sstevel@tonic-gate else if (hal->IRM_node != -1) 687*7c478bd9Sstevel@tonic-gate should_be_from = IEEE1394_NODE_NUM(hal->IRM_node); 688*7c478bd9Sstevel@tonic-gate else 689*7c478bd9Sstevel@tonic-gate should_be_from = S1394_INVALID_NODE_NUM; 690*7c478bd9Sstevel@tonic-gate hal_node_num = IEEE1394_NODE_NUM(hal->node_id); 691*7c478bd9Sstevel@tonic-gate hal_number_of_nodes = hal->number_of_nodes; 692*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->topology_tree_mutex); 693*7c478bd9Sstevel@tonic-gate 694*7c478bd9Sstevel@tonic-gate switch (req->cmd_type) { 695*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_WR_QUAD: 696*7c478bd9Sstevel@tonic-gate data = req->cmd_u.q.quadlet_data; 697*7c478bd9Sstevel@tonic-gate 698*7c478bd9Sstevel@tonic-gate /* CMSTR bit - request must be from bus_mgr/IRM */ 699*7c478bd9Sstevel@tonic-gate /* & must be root to have bit set */ 700*7c478bd9Sstevel@tonic-gate if ((is_from != should_be_from) || 701*7c478bd9Sstevel@tonic-gate (hal_node_num != (hal_number_of_nodes - 1))) { 702*7c478bd9Sstevel@tonic-gate data = data & ~IEEE1394_CSR_STATE_CMSTR; 703*7c478bd9Sstevel@tonic-gate } 704*7c478bd9Sstevel@tonic-gate 705*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->topology_tree_mutex); 706*7c478bd9Sstevel@tonic-gate /* DREQ bit - only bus_mgr/IRM can set this bit */ 707*7c478bd9Sstevel@tonic-gate if (is_from != should_be_from) { 708*7c478bd9Sstevel@tonic-gate data = data & ~IEEE1394_CSR_STATE_DREQ; 709*7c478bd9Sstevel@tonic-gate 710*7c478bd9Sstevel@tonic-gate } else if (data & IEEE1394_CSR_STATE_DREQ) { 711*7c478bd9Sstevel@tonic-gate hal->disable_requests_bit = 1; 712*7c478bd9Sstevel@tonic-gate if (hal->hal_state == S1394_HAL_NORMAL) 713*7c478bd9Sstevel@tonic-gate hal->hal_state = S1394_HAL_DREQ; 714*7c478bd9Sstevel@tonic-gate } 715*7c478bd9Sstevel@tonic-gate /* ABDICATE bit */ 716*7c478bd9Sstevel@tonic-gate if (data & IEEE1394_CSR_STATE_ABDICATE) { 717*7c478bd9Sstevel@tonic-gate hal->abdicate_bus_mgr_bit = 1; 718*7c478bd9Sstevel@tonic-gate } 719*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->topology_tree_mutex); 720*7c478bd9Sstevel@tonic-gate /* 721*7c478bd9Sstevel@tonic-gate * The csr_write() call can return DDI_FAILURE if the HAL 722*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 723*7c478bd9Sstevel@tonic-gate * unimplemented. But although the STATE_SET register 724*7c478bd9Sstevel@tonic-gate * is required to be implemented and writeable, we will 725*7c478bd9Sstevel@tonic-gate * return IEEE1394_RESP_ADDRESS_ERROR in the response if 726*7c478bd9Sstevel@tonic-gate * we ever see this error. 727*7c478bd9Sstevel@tonic-gate */ 728*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, 729*7c478bd9Sstevel@tonic-gate offset, data); 730*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 731*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 732*7c478bd9Sstevel@tonic-gate } else { 733*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 734*7c478bd9Sstevel@tonic-gate } 735*7c478bd9Sstevel@tonic-gate break; 736*7c478bd9Sstevel@tonic-gate 737*7c478bd9Sstevel@tonic-gate default: 738*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 739*7c478bd9Sstevel@tonic-gate } 740*7c478bd9Sstevel@tonic-gate 741*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 742*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_state_set_exit, S1394_TNF_SL_CSR_STACK, 743*7c478bd9Sstevel@tonic-gate ""); 744*7c478bd9Sstevel@tonic-gate } 745*7c478bd9Sstevel@tonic-gate 746*7c478bd9Sstevel@tonic-gate /* 747*7c478bd9Sstevel@tonic-gate * s1394_CSR_node_ids() 748*7c478bd9Sstevel@tonic-gate * handles all requests to the NODE_IDS CSR register. It passes all 749*7c478bd9Sstevel@tonic-gate * requests to the common routine - s1394_common_CSR_routine(). 750*7c478bd9Sstevel@tonic-gate */ 751*7c478bd9Sstevel@tonic-gate static void 752*7c478bd9Sstevel@tonic-gate s1394_CSR_node_ids(cmd1394_cmd_t *req) 753*7c478bd9Sstevel@tonic-gate { 754*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 755*7c478bd9Sstevel@tonic-gate 756*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_node_ids_enter, S1394_TNF_SL_CSR_STACK, ""); 757*7c478bd9Sstevel@tonic-gate 758*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 759*7c478bd9Sstevel@tonic-gate 760*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 761*7c478bd9Sstevel@tonic-gate 762*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_node_ids_exit, S1394_TNF_SL_CSR_STACK, ""); 763*7c478bd9Sstevel@tonic-gate } 764*7c478bd9Sstevel@tonic-gate 765*7c478bd9Sstevel@tonic-gate /* 766*7c478bd9Sstevel@tonic-gate * s1394_CSR_reset_start() 767*7c478bd9Sstevel@tonic-gate * handles all requests to the RESET_START CSR register. Only write 768*7c478bd9Sstevel@tonic-gate * requests are legal, everything else gets a type_error response. 769*7c478bd9Sstevel@tonic-gate */ 770*7c478bd9Sstevel@tonic-gate static void 771*7c478bd9Sstevel@tonic-gate s1394_CSR_reset_start(cmd1394_cmd_t *req) 772*7c478bd9Sstevel@tonic-gate { 773*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 774*7c478bd9Sstevel@tonic-gate uint32_t data; 775*7c478bd9Sstevel@tonic-gate uint_t offset; 776*7c478bd9Sstevel@tonic-gate 777*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_reset_start_enter, S1394_TNF_SL_CSR_STACK, 778*7c478bd9Sstevel@tonic-gate ""); 779*7c478bd9Sstevel@tonic-gate 780*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 781*7c478bd9Sstevel@tonic-gate 782*7c478bd9Sstevel@tonic-gate /* RESET_START register offset */ 783*7c478bd9Sstevel@tonic-gate offset = req->cmd_addr & IEEE1394_CSR_OFFSET_MASK; 784*7c478bd9Sstevel@tonic-gate 785*7c478bd9Sstevel@tonic-gate /* Verify that request is quadlet aligned */ 786*7c478bd9Sstevel@tonic-gate if ((offset & 0x3) != 0) { 787*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 788*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 789*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_reset_start_exit, 790*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 791*7c478bd9Sstevel@tonic-gate return; 792*7c478bd9Sstevel@tonic-gate } 793*7c478bd9Sstevel@tonic-gate 794*7c478bd9Sstevel@tonic-gate switch (req->cmd_type) { 795*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_WR_QUAD: 796*7c478bd9Sstevel@tonic-gate data = req->cmd_u.q.quadlet_data; 797*7c478bd9Sstevel@tonic-gate /* 798*7c478bd9Sstevel@tonic-gate * The csr_write() call can return DDI_FAILURE if the HAL 799*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 800*7c478bd9Sstevel@tonic-gate * unimplemented. Because we don't do any thing with 801*7c478bd9Sstevel@tonic-gate * the RESET_START register we will ignore failures and 802*7c478bd9Sstevel@tonic-gate * return IEEE1394_RESP_COMPLETE regardless. 803*7c478bd9Sstevel@tonic-gate */ 804*7c478bd9Sstevel@tonic-gate (void) HAL_CALL(hal).csr_write(hal->halinfo.hal_private, 805*7c478bd9Sstevel@tonic-gate offset, data); 806*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 807*7c478bd9Sstevel@tonic-gate break; 808*7c478bd9Sstevel@tonic-gate 809*7c478bd9Sstevel@tonic-gate default: 810*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 811*7c478bd9Sstevel@tonic-gate } 812*7c478bd9Sstevel@tonic-gate 813*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 814*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_reset_start_exit, S1394_TNF_SL_CSR_STACK, 815*7c478bd9Sstevel@tonic-gate ""); 816*7c478bd9Sstevel@tonic-gate } 817*7c478bd9Sstevel@tonic-gate 818*7c478bd9Sstevel@tonic-gate /* 819*7c478bd9Sstevel@tonic-gate * s1394_CSR_split_timeout() 820*7c478bd9Sstevel@tonic-gate * handles all requests to the SPLIT_TIMEOUT CSR register. It passes all 821*7c478bd9Sstevel@tonic-gate * requests to the common routine - s1394_common_CSR_routine(). 822*7c478bd9Sstevel@tonic-gate */ 823*7c478bd9Sstevel@tonic-gate static void 824*7c478bd9Sstevel@tonic-gate s1394_CSR_split_timeout(cmd1394_cmd_t *req) 825*7c478bd9Sstevel@tonic-gate { 826*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 827*7c478bd9Sstevel@tonic-gate 828*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_split_timeout_enter, 829*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 830*7c478bd9Sstevel@tonic-gate 831*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 832*7c478bd9Sstevel@tonic-gate 833*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 834*7c478bd9Sstevel@tonic-gate 835*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_split_timeout_exit, 836*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 837*7c478bd9Sstevel@tonic-gate } 838*7c478bd9Sstevel@tonic-gate 839*7c478bd9Sstevel@tonic-gate /* 840*7c478bd9Sstevel@tonic-gate * s1394_CSR_argument_regs() 841*7c478bd9Sstevel@tonic-gate * handles all requests to the ARGUMENT CSR registers. It passes all 842*7c478bd9Sstevel@tonic-gate * requests to the common routine - s1394_common_CSR_routine(). 843*7c478bd9Sstevel@tonic-gate */ 844*7c478bd9Sstevel@tonic-gate static void 845*7c478bd9Sstevel@tonic-gate s1394_CSR_argument_regs(cmd1394_cmd_t *req) 846*7c478bd9Sstevel@tonic-gate { 847*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 848*7c478bd9Sstevel@tonic-gate 849*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_argument_regs_enter, 850*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 851*7c478bd9Sstevel@tonic-gate 852*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 853*7c478bd9Sstevel@tonic-gate 854*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 855*7c478bd9Sstevel@tonic-gate 856*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_argument_regs_exit, 857*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 858*7c478bd9Sstevel@tonic-gate } 859*7c478bd9Sstevel@tonic-gate 860*7c478bd9Sstevel@tonic-gate /* 861*7c478bd9Sstevel@tonic-gate * s1394_CSR_test_regs() 862*7c478bd9Sstevel@tonic-gate * handles all requests to the TEST CSR registers. It passes all requests 863*7c478bd9Sstevel@tonic-gate * to the common routine - s1394_common_CSR_routine(). 864*7c478bd9Sstevel@tonic-gate */ 865*7c478bd9Sstevel@tonic-gate static void 866*7c478bd9Sstevel@tonic-gate s1394_CSR_test_regs(cmd1394_cmd_t *req) 867*7c478bd9Sstevel@tonic-gate { 868*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 869*7c478bd9Sstevel@tonic-gate uint_t offset; 870*7c478bd9Sstevel@tonic-gate 871*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_test_regs_enter, 872*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 873*7c478bd9Sstevel@tonic-gate 874*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 875*7c478bd9Sstevel@tonic-gate 876*7c478bd9Sstevel@tonic-gate /* TEST register offset */ 877*7c478bd9Sstevel@tonic-gate offset = req->cmd_addr & IEEE1394_CSR_OFFSET_MASK; 878*7c478bd9Sstevel@tonic-gate 879*7c478bd9Sstevel@tonic-gate /* TEST_STATUS is Read-Only */ 880*7c478bd9Sstevel@tonic-gate if ((offset == (IEEE1394_CSR_TEST_STATUS & IEEE1394_CSR_OFFSET_MASK)) && 881*7c478bd9Sstevel@tonic-gate (req->cmd_type == CMD1394_ASYNCH_WR_QUAD)) { 882*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 883*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 884*7c478bd9Sstevel@tonic-gate } else { 885*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 886*7c478bd9Sstevel@tonic-gate } 887*7c478bd9Sstevel@tonic-gate 888*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_test_regs_exit, 889*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 890*7c478bd9Sstevel@tonic-gate } 891*7c478bd9Sstevel@tonic-gate 892*7c478bd9Sstevel@tonic-gate /* 893*7c478bd9Sstevel@tonic-gate * s1394_CSR_interrupt_regs() 894*7c478bd9Sstevel@tonic-gate * handles all requests to the INTERRUPT CSR registers. It passes all 895*7c478bd9Sstevel@tonic-gate * requests to the common routine - s1394_common_CSR_routine(). 896*7c478bd9Sstevel@tonic-gate */ 897*7c478bd9Sstevel@tonic-gate static void 898*7c478bd9Sstevel@tonic-gate s1394_CSR_interrupt_regs(cmd1394_cmd_t *req) 899*7c478bd9Sstevel@tonic-gate { 900*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 901*7c478bd9Sstevel@tonic-gate 902*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_interrupt_regs_enter, 903*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 904*7c478bd9Sstevel@tonic-gate 905*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 906*7c478bd9Sstevel@tonic-gate 907*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 908*7c478bd9Sstevel@tonic-gate 909*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_interrupt_regs_exit, 910*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 911*7c478bd9Sstevel@tonic-gate } 912*7c478bd9Sstevel@tonic-gate 913*7c478bd9Sstevel@tonic-gate /* 914*7c478bd9Sstevel@tonic-gate * s1394_CSR_clock_regs() 915*7c478bd9Sstevel@tonic-gate * handles all requests to the CLOCK CSR registers. It passes all 916*7c478bd9Sstevel@tonic-gate * requests to the common routine - s1394_common_CSR_routine(). 917*7c478bd9Sstevel@tonic-gate */ 918*7c478bd9Sstevel@tonic-gate static void 919*7c478bd9Sstevel@tonic-gate s1394_CSR_clock_regs(cmd1394_cmd_t *req) 920*7c478bd9Sstevel@tonic-gate { 921*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 922*7c478bd9Sstevel@tonic-gate 923*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_clock_regs_enter, 924*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 925*7c478bd9Sstevel@tonic-gate 926*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 927*7c478bd9Sstevel@tonic-gate 928*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 929*7c478bd9Sstevel@tonic-gate 930*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_clock_regs_exit, 931*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 932*7c478bd9Sstevel@tonic-gate } 933*7c478bd9Sstevel@tonic-gate 934*7c478bd9Sstevel@tonic-gate /* 935*7c478bd9Sstevel@tonic-gate * s1394_CSR_message_regs() 936*7c478bd9Sstevel@tonic-gate * handles all requests to the MESSAGE CSR registers. It passes all 937*7c478bd9Sstevel@tonic-gate * requests to the common routine - s1394_common_CSR_routine(). 938*7c478bd9Sstevel@tonic-gate */ 939*7c478bd9Sstevel@tonic-gate static void 940*7c478bd9Sstevel@tonic-gate s1394_CSR_message_regs(cmd1394_cmd_t *req) 941*7c478bd9Sstevel@tonic-gate { 942*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 943*7c478bd9Sstevel@tonic-gate 944*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_message_regs_enter, 945*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 946*7c478bd9Sstevel@tonic-gate 947*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 948*7c478bd9Sstevel@tonic-gate 949*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 950*7c478bd9Sstevel@tonic-gate 951*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_message_regs_exit, 952*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 953*7c478bd9Sstevel@tonic-gate } 954*7c478bd9Sstevel@tonic-gate 955*7c478bd9Sstevel@tonic-gate /* 956*7c478bd9Sstevel@tonic-gate * s1394_CSR_cycle_time() 957*7c478bd9Sstevel@tonic-gate * handles all requests to the CYCLE_TIME CSR register. 958*7c478bd9Sstevel@tonic-gate */ 959*7c478bd9Sstevel@tonic-gate static void 960*7c478bd9Sstevel@tonic-gate s1394_CSR_cycle_time(cmd1394_cmd_t *req) 961*7c478bd9Sstevel@tonic-gate { 962*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 963*7c478bd9Sstevel@tonic-gate uint32_t data; 964*7c478bd9Sstevel@tonic-gate uint_t offset; 965*7c478bd9Sstevel@tonic-gate int result; 966*7c478bd9Sstevel@tonic-gate 967*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_cycle_time_enter, 968*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 969*7c478bd9Sstevel@tonic-gate 970*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 971*7c478bd9Sstevel@tonic-gate 972*7c478bd9Sstevel@tonic-gate /* CYCLE_TIME register offset */ 973*7c478bd9Sstevel@tonic-gate offset = req->cmd_addr & IEEE1394_CSR_OFFSET_MASK; 974*7c478bd9Sstevel@tonic-gate 975*7c478bd9Sstevel@tonic-gate /* Verify that request is quadlet aligned */ 976*7c478bd9Sstevel@tonic-gate if ((offset & 0x3) != 0) { 977*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 978*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 979*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_cycle_time_exit, 980*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 981*7c478bd9Sstevel@tonic-gate return; 982*7c478bd9Sstevel@tonic-gate } 983*7c478bd9Sstevel@tonic-gate 984*7c478bd9Sstevel@tonic-gate switch (req->cmd_type) { 985*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_RD_QUAD: 986*7c478bd9Sstevel@tonic-gate /* 987*7c478bd9Sstevel@tonic-gate * The csr_read() call can return DDI_FAILURE if the HAL 988*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 989*7c478bd9Sstevel@tonic-gate * unimplemented. But although the CYCLE_TIME register 990*7c478bd9Sstevel@tonic-gate * is required to be implemented on devices capable of 991*7c478bd9Sstevel@tonic-gate * providing isochronous services (like us), we will 992*7c478bd9Sstevel@tonic-gate * return IEEE1394_RESP_ADDRESS_ERROR in the response 993*7c478bd9Sstevel@tonic-gate * if we ever see this error. 994*7c478bd9Sstevel@tonic-gate */ 995*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, 996*7c478bd9Sstevel@tonic-gate offset, &data); 997*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 998*7c478bd9Sstevel@tonic-gate req->cmd_u.q.quadlet_data = data; 999*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1000*7c478bd9Sstevel@tonic-gate } else { 1001*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1002*7c478bd9Sstevel@tonic-gate } 1003*7c478bd9Sstevel@tonic-gate break; 1004*7c478bd9Sstevel@tonic-gate 1005*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_WR_QUAD: 1006*7c478bd9Sstevel@tonic-gate data = req->cmd_u.q.quadlet_data; 1007*7c478bd9Sstevel@tonic-gate /* 1008*7c478bd9Sstevel@tonic-gate * The csr_write() call can return DDI_FAILURE if the HAL 1009*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 1010*7c478bd9Sstevel@tonic-gate * unimplemented. But although the CYCLE_TIME register 1011*7c478bd9Sstevel@tonic-gate * is required to be implemented on devices capable of 1012*7c478bd9Sstevel@tonic-gate * providing isochronous services (like us), the effects 1013*7c478bd9Sstevel@tonic-gate * of a write are "node-dependent" so we will return 1014*7c478bd9Sstevel@tonic-gate * IEEE1394_RESP_ADDRESS_ERROR in the response if we 1015*7c478bd9Sstevel@tonic-gate * ever see this error. 1016*7c478bd9Sstevel@tonic-gate */ 1017*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, 1018*7c478bd9Sstevel@tonic-gate offset, data); 1019*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 1020*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1021*7c478bd9Sstevel@tonic-gate } else { 1022*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1023*7c478bd9Sstevel@tonic-gate } 1024*7c478bd9Sstevel@tonic-gate break; 1025*7c478bd9Sstevel@tonic-gate 1026*7c478bd9Sstevel@tonic-gate default: 1027*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1028*7c478bd9Sstevel@tonic-gate } 1029*7c478bd9Sstevel@tonic-gate 1030*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1031*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_cycle_time_exit, 1032*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1033*7c478bd9Sstevel@tonic-gate } 1034*7c478bd9Sstevel@tonic-gate 1035*7c478bd9Sstevel@tonic-gate /* 1036*7c478bd9Sstevel@tonic-gate * s1394_CSR_bus_time() 1037*7c478bd9Sstevel@tonic-gate * handles all requests to the BUS_TIME CSR register. It enforces that 1038*7c478bd9Sstevel@tonic-gate * only a broadcast write request from the IRM or Bus Manager can change 1039*7c478bd9Sstevel@tonic-gate * its value. 1040*7c478bd9Sstevel@tonic-gate */ 1041*7c478bd9Sstevel@tonic-gate static void 1042*7c478bd9Sstevel@tonic-gate s1394_CSR_bus_time(cmd1394_cmd_t *req) 1043*7c478bd9Sstevel@tonic-gate { 1044*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 1045*7c478bd9Sstevel@tonic-gate uint32_t data; 1046*7c478bd9Sstevel@tonic-gate uint_t offset; 1047*7c478bd9Sstevel@tonic-gate uint_t is_from; 1048*7c478bd9Sstevel@tonic-gate uint_t should_be_from; 1049*7c478bd9Sstevel@tonic-gate int result; 1050*7c478bd9Sstevel@tonic-gate 1051*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_bus_time_enter, S1394_TNF_SL_CSR_STACK, ""); 1052*7c478bd9Sstevel@tonic-gate 1053*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 1054*7c478bd9Sstevel@tonic-gate 1055*7c478bd9Sstevel@tonic-gate /* BUS_TIME register offset */ 1056*7c478bd9Sstevel@tonic-gate offset = req->cmd_addr & IEEE1394_CSR_OFFSET_MASK; 1057*7c478bd9Sstevel@tonic-gate 1058*7c478bd9Sstevel@tonic-gate /* Verify that request is quadlet aligned */ 1059*7c478bd9Sstevel@tonic-gate if ((offset & 0x3) != 0) { 1060*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1061*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1062*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_bus_time_exit, 1063*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1064*7c478bd9Sstevel@tonic-gate return; 1065*7c478bd9Sstevel@tonic-gate } 1066*7c478bd9Sstevel@tonic-gate 1067*7c478bd9Sstevel@tonic-gate switch (req->cmd_type) { 1068*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_RD_QUAD: 1069*7c478bd9Sstevel@tonic-gate /* 1070*7c478bd9Sstevel@tonic-gate * The csr_read() call can return DDI_FAILURE if the HAL 1071*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 1072*7c478bd9Sstevel@tonic-gate * unimplemented. But although the BUS_TIME register 1073*7c478bd9Sstevel@tonic-gate * is required to be implemented by devices capable of 1074*7c478bd9Sstevel@tonic-gate * being cycle master (like us), we will return 1075*7c478bd9Sstevel@tonic-gate * IEEE1394_RESP_ADDRESS_ERROR in the response if we 1076*7c478bd9Sstevel@tonic-gate * ever see this error. 1077*7c478bd9Sstevel@tonic-gate */ 1078*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, 1079*7c478bd9Sstevel@tonic-gate offset, &data); 1080*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 1081*7c478bd9Sstevel@tonic-gate req->cmd_u.q.quadlet_data = data; 1082*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1083*7c478bd9Sstevel@tonic-gate } else { 1084*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1085*7c478bd9Sstevel@tonic-gate } 1086*7c478bd9Sstevel@tonic-gate break; 1087*7c478bd9Sstevel@tonic-gate 1088*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_WR_QUAD: 1089*7c478bd9Sstevel@tonic-gate /* Only broadcast writes from IRM or Bus Mgr allowed */ 1090*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->topology_tree_mutex); 1091*7c478bd9Sstevel@tonic-gate is_from = IEEE1394_NODE_NUM(req->nodeID); 1092*7c478bd9Sstevel@tonic-gate if (hal->bus_mgr_node != -1) 1093*7c478bd9Sstevel@tonic-gate should_be_from = IEEE1394_NODE_NUM(hal->bus_mgr_node); 1094*7c478bd9Sstevel@tonic-gate else if (hal->IRM_node != -1) 1095*7c478bd9Sstevel@tonic-gate should_be_from = IEEE1394_NODE_NUM(hal->IRM_node); 1096*7c478bd9Sstevel@tonic-gate else 1097*7c478bd9Sstevel@tonic-gate should_be_from = S1394_INVALID_NODE_NUM; 1098*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->topology_tree_mutex); 1099*7c478bd9Sstevel@tonic-gate 1100*7c478bd9Sstevel@tonic-gate if ((req->broadcast != 1) || (is_from != should_be_from)) { 1101*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1102*7c478bd9Sstevel@tonic-gate break; 1103*7c478bd9Sstevel@tonic-gate } 1104*7c478bd9Sstevel@tonic-gate 1105*7c478bd9Sstevel@tonic-gate data = req->cmd_u.q.quadlet_data; 1106*7c478bd9Sstevel@tonic-gate /* 1107*7c478bd9Sstevel@tonic-gate * The csr_write() call can return DDI_FAILURE if the HAL 1108*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 1109*7c478bd9Sstevel@tonic-gate * unimplemented. But although the BUS_TIME register 1110*7c478bd9Sstevel@tonic-gate * is required to be implemented on devices capable of 1111*7c478bd9Sstevel@tonic-gate * being cycle master (like us), we will return 1112*7c478bd9Sstevel@tonic-gate * IEEE1394_RESP_ADDRESS_ERROR in the response if we 1113*7c478bd9Sstevel@tonic-gate * ever see this error. 1114*7c478bd9Sstevel@tonic-gate */ 1115*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, 1116*7c478bd9Sstevel@tonic-gate offset, data); 1117*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 1118*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1119*7c478bd9Sstevel@tonic-gate } else { 1120*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1121*7c478bd9Sstevel@tonic-gate } 1122*7c478bd9Sstevel@tonic-gate break; 1123*7c478bd9Sstevel@tonic-gate 1124*7c478bd9Sstevel@tonic-gate default: 1125*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1126*7c478bd9Sstevel@tonic-gate } 1127*7c478bd9Sstevel@tonic-gate 1128*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1129*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_bus_time_exit, S1394_TNF_SL_CSR_STACK, ""); 1130*7c478bd9Sstevel@tonic-gate } 1131*7c478bd9Sstevel@tonic-gate 1132*7c478bd9Sstevel@tonic-gate /* 1133*7c478bd9Sstevel@tonic-gate * s1394_CSR_busy_timeout() 1134*7c478bd9Sstevel@tonic-gate * handles all requests to the BUSY_TIMEOUT CSR register. It passes all 1135*7c478bd9Sstevel@tonic-gate * requests to the common routine - s1394_common_CSR_routine(). 1136*7c478bd9Sstevel@tonic-gate */ 1137*7c478bd9Sstevel@tonic-gate static void 1138*7c478bd9Sstevel@tonic-gate s1394_CSR_busy_timeout(cmd1394_cmd_t *req) 1139*7c478bd9Sstevel@tonic-gate { 1140*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 1141*7c478bd9Sstevel@tonic-gate 1142*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_busy_timeout_enter, 1143*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1144*7c478bd9Sstevel@tonic-gate 1145*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 1146*7c478bd9Sstevel@tonic-gate 1147*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(hal, req); 1148*7c478bd9Sstevel@tonic-gate 1149*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_busy_timeout_exit, 1150*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1151*7c478bd9Sstevel@tonic-gate } 1152*7c478bd9Sstevel@tonic-gate 1153*7c478bd9Sstevel@tonic-gate /* 1154*7c478bd9Sstevel@tonic-gate * s1394_CSR_IRM_regs() 1155*7c478bd9Sstevel@tonic-gate * handles all requests to the IRM registers, including BANDWIDTH_AVAILABLE, 1156*7c478bd9Sstevel@tonic-gate * CHANNELS_AVAILABLE, and the BUS_MANAGER_ID. Only quadlet read and lock 1157*7c478bd9Sstevel@tonic-gate * requests are allowed. 1158*7c478bd9Sstevel@tonic-gate */ 1159*7c478bd9Sstevel@tonic-gate static void 1160*7c478bd9Sstevel@tonic-gate s1394_CSR_IRM_regs(cmd1394_cmd_t *req) 1161*7c478bd9Sstevel@tonic-gate { 1162*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 1163*7c478bd9Sstevel@tonic-gate uint32_t generation; 1164*7c478bd9Sstevel@tonic-gate uint32_t data; 1165*7c478bd9Sstevel@tonic-gate uint32_t compare; 1166*7c478bd9Sstevel@tonic-gate uint32_t swap; 1167*7c478bd9Sstevel@tonic-gate uint32_t old; 1168*7c478bd9Sstevel@tonic-gate uint_t offset; 1169*7c478bd9Sstevel@tonic-gate int result; 1170*7c478bd9Sstevel@tonic-gate 1171*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_IRM_regs_enter, S1394_TNF_SL_CSR_STACK, ""); 1172*7c478bd9Sstevel@tonic-gate 1173*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 1174*7c478bd9Sstevel@tonic-gate 1175*7c478bd9Sstevel@tonic-gate /* IRM register offset */ 1176*7c478bd9Sstevel@tonic-gate offset = (req->cmd_addr & IEEE1394_CSR_OFFSET_MASK); 1177*7c478bd9Sstevel@tonic-gate 1178*7c478bd9Sstevel@tonic-gate /* Verify that request is quadlet aligned */ 1179*7c478bd9Sstevel@tonic-gate if ((offset & 0x3) != 0) { 1180*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1181*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1182*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_IRM_regs_exit, 1183*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1184*7c478bd9Sstevel@tonic-gate return; 1185*7c478bd9Sstevel@tonic-gate } 1186*7c478bd9Sstevel@tonic-gate 1187*7c478bd9Sstevel@tonic-gate switch (req->cmd_type) { 1188*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_RD_QUAD: 1189*7c478bd9Sstevel@tonic-gate /* 1190*7c478bd9Sstevel@tonic-gate * The csr_read() call can return DDI_FAILURE if the HAL 1191*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 1192*7c478bd9Sstevel@tonic-gate * unimplemented. In many cases these registers will 1193*7c478bd9Sstevel@tonic-gate * have been implemented in HW. We are not likely to ever 1194*7c478bd9Sstevel@tonic-gate * receive this callback. If we do, though, we will 1195*7c478bd9Sstevel@tonic-gate * return IEEE1394_RESP_ADDRESS_ERROR when we get an error 1196*7c478bd9Sstevel@tonic-gate * and IEEE1394_RESP_COMPLETE for success. 1197*7c478bd9Sstevel@tonic-gate */ 1198*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, 1199*7c478bd9Sstevel@tonic-gate offset, &data); 1200*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 1201*7c478bd9Sstevel@tonic-gate req->cmd_u.q.quadlet_data = data; 1202*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1203*7c478bd9Sstevel@tonic-gate } else { 1204*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1205*7c478bd9Sstevel@tonic-gate } 1206*7c478bd9Sstevel@tonic-gate break; 1207*7c478bd9Sstevel@tonic-gate 1208*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_LOCK_32: 1209*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->topology_tree_mutex); 1210*7c478bd9Sstevel@tonic-gate generation = hal->generation_count; 1211*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->topology_tree_mutex); 1212*7c478bd9Sstevel@tonic-gate if (req->cmd_u.l32.lock_type == CMD1394_LOCK_COMPARE_SWAP) { 1213*7c478bd9Sstevel@tonic-gate compare = req->cmd_u.l32.arg_value; 1214*7c478bd9Sstevel@tonic-gate swap = req->cmd_u.l32.data_value; 1215*7c478bd9Sstevel@tonic-gate /* 1216*7c478bd9Sstevel@tonic-gate * The csr_cswap32() call can return DDI_FAILURE if 1217*7c478bd9Sstevel@tonic-gate * the HAL is shutdown, if the register at "offset" 1218*7c478bd9Sstevel@tonic-gate * is unimplemented, or if the generation has changed. 1219*7c478bd9Sstevel@tonic-gate * In the last case, it shouldn't matter because the 1220*7c478bd9Sstevel@tonic-gate * call to s1394_send_response will fail on a bad 1221*7c478bd9Sstevel@tonic-gate * generation and the command will be freed. 1222*7c478bd9Sstevel@tonic-gate */ 1223*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_cswap32( 1224*7c478bd9Sstevel@tonic-gate hal->halinfo.hal_private, generation, 1225*7c478bd9Sstevel@tonic-gate offset, compare, swap, &old); 1226*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 1227*7c478bd9Sstevel@tonic-gate req->cmd_u.l32.old_value = old; 1228*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1229*7c478bd9Sstevel@tonic-gate } else { 1230*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1231*7c478bd9Sstevel@tonic-gate } 1232*7c478bd9Sstevel@tonic-gate break; 1233*7c478bd9Sstevel@tonic-gate } else { 1234*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1235*7c478bd9Sstevel@tonic-gate } 1236*7c478bd9Sstevel@tonic-gate 1237*7c478bd9Sstevel@tonic-gate break; 1238*7c478bd9Sstevel@tonic-gate 1239*7c478bd9Sstevel@tonic-gate default: 1240*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1241*7c478bd9Sstevel@tonic-gate } 1242*7c478bd9Sstevel@tonic-gate 1243*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1244*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_IRM_regs_exit, S1394_TNF_SL_CSR_STACK, ""); 1245*7c478bd9Sstevel@tonic-gate } 1246*7c478bd9Sstevel@tonic-gate 1247*7c478bd9Sstevel@tonic-gate /* 1248*7c478bd9Sstevel@tonic-gate * s1394_CSR_topology_map() 1249*7c478bd9Sstevel@tonic-gate * handles all request for the TOPOLOGY_MAP[]. Since it is implemented 1250*7c478bd9Sstevel@tonic-gate * with backing store, there isn't much to do besides return success or 1251*7c478bd9Sstevel@tonic-gate * failure. 1252*7c478bd9Sstevel@tonic-gate */ 1253*7c478bd9Sstevel@tonic-gate static void 1254*7c478bd9Sstevel@tonic-gate s1394_CSR_topology_map(cmd1394_cmd_t *req) 1255*7c478bd9Sstevel@tonic-gate { 1256*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 1257*7c478bd9Sstevel@tonic-gate 1258*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_topology_map_enter, 1259*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1260*7c478bd9Sstevel@tonic-gate 1261*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)req->cmd_callback_arg; 1262*7c478bd9Sstevel@tonic-gate 1263*7c478bd9Sstevel@tonic-gate /* Make sure it's a quadlet read request */ 1264*7c478bd9Sstevel@tonic-gate if (req->cmd_type == CMD1394_ASYNCH_RD_QUAD) 1265*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1266*7c478bd9Sstevel@tonic-gate else 1267*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1268*7c478bd9Sstevel@tonic-gate 1269*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1270*7c478bd9Sstevel@tonic-gate 1271*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_topology_map_exit, 1272*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1273*7c478bd9Sstevel@tonic-gate } 1274*7c478bd9Sstevel@tonic-gate 1275*7c478bd9Sstevel@tonic-gate /* 1276*7c478bd9Sstevel@tonic-gate * s1394_CSR_topology_map_update() 1277*7c478bd9Sstevel@tonic-gate * is used to update the local host's TOPOLOGY_MAP[] buffer. It copies in 1278*7c478bd9Sstevel@tonic-gate * the SelfID packets, updates the generation and other fields, and 1279*7c478bd9Sstevel@tonic-gate * computes the necessary CRC values before returning. 1280*7c478bd9Sstevel@tonic-gate * Callers must be holding the topology_tree_mutex. 1281*7c478bd9Sstevel@tonic-gate */ 1282*7c478bd9Sstevel@tonic-gate void 1283*7c478bd9Sstevel@tonic-gate s1394_CSR_topology_map_update(s1394_hal_t *hal) 1284*7c478bd9Sstevel@tonic-gate { 1285*7c478bd9Sstevel@tonic-gate s1394_selfid_pkt_t *selfid_packet; 1286*7c478bd9Sstevel@tonic-gate uint32_t *tm_ptr; 1287*7c478bd9Sstevel@tonic-gate uint32_t *data_ptr; 1288*7c478bd9Sstevel@tonic-gate uint32_t node_count; 1289*7c478bd9Sstevel@tonic-gate uint32_t self_id_count; 1290*7c478bd9Sstevel@tonic-gate uint_t CRC; 1291*7c478bd9Sstevel@tonic-gate uint32_t length; 1292*7c478bd9Sstevel@tonic-gate int i, j, c; 1293*7c478bd9Sstevel@tonic-gate 1294*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_topology_map_update_enter, 1295*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_BR_CSR_STACK, ""); 1296*7c478bd9Sstevel@tonic-gate 1297*7c478bd9Sstevel@tonic-gate ASSERT(MUTEX_HELD(&hal->topology_tree_mutex)); 1298*7c478bd9Sstevel@tonic-gate 1299*7c478bd9Sstevel@tonic-gate tm_ptr = (uint32_t *)hal->CSR_topology_map; 1300*7c478bd9Sstevel@tonic-gate data_ptr = (uint32_t *)&(tm_ptr[3]); 1301*7c478bd9Sstevel@tonic-gate 1302*7c478bd9Sstevel@tonic-gate c = 0; 1303*7c478bd9Sstevel@tonic-gate for (i = 0; i < hal->number_of_nodes; i++) { 1304*7c478bd9Sstevel@tonic-gate j = -1; 1305*7c478bd9Sstevel@tonic-gate selfid_packet = hal->selfid_ptrs[i]; 1306*7c478bd9Sstevel@tonic-gate 1307*7c478bd9Sstevel@tonic-gate do { 1308*7c478bd9Sstevel@tonic-gate j++; 1309*7c478bd9Sstevel@tonic-gate data_ptr[c++] = selfid_packet[j].spkt_data; 1310*7c478bd9Sstevel@tonic-gate } 1311*7c478bd9Sstevel@tonic-gate while (IEEE1394_SELFID_ISMORE(&selfid_packet[j])); 1312*7c478bd9Sstevel@tonic-gate } 1313*7c478bd9Sstevel@tonic-gate 1314*7c478bd9Sstevel@tonic-gate /* Update Topology Map Generation */ 1315*7c478bd9Sstevel@tonic-gate tm_ptr[1] = tm_ptr[1] + 1; 1316*7c478bd9Sstevel@tonic-gate 1317*7c478bd9Sstevel@tonic-gate /* Update Node_Count and Self_Id_Count */ 1318*7c478bd9Sstevel@tonic-gate node_count = (i & IEEE1394_TOP_MAP_LEN_MASK); 1319*7c478bd9Sstevel@tonic-gate self_id_count = (c & IEEE1394_TOP_MAP_LEN_MASK); 1320*7c478bd9Sstevel@tonic-gate tm_ptr[2] = (node_count << IEEE1394_TOP_MAP_LEN_SHIFT) | 1321*7c478bd9Sstevel@tonic-gate (self_id_count); 1322*7c478bd9Sstevel@tonic-gate 1323*7c478bd9Sstevel@tonic-gate /* Calculate CRC-16 */ 1324*7c478bd9Sstevel@tonic-gate length = self_id_count + 2; 1325*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&(tm_ptr[1]), length); 1326*7c478bd9Sstevel@tonic-gate tm_ptr[0] = (length << IEEE1394_TOP_MAP_LEN_SHIFT) | CRC; 1327*7c478bd9Sstevel@tonic-gate 1328*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_topology_map_update_exit, 1329*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_BR_CSR_STACK, ""); 1330*7c478bd9Sstevel@tonic-gate } 1331*7c478bd9Sstevel@tonic-gate 1332*7c478bd9Sstevel@tonic-gate /* 1333*7c478bd9Sstevel@tonic-gate * s1394_CSR_topology_map_disable() 1334*7c478bd9Sstevel@tonic-gate * is used to disable the local host's TOPOLOGY_MAP[] buffer (during bus 1335*7c478bd9Sstevel@tonic-gate * reset processing). It sets the topology map's length to zero to 1336*7c478bd9Sstevel@tonic-gate * indicate that it is invalid. 1337*7c478bd9Sstevel@tonic-gate */ 1338*7c478bd9Sstevel@tonic-gate void 1339*7c478bd9Sstevel@tonic-gate s1394_CSR_topology_map_disable(s1394_hal_t *hal) 1340*7c478bd9Sstevel@tonic-gate { 1341*7c478bd9Sstevel@tonic-gate uint32_t *tm_ptr; 1342*7c478bd9Sstevel@tonic-gate 1343*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_topology_map_disable_enter, 1344*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_BR_CSR_STACK, ""); 1345*7c478bd9Sstevel@tonic-gate 1346*7c478bd9Sstevel@tonic-gate ASSERT(MUTEX_HELD(&hal->topology_tree_mutex)); 1347*7c478bd9Sstevel@tonic-gate 1348*7c478bd9Sstevel@tonic-gate tm_ptr = (uint32_t *)hal->CSR_topology_map; 1349*7c478bd9Sstevel@tonic-gate 1350*7c478bd9Sstevel@tonic-gate /* Set length = 0 */ 1351*7c478bd9Sstevel@tonic-gate tm_ptr[0] = tm_ptr[0] & IEEE1394_TOP_MAP_LEN_MASK; 1352*7c478bd9Sstevel@tonic-gate 1353*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_CSR_topology_map_disable_exit, 1354*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_BR_CSR_STACK, ""); 1355*7c478bd9Sstevel@tonic-gate } 1356*7c478bd9Sstevel@tonic-gate 1357*7c478bd9Sstevel@tonic-gate /* 1358*7c478bd9Sstevel@tonic-gate * s1394_common_CSR_routine() 1359*7c478bd9Sstevel@tonic-gate * is used to handle most of the CSR register requests. They are passed 1360*7c478bd9Sstevel@tonic-gate * to the appropriate HAL entry point for further processing. Then they 1361*7c478bd9Sstevel@tonic-gate * are filled in with an appropriate response code, and the response is sent. 1362*7c478bd9Sstevel@tonic-gate */ 1363*7c478bd9Sstevel@tonic-gate static void 1364*7c478bd9Sstevel@tonic-gate s1394_common_CSR_routine(s1394_hal_t *hal, cmd1394_cmd_t *req) 1365*7c478bd9Sstevel@tonic-gate { 1366*7c478bd9Sstevel@tonic-gate uint32_t data; 1367*7c478bd9Sstevel@tonic-gate uint_t offset; 1368*7c478bd9Sstevel@tonic-gate int result; 1369*7c478bd9Sstevel@tonic-gate 1370*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_common_CSR_routine_enter, 1371*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1372*7c478bd9Sstevel@tonic-gate 1373*7c478bd9Sstevel@tonic-gate /* Register offset */ 1374*7c478bd9Sstevel@tonic-gate offset = (req->cmd_addr & IEEE1394_CSR_OFFSET_MASK); 1375*7c478bd9Sstevel@tonic-gate 1376*7c478bd9Sstevel@tonic-gate /* Verify that request is quadlet aligned */ 1377*7c478bd9Sstevel@tonic-gate if ((offset & 0x3) != 0) { 1378*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1379*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1380*7c478bd9Sstevel@tonic-gate } 1381*7c478bd9Sstevel@tonic-gate 1382*7c478bd9Sstevel@tonic-gate switch (req->cmd_type) { 1383*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_RD_QUAD: 1384*7c478bd9Sstevel@tonic-gate /* 1385*7c478bd9Sstevel@tonic-gate * The csr_read() call can return DDI_FAILURE if the HAL 1386*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 1387*7c478bd9Sstevel@tonic-gate * unimplemented. We will return IEEE1394_RESP_ADDRESS_ERROR 1388*7c478bd9Sstevel@tonic-gate * in the response if we see this error. 1389*7c478bd9Sstevel@tonic-gate */ 1390*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, 1391*7c478bd9Sstevel@tonic-gate offset, &data); 1392*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 1393*7c478bd9Sstevel@tonic-gate req->cmd_u.q.quadlet_data = data; 1394*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1395*7c478bd9Sstevel@tonic-gate } else { 1396*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1397*7c478bd9Sstevel@tonic-gate } 1398*7c478bd9Sstevel@tonic-gate break; 1399*7c478bd9Sstevel@tonic-gate 1400*7c478bd9Sstevel@tonic-gate case CMD1394_ASYNCH_WR_QUAD: 1401*7c478bd9Sstevel@tonic-gate data = req->cmd_u.q.quadlet_data; 1402*7c478bd9Sstevel@tonic-gate /* 1403*7c478bd9Sstevel@tonic-gate * The csr_read() call can return DDI_FAILURE if the HAL 1404*7c478bd9Sstevel@tonic-gate * is shutdown or if the register at "offset" is 1405*7c478bd9Sstevel@tonic-gate * unimplemented. We will return IEEE1394_RESP_ADDRESS_ERROR 1406*7c478bd9Sstevel@tonic-gate * in the response if we see this error. 1407*7c478bd9Sstevel@tonic-gate */ 1408*7c478bd9Sstevel@tonic-gate result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, 1409*7c478bd9Sstevel@tonic-gate offset, data); 1410*7c478bd9Sstevel@tonic-gate if (result == DDI_SUCCESS) { 1411*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_COMPLETE; 1412*7c478bd9Sstevel@tonic-gate } else { 1413*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; 1414*7c478bd9Sstevel@tonic-gate } 1415*7c478bd9Sstevel@tonic-gate break; 1416*7c478bd9Sstevel@tonic-gate 1417*7c478bd9Sstevel@tonic-gate default: 1418*7c478bd9Sstevel@tonic-gate req->cmd_result = IEEE1394_RESP_TYPE_ERROR; 1419*7c478bd9Sstevel@tonic-gate } 1420*7c478bd9Sstevel@tonic-gate 1421*7c478bd9Sstevel@tonic-gate (void) s1394_send_response(hal, req); 1422*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_common_CSR_routine_exit, 1423*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CSR_STACK, ""); 1424*7c478bd9Sstevel@tonic-gate } 1425*7c478bd9Sstevel@tonic-gate 1426*7c478bd9Sstevel@tonic-gate /* 1427*7c478bd9Sstevel@tonic-gate * s1394_init_local_config_rom() 1428*7c478bd9Sstevel@tonic-gate * is called in the HAL attach routine - h1394_attach() - to setup the 1429*7c478bd9Sstevel@tonic-gate * initial Config ROM entries on the local host, including the 1430*7c478bd9Sstevel@tonic-gate * bus_info_block and the root and unit directories. 1431*7c478bd9Sstevel@tonic-gate */ 1432*7c478bd9Sstevel@tonic-gate int 1433*7c478bd9Sstevel@tonic-gate s1394_init_local_config_rom(s1394_hal_t *hal) 1434*7c478bd9Sstevel@tonic-gate { 1435*7c478bd9Sstevel@tonic-gate uint32_t *config_rom; 1436*7c478bd9Sstevel@tonic-gate uint32_t *node_unique_id_leaf; 1437*7c478bd9Sstevel@tonic-gate uint32_t *unit_dir; 1438*7c478bd9Sstevel@tonic-gate uint32_t *text_leaf; 1439*7c478bd9Sstevel@tonic-gate void *n_handle; 1440*7c478bd9Sstevel@tonic-gate uint64_t guid; 1441*7c478bd9Sstevel@tonic-gate uint32_t guid_hi, guid_lo; 1442*7c478bd9Sstevel@tonic-gate uint32_t bus_capabilities; 1443*7c478bd9Sstevel@tonic-gate uint32_t irmc, g; 1444*7c478bd9Sstevel@tonic-gate uint32_t module_vendor_id; 1445*7c478bd9Sstevel@tonic-gate uint32_t node_capabilities; 1446*7c478bd9Sstevel@tonic-gate uint32_t root_dir_len; 1447*7c478bd9Sstevel@tonic-gate uint32_t CRC; 1448*7c478bd9Sstevel@tonic-gate int status, i, ret; 1449*7c478bd9Sstevel@tonic-gate 1450*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_local_config_rom_enter, 1451*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1452*7c478bd9Sstevel@tonic-gate 1453*7c478bd9Sstevel@tonic-gate /* Setup Config ROM mutex */ 1454*7c478bd9Sstevel@tonic-gate mutex_init(&hal->local_config_rom_mutex, 1455*7c478bd9Sstevel@tonic-gate NULL, MUTEX_DRIVER, hal->halinfo.hw_interrupt); 1456*7c478bd9Sstevel@tonic-gate 1457*7c478bd9Sstevel@tonic-gate /* Allocate 1K for the Config ROM buffer */ 1458*7c478bd9Sstevel@tonic-gate hal->local_config_rom = (uint32_t *)kmem_zalloc(IEEE1394_CONFIG_ROM_SZ, 1459*7c478bd9Sstevel@tonic-gate KM_SLEEP); 1460*7c478bd9Sstevel@tonic-gate 1461*7c478bd9Sstevel@tonic-gate /* Allocate 1K for the temporary buffer */ 1462*7c478bd9Sstevel@tonic-gate hal->temp_config_rom_buf = (uint32_t *)kmem_zalloc( 1463*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ, KM_SLEEP); 1464*7c478bd9Sstevel@tonic-gate 1465*7c478bd9Sstevel@tonic-gate config_rom = hal->local_config_rom; 1466*7c478bd9Sstevel@tonic-gate 1467*7c478bd9Sstevel@tonic-gate /* Lock the Config ROM buffer */ 1468*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->local_config_rom_mutex); 1469*7c478bd9Sstevel@tonic-gate 1470*7c478bd9Sstevel@tonic-gate /* Build the config ROM structures */ 1471*7c478bd9Sstevel@tonic-gate ret = s1394_init_config_rom_structures(hal); 1472*7c478bd9Sstevel@tonic-gate if (ret != DDI_SUCCESS) { 1473*7c478bd9Sstevel@tonic-gate /* Unlock the Config ROM buffer */ 1474*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->local_config_rom_mutex); 1475*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->temp_config_rom_buf, 1476*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1477*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->local_config_rom, 1478*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1479*7c478bd9Sstevel@tonic-gate mutex_destroy(&hal->local_config_rom_mutex); 1480*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_init_local_config_rom_error, 1481*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_ERROR, "", tnf_string, msg, 1482*7c478bd9Sstevel@tonic-gate "Failed in s1394_init_config_rom_structures()"); 1483*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_local_config_rom_exit, 1484*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1485*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 1486*7c478bd9Sstevel@tonic-gate } 1487*7c478bd9Sstevel@tonic-gate /* Build the Bus_Info_Block - see IEEE 1394-1995, Section 8.3.2.5.4 */ 1488*7c478bd9Sstevel@tonic-gate bus_capabilities = hal->halinfo.bus_capabilities; 1489*7c478bd9Sstevel@tonic-gate 1490*7c478bd9Sstevel@tonic-gate /* 1491*7c478bd9Sstevel@tonic-gate * If we are Isoch Resource Manager capable then we are 1492*7c478bd9Sstevel@tonic-gate * Bus Manager capable too. 1493*7c478bd9Sstevel@tonic-gate */ 1494*7c478bd9Sstevel@tonic-gate irmc = (bus_capabilities & IEEE1394_BIB_IRMC_MASK) >> 1495*7c478bd9Sstevel@tonic-gate IEEE1394_BIB_IRMC_SHIFT; 1496*7c478bd9Sstevel@tonic-gate if (irmc) 1497*7c478bd9Sstevel@tonic-gate bus_capabilities = bus_capabilities | IEEE1394_BIB_BMC_MASK; 1498*7c478bd9Sstevel@tonic-gate 1499*7c478bd9Sstevel@tonic-gate /* 1500*7c478bd9Sstevel@tonic-gate * Set generation to P1394a valid (but changeable) 1501*7c478bd9Sstevel@tonic-gate * Even if we have a 1995 PHY, we will still provide 1502*7c478bd9Sstevel@tonic-gate * certain P1394A functionality (especially with respect 1503*7c478bd9Sstevel@tonic-gate * to Config ROM updates). So we must publish this 1504*7c478bd9Sstevel@tonic-gate * information. 1505*7c478bd9Sstevel@tonic-gate */ 1506*7c478bd9Sstevel@tonic-gate g = 2 << IEEE1394_BIB_GEN_SHIFT; 1507*7c478bd9Sstevel@tonic-gate bus_capabilities = bus_capabilities | g; 1508*7c478bd9Sstevel@tonic-gate 1509*7c478bd9Sstevel@tonic-gate /* Get the GUID */ 1510*7c478bd9Sstevel@tonic-gate guid = hal->halinfo.guid; 1511*7c478bd9Sstevel@tonic-gate guid_hi = (uint32_t)(guid >> 32); 1512*7c478bd9Sstevel@tonic-gate guid_lo = (uint32_t)(guid & 0x00000000FFFFFFFF); 1513*7c478bd9Sstevel@tonic-gate 1514*7c478bd9Sstevel@tonic-gate config_rom[1] = 0x31333934; /* "1394" */ 1515*7c478bd9Sstevel@tonic-gate config_rom[2] = bus_capabilities; 1516*7c478bd9Sstevel@tonic-gate config_rom[3] = guid_hi; 1517*7c478bd9Sstevel@tonic-gate config_rom[4] = guid_lo; 1518*7c478bd9Sstevel@tonic-gate 1519*7c478bd9Sstevel@tonic-gate /* The CRC covers only our Bus_Info_Block */ 1520*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&config_rom[1], 4); 1521*7c478bd9Sstevel@tonic-gate config_rom[0] = (0x04040000) | CRC; 1522*7c478bd9Sstevel@tonic-gate 1523*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 1524*7c478bd9Sstevel@tonic-gate for (i = 0; i < IEEE1394_BIB_QUAD_SZ; i++) 1525*7c478bd9Sstevel@tonic-gate config_rom[i] = T1394_DATA32(config_rom[i]); 1526*7c478bd9Sstevel@tonic-gate 1527*7c478bd9Sstevel@tonic-gate /* Build the Root_Directory - see IEEE 1394-1995, Section 8.3.2.5.5 */ 1528*7c478bd9Sstevel@tonic-gate 1529*7c478bd9Sstevel@tonic-gate /* MODULE_VENDOR_ID - see IEEE 1394-1995, Section 8.3.2.5.5.1 */ 1530*7c478bd9Sstevel@tonic-gate module_vendor_id = S1394_SUNW_OUI; 1531*7c478bd9Sstevel@tonic-gate 1532*7c478bd9Sstevel@tonic-gate /* NODE_CAPABILITIES - see IEEE 1394-1995, Section 8.3.2.5.5.2 */ 1533*7c478bd9Sstevel@tonic-gate node_capabilities = hal->halinfo.node_capabilities & 1534*7c478bd9Sstevel@tonic-gate IEEE1212_NODE_CAPABILITIES_MASK; 1535*7c478bd9Sstevel@tonic-gate root_dir_len = 2; 1536*7c478bd9Sstevel@tonic-gate 1537*7c478bd9Sstevel@tonic-gate config_rom[6] = (IEEE1212_MODULE_VENDOR_ID << 1538*7c478bd9Sstevel@tonic-gate IEEE1212_KEY_VALUE_SHIFT) | module_vendor_id; 1539*7c478bd9Sstevel@tonic-gate config_rom[7] = (IEEE1212_NODE_CAPABILITIES << 1540*7c478bd9Sstevel@tonic-gate IEEE1212_KEY_VALUE_SHIFT) | node_capabilities; 1541*7c478bd9Sstevel@tonic-gate 1542*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&config_rom[6], root_dir_len); 1543*7c478bd9Sstevel@tonic-gate config_rom[IEEE1394_BIB_QUAD_SZ] = 1544*7c478bd9Sstevel@tonic-gate (root_dir_len << IEEE1394_CFG_ROM_LEN_SHIFT) | CRC; 1545*7c478bd9Sstevel@tonic-gate 1546*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 1547*7c478bd9Sstevel@tonic-gate for (i = IEEE1394_BIB_QUAD_SZ; i < 8; i++) 1548*7c478bd9Sstevel@tonic-gate config_rom[i] = T1394_DATA32(config_rom[i]); 1549*7c478bd9Sstevel@tonic-gate 1550*7c478bd9Sstevel@tonic-gate /* Build the Root Text leaf - see IEEE 1394-1995, Section 8.3.2.5.7 */ 1551*7c478bd9Sstevel@tonic-gate text_leaf = (uint32_t *)kmem_zalloc(S1394_ROOT_TEXT_LEAF_SZ, KM_SLEEP); 1552*7c478bd9Sstevel@tonic-gate text_leaf[1] = 0x00000000; 1553*7c478bd9Sstevel@tonic-gate text_leaf[2] = 0x00000000; 1554*7c478bd9Sstevel@tonic-gate text_leaf[3] = 0x53756e20; /* "Sun " */ 1555*7c478bd9Sstevel@tonic-gate text_leaf[4] = 0x4d696372; /* "Micr" */ 1556*7c478bd9Sstevel@tonic-gate text_leaf[5] = 0x6f737973; /* "osys" */ 1557*7c478bd9Sstevel@tonic-gate text_leaf[6] = 0x74656d73; /* "tems" */ 1558*7c478bd9Sstevel@tonic-gate text_leaf[7] = 0x2c20496e; /* ", In" */ 1559*7c478bd9Sstevel@tonic-gate text_leaf[8] = 0x632e0000; /* "c." */ 1560*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&text_leaf[1], S1394_ROOT_TEXT_LEAF_QUAD_SZ - 1); 1561*7c478bd9Sstevel@tonic-gate text_leaf[0] = (0x00080000) | CRC; 1562*7c478bd9Sstevel@tonic-gate 1563*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 1564*7c478bd9Sstevel@tonic-gate for (i = 0; i < 9; i++) 1565*7c478bd9Sstevel@tonic-gate text_leaf[i] = T1394_DATA32(text_leaf[i]); 1566*7c478bd9Sstevel@tonic-gate 1567*7c478bd9Sstevel@tonic-gate ret = s1394_add_config_rom_entry(hal, S1394_ROOT_TEXT_KEY, text_leaf, 1568*7c478bd9Sstevel@tonic-gate S1394_ROOT_TEXT_LEAF_QUAD_SZ, &n_handle, &status); 1569*7c478bd9Sstevel@tonic-gate if (ret != DDI_SUCCESS) { 1570*7c478bd9Sstevel@tonic-gate kmem_free((void *)text_leaf, S1394_ROOT_TEXT_LEAF_SZ); 1571*7c478bd9Sstevel@tonic-gate /* Destroy the config_rom structures */ 1572*7c478bd9Sstevel@tonic-gate (void) s1394_destroy_config_rom_structures(hal); 1573*7c478bd9Sstevel@tonic-gate /* Unlock the Config ROM buffer */ 1574*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->local_config_rom_mutex); 1575*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->temp_config_rom_buf, 1576*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1577*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->local_config_rom, 1578*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1579*7c478bd9Sstevel@tonic-gate mutex_destroy(&hal->local_config_rom_mutex); 1580*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_init_local_config_rom_error, 1581*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_ERROR, "", tnf_string, msg, 1582*7c478bd9Sstevel@tonic-gate "Failure in kmem_zalloc"); 1583*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_local_config_rom_exit, 1584*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1585*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 1586*7c478bd9Sstevel@tonic-gate } 1587*7c478bd9Sstevel@tonic-gate kmem_free((void *)text_leaf, S1394_ROOT_TEXT_LEAF_SZ); 1588*7c478bd9Sstevel@tonic-gate 1589*7c478bd9Sstevel@tonic-gate /* Build the Node_Unique_Id leaf - IEEE 1394-1995, Sect. 8.3.2.5.7.1 */ 1590*7c478bd9Sstevel@tonic-gate node_unique_id_leaf = (uint32_t *)kmem_zalloc(S1394_NODE_UNIQUE_ID_SZ, 1591*7c478bd9Sstevel@tonic-gate KM_SLEEP); 1592*7c478bd9Sstevel@tonic-gate node_unique_id_leaf[1] = guid_hi; 1593*7c478bd9Sstevel@tonic-gate node_unique_id_leaf[2] = guid_lo; 1594*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&node_unique_id_leaf[1], 1595*7c478bd9Sstevel@tonic-gate S1394_NODE_UNIQUE_ID_QUAD_SZ - 1); 1596*7c478bd9Sstevel@tonic-gate node_unique_id_leaf[0] = (0x00020000) | CRC; 1597*7c478bd9Sstevel@tonic-gate 1598*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 1599*7c478bd9Sstevel@tonic-gate for (i = 0; i < S1394_NODE_UNIQUE_ID_QUAD_SZ; i++) 1600*7c478bd9Sstevel@tonic-gate node_unique_id_leaf[i] = T1394_DATA32(node_unique_id_leaf[i]); 1601*7c478bd9Sstevel@tonic-gate 1602*7c478bd9Sstevel@tonic-gate ret = s1394_add_config_rom_entry(hal, S1394_NODE_UNIQUE_ID_KEY, 1603*7c478bd9Sstevel@tonic-gate node_unique_id_leaf, S1394_NODE_UNIQUE_ID_QUAD_SZ, &n_handle, 1604*7c478bd9Sstevel@tonic-gate &status); 1605*7c478bd9Sstevel@tonic-gate if (ret != DDI_SUCCESS) { 1606*7c478bd9Sstevel@tonic-gate kmem_free((void *)node_unique_id_leaf, 1607*7c478bd9Sstevel@tonic-gate S1394_NODE_UNIQUE_ID_SZ); 1608*7c478bd9Sstevel@tonic-gate /* Destroy the config_rom structures */ 1609*7c478bd9Sstevel@tonic-gate (void) s1394_destroy_config_rom_structures(hal); 1610*7c478bd9Sstevel@tonic-gate /* Unlock the Config ROM buffer */ 1611*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->local_config_rom_mutex); 1612*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->temp_config_rom_buf, 1613*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1614*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->local_config_rom, 1615*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1616*7c478bd9Sstevel@tonic-gate mutex_destroy(&hal->local_config_rom_mutex); 1617*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_init_local_config_rom_error, 1618*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_ERROR, "", tnf_string, msg, 1619*7c478bd9Sstevel@tonic-gate "Failure in kmem_zalloc"); 1620*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_local_config_rom_exit, 1621*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1622*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 1623*7c478bd9Sstevel@tonic-gate } 1624*7c478bd9Sstevel@tonic-gate kmem_free((void *)node_unique_id_leaf, S1394_NODE_UNIQUE_ID_SZ); 1625*7c478bd9Sstevel@tonic-gate 1626*7c478bd9Sstevel@tonic-gate /* Build the Unit_Directory for 1394 Framework */ 1627*7c478bd9Sstevel@tonic-gate unit_dir = (uint32_t *)kmem_zalloc(S1394_UNIT_DIR_SZ, KM_SLEEP); 1628*7c478bd9Sstevel@tonic-gate unit_dir[1] = 0x12080020; /* Sun Microsystems */ 1629*7c478bd9Sstevel@tonic-gate unit_dir[2] = 0x13000001; /* Version 1 */ 1630*7c478bd9Sstevel@tonic-gate unit_dir[3] = 0x81000001; /* offset to the text leaf */ 1631*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&unit_dir[1], 3); 1632*7c478bd9Sstevel@tonic-gate unit_dir[0] = (0x00030000) | CRC; 1633*7c478bd9Sstevel@tonic-gate 1634*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 1635*7c478bd9Sstevel@tonic-gate for (i = 0; i < 4; i++) 1636*7c478bd9Sstevel@tonic-gate unit_dir[i] = T1394_DATA32(unit_dir[i]); 1637*7c478bd9Sstevel@tonic-gate 1638*7c478bd9Sstevel@tonic-gate /* Build the Unit Directory text leaf */ 1639*7c478bd9Sstevel@tonic-gate unit_dir[5] = 0x00000000; 1640*7c478bd9Sstevel@tonic-gate unit_dir[6] = 0x00000000; 1641*7c478bd9Sstevel@tonic-gate unit_dir[7] = 0x536f6c61; /* "Sola" */ 1642*7c478bd9Sstevel@tonic-gate unit_dir[8] = 0x72697320; /* "ris " */ 1643*7c478bd9Sstevel@tonic-gate unit_dir[9] = 0x31333934; /* "1394" */ 1644*7c478bd9Sstevel@tonic-gate unit_dir[10] = 0x20535720; /* " SW " */ 1645*7c478bd9Sstevel@tonic-gate unit_dir[11] = 0x4672616d; /* "Fram" */ 1646*7c478bd9Sstevel@tonic-gate unit_dir[12] = 0x65576f72; /* "ewor" */ 1647*7c478bd9Sstevel@tonic-gate unit_dir[13] = 0x6b000000; /* "k" */ 1648*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&unit_dir[5], 9); 1649*7c478bd9Sstevel@tonic-gate unit_dir[4] = (0x00090000) | CRC; 1650*7c478bd9Sstevel@tonic-gate 1651*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 1652*7c478bd9Sstevel@tonic-gate for (i = 4; i < S1394_UNIT_DIR_QUAD_SZ; i++) 1653*7c478bd9Sstevel@tonic-gate unit_dir[i] = T1394_DATA32(unit_dir[i]); 1654*7c478bd9Sstevel@tonic-gate 1655*7c478bd9Sstevel@tonic-gate ret = s1394_add_config_rom_entry(hal, S1394_UNIT_DIR_KEY, unit_dir, 1656*7c478bd9Sstevel@tonic-gate S1394_UNIT_DIR_QUAD_SZ, &n_handle, &status); 1657*7c478bd9Sstevel@tonic-gate if (ret != DDI_SUCCESS) { 1658*7c478bd9Sstevel@tonic-gate kmem_free((void *)unit_dir, S1394_UNIT_DIR_SZ); 1659*7c478bd9Sstevel@tonic-gate /* Destroy the config_rom structures */ 1660*7c478bd9Sstevel@tonic-gate (void) s1394_destroy_config_rom_structures(hal); 1661*7c478bd9Sstevel@tonic-gate /* Unlock the Config ROM buffer */ 1662*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->local_config_rom_mutex); 1663*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->temp_config_rom_buf, 1664*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1665*7c478bd9Sstevel@tonic-gate /* Free the 1K for the Config ROM buffer */ 1666*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->local_config_rom, 1667*7c478bd9Sstevel@tonic-gate IEEE1394_CONFIG_ROM_SZ); 1668*7c478bd9Sstevel@tonic-gate mutex_destroy(&hal->local_config_rom_mutex); 1669*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_init_local_config_rom_error, 1670*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_ERROR, "", tnf_string, msg, 1671*7c478bd9Sstevel@tonic-gate "Failure in kmem_zalloc"); 1672*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_local_config_rom_exit, 1673*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1674*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 1675*7c478bd9Sstevel@tonic-gate } 1676*7c478bd9Sstevel@tonic-gate kmem_free((void *)unit_dir, S1394_UNIT_DIR_SZ); 1677*7c478bd9Sstevel@tonic-gate 1678*7c478bd9Sstevel@tonic-gate hal->config_rom_update_amount = (IEEE1394_CONFIG_ROM_QUAD_SZ - 1679*7c478bd9Sstevel@tonic-gate hal->free_space); 1680*7c478bd9Sstevel@tonic-gate 1681*7c478bd9Sstevel@tonic-gate /* Unlock the Config ROM buffer */ 1682*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->local_config_rom_mutex); 1683*7c478bd9Sstevel@tonic-gate 1684*7c478bd9Sstevel@tonic-gate /* 1685*7c478bd9Sstevel@tonic-gate * The update_config_rom() call can return DDI_FAILURE if the 1686*7c478bd9Sstevel@tonic-gate * HAL is shutdown. 1687*7c478bd9Sstevel@tonic-gate */ 1688*7c478bd9Sstevel@tonic-gate (void) HAL_CALL(hal).update_config_rom(hal->halinfo.hal_private, 1689*7c478bd9Sstevel@tonic-gate config_rom, IEEE1394_CONFIG_ROM_QUAD_SZ); 1690*7c478bd9Sstevel@tonic-gate 1691*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_local_config_rom_exit, 1692*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1693*7c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 1694*7c478bd9Sstevel@tonic-gate } 1695*7c478bd9Sstevel@tonic-gate 1696*7c478bd9Sstevel@tonic-gate /* 1697*7c478bd9Sstevel@tonic-gate * s1394_destroy_local_config_rom() 1698*7c478bd9Sstevel@tonic-gate * is necessary for h1394_detach(). It undoes all the work that 1699*7c478bd9Sstevel@tonic-gate * s1394_init_local_config_rom() had setup and more. By pulling 1700*7c478bd9Sstevel@tonic-gate * everything out of the conig rom structures and freeing them and their 1701*7c478bd9Sstevel@tonic-gate * associated mutexes, the Config ROM is completely cleaned up. 1702*7c478bd9Sstevel@tonic-gate */ 1703*7c478bd9Sstevel@tonic-gate void 1704*7c478bd9Sstevel@tonic-gate s1394_destroy_local_config_rom(s1394_hal_t *hal) 1705*7c478bd9Sstevel@tonic-gate { 1706*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_destroy_local_config_rom_enter, 1707*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1708*7c478bd9Sstevel@tonic-gate 1709*7c478bd9Sstevel@tonic-gate /* Lock the Config ROM buffer */ 1710*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->local_config_rom_mutex); 1711*7c478bd9Sstevel@tonic-gate 1712*7c478bd9Sstevel@tonic-gate /* Destroy the config_rom structures */ 1713*7c478bd9Sstevel@tonic-gate (void) s1394_destroy_config_rom_structures(hal); 1714*7c478bd9Sstevel@tonic-gate 1715*7c478bd9Sstevel@tonic-gate /* Unlock the Config ROM buffer */ 1716*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->local_config_rom_mutex); 1717*7c478bd9Sstevel@tonic-gate 1718*7c478bd9Sstevel@tonic-gate /* Free the 1K for the temporary buffer */ 1719*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->temp_config_rom_buf, IEEE1394_CONFIG_ROM_SZ); 1720*7c478bd9Sstevel@tonic-gate /* Free the 1K for the Config ROM buffer */ 1721*7c478bd9Sstevel@tonic-gate kmem_free((void *)hal->local_config_rom, IEEE1394_CONFIG_ROM_SZ); 1722*7c478bd9Sstevel@tonic-gate 1723*7c478bd9Sstevel@tonic-gate /* Setup Config ROM mutex */ 1724*7c478bd9Sstevel@tonic-gate mutex_destroy(&hal->local_config_rom_mutex); 1725*7c478bd9Sstevel@tonic-gate 1726*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_destroy_local_config_rom_exit, 1727*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1728*7c478bd9Sstevel@tonic-gate } 1729*7c478bd9Sstevel@tonic-gate 1730*7c478bd9Sstevel@tonic-gate /* 1731*7c478bd9Sstevel@tonic-gate * s1394_init_config_rom_structures() 1732*7c478bd9Sstevel@tonic-gate * initializes the structures that are used to maintain the local Config ROM. 1733*7c478bd9Sstevel@tonic-gate * Callers must be holding the local_config_rom_mutex. 1734*7c478bd9Sstevel@tonic-gate */ 1735*7c478bd9Sstevel@tonic-gate static int 1736*7c478bd9Sstevel@tonic-gate s1394_init_config_rom_structures(s1394_hal_t *hal) 1737*7c478bd9Sstevel@tonic-gate { 1738*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *root_directory; 1739*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *rest_of_config_rom; 1740*7c478bd9Sstevel@tonic-gate 1741*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_config_rom_structures_enter, 1742*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1743*7c478bd9Sstevel@tonic-gate 1744*7c478bd9Sstevel@tonic-gate ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); 1745*7c478bd9Sstevel@tonic-gate 1746*7c478bd9Sstevel@tonic-gate root_directory = (s1394_config_rom_t *)kmem_zalloc( 1747*7c478bd9Sstevel@tonic-gate sizeof (s1394_config_rom_t), KM_SLEEP); 1748*7c478bd9Sstevel@tonic-gate 1749*7c478bd9Sstevel@tonic-gate root_directory->cfgrom_used = B_TRUE; 1750*7c478bd9Sstevel@tonic-gate root_directory->cfgrom_addr_lo = IEEE1394_BIB_QUAD_SZ; 1751*7c478bd9Sstevel@tonic-gate root_directory->cfgrom_addr_hi = IEEE1394_BIB_QUAD_SZ + 2; 1752*7c478bd9Sstevel@tonic-gate 1753*7c478bd9Sstevel@tonic-gate rest_of_config_rom = (s1394_config_rom_t *)kmem_zalloc( 1754*7c478bd9Sstevel@tonic-gate sizeof (s1394_config_rom_t), KM_SLEEP); 1755*7c478bd9Sstevel@tonic-gate 1756*7c478bd9Sstevel@tonic-gate rest_of_config_rom->cfgrom_used = B_FALSE; 1757*7c478bd9Sstevel@tonic-gate rest_of_config_rom->cfgrom_addr_lo = root_directory->cfgrom_addr_hi + 1; 1758*7c478bd9Sstevel@tonic-gate rest_of_config_rom->cfgrom_addr_hi = IEEE1394_CONFIG_ROM_QUAD_SZ - 1; 1759*7c478bd9Sstevel@tonic-gate 1760*7c478bd9Sstevel@tonic-gate root_directory->cfgrom_next = rest_of_config_rom; 1761*7c478bd9Sstevel@tonic-gate root_directory->cfgrom_prev = NULL; 1762*7c478bd9Sstevel@tonic-gate rest_of_config_rom->cfgrom_next = NULL; 1763*7c478bd9Sstevel@tonic-gate rest_of_config_rom->cfgrom_prev = root_directory; 1764*7c478bd9Sstevel@tonic-gate 1765*7c478bd9Sstevel@tonic-gate hal->root_directory = root_directory; 1766*7c478bd9Sstevel@tonic-gate hal->free_space = IEEE1394_CONFIG_ROM_QUAD_SZ - 1767*7c478bd9Sstevel@tonic-gate (rest_of_config_rom->cfgrom_addr_lo); 1768*7c478bd9Sstevel@tonic-gate 1769*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_init_config_rom_structures_exit, 1770*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1771*7c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 1772*7c478bd9Sstevel@tonic-gate } 1773*7c478bd9Sstevel@tonic-gate 1774*7c478bd9Sstevel@tonic-gate /* 1775*7c478bd9Sstevel@tonic-gate * s1394_destroy_config_rom_structures() 1776*7c478bd9Sstevel@tonic-gate * is used to destroy the structures that maintain the local Config ROM. 1777*7c478bd9Sstevel@tonic-gate * Callers must be holding the local_config_rom_mutex. 1778*7c478bd9Sstevel@tonic-gate */ 1779*7c478bd9Sstevel@tonic-gate static int 1780*7c478bd9Sstevel@tonic-gate s1394_destroy_config_rom_structures(s1394_hal_t *hal) 1781*7c478bd9Sstevel@tonic-gate { 1782*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *curr_blk; 1783*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *next_blk; 1784*7c478bd9Sstevel@tonic-gate 1785*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_destroy_config_rom_structures_enter, 1786*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1787*7c478bd9Sstevel@tonic-gate 1788*7c478bd9Sstevel@tonic-gate ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); 1789*7c478bd9Sstevel@tonic-gate 1790*7c478bd9Sstevel@tonic-gate curr_blk = hal->root_directory; 1791*7c478bd9Sstevel@tonic-gate 1792*7c478bd9Sstevel@tonic-gate while (curr_blk != NULL) { 1793*7c478bd9Sstevel@tonic-gate next_blk = curr_blk->cfgrom_next; 1794*7c478bd9Sstevel@tonic-gate kmem_free(curr_blk, sizeof (s1394_config_rom_t)); 1795*7c478bd9Sstevel@tonic-gate curr_blk = next_blk; 1796*7c478bd9Sstevel@tonic-gate } 1797*7c478bd9Sstevel@tonic-gate 1798*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_destroy_config_rom_structures_exit, 1799*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1800*7c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 1801*7c478bd9Sstevel@tonic-gate } 1802*7c478bd9Sstevel@tonic-gate 1803*7c478bd9Sstevel@tonic-gate /* 1804*7c478bd9Sstevel@tonic-gate * s1394_add_config_rom_entry() 1805*7c478bd9Sstevel@tonic-gate * is used to add a new entry to the local host's config ROM. By 1806*7c478bd9Sstevel@tonic-gate * specifying a key and a buffer, it is possible to update the Root 1807*7c478bd9Sstevel@tonic-gate * Directory to point to the new entry (in buffer). Additionally, all 1808*7c478bd9Sstevel@tonic-gate * of the relevant CRCs, lengths, and generations are updated as well. 1809*7c478bd9Sstevel@tonic-gate * By returning a Config ROM "handle", we can allow targets to remove 1810*7c478bd9Sstevel@tonic-gate * the corresponding entry. 1811*7c478bd9Sstevel@tonic-gate * Callers must be holding the local_config_rom_mutex. 1812*7c478bd9Sstevel@tonic-gate */ 1813*7c478bd9Sstevel@tonic-gate int 1814*7c478bd9Sstevel@tonic-gate s1394_add_config_rom_entry(s1394_hal_t *hal, uint8_t key, uint32_t *buffer, 1815*7c478bd9Sstevel@tonic-gate uint_t size, void **handle, int *status) 1816*7c478bd9Sstevel@tonic-gate { 1817*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *curr_blk; 1818*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *new_blk; 1819*7c478bd9Sstevel@tonic-gate uint32_t *config_rom; 1820*7c478bd9Sstevel@tonic-gate uint32_t *temp_buf; 1821*7c478bd9Sstevel@tonic-gate uint32_t CRC; 1822*7c478bd9Sstevel@tonic-gate uint_t tmp_offset; 1823*7c478bd9Sstevel@tonic-gate uint_t tmp_size, temp; 1824*7c478bd9Sstevel@tonic-gate uint_t last_entry_offset; 1825*7c478bd9Sstevel@tonic-gate int i; 1826*7c478bd9Sstevel@tonic-gate 1827*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_add_config_rom_entry_enter, 1828*7c478bd9Sstevel@tonic-gate "stacktrace 1394 s1394", ""); 1829*7c478bd9Sstevel@tonic-gate 1830*7c478bd9Sstevel@tonic-gate ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); 1831*7c478bd9Sstevel@tonic-gate 1832*7c478bd9Sstevel@tonic-gate if (size > hal->free_space) { 1833*7c478bd9Sstevel@tonic-gate /* Out of space */ 1834*7c478bd9Sstevel@tonic-gate *status = CMD1394_ERSRC_CONFLICT; 1835*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_add_config_rom_entry_exit, 1836*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1837*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 1838*7c478bd9Sstevel@tonic-gate } 1839*7c478bd9Sstevel@tonic-gate 1840*7c478bd9Sstevel@tonic-gate config_rom = hal->local_config_rom; 1841*7c478bd9Sstevel@tonic-gate temp_buf = hal->temp_config_rom_buf; 1842*7c478bd9Sstevel@tonic-gate 1843*7c478bd9Sstevel@tonic-gate /* Copy the Bus_Info_Block */ 1844*7c478bd9Sstevel@tonic-gate bcopy(&config_rom[0], &temp_buf[0], IEEE1394_BIB_SZ); 1845*7c478bd9Sstevel@tonic-gate 1846*7c478bd9Sstevel@tonic-gate /* Copy and add to the Root_Directory */ 1847*7c478bd9Sstevel@tonic-gate tmp_offset = hal->root_directory->cfgrom_addr_lo; 1848*7c478bd9Sstevel@tonic-gate tmp_size = (hal->root_directory->cfgrom_addr_hi - tmp_offset) + 1; 1849*7c478bd9Sstevel@tonic-gate tmp_size = tmp_size + 1; /* For the new entry */ 1850*7c478bd9Sstevel@tonic-gate bcopy(&config_rom[tmp_offset], &temp_buf[tmp_offset], tmp_size << 2); 1851*7c478bd9Sstevel@tonic-gate last_entry_offset = hal->root_directory->cfgrom_addr_hi + 1; 1852*7c478bd9Sstevel@tonic-gate 1853*7c478bd9Sstevel@tonic-gate curr_blk = hal->root_directory; 1854*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_addr_hi = curr_blk->cfgrom_addr_hi + 1; 1855*7c478bd9Sstevel@tonic-gate while (curr_blk->cfgrom_next != NULL) { 1856*7c478bd9Sstevel@tonic-gate if (curr_blk->cfgrom_next->cfgrom_used == B_TRUE) { 1857*7c478bd9Sstevel@tonic-gate tmp_offset = curr_blk->cfgrom_next->cfgrom_addr_lo; 1858*7c478bd9Sstevel@tonic-gate tmp_size = (curr_blk->cfgrom_next->cfgrom_addr_hi - 1859*7c478bd9Sstevel@tonic-gate tmp_offset) + 1; 1860*7c478bd9Sstevel@tonic-gate 1861*7c478bd9Sstevel@tonic-gate bcopy(&config_rom[tmp_offset], 1862*7c478bd9Sstevel@tonic-gate &temp_buf[tmp_offset + 1], tmp_size << 2); 1863*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_next->cfgrom_addr_lo++; 1864*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_next->cfgrom_addr_hi++; 1865*7c478bd9Sstevel@tonic-gate last_entry_offset = 1866*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_next->cfgrom_addr_hi; 1867*7c478bd9Sstevel@tonic-gate 1868*7c478bd9Sstevel@tonic-gate tmp_offset = curr_blk->cfgrom_next->root_dir_offset; 1869*7c478bd9Sstevel@tonic-gate 1870*7c478bd9Sstevel@tonic-gate /* Swap... add one... then unswap */ 1871*7c478bd9Sstevel@tonic-gate temp = T1394_DATA32(temp_buf[tmp_offset]); 1872*7c478bd9Sstevel@tonic-gate temp++; 1873*7c478bd9Sstevel@tonic-gate temp_buf[tmp_offset] = T1394_DATA32(temp); 1874*7c478bd9Sstevel@tonic-gate } else { 1875*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_next->cfgrom_addr_lo++; 1876*7c478bd9Sstevel@tonic-gate hal->free_space--; 1877*7c478bd9Sstevel@tonic-gate break; 1878*7c478bd9Sstevel@tonic-gate } 1879*7c478bd9Sstevel@tonic-gate 1880*7c478bd9Sstevel@tonic-gate curr_blk = curr_blk->cfgrom_next; 1881*7c478bd9Sstevel@tonic-gate } 1882*7c478bd9Sstevel@tonic-gate 1883*7c478bd9Sstevel@tonic-gate /* Get the pointer to the "free" space */ 1884*7c478bd9Sstevel@tonic-gate curr_blk = curr_blk->cfgrom_next; 1885*7c478bd9Sstevel@tonic-gate 1886*7c478bd9Sstevel@tonic-gate /* Is it an exact fit? */ 1887*7c478bd9Sstevel@tonic-gate if (hal->free_space == size) { 1888*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_used = B_TRUE; 1889*7c478bd9Sstevel@tonic-gate 1890*7c478bd9Sstevel@tonic-gate } else { /* Must break this piece */ 1891*7c478bd9Sstevel@tonic-gate new_blk = (s1394_config_rom_t *)kmem_zalloc( 1892*7c478bd9Sstevel@tonic-gate sizeof (s1394_config_rom_t), KM_SLEEP); 1893*7c478bd9Sstevel@tonic-gate if (new_blk == NULL) { 1894*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_add_config_rom_entry_exit, 1895*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1896*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 1897*7c478bd9Sstevel@tonic-gate } 1898*7c478bd9Sstevel@tonic-gate 1899*7c478bd9Sstevel@tonic-gate new_blk->cfgrom_addr_hi = curr_blk->cfgrom_addr_hi; 1900*7c478bd9Sstevel@tonic-gate new_blk->cfgrom_addr_lo = curr_blk->cfgrom_addr_lo + size; 1901*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_addr_hi = new_blk->cfgrom_addr_lo - 1; 1902*7c478bd9Sstevel@tonic-gate new_blk->cfgrom_next = curr_blk->cfgrom_next; 1903*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_next = new_blk; 1904*7c478bd9Sstevel@tonic-gate new_blk->cfgrom_prev = curr_blk; 1905*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_used = B_TRUE; 1906*7c478bd9Sstevel@tonic-gate last_entry_offset = curr_blk->cfgrom_addr_hi; 1907*7c478bd9Sstevel@tonic-gate } 1908*7c478bd9Sstevel@tonic-gate hal->free_space = hal->free_space - size; 1909*7c478bd9Sstevel@tonic-gate 1910*7c478bd9Sstevel@tonic-gate /* Copy in the new entry */ 1911*7c478bd9Sstevel@tonic-gate tmp_offset = curr_blk->cfgrom_addr_lo; 1912*7c478bd9Sstevel@tonic-gate bcopy(buffer, &temp_buf[tmp_offset], size << 2); 1913*7c478bd9Sstevel@tonic-gate 1914*7c478bd9Sstevel@tonic-gate /* Update root directory */ 1915*7c478bd9Sstevel@tonic-gate tmp_offset = hal->root_directory->cfgrom_addr_hi; 1916*7c478bd9Sstevel@tonic-gate tmp_size = tmp_offset - hal->root_directory->cfgrom_addr_lo; 1917*7c478bd9Sstevel@tonic-gate curr_blk->root_dir_offset = tmp_offset; 1918*7c478bd9Sstevel@tonic-gate tmp_offset = curr_blk->cfgrom_addr_lo - tmp_offset; 1919*7c478bd9Sstevel@tonic-gate 1920*7c478bd9Sstevel@tonic-gate temp_buf[hal->root_directory->cfgrom_addr_hi] = 1921*7c478bd9Sstevel@tonic-gate T1394_DATA32((((uint32_t)key) << IEEE1212_KEY_VALUE_SHIFT) | 1922*7c478bd9Sstevel@tonic-gate tmp_offset); 1923*7c478bd9Sstevel@tonic-gate tmp_offset = hal->root_directory->cfgrom_addr_lo; 1924*7c478bd9Sstevel@tonic-gate 1925*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 1926*7c478bd9Sstevel@tonic-gate for (i = (tmp_offset + 1); i <= hal->root_directory->cfgrom_addr_hi; 1927*7c478bd9Sstevel@tonic-gate i++) 1928*7c478bd9Sstevel@tonic-gate temp_buf[i] = T1394_DATA32(temp_buf[i]); 1929*7c478bd9Sstevel@tonic-gate 1930*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&temp_buf[tmp_offset + 1], tmp_size); 1931*7c478bd9Sstevel@tonic-gate temp_buf[tmp_offset] = (tmp_size << IEEE1394_CFG_ROM_LEN_SHIFT) | CRC; 1932*7c478bd9Sstevel@tonic-gate 1933*7c478bd9Sstevel@tonic-gate /* Redo byte-swapping if necessary (x86) */ 1934*7c478bd9Sstevel@tonic-gate for (i = tmp_offset; i <= hal->root_directory->cfgrom_addr_hi; i++) 1935*7c478bd9Sstevel@tonic-gate temp_buf[i] = T1394_DATA32(temp_buf[i]); 1936*7c478bd9Sstevel@tonic-gate 1937*7c478bd9Sstevel@tonic-gate /* Copy it back to config_rom buffer */ 1938*7c478bd9Sstevel@tonic-gate last_entry_offset++; 1939*7c478bd9Sstevel@tonic-gate bcopy(&temp_buf[0], &config_rom[0], last_entry_offset << 2); 1940*7c478bd9Sstevel@tonic-gate 1941*7c478bd9Sstevel@tonic-gate /* Return a handle to this block */ 1942*7c478bd9Sstevel@tonic-gate *handle = curr_blk; 1943*7c478bd9Sstevel@tonic-gate 1944*7c478bd9Sstevel@tonic-gate *status = T1394_NOERROR; 1945*7c478bd9Sstevel@tonic-gate 1946*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_add_config_rom_entry_exit, 1947*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1948*7c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 1949*7c478bd9Sstevel@tonic-gate } 1950*7c478bd9Sstevel@tonic-gate 1951*7c478bd9Sstevel@tonic-gate /* 1952*7c478bd9Sstevel@tonic-gate * s1394_remove_config_rom_entry() 1953*7c478bd9Sstevel@tonic-gate * is used to remove an entry from the local host's config ROM. By 1954*7c478bd9Sstevel@tonic-gate * specifying the Config ROM "handle" that was given in the allocation, 1955*7c478bd9Sstevel@tonic-gate * it is possible to remove the entry. Subsequently, the Config ROM is 1956*7c478bd9Sstevel@tonic-gate * updated again. 1957*7c478bd9Sstevel@tonic-gate * Callers must be holding the local_config_rom_mutex. 1958*7c478bd9Sstevel@tonic-gate */ 1959*7c478bd9Sstevel@tonic-gate int 1960*7c478bd9Sstevel@tonic-gate s1394_remove_config_rom_entry(s1394_hal_t *hal, void **handle, int *status) 1961*7c478bd9Sstevel@tonic-gate { 1962*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *del_blk; 1963*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *curr_blk; 1964*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *last_blk; 1965*7c478bd9Sstevel@tonic-gate s1394_config_rom_t *free_blk; 1966*7c478bd9Sstevel@tonic-gate uint32_t *config_rom; 1967*7c478bd9Sstevel@tonic-gate uint32_t *temp_buf; 1968*7c478bd9Sstevel@tonic-gate uint32_t entry; 1969*7c478bd9Sstevel@tonic-gate uint_t CRC; 1970*7c478bd9Sstevel@tonic-gate uint_t root_offset; 1971*7c478bd9Sstevel@tonic-gate uint_t del_offset; 1972*7c478bd9Sstevel@tonic-gate uint_t tmp_offset; 1973*7c478bd9Sstevel@tonic-gate uint_t tmp_size; 1974*7c478bd9Sstevel@tonic-gate int i; 1975*7c478bd9Sstevel@tonic-gate 1976*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_remove_config_rom_entry_enter, 1977*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 1978*7c478bd9Sstevel@tonic-gate 1979*7c478bd9Sstevel@tonic-gate ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); 1980*7c478bd9Sstevel@tonic-gate 1981*7c478bd9Sstevel@tonic-gate del_blk = (s1394_config_rom_t *)(*handle); 1982*7c478bd9Sstevel@tonic-gate 1983*7c478bd9Sstevel@tonic-gate config_rom = hal->local_config_rom; 1984*7c478bd9Sstevel@tonic-gate temp_buf = hal->temp_config_rom_buf; 1985*7c478bd9Sstevel@tonic-gate 1986*7c478bd9Sstevel@tonic-gate /* Copy the Bus_Info_Block */ 1987*7c478bd9Sstevel@tonic-gate bcopy(&config_rom[0], &temp_buf[0], IEEE1394_BIB_SZ); 1988*7c478bd9Sstevel@tonic-gate 1989*7c478bd9Sstevel@tonic-gate root_offset = hal->root_directory->cfgrom_addr_lo; 1990*7c478bd9Sstevel@tonic-gate del_offset = del_blk->root_dir_offset; 1991*7c478bd9Sstevel@tonic-gate 1992*7c478bd9Sstevel@tonic-gate /* Update Root_Directory entries before the deleted one */ 1993*7c478bd9Sstevel@tonic-gate for (i = root_offset; i < del_offset; i++) { 1994*7c478bd9Sstevel@tonic-gate entry = T1394_DATA32(config_rom[i]); 1995*7c478bd9Sstevel@tonic-gate 1996*7c478bd9Sstevel@tonic-gate /* If entry is an offset address - update it */ 1997*7c478bd9Sstevel@tonic-gate if (entry & 0x80000000) 1998*7c478bd9Sstevel@tonic-gate temp_buf[i] = T1394_DATA32(entry - 1); 1999*7c478bd9Sstevel@tonic-gate else 2000*7c478bd9Sstevel@tonic-gate temp_buf[i] = T1394_DATA32(entry); 2001*7c478bd9Sstevel@tonic-gate } 2002*7c478bd9Sstevel@tonic-gate 2003*7c478bd9Sstevel@tonic-gate /* Move all Unit_Directories prior to the deleted one */ 2004*7c478bd9Sstevel@tonic-gate curr_blk = hal->root_directory->cfgrom_next; 2005*7c478bd9Sstevel@tonic-gate 2006*7c478bd9Sstevel@tonic-gate while (curr_blk != del_blk) { 2007*7c478bd9Sstevel@tonic-gate tmp_offset = curr_blk->cfgrom_addr_lo; 2008*7c478bd9Sstevel@tonic-gate tmp_size = (curr_blk->cfgrom_addr_hi - tmp_offset) + 1; 2009*7c478bd9Sstevel@tonic-gate 2010*7c478bd9Sstevel@tonic-gate bcopy(&config_rom[tmp_offset], &temp_buf[tmp_offset - 1], 2011*7c478bd9Sstevel@tonic-gate tmp_size << 2); 2012*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_addr_lo--; 2013*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_addr_hi--; 2014*7c478bd9Sstevel@tonic-gate curr_blk = curr_blk->cfgrom_next; 2015*7c478bd9Sstevel@tonic-gate } 2016*7c478bd9Sstevel@tonic-gate 2017*7c478bd9Sstevel@tonic-gate /* Move all Unit_Directories after the deleted one */ 2018*7c478bd9Sstevel@tonic-gate curr_blk = del_blk->cfgrom_next; 2019*7c478bd9Sstevel@tonic-gate last_blk = del_blk->cfgrom_prev; 2020*7c478bd9Sstevel@tonic-gate 2021*7c478bd9Sstevel@tonic-gate del_offset = (del_blk->cfgrom_addr_hi - del_blk->cfgrom_addr_lo) + 1; 2022*7c478bd9Sstevel@tonic-gate 2023*7c478bd9Sstevel@tonic-gate while ((curr_blk != NULL) && (curr_blk->cfgrom_used == B_TRUE)) { 2024*7c478bd9Sstevel@tonic-gate tmp_offset = curr_blk->cfgrom_addr_lo; 2025*7c478bd9Sstevel@tonic-gate tmp_size = (curr_blk->cfgrom_addr_hi - tmp_offset) + 1; 2026*7c478bd9Sstevel@tonic-gate 2027*7c478bd9Sstevel@tonic-gate bcopy(&config_rom[tmp_offset], 2028*7c478bd9Sstevel@tonic-gate &temp_buf[tmp_offset - (del_offset + 1)], tmp_size << 2); 2029*7c478bd9Sstevel@tonic-gate 2030*7c478bd9Sstevel@tonic-gate root_offset = curr_blk->root_dir_offset; 2031*7c478bd9Sstevel@tonic-gate temp_buf[root_offset - 1] = 2032*7c478bd9Sstevel@tonic-gate config_rom[root_offset] - del_offset; 2033*7c478bd9Sstevel@tonic-gate curr_blk->root_dir_offset--; 2034*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_addr_lo = curr_blk->cfgrom_addr_lo - 2035*7c478bd9Sstevel@tonic-gate (del_offset + 1); 2036*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_addr_hi = curr_blk->cfgrom_addr_hi - 2037*7c478bd9Sstevel@tonic-gate (del_offset + 1); 2038*7c478bd9Sstevel@tonic-gate 2039*7c478bd9Sstevel@tonic-gate last_blk = curr_blk; 2040*7c478bd9Sstevel@tonic-gate curr_blk = curr_blk->cfgrom_next; 2041*7c478bd9Sstevel@tonic-gate } 2042*7c478bd9Sstevel@tonic-gate 2043*7c478bd9Sstevel@tonic-gate /* Remove del_blk from the list */ 2044*7c478bd9Sstevel@tonic-gate if (del_blk->cfgrom_prev != NULL) 2045*7c478bd9Sstevel@tonic-gate del_blk->cfgrom_prev->cfgrom_next = del_blk->cfgrom_next; 2046*7c478bd9Sstevel@tonic-gate 2047*7c478bd9Sstevel@tonic-gate if (del_blk->cfgrom_next != NULL) 2048*7c478bd9Sstevel@tonic-gate del_blk->cfgrom_next->cfgrom_prev = del_blk->cfgrom_prev; 2049*7c478bd9Sstevel@tonic-gate 2050*7c478bd9Sstevel@tonic-gate del_blk->cfgrom_prev = NULL; 2051*7c478bd9Sstevel@tonic-gate del_blk->cfgrom_next = NULL; 2052*7c478bd9Sstevel@tonic-gate kmem_free((void *)del_blk, sizeof (s1394_config_rom_t)); 2053*7c478bd9Sstevel@tonic-gate 2054*7c478bd9Sstevel@tonic-gate /* Update and zero out the "free" block */ 2055*7c478bd9Sstevel@tonic-gate if (curr_blk != NULL) { 2056*7c478bd9Sstevel@tonic-gate curr_blk->cfgrom_addr_lo = curr_blk->cfgrom_addr_lo - 2057*7c478bd9Sstevel@tonic-gate (del_offset + 1); 2058*7c478bd9Sstevel@tonic-gate 2059*7c478bd9Sstevel@tonic-gate } else { 2060*7c478bd9Sstevel@tonic-gate free_blk = (s1394_config_rom_t *)kmem_zalloc( 2061*7c478bd9Sstevel@tonic-gate sizeof (s1394_config_rom_t), KM_SLEEP); 2062*7c478bd9Sstevel@tonic-gate if (free_blk == NULL) { 2063*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_remove_config_rom_entry_exit, 2064*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 2065*7c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 2066*7c478bd9Sstevel@tonic-gate } 2067*7c478bd9Sstevel@tonic-gate 2068*7c478bd9Sstevel@tonic-gate free_blk->cfgrom_used = B_FALSE; 2069*7c478bd9Sstevel@tonic-gate free_blk->cfgrom_addr_lo = (IEEE1394_CONFIG_ROM_QUAD_SZ - 1) - 2070*7c478bd9Sstevel@tonic-gate (del_offset + 1); 2071*7c478bd9Sstevel@tonic-gate free_blk->cfgrom_addr_hi = (IEEE1394_CONFIG_ROM_QUAD_SZ - 1); 2072*7c478bd9Sstevel@tonic-gate 2073*7c478bd9Sstevel@tonic-gate free_blk->cfgrom_prev = last_blk; 2074*7c478bd9Sstevel@tonic-gate free_blk->cfgrom_next = NULL; 2075*7c478bd9Sstevel@tonic-gate curr_blk = free_blk; 2076*7c478bd9Sstevel@tonic-gate } 2077*7c478bd9Sstevel@tonic-gate hal->free_space = hal->free_space + (del_offset + 1); 2078*7c478bd9Sstevel@tonic-gate tmp_offset = curr_blk->cfgrom_addr_lo; 2079*7c478bd9Sstevel@tonic-gate tmp_size = (curr_blk->cfgrom_addr_hi - tmp_offset) + 1; 2080*7c478bd9Sstevel@tonic-gate bzero(&temp_buf[tmp_offset], tmp_size << 2); 2081*7c478bd9Sstevel@tonic-gate 2082*7c478bd9Sstevel@tonic-gate 2083*7c478bd9Sstevel@tonic-gate /* Update root directory */ 2084*7c478bd9Sstevel@tonic-gate hal->root_directory->cfgrom_addr_hi--; 2085*7c478bd9Sstevel@tonic-gate tmp_offset = hal->root_directory->cfgrom_addr_lo; 2086*7c478bd9Sstevel@tonic-gate tmp_size = hal->root_directory->cfgrom_addr_hi - tmp_offset; 2087*7c478bd9Sstevel@tonic-gate 2088*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 2089*7c478bd9Sstevel@tonic-gate for (i = (tmp_offset + 1); i <= hal->root_directory->cfgrom_addr_hi; 2090*7c478bd9Sstevel@tonic-gate i++) 2091*7c478bd9Sstevel@tonic-gate temp_buf[i] = T1394_DATA32(temp_buf[i]); 2092*7c478bd9Sstevel@tonic-gate 2093*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&temp_buf[tmp_offset + 1], tmp_size); 2094*7c478bd9Sstevel@tonic-gate temp_buf[tmp_offset] = (tmp_size << IEEE1394_CFG_ROM_LEN_SHIFT) | CRC; 2095*7c478bd9Sstevel@tonic-gate 2096*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 2097*7c478bd9Sstevel@tonic-gate for (i = (tmp_offset + 1); i <= hal->root_directory->cfgrom_addr_hi; 2098*7c478bd9Sstevel@tonic-gate i++) 2099*7c478bd9Sstevel@tonic-gate temp_buf[i] = T1394_DATA32(temp_buf[i]); 2100*7c478bd9Sstevel@tonic-gate 2101*7c478bd9Sstevel@tonic-gate /* Copy it back to config_rom buffer */ 2102*7c478bd9Sstevel@tonic-gate tmp_size = IEEE1394_CONFIG_ROM_SZ - (hal->free_space << 2); 2103*7c478bd9Sstevel@tonic-gate bcopy(&temp_buf[0], &config_rom[0], tmp_size); 2104*7c478bd9Sstevel@tonic-gate 2105*7c478bd9Sstevel@tonic-gate /* Return a handle to this block */ 2106*7c478bd9Sstevel@tonic-gate *handle = NULL; 2107*7c478bd9Sstevel@tonic-gate 2108*7c478bd9Sstevel@tonic-gate *status = T1394_NOERROR; 2109*7c478bd9Sstevel@tonic-gate 2110*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_remove_config_rom_entry_exit, 2111*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 2112*7c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 2113*7c478bd9Sstevel@tonic-gate } 2114*7c478bd9Sstevel@tonic-gate 2115*7c478bd9Sstevel@tonic-gate /* 2116*7c478bd9Sstevel@tonic-gate * s1394_update_config_rom_callback() 2117*7c478bd9Sstevel@tonic-gate * is the callback used by t1394_add_cfgrom_entry() and 2118*7c478bd9Sstevel@tonic-gate * t1394_rem_cfgrom_entry(). After a target updates the Config ROM, a 2119*7c478bd9Sstevel@tonic-gate * timer is set with this as its callback function. This is to reduce 2120*7c478bd9Sstevel@tonic-gate * the number of bus resets that would be necessary if many targets 2121*7c478bd9Sstevel@tonic-gate * wished to update the Config ROM simultaneously. 2122*7c478bd9Sstevel@tonic-gate */ 2123*7c478bd9Sstevel@tonic-gate void 2124*7c478bd9Sstevel@tonic-gate s1394_update_config_rom_callback(void *arg) 2125*7c478bd9Sstevel@tonic-gate { 2126*7c478bd9Sstevel@tonic-gate s1394_hal_t *hal; 2127*7c478bd9Sstevel@tonic-gate uint32_t *config_rom; 2128*7c478bd9Sstevel@tonic-gate uint32_t bus_capabilities; 2129*7c478bd9Sstevel@tonic-gate uint32_t g; 2130*7c478bd9Sstevel@tonic-gate uint_t CRC; 2131*7c478bd9Sstevel@tonic-gate uint_t last_entry_offset; 2132*7c478bd9Sstevel@tonic-gate int i, ret; 2133*7c478bd9Sstevel@tonic-gate 2134*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_update_config_rom_callback_enter, 2135*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 2136*7c478bd9Sstevel@tonic-gate 2137*7c478bd9Sstevel@tonic-gate hal = (s1394_hal_t *)arg; 2138*7c478bd9Sstevel@tonic-gate 2139*7c478bd9Sstevel@tonic-gate /* Lock the Config ROM buffer */ 2140*7c478bd9Sstevel@tonic-gate mutex_enter(&hal->local_config_rom_mutex); 2141*7c478bd9Sstevel@tonic-gate 2142*7c478bd9Sstevel@tonic-gate config_rom = hal->local_config_rom; 2143*7c478bd9Sstevel@tonic-gate 2144*7c478bd9Sstevel@tonic-gate /* Update Generation and CRC for Bus_Info_Block */ 2145*7c478bd9Sstevel@tonic-gate 2146*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 2147*7c478bd9Sstevel@tonic-gate for (i = 0; i < IEEE1394_BIB_QUAD_SZ; i++) 2148*7c478bd9Sstevel@tonic-gate config_rom[i] = T1394_DATA32(config_rom[i]); 2149*7c478bd9Sstevel@tonic-gate 2150*7c478bd9Sstevel@tonic-gate bus_capabilities = config_rom[IEEE1212_NODE_CAP_QUAD]; 2151*7c478bd9Sstevel@tonic-gate g = ((bus_capabilities & IEEE1394_BIB_GEN_MASK) >> 2152*7c478bd9Sstevel@tonic-gate IEEE1394_BIB_GEN_SHIFT) + 1; 2153*7c478bd9Sstevel@tonic-gate if (g > 15) 2154*7c478bd9Sstevel@tonic-gate g = 2; 2155*7c478bd9Sstevel@tonic-gate g = g << IEEE1394_BIB_GEN_SHIFT; 2156*7c478bd9Sstevel@tonic-gate 2157*7c478bd9Sstevel@tonic-gate bus_capabilities = (bus_capabilities & (~IEEE1394_BIB_GEN_MASK)) | g; 2158*7c478bd9Sstevel@tonic-gate config_rom[IEEE1212_NODE_CAP_QUAD] = bus_capabilities; 2159*7c478bd9Sstevel@tonic-gate 2160*7c478bd9Sstevel@tonic-gate CRC = s1394_CRC16(&config_rom[1], IEEE1394_BIB_QUAD_SZ - 1); 2161*7c478bd9Sstevel@tonic-gate config_rom[0] = (0x04040000) | CRC; 2162*7c478bd9Sstevel@tonic-gate 2163*7c478bd9Sstevel@tonic-gate /* Do byte-swapping if necessary (x86) */ 2164*7c478bd9Sstevel@tonic-gate for (i = 0; i < IEEE1394_BIB_QUAD_SZ; i++) 2165*7c478bd9Sstevel@tonic-gate config_rom[i] = T1394_DATA32(config_rom[i]); 2166*7c478bd9Sstevel@tonic-gate 2167*7c478bd9Sstevel@tonic-gate /* Make sure we update only what is necessary */ 2168*7c478bd9Sstevel@tonic-gate last_entry_offset = (IEEE1394_CONFIG_ROM_QUAD_SZ - hal->free_space); 2169*7c478bd9Sstevel@tonic-gate if (last_entry_offset < hal->config_rom_update_amount) 2170*7c478bd9Sstevel@tonic-gate last_entry_offset = hal->config_rom_update_amount; 2171*7c478bd9Sstevel@tonic-gate 2172*7c478bd9Sstevel@tonic-gate hal->config_rom_update_amount = (IEEE1394_CONFIG_ROM_QUAD_SZ - 2173*7c478bd9Sstevel@tonic-gate hal->free_space); 2174*7c478bd9Sstevel@tonic-gate 2175*7c478bd9Sstevel@tonic-gate /* Clear the timer flag */ 2176*7c478bd9Sstevel@tonic-gate hal->config_rom_timer_set = B_FALSE; 2177*7c478bd9Sstevel@tonic-gate 2178*7c478bd9Sstevel@tonic-gate /* Unlock the Config ROM buffer */ 2179*7c478bd9Sstevel@tonic-gate mutex_exit(&hal->local_config_rom_mutex); 2180*7c478bd9Sstevel@tonic-gate 2181*7c478bd9Sstevel@tonic-gate /* 2182*7c478bd9Sstevel@tonic-gate * The update_config_rom() call can return DDI_FAILURE if the 2183*7c478bd9Sstevel@tonic-gate * HAL is shutdown. 2184*7c478bd9Sstevel@tonic-gate */ 2185*7c478bd9Sstevel@tonic-gate (void) HAL_CALL(hal).update_config_rom(hal->halinfo.hal_private,\ 2186*7c478bd9Sstevel@tonic-gate config_rom, last_entry_offset); 2187*7c478bd9Sstevel@tonic-gate 2188*7c478bd9Sstevel@tonic-gate /* Initiate a bus reset */ 2189*7c478bd9Sstevel@tonic-gate ret = HAL_CALL(hal).bus_reset(hal->halinfo.hal_private); 2190*7c478bd9Sstevel@tonic-gate if (ret != DDI_SUCCESS) { 2191*7c478bd9Sstevel@tonic-gate TNF_PROBE_1(s1394_update_config_rom_callback_error, 2192*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_ERROR, "", tnf_string, msg, 2193*7c478bd9Sstevel@tonic-gate "Error initiating bus reset"); 2194*7c478bd9Sstevel@tonic-gate } 2195*7c478bd9Sstevel@tonic-gate 2196*7c478bd9Sstevel@tonic-gate TNF_PROBE_0_DEBUG(s1394_update_config_rom_callback_exit, 2197*7c478bd9Sstevel@tonic-gate S1394_TNF_SL_CFGROM_STACK, ""); 2198*7c478bd9Sstevel@tonic-gate } 2199