1*507c3241Smlf /*
2*507c3241Smlf  * CDDL HEADER START
3*507c3241Smlf  *
4*507c3241Smlf  * The contents of this file are subject to the terms of the
5*507c3241Smlf  * Common Development and Distribution License (the "License").
6*507c3241Smlf  * You may not use this file except in compliance with the License.
7*507c3241Smlf  *
8*507c3241Smlf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*507c3241Smlf  * or http://www.opensolaris.org/os/licensing.
10*507c3241Smlf  * See the License for the specific language governing permissions
11*507c3241Smlf  * and limitations under the License.
12*507c3241Smlf  *
13*507c3241Smlf  * When distributing Covered Code, include this CDDL HEADER in each
14*507c3241Smlf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*507c3241Smlf  * If applicable, add the following below this CDDL HEADER, with the
16*507c3241Smlf  * fields enclosed by brackets "[]" replaced with your own identifying
17*507c3241Smlf  * information: Portions Copyright [yyyy] [name of copyright owner]
18*507c3241Smlf  *
19*507c3241Smlf  * CDDL HEADER END
20*507c3241Smlf  */
21*507c3241Smlf 
22*507c3241Smlf /*
23*507c3241Smlf  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*507c3241Smlf  * Use is subject to license terms.
25*507c3241Smlf  */
26*507c3241Smlf 
27*507c3241Smlf #include <sys/types.h>
28*507c3241Smlf #include <sys/debug.h>
29*507c3241Smlf 
30*507c3241Smlf #include "ata_common.h"
31*507c3241Smlf #include "ata_disk.h"
32*507c3241Smlf #include "atapi.h"
33*507c3241Smlf #include "pciide.h"
34*507c3241Smlf 
35*507c3241Smlf 
36*507c3241Smlf #ifdef ATA_DEBUG
37*507c3241Smlf 
38*507c3241Smlf void
dump_ata_ctl(ata_ctl_t * P)39*507c3241Smlf dump_ata_ctl(ata_ctl_t *P)
40*507c3241Smlf {
41*507c3241Smlf 	ghd_err("dip 0x%p flags 0x%x timing 0x%x\n",
42*507c3241Smlf 		P->ac_dip, P->ac_flags, P->ac_timing_flags);
43*507c3241Smlf 	ghd_err("drvp[0][0..7] 0x%p 0x%p 0x%p 0x%p 0x%p 0x%p 0x%p 0x%p\n",
44*507c3241Smlf 		P->ac_drvp[0][0], P->ac_drvp[0][1], P->ac_drvp[0][2],
45*507c3241Smlf 		P->ac_drvp[0][3], P->ac_drvp[0][4], P->ac_drvp[0][5],
46*507c3241Smlf 		P->ac_drvp[0][6], P->ac_drvp[0][7]);
47*507c3241Smlf 	ghd_err("drvp[1][0..7] 0x%p 0x%p 0x%p 0x%p 0x%p 0x%p 0x%p 0x%p\n",
48*507c3241Smlf 		P->ac_drvp[1][0], P->ac_drvp[1][1], P->ac_drvp[1][2],
49*507c3241Smlf 		P->ac_drvp[1][3], P->ac_drvp[1][4], P->ac_drvp[1][5],
50*507c3241Smlf 		P->ac_drvp[1][6], P->ac_drvp[1][7]);
51*507c3241Smlf 	ghd_err("max tran 0x%x &ccc_t 0x%p actv drvp 0x%p actv pktp 0x%p\n",
52*507c3241Smlf 		P->ac_max_transfer, &P->ac_ccc,
53*507c3241Smlf 		P->ac_active_drvp, P->ac_active_pktp);
54*507c3241Smlf 	ghd_err("state %d hba tranp 0x%p\n", P->ac_state, P->ac_atapi_tran);
55*507c3241Smlf 	ghd_err("iohdl1 0x%p 0x%p D 0x%p E 0x%p F 0x%p C 0x%p S 0x%p LC 0x%p "
56*507c3241Smlf 		"HC 0x%p HD 0x%p ST 0x%p CMD 0x%p\n",
57*507c3241Smlf 		P->ac_iohandle1, P->ac_ioaddr1, P->ac_data, P->ac_error,
58*507c3241Smlf 		P->ac_feature, P->ac_count, P->ac_sect, P->ac_lcyl,
59*507c3241Smlf 		P->ac_hcyl, P->ac_drvhd, P->ac_status, P->ac_cmd);
60*507c3241Smlf 	ghd_err("iohdl2 0x%p 0x%p AST 0x%p DC 0x%p\n",
61*507c3241Smlf 		P->ac_iohandle2, P->ac_ioaddr2, P->ac_altstatus, P->ac_devctl);
62*507c3241Smlf 	ghd_err("bm hdl 0x%p 0x%p pciide %d BM %d sg_list 0x%p paddr 0x%llx "
63*507c3241Smlf 		"acc hdl 0x%p sg hdl 0x%p\n",
64*507c3241Smlf 		P->ac_bmhandle, P->ac_bmaddr, P->ac_pciide, P->ac_pciide_bm,
65*507c3241Smlf 		P->ac_sg_list, (unsigned long long) P->ac_sg_paddr,
66*507c3241Smlf 		P->ac_sg_acc_handle, P->ac_sg_handle);
67*507c3241Smlf 	ghd_err("arq pktp 0x%p flt pktp 0x%p &cdb 0x%p\n",
68*507c3241Smlf 		P->ac_arq_pktp, P->ac_fault_pktp, &P->ac_arq_cdb);
69*507c3241Smlf }
70*507c3241Smlf 
71*507c3241Smlf void
dump_ata_drv(ata_drv_t * P)72*507c3241Smlf dump_ata_drv(ata_drv_t *P)
73*507c3241Smlf {
74*507c3241Smlf 
75*507c3241Smlf 
76*507c3241Smlf 	ghd_err("ctlp 0x%p &ata_id 0x%p flags 0x%x pciide dma 0x%x\n",
77*507c3241Smlf 		P->ad_ctlp, &P->ad_id, P->ad_flags, P->ad_pciide_dma);
78*507c3241Smlf 
79*507c3241Smlf 	ghd_err("targ %d lun %d driv 0x%x state %d cdb len %d "
80*507c3241Smlf 		"bogus %d nec %d\n", P->ad_targ, P->ad_lun, P->ad_drive_bits,
81*507c3241Smlf 		P->ad_state, P->ad_cdb_len, P->ad_bogus_drq,
82*507c3241Smlf 		P->ad_nec_bad_status);
83*507c3241Smlf 
84*507c3241Smlf 	ghd_err("ata &scsi_dev 0x%p &scsi_inquiry 0x%p &ctl_obj 0x%p\n",
85*507c3241Smlf 		&P->ad_device, &P->ad_inquiry, &P->ad_ctl_obj);
86*507c3241Smlf 
87*507c3241Smlf 	ghd_err("ata rd cmd 0x%x wr cmd 0x%x acyl 0x%x\n",
88*507c3241Smlf 		P->ad_rd_cmd, P->ad_wr_cmd, P->ad_acyl);
89*507c3241Smlf 
90*507c3241Smlf 	ghd_err("ata bios cyl %d hd %d sec %d  phs hd %d sec %d\n",
91*507c3241Smlf 		P->ad_drvrcyl, P->ad_drvrhd, P->ad_drvrsec, P->ad_phhd,
92*507c3241Smlf 		P->ad_phsec);
93*507c3241Smlf 
94*507c3241Smlf 	ghd_err("block factor %d bpb %d\n",
95*507c3241Smlf 		P->ad_block_factor, P->ad_bytes_per_block);
96*507c3241Smlf }
97*507c3241Smlf 
98*507c3241Smlf void
dump_ata_pkt(ata_pkt_t * P)99*507c3241Smlf dump_ata_pkt(ata_pkt_t *P)
100*507c3241Smlf {
101*507c3241Smlf 	ghd_err("gcmdp 0x%p flags 0x%x v_addr 0x%p dma %d\n",
102*507c3241Smlf 		P->ap_gcmdp, P->ap_flags, P->ap_v_addr, P->ap_pciide_dma);
103*507c3241Smlf 	ghd_err("&sg_list 0x%p sg cnt 0x%x resid 0x%lx bcnt 0x%lx\n",
104*507c3241Smlf 		P->ap_sg_list, P->ap_sg_cnt, P->ap_resid, P->ap_bcount);
105*507c3241Smlf 	ghd_err("sec 0x%x cnt 0x%x lc 0x%x hc 0x%x hd 0x%x cmd 0x%x\n",
106*507c3241Smlf 		P->ap_sec, P->ap_count, P->ap_lwcyl, P->ap_hicyl,
107*507c3241Smlf 		P->ap_hd, P->ap_cmd);
108*507c3241Smlf 	ghd_err("status 0x%x error 0x%x\n", P->ap_status, P->ap_error);
109*507c3241Smlf 	ghd_err("start 0x%p intr 0x%p complete 0x%p\n",
110*507c3241Smlf 		P->ap_start, P->ap_intr, P->ap_complete);
111*507c3241Smlf 	ghd_err("ata cdb 0x%x scb 0x%x bpb 0x%x wrt cnt 0x%x\n",
112*507c3241Smlf 		P->ap_cdb, P->ap_scb, P->ap_bytes_per_block, P->ap_wrt_count);
113*507c3241Smlf 	ghd_err("atapi cdbp 0x%p cdb len %d cdb pad %d\n",
114*507c3241Smlf 		P->ap_cdbp, P->ap_cdb_len, P->ap_cdb_pad);
115*507c3241Smlf 	ghd_err("scbp 0x%p statuslen 0x%x\n", P->ap_scbp, P->ap_statuslen);
116*507c3241Smlf }
117*507c3241Smlf 
118*507c3241Smlf #endif
119