diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/pkgdefs/SUNWhea/prototype_com | 2 | ||||
-rw-r--r-- | usr/src/pkgdefs/SUNWhea/prototype_sparc | 6 | ||||
-rw-r--r-- | usr/src/uts/common/io/1394/targets/av1394/av1394_cfgrom.c | 21 | ||||
-rw-r--r-- | usr/src/uts/common/io/1394/targets/av1394/av1394_cmp.c | 31 | ||||
-rw-r--r-- | usr/src/uts/common/io/1394/targets/av1394/av1394_isoch.c | 31 | ||||
-rw-r--r-- | usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_chan.c | 80 | ||||
-rw-r--r-- | usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_recv.c | 240 | ||||
-rw-r--r-- | usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_xmit.c | 59 | ||||
-rw-r--r-- | usr/src/uts/common/sys/1394/targets/av1394/av1394_impl.h | 25 | ||||
-rw-r--r-- | usr/src/uts/common/sys/1394/targets/av1394/av1394_isoch.h | 17 | ||||
-rw-r--r-- | usr/src/uts/common/sys/Makefile | 12 | ||||
-rw-r--r-- | usr/src/uts/common/sys/Makefile.syshdrs | 6 |
12 files changed, 323 insertions, 207 deletions
diff --git a/usr/src/pkgdefs/SUNWhea/prototype_com b/usr/src/pkgdefs/SUNWhea/prototype_com index 3cc32ddd3d..ad2d51eb1b 100644 --- a/usr/src/pkgdefs/SUNWhea/prototype_com +++ b/usr/src/pkgdefs/SUNWhea/prototype_com @@ -658,6 +658,8 @@ f none usr/include/sys/auxv.h 644 root bin f none usr/include/sys/auxv_386.h 644 root bin f none usr/include/sys/auxv_SPARC.h 644 root bin f none usr/include/sys/avintr.h 644 root bin +d none usr/include/sys/av 755 root bin +f none usr/include/sys/av/iec61883.h 644 root bin f none usr/include/sys/avl.h 644 root bin f none usr/include/sys/avl_impl.h 644 root bin f none usr/include/sys/acpi_drv.h 644 root bin diff --git a/usr/src/pkgdefs/SUNWhea/prototype_sparc b/usr/src/pkgdefs/SUNWhea/prototype_sparc index de7bfad529..9ce81fdcfc 100644 --- a/usr/src/pkgdefs/SUNWhea/prototype_sparc +++ b/usr/src/pkgdefs/SUNWhea/prototype_sparc @@ -20,11 +20,9 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package # and their location on the development machine when building the package. @@ -51,8 +49,6 @@ # f none usr/include/asm/flush.h 644 root bin f none usr/include/rpc/ib.h 644 root bin -d none usr/include/sys/av 755 root bin -f none usr/include/sys/av/iec61883.h 644 root bin f none usr/include/sys/bpp_var.h 644 root bin f none usr/include/sys/bpp_reg.h 644 root bin f none usr/include/sys/cg3var.h 644 root bin diff --git a/usr/src/uts/common/io/1394/targets/av1394/av1394_cfgrom.c b/usr/src/uts/common/io/1394/targets/av1394/av1394_cfgrom.c index e470d26b31..a8804d1f7e 100644 --- a/usr/src/uts/common/io/1394/targets/av1394/av1394_cfgrom.c +++ b/usr/src/uts/common/io/1394/targets/av1394/av1394_cfgrom.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,11 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* * av1394 configuration ROM @@ -261,8 +259,8 @@ av1394_ioctl_node_get_text_leaf(av1394_inst_t *avp, void *arg, int mode) if (ddi_copyout(&tl32, arg, sizeof (tl32), mode) != 0) { ret = EFAULT; } else if (bp && ddi_copyout(bp->b_rptr, - (void *)(uintptr_t)tl32.tl_data, - 4 * min(tl32.tl_len, tl32.tl_rlen), mode) != 0) { + (void *)(uintptr_t)tl32.tl_data, + 4 * min(tl32.tl_len, tl32.tl_rlen), mode) != 0) { ret = EFAULT; } } else { @@ -275,7 +273,7 @@ av1394_ioctl_node_get_text_leaf(av1394_inst_t *avp, void *arg, int mode) if (ddi_copyout(&tl, arg, sizeof (tl), mode) != 0) { ret = EFAULT; } else if (bp && ddi_copyout(bp->b_rptr, tl.tl_data, - 4 * min(tl.tl_len, tl.tl_rlen), mode) != 0) { + 4 * min(tl.tl_len, tl.tl_rlen), mode) != 0) { ret = EFAULT; } #ifdef _MULTI_DATAMODEL @@ -318,8 +316,10 @@ av1394_cfgrom_parse_rom(av1394_inst_t *avp) /* skip info_len quadlets to get root dir address and length */ AV1394_CFGROM_RQ(avp, cmd, AV1394_CFGROM_INFO_LEN_ADDR, &val); + val = AV_SWAP32(val); root_addr = IEEE1394_CONFIG_ROM_ADDR + 4 + (val >> 24) * 4; AV1394_CFGROM_RQ(avp, cmd, root_addr, &val); + val = AV_SWAP32(val); root_len = IEEE1212_DIR_LEN(val); /* parse root dir and everything underneath */ @@ -377,6 +377,7 @@ av1394_cfgrom_parse_dir(av1394_inst_t *avp, cmd1394_cmd_t *cmd, entry_addr = pa->pa_addr; for (i = 0; i < pa->pa_len; i++) { AV1394_CFGROM_RQ(avp, cmd, entry_addr, &entry); + entry = AV_SWAP32(entry); CFGROM_TYPE_KEY_VALUE(entry, t, k, v); if ((t == IEEE1212_LEAF_TYPE) && @@ -384,10 +385,11 @@ av1394_cfgrom_parse_dir(av1394_inst_t *avp, cmd1394_cmd_t *cmd, /* save this leaf */ leaf_addr = entry_addr + 4 * v; av1394_cfgrom_add_text_leaf(avp, pa->pa_dir, - leaf_addr, this_pa.pa_desc_entry); + leaf_addr, this_pa.pa_desc_entry); } else if (t == IEEE1212_DIRECTORY_TYPE) { dir_addr = entry_addr + 4 * v; AV1394_CFGROM_RQ(avp, cmd, dir_addr, &val); + val = AV_SWAP32(val); dir_len = IEEE1212_DIR_LEN(val); /* parse this dir */ @@ -499,6 +501,7 @@ av1394_cfgrom_read_leaf(av1394_inst_t *avp, uint64_t leaf_addr, mblk_t **bpp) /* read leaf length */ AV1394_CFGROM_RQ(avp, cmd, leaf_addr, &val); + val = AV_SWAP32(val); leaf_len = IEEE1212_DIR_LEN(val); if (leaf_len < 3) { diff --git a/usr/src/uts/common/io/1394/targets/av1394/av1394_cmp.c b/usr/src/uts/common/io/1394/targets/av1394/av1394_cmp.c index 1e731893f5..38efe58da5 100644 --- a/usr/src/uts/common/io/1394/targets/av1394/av1394_cmp.c +++ b/usr/src/uts/common/io/1394/targets/av1394/av1394_cmp.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * av1394 CMP (Connection Management Procedures) */ @@ -117,10 +114,10 @@ av1394_cmp_bus_reset(av1394_inst_t *avp) if (cmp->cmp_pcr[i]) { if (i < AV1394_IMPR_IDX) { cmp->cmp_pcr[i]->pcr_val &= - ~AV1394_OPCR_BR_CLEAR_MASK; + ~AV1394_OPCR_BR_CLEAR_MASK; } else { cmp->cmp_pcr[i]->pcr_val &= - ~AV1394_IPCR_BR_CLEAR_MASK; + ~AV1394_IPCR_BR_CLEAR_MASK; } } } @@ -245,11 +242,11 @@ av1394_ioctl_plug_reg_read(av1394_inst_t *avp, void *arg, int mode) switch (av1394_pcr_ph2idx(ph)) { case AV1394_OMPR_IDX: ret = t1394_cmp_read(avp->av_t1394_hdl, T1394_CMP_OMPR, - &pr.pr_val); + &pr.pr_val); break; case AV1394_IMPR_IDX: ret = t1394_cmp_read(avp->av_t1394_hdl, T1394_CMP_IMPR, - &pr.pr_val); + &pr.pr_val); break; default: rw_enter(&cmp->cmp_pcr_rwlock, RW_READER); @@ -290,16 +287,16 @@ av1394_ioctl_plug_reg_cas(av1394_inst_t *avp, void *arg, int mode) if (av1394_pcr_ph_is_remote(ph)) { ret = av1394_pcr_remote_cas(avp, ph, - &pl.pl_old, pl.pl_data, pl.pl_arg); + &pl.pl_old, pl.pl_data, pl.pl_arg); } else { switch (av1394_pcr_ph2idx(ph)) { case AV1394_OMPR_IDX: ret = t1394_cmp_cas(avp->av_t1394_hdl, T1394_CMP_OMPR, - pl.pl_arg, pl.pl_data, &pl.pl_old); + pl.pl_arg, pl.pl_data, &pl.pl_old); break; case AV1394_IMPR_IDX: ret = t1394_cmp_cas(avp->av_t1394_hdl, T1394_CMP_IMPR, - pl.pl_arg, pl.pl_data, &pl.pl_old); + pl.pl_arg, pl.pl_data, &pl.pl_old); break; default: rw_enter(&cmp->cmp_pcr_rwlock, RW_WRITER); @@ -367,7 +364,7 @@ av1394_ioctl_plug_init_local(av1394_inst_t *avp, iec61883_plug_init_t *pip) if ((pip->pi_type == IEC61883_PLUG_MASTER_IN) || (pip->pi_type == IEC61883_PLUG_MASTER_OUT)) { pip->pi_handle = av1394_pcr_make_ph(pip->pi_loc, - pip->pi_type, 0); + pip->pi_type, 0); return (0); } @@ -410,7 +407,7 @@ av1394_ioctl_plug_init_local(av1394_inst_t *avp, iec61883_plug_init_t *pip) } pip->pi_rnum = av1394_pcr_idx2num(idx); pip->pi_handle = av1394_pcr_make_ph(pip->pi_loc, pip->pi_type, - pip->pi_rnum); + pip->pi_rnum); return (0); } @@ -652,7 +649,7 @@ av1394_pcr_recv_read_request(cmd1394_cmd_t *req) if (req->cmd_type != CMD1394_ASYNCH_RD_QUAD) { req->cmd_result = IEEE1394_RESP_TYPE_ERROR; - } if ((idx >= NELEM(cmp->cmp_pcr)) || + } else if ((idx >= NELEM(cmp->cmp_pcr)) || ((pcr = cmp->cmp_pcr[idx]) == NULL)) { req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; } else { @@ -689,7 +686,7 @@ av1394_pcr_recv_lock_request(cmd1394_cmd_t *req) if ((req->cmd_type != CMD1394_ASYNCH_LOCK_32) || (req->cmd_u.l32.lock_type != CMD1394_LOCK_COMPARE_SWAP)) { req->cmd_result = IEEE1394_RESP_TYPE_ERROR; - } if ((idx >= NELEM(cmp->cmp_pcr)) || + } else if ((idx >= NELEM(cmp->cmp_pcr)) || ((pcr = cmp->cmp_pcr[idx]) == NULL)) { req->cmd_result = IEEE1394_RESP_ADDRESS_ERROR; } else { diff --git a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch.c b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch.c index 107f2f1220..c604831c57 100644 --- a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch.c +++ b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * av1394 isochronous module */ @@ -59,7 +56,7 @@ static uint_t av1394_isoch_softintr(caddr_t); static struct devmap_callback_ctl av1394_isoch_devmap_ops = { DEVMAP_OPS_REV, /* rev */ NULL, /* map */ - devmap_default_access, /* access */ + NULL, /* access */ NULL, /* dup */ NULL, /* unmap */ }; @@ -320,8 +317,8 @@ av1394_isoch_create_minor_node(av1394_inst_t *avp) int ret; ret = ddi_create_minor_node(avp->av_dip, "isoch", - S_IFCHR, AV1394_ISOCH_INST2MINOR(avp->av_instance), - DDI_NT_AV_ISOCH, NULL); + S_IFCHR, AV1394_ISOCH_INST2MINOR(avp->av_instance), + DDI_NT_AV_ISOCH, NULL); if (ret != DDI_SUCCESS) { TNF_PROBE_0(av1394_isoch_create_minor_node_error, AV1394_TNF_ISOCH_ERROR, ""); @@ -403,7 +400,7 @@ av1394_isoch_find_seg(av1394_inst_t *avp, offset_t off, size_t len) /* find a segment */ pool = (icp->ic_dir == AV1394_IR) ? - &icp->ic_ir.ir_data_pool : &icp->ic_it.it_data_pool; + &icp->ic_ir.ir_data_pool : &icp->ic_it.it_data_pool; for (segoff = 0, i = 0; i < pool->ip_nsegs; i++) { isp = &pool->ip_seg[i]; if (off == segoff) { @@ -555,6 +552,14 @@ av1394_ioctl_isoch_init(av1394_inst_t *avp, void *arg, int mode) if (ret != 0) { AV1394_TNF_EXIT(av1394_ioctl_isoch_init); +#ifdef _MULTI_DATAMODEL + if (ddi_model_convert_from(mode & FMODELS) == DDI_MODEL_ILP32) { + bcopy(&ii, &ii32, sizeof (ii32)); + ii32.ii_error = ii.ii_error; + (void) ddi_copyout(&ii32, arg, sizeof (ii32), mode); + } else +#endif + (void) ddi_copyout(&ii, arg, sizeof (ii), mode); return (ret); } @@ -584,7 +589,7 @@ av1394_ioctl_isoch_handle2ic(av1394_inst_t *avp, void *arg) int num = (int)(intptr_t)arg; av1394_isoch_t *ip = &avp->av_i; - if (num >= sizeof (ip->i_ic)) { + if (num >= (sizeof (ip->i_ic) / sizeof (av1394_ic_t))) { TNF_PROBE_0(av1394_ioctl_isoch_handle2ic_error_range, AV1394_TNF_ISOCH_ERROR, ""); return (NULL); @@ -660,7 +665,7 @@ av1394_ioctl_recv(av1394_inst_t *avp, void *arg, int mode) return (EFAULT); } num = recv.rx_handle; - if (num >= sizeof (ip->i_ic)) { + if (num >= (sizeof (ip->i_ic) / sizeof (av1394_ic_t))) { TNF_PROBE_0(av1394_ioctl_recv_error_range, AV1394_TNF_ISOCH_ERROR, ""); return (EINVAL); @@ -702,7 +707,7 @@ av1394_ioctl_xmit(av1394_inst_t *avp, void *arg, int mode) return (EFAULT); } num = xmit.tx_handle; - if (num >= sizeof (ip->i_ic)) { + if (num >= (sizeof (ip->i_ic) / sizeof (av1394_ic_t))) { TNF_PROBE_0(av1394_ioctl_xmit_error_range, AV1394_TNF_ISOCH_ERROR, ""); return (EINVAL); diff --git a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_chan.c b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_chan.c index ef8647e330..7301983986 100644 --- a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_chan.c +++ b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_chan.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * routines common to isoch receive and isoch transmit */ @@ -263,8 +260,7 @@ av1394_ic_validate_init_params(iec61883_isoch_init_t *ii) return (EINVAL); } framesz = ii->ii_frame_size * ii->ii_pkt_size; - if ((framesz > AV1394_IC_FRAME_SIZE_MAX) || - (framesz < AV1394_IXL_BUFSZ_MAX)) { + if (framesz > AV1394_IC_FRAME_SIZE_MAX) { TNF_PROBE_0(av1394_ic_validate_init_params_frsz_error, AV1394_TNF_ISOCH_ERROR, ""); ii->ii_error = IEC61883_ERR_NOMEM; @@ -341,7 +337,7 @@ av1394_ic_set_params(av1394_inst_t *avp, iec61883_isoch_init_t *ii, icp->ic_avp = avp; icp->ic_num = num; icp->ic_dir = (ii->ii_direction == IEC61883_DIR_RECV) ? - AV1394_IR : AV1394_IT; + AV1394_IR : AV1394_IT; icp->ic_pktsz = ii->ii_pkt_size; icp->ic_npkts = ii->ii_frame_size; icp->ic_framesz = icp->ic_pktsz * icp->ic_npkts; @@ -388,7 +384,7 @@ av1394_ic_alloc_channel(av1394_ic_t *icp, uint64_t mask, int *num) sii.si_speed = icp->ic_param.cp_bus_speed; ret = t1394_alloc_isoch_single(avp->av_t1394_hdl, &sii, 0, &so, - &icp->ic_sii_hdl, &result); + &icp->ic_sii_hdl, &result); if (ret != DDI_SUCCESS) { TNF_PROBE_1(av1394_ic_alloc_channel_error, AV1394_TNF_ISOCH_ERROR, "", tnf_int, result, result); @@ -454,8 +450,10 @@ av1394_ic_alloc_pool(av1394_isoch_pool_t *pool, size_t framesz, int cnt, nsegs = cnt; if (framesz < AV1394_IXL_BUFSZ_MAX / 2) { fps = AV1394_IXL_BUFSZ_MAX / framesz; - segsz *= fps; - nsegs /= fps; + segsz = framesz * fps; + nsegs = totalsz / segsz; + if ((totalsz % segsz) != 0) + nsegs++; /* remainder in non-full segment */ } ASSERT(segsz * nsegs >= totalsz); @@ -472,7 +470,7 @@ av1394_ic_alloc_pool(av1394_isoch_pool_t *pool, size_t framesz, int cnt, seg->is_umem_size = ptob(btopr(segsz)); seg->is_kaddr = ddi_umem_alloc(seg->is_umem_size, - DDI_UMEM_SLEEP, &seg->is_umem_cookie); + DDI_UMEM_SLEEP, &seg->is_umem_cookie); if (seg->is_kaddr == NULL) { TNF_PROBE_0(av1394_ic_alloc_pool_error_umem_alloc, AV1394_TNF_ISOCH_ERROR, ""); @@ -524,6 +522,7 @@ av1394_ic_dma_setup(av1394_ic_t *icp, av1394_isoch_pool_t *pool) uint_t dma_dir; int ret; int i; + int j; AV1394_TNF_ENTER(av1394_ic_dma_setup); @@ -538,8 +537,8 @@ av1394_ic_dma_setup(av1394_ic_t *icp, av1394_isoch_pool_t *pool) isp = &pool->ip_seg[i]; ret = ddi_dma_alloc_handle(avp->av_dip, - &avp->av_attachinfo.dma_attr, DDI_DMA_DONTWAIT, NULL, - &isp->is_dma_hdl); + &avp->av_attachinfo.dma_attr, DDI_DMA_DONTWAIT, NULL, + &isp->is_dma_hdl); if (ret != DDI_SUCCESS) { TNF_PROBE_0(av1394_ic_dma_setup_error_alloc_hdl, AV1394_TNF_ISOCH_ERROR, ""); @@ -549,9 +548,9 @@ av1394_ic_dma_setup(av1394_ic_t *icp, av1394_isoch_pool_t *pool) } ret = ddi_dma_addr_bind_handle(isp->is_dma_hdl, NULL, - isp->is_kaddr, isp->is_size, - dma_dir | DDI_DMA_CONSISTENT, DDI_DMA_DONTWAIT, NULL, - &isp->is_dma_cookie, &isp->is_dma_ncookies); + isp->is_kaddr, isp->is_size, + dma_dir | DDI_DMA_CONSISTENT, DDI_DMA_DONTWAIT, NULL, + &isp->is_dma_cookie[0], &isp->is_dma_ncookies); if (ret != DDI_DMA_MAPPED) { TNF_PROBE_0(av1394_ic_dma_setup_error_bind_hdl, @@ -561,14 +560,17 @@ av1394_ic_dma_setup(av1394_ic_t *icp, av1394_isoch_pool_t *pool) return (DDI_FAILURE); } - /* multiple cookies not supported (yet) */ - if (isp->is_dma_ncookies != 1) { + if (isp->is_dma_ncookies > COOKIES) { TNF_PROBE_0(av1394_ic_dma_setup_error_ncookies, AV1394_TNF_ISOCH_ERROR, ""); av1394_ic_dma_cleanup(icp, pool); AV1394_TNF_EXIT(av1394_ic_dma_setup); return (DDI_FAILURE); } + + for (j = 1; j < isp->is_dma_ncookies; ++j) + ddi_dma_nextcookie(isp->is_dma_hdl, + &isp->is_dma_cookie[j]); } AV1394_TNF_EXIT(av1394_ic_dma_setup); @@ -604,13 +606,26 @@ void av1394_ic_dma_sync_frames(av1394_ic_t *icp, int idx, int cnt, av1394_isoch_pool_t *pool, uint_t type) { - int i; - int j = idx; + int fps; /* frames per segment */ + int nsegs; /* number of segments for indicated frames */ + int seg; /* index of segment to sync */ + + fps = icp->ic_nframes / pool->ip_nsegs; + + nsegs = (cnt / fps) + 1; - for (i = cnt; i > 0; i--) { - (void) ddi_dma_sync(pool->ip_seg[j].is_dma_hdl, 0, - icp->ic_framesz, type); - j = (j + 1) % icp->ic_nframes; + seg = idx / fps; + for (;;) { + (void) ddi_dma_sync(pool->ip_seg[seg].is_dma_hdl, 0, + icp->ic_framesz, type); + + --nsegs; + if (nsegs == 0) + break; + + ++seg; + if (seg == pool->ip_nsegs) + seg = 0; /* wrap segment index */ } } @@ -653,7 +668,7 @@ av1394_ic_rsrc_fail(t1394_isoch_single_handle_t t1394_sii_hdl, opaque_t arg, /* XXX this could be handled more gracefully */ cmn_err(CE_CONT, "av1394: can't reallocate isochronous resources" - " after bus reset\n"); + " after bus reset\n"); AV1394_TNF_EXIT(av1394_ic_rsrc_fail); } @@ -749,17 +764,17 @@ av1394_ic_ixl_dump(ixl1394_command_t *cmd) case IXL1394_OP_CALLBACK_U: cb = (ixl1394_callback_t *)cmd; cmn_err(CE_CONT, "%p: CALLBACK %p\n", (void *)cmd, - (void *)cb->callback); + (void *)cb->callback); break; case IXL1394_OP_JUMP: jmp = (ixl1394_jump_t *)cmd; cmn_err(CE_CONT, "%p: JUMP %p\n", (void *)cmd, - (void *)jmp->label); + (void *)jmp->label); break; case IXL1394_OP_JUMP_U: jmp = (ixl1394_jump_t *)cmd; cmn_err(CE_CONT, "%p: JUMP_U %p\n", (void *)cmd, - (void *)jmp->label); + (void *)jmp->label); break; case IXL1394_OP_STORE_TIMESTAMP: cmn_err(CE_CONT, "%p: STORE_TIMESTAMP\n", (void *)cmd); @@ -778,7 +793,7 @@ void av1394_ic_trigger_softintr(av1394_ic_t *icp, int num, int preq) { av1394_isoch_t *ip = &icp->ic_avp->av_i; - uint64_t chmask = (1UL << num); + uint64_t chmask = (1ULL << num); if (((ip->i_softintr_ch & chmask) == 0) || ((icp->ic_preq & preq) == 0)) { @@ -799,7 +814,8 @@ av1394_ic_bitreverse(uint64_t x) x = (((x >> 4) & 0x0f0f0f0f0f0f0f0f) | ((x & 0x0f0f0f0f0f0f0f0f) << 4)); x = (((x >> 8) & 0x00ff00ff00ff00ff) | ((x & 0x00ff00ff00ff00ff) << 8)); x = (((x >> 16) & 0x0000ffff0000ffff) | - ((x & 0x0000ffff0000ffff) << 16)); + ((x & 0x0000ffff0000ffff) << 16)); + return ((x >> 32) | (x << 32)); } diff --git a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_recv.c b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_recv.c index 1644970803..fdce717a68 100644 --- a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_recv.c +++ b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_recv.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * av1394 isochronous receive module */ @@ -37,7 +34,8 @@ static int av1394_ir_build_ixl(av1394_ic_t *); static void av1394_ir_ixl_label_init(av1394_ir_ixl_data_t *, ixl1394_command_t *); static void av1394_ir_ixl_buf_init(av1394_ic_t *, ixl1394_xfer_buf_t *, - av1394_isoch_seg_t *, off_t, uint16_t, ixl1394_command_t *); + av1394_isoch_seg_t *, off_t, uint64_t, uint16_t, + ixl1394_command_t *); static void av1394_ir_ixl_cb_init(av1394_ic_t *, av1394_ir_ixl_data_t *, int); static void av1394_ir_ixl_jump_init(av1394_ic_t *, av1394_ir_ixl_data_t *, @@ -80,7 +78,7 @@ av1394_ir_init(av1394_ic_t *icp, int *error) AV1394_TNF_ENTER(av1394_ir_init); nframes = av1394_ic_alloc_pool(pool, icp->ic_framesz, icp->ic_nframes, - AV1394_IR_NFRAMES_MIN); + AV1394_IR_NFRAMES_MIN); if (nframes == 0) { *error = IEC61883_ERR_NOMEM; AV1394_TNF_EXIT(av1394_ir_init); @@ -155,7 +153,7 @@ av1394_ir_start(av1394_ic_t *icp) mutex_exit(&icp->ic_mutex); err = t1394_start_isoch_dma(avp->av_t1394_hdl, icp->ic_isoch_hdl, - &idma_ctrlinfo, 0, &result); + &idma_ctrlinfo, 0, &result); if (err == DDI_SUCCESS) { mutex_enter(&icp->ic_mutex); icp->ic_state = AV1394_IC_DMA; @@ -218,7 +216,7 @@ av1394_ir_recv(av1394_ic_t *icp, iec61883_recv_t *recv) /* wait for new frames to arrive */ ret = av1394_ir_wait_frames(icp, - &recv->rx_xfer.xf_full_idx, &recv->rx_xfer.xf_full_cnt); + &recv->rx_xfer.xf_full_idx, &recv->rx_xfer.xf_full_cnt); mutex_exit(&icp->ic_mutex); return (ret); @@ -239,7 +237,7 @@ av1394_ir_read(av1394_ic_t *icp, struct uio *uiop) if (irp->ir_read_cnt == 0) { irp->ir_read_off = 0; ret = av1394_ir_wait_frames(icp, - &irp->ir_read_idx, &irp->ir_read_cnt); + &irp->ir_read_idx, &irp->ir_read_cnt); if (ret != 0) { mutex_exit(&icp->ic_mutex); AV1394_TNF_EXIT(av1394_ir_read); @@ -254,7 +252,7 @@ av1394_ir_read(av1394_ic_t *icp, struct uio *uiop) if (empty_cnt > 0) { av1394_ir_zero_pkts(icp, irp->ir_read_idx, empty_cnt); ret = av1394_ir_add_frames(icp, irp->ir_read_idx, - empty_cnt); + empty_cnt); irp->ir_read_idx += empty_cnt; irp->ir_read_idx %= icp->ic_nframes; irp->ir_read_cnt -= empty_cnt; @@ -337,82 +335,168 @@ av1394_ir_build_ixl(av1394_ic_t *icp) { av1394_ir_t *irp = &icp->ic_ir; av1394_isoch_pool_t *pool = &irp->ir_data_pool; - size_t segsz; - av1394_ir_ixl_data_t *dp; - int i; /* frame index */ - int j; /* buffer index */ - int k; - int spf; /* segments per frame */ - int bpf; /* buffers per frame */ + int i; /* segment index */ + int j; + int fi; /* frame index */ + int bi; /* buffer index */ AV1394_TNF_ENTER(av1394_ir_build_ixl); /* allocate space for IXL data blocks */ irp->ir_ixl_data = kmem_zalloc(icp->ic_nframes * - sizeof (av1394_ir_ixl_data_t), KM_SLEEP); + sizeof (av1394_ir_ixl_data_t), KM_SLEEP); /* - * calculate and allocate space for buf commands + * We have a bunch of segments, and each is divided into cookies. We + * need to cover the segments with RECV_BUFs such that they + * - don't span cookies + * - don't span frames + * - are at most AV1394_IXL_BUFSZ_MAX + * + * The straightforward algorithm is to start from the beginning, find + * the next lowest frame or cookie boundary, and either make a buf for + * it if it is smaller than AV1394_IXL_BUFSZ_MAX, or make multiple + * bufs for it as with av1394_ic_ixl_seg_decomp(). And repeat. */ - segsz = pool->ip_seg[0].is_size; - ASSERT(segsz * pool->ip_nsegs == pool->ip_size); /* equal-size segs */ - ASSERT(segsz % icp->ic_pktsz == 0); /* packet-aligned */ - ASSERT(segsz >= icp->ic_framesz); /* 1+ full frames per segment */ - - if (icp->ic_framesz <= AV1394_IXL_BUFSZ_MAX) { - /* RECV_BUF == frame, one or more frames per segment */ - irp->ir_ixl_tailsz = irp->ir_ixl_bufsz = icp->ic_framesz; - irp->ir_ixl_bpf = 0; - } else { - /* segment == frame, several RECV_BUF's per segment */ - ASSERT(segsz == icp->ic_framesz); - /* calculate the best decomposition of a segment into buffers */ - irp->ir_ixl_bpf = av1394_ic_ixl_seg_decomp(segsz, - icp->ic_pktsz, &irp->ir_ixl_bufsz, &irp->ir_ixl_tailsz); + + irp->ir_ixl_nbufs = 0; + for (i = 0; i < pool->ip_nsegs; ++i) { + av1394_isoch_seg_t *isp = &pool->ip_seg[i]; + size_t dummy1, dummy2; + + uint_t off = 0; + uint_t end; + + uint_t frame_end = icp->ic_framesz; + int ci = 0; + uint_t cookie_end = isp->is_dma_cookie[ci].dmac_size; + + for (;;) { + end = min(frame_end, cookie_end); + + if (end - off <= AV1394_IXL_BUFSZ_MAX) { + ++irp->ir_ixl_nbufs; + } else { + irp->ir_ixl_nbufs += av1394_ic_ixl_seg_decomp( + end - off, icp->ic_pktsz, &dummy1, &dummy2); + /* count the tail buffer */ + ++irp->ir_ixl_nbufs; + } + + off = end; + if (off >= isp->is_size) + break; + + if (off == frame_end) + frame_end += icp->ic_framesz; + if (off == cookie_end) { + ++ci; + cookie_end += isp->is_dma_cookie[ci].dmac_size; + } + } } - spf = segsz / icp->ic_framesz; - bpf = irp->ir_ixl_bpf + 1; - irp->ir_ixl_nbufs = bpf * icp->ic_nframes; irp->ir_ixl_buf = kmem_zalloc(irp->ir_ixl_nbufs * - sizeof (ixl1394_xfer_buf_t), KM_SLEEP); - - /* initialize data blocks and receive buffers */ - for (i = 0; i < icp->ic_nframes; i++) { - dp = &irp->ir_ixl_data[i]; - - av1394_ir_ixl_label_init(dp, - (ixl1394_command_t *)&irp->ir_ixl_buf[i * bpf]); - - /* regular buffers, if any */ - for (j = 0; j < irp->ir_ixl_bpf; j++) { - k = j + i * bpf; - av1394_ir_ixl_buf_init(icp, &irp->ir_ixl_buf[k], - &pool->ip_seg[i], j * irp->ir_ixl_bufsz, - irp->ir_ixl_bufsz, - (ixl1394_command_t *)&irp->ir_ixl_buf[k + 1]); - } + sizeof (ixl1394_xfer_buf_t), KM_SLEEP); - /* tail buffer */ - if (icp->ic_framesz <= AV1394_IXL_BUFSZ_MAX) { - av1394_ir_ixl_buf_init(icp, &irp->ir_ixl_buf[i], - &pool->ip_seg[i / spf], - i * irp->ir_ixl_tailsz, - irp->ir_ixl_tailsz, - (ixl1394_command_t *)&dp->rd_cb); - } else { - k = irp->ir_ixl_bpf + i * bpf; - av1394_ir_ixl_buf_init(icp, &irp->ir_ixl_buf[k], - &pool->ip_seg[i], - irp->ir_ixl_bpf * irp->ir_ixl_bufsz, - irp->ir_ixl_tailsz, - (ixl1394_command_t *)&dp->rd_cb); + + fi = 0; + bi = 0; + + for (i = 0; i < pool->ip_nsegs; ++i) { + av1394_isoch_seg_t *isp = &pool->ip_seg[i]; + + uint_t off = 0; /* offset into segment */ + uint_t end; + uint_t coff = 0; /* offset into cookie */ + + + uint_t frame_end = icp->ic_framesz; + int ci = 0; + uint_t cookie_end = isp->is_dma_cookie[ci].dmac_size; + + ixl1394_command_t *nextp; + + av1394_ir_ixl_label_init(&irp->ir_ixl_data[fi], + (ixl1394_command_t *)&irp->ir_ixl_buf[bi]); + + for (;;) { + end = min(frame_end, cookie_end); + + if (end == frame_end) + nextp = (ixl1394_command_t *) + &irp->ir_ixl_data[fi].rd_cb; + else + nextp = (ixl1394_command_t *) + &irp->ir_ixl_buf[bi + 1]; + + if (end - off <= AV1394_IXL_BUFSZ_MAX) { + av1394_ir_ixl_buf_init(icp, + &irp->ir_ixl_buf[bi], isp, off, + isp->is_dma_cookie[ci].dmac_laddress + coff, + end - off, nextp); + coff += end - off; + off = end; + ++bi; + } else { + size_t reg, tail; + uint_t nbufs; + + nbufs = av1394_ic_ixl_seg_decomp(end - off, + icp->ic_pktsz, ®, &tail); + + for (j = 0; j < nbufs; ++j) { + av1394_ir_ixl_buf_init(icp, + &irp->ir_ixl_buf[bi], isp, off, + isp->is_dma_cookie[ci]. + dmac_laddress + coff, reg, + (ixl1394_command_t *) + &irp->ir_ixl_buf[bi + 1]); + ++bi; + off += reg; + coff += reg; + } + + av1394_ir_ixl_buf_init(icp, + &irp->ir_ixl_buf[bi], isp, off, + isp->is_dma_cookie[ci].dmac_laddress + coff, + tail, nextp); + ++bi; + off += tail; + coff += tail; + } + + ASSERT((off == frame_end) || (off == cookie_end)); + + if (off >= isp->is_size) + break; + + if (off == frame_end) { + av1394_ir_ixl_cb_init(icp, + &irp->ir_ixl_data[fi], fi); + av1394_ir_ixl_jump_init(icp, + &irp->ir_ixl_data[fi], fi); + ++fi; + frame_end += icp->ic_framesz; + av1394_ir_ixl_label_init(&irp->ir_ixl_data[fi], + (ixl1394_command_t *)&irp->ir_ixl_buf[bi]); + } + + if (off == cookie_end) { + ++ci; + cookie_end += isp->is_dma_cookie[ci].dmac_size; + coff = 0; + } } - av1394_ir_ixl_cb_init(icp, dp, i); - av1394_ir_ixl_jump_init(icp, dp, i); + av1394_ir_ixl_cb_init(icp, &irp->ir_ixl_data[fi], fi); + av1394_ir_ixl_jump_init(icp, &irp->ir_ixl_data[fi], fi); + ++fi; } + ASSERT(fi == icp->ic_nframes); + ASSERT(bi == irp->ir_ixl_nbufs); + irp->ir_ixlp = (ixl1394_command_t *)irp->ir_ixl_data; if (av1394_ir_dump_ixl) { @@ -432,13 +516,13 @@ av1394_ir_ixl_label_init(av1394_ir_ixl_data_t *dp, ixl1394_command_t *nextp) static void av1394_ir_ixl_buf_init(av1394_ic_t *icp, ixl1394_xfer_buf_t *buf, - av1394_isoch_seg_t *isp, off_t offset, uint16_t size, + av1394_isoch_seg_t *isp, off_t offset, uint64_t addr, uint16_t size, ixl1394_command_t *nextp) { buf->ixl_opcode = IXL1394_OP_RECV_BUF; buf->size = size; buf->pkt_size = icp->ic_pktsz; - buf->ixl_buf._dmac_ll = isp->is_dma_cookie.dmac_laddress + offset; + buf->ixl_buf._dmac_ll = addr; buf->mem_bufp = isp->is_kaddr + offset; buf->next_ixlp = nextp; } @@ -477,9 +561,9 @@ av1394_ir_destroy_ixl(av1394_ic_t *icp) mutex_enter(&icp->ic_mutex); kmem_free(irp->ir_ixl_buf, - irp->ir_ixl_nbufs * sizeof (ixl1394_xfer_buf_t)); + irp->ir_ixl_nbufs * sizeof (ixl1394_xfer_buf_t)); kmem_free(irp->ir_ixl_data, - icp->ic_nframes * sizeof (av1394_ir_ixl_data_t)); + icp->ic_nframes * sizeof (av1394_ir_ixl_data_t)); irp->ir_ixlp = NULL; irp->ir_ixl_buf = NULL; @@ -533,7 +617,7 @@ static void av1394_ir_dma_sync_frames(av1394_ic_t *icp, int idx, int cnt) { av1394_ic_dma_sync_frames(icp, idx, cnt, - &icp->ic_ir.ir_data_pool, DDI_DMA_SYNC_FORCPU); + &icp->ic_ir.ir_data_pool, DDI_DMA_SYNC_FORCPU); } /* @@ -564,7 +648,7 @@ av1394_ir_ixl_frame_cb(opaque_t arg, struct ixl1394_callback *cb) */ if (irp->ir_nfull >= irp->ir_hiwat) { av1394_ic_trigger_softintr(icp, icp->ic_num, - AV1394_PREQ_IR_OVERFLOW); + AV1394_PREQ_IR_OVERFLOW); } } mutex_exit(&icp->ic_mutex); diff --git a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_xmit.c b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_xmit.c index 153e8b5703..8dca362c1c 100644 --- a/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_xmit.c +++ b/usr/src/uts/common/io/1394/targets/av1394/av1394_isoch_xmit.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * av1394 isochronous transmit module */ @@ -100,7 +97,7 @@ av1394_it_init(av1394_ic_t *icp, int *error) AV1394_TNF_ENTER(av1394_it_init); nframes = av1394_ic_alloc_pool(pool, icp->ic_framesz, icp->ic_nframes, - AV1394_IT_NFRAMES_MIN); + AV1394_IT_NFRAMES_MIN); if (nframes == 0) { *error = IEC61883_ERR_NOMEM; AV1394_TNF_EXIT(av1394_it_init); @@ -185,7 +182,7 @@ av1394_it_start_common(av1394_ic_t *icp) ASSERT(icp->ic_state == AV1394_IC_IDLE); err = t1394_start_isoch_dma(avp->av_t1394_hdl, icp->ic_isoch_hdl, - &idma_ctrlinfo, 0, &result); + &idma_ctrlinfo, 0, &result); if (err == DDI_SUCCESS) { icp->ic_state = AV1394_IC_DMA; } else { @@ -261,7 +258,7 @@ av1394_it_xmit(av1394_ic_t *icp, iec61883_xmit_t *xmit) /* wait for new empty frames */ ret = av1394_it_wait_frames(icp, &xmit->tx_xfer.xf_empty_idx, - &xmit->tx_xfer.xf_empty_cnt, &xmit->tx_miss_cnt); + &xmit->tx_xfer.xf_empty_cnt, &xmit->tx_miss_cnt); mutex_exit(&icp->ic_mutex); return (ret); @@ -287,7 +284,7 @@ av1394_it_write(av1394_ic_t *icp, struct uio *uiop) /* must have at least one empty frame */ if (itp->it_write_cnt == 0) { ret = av1394_it_wait_frames(icp, &itp->it_write_idx, - &itp->it_write_cnt, &miss_cnt); + &itp->it_write_cnt, &miss_cnt); if (ret != 0) { break; } @@ -306,7 +303,7 @@ av1394_it_write(av1394_ic_t *icp, struct uio *uiop) /* add full frames to the pool */ if (full_cnt > 0) { ret = av1394_it_add_frames(icp, - itp->it_write_idx, full_cnt); + itp->it_write_idx, full_cnt); if (ret != 0) { break; } @@ -383,7 +380,7 @@ av1394_it_bld_ixl(av1394_ic_t *icp) itp->it_ixlp = (ixl1394_command_t *)&itp->it_ixl_begin; } else { itp->it_ixlp = (ixl1394_command_t *) - &((av1394_it_ixl_buf_t *)itp->it_ixl_data)->tb_label; + &((av1394_it_ixl_buf_t *)itp->it_ixl_data)->tb_label; } if (av1394_it_dump_ixl) { @@ -426,7 +423,7 @@ av1394_it_ixl_bld_data(av1394_ic_t *icp) int tb_flags; itp->it_frame_info = kmem_zalloc(icp->ic_nframes * - sizeof (av1394_it_frame_info_t), KM_SLEEP); + sizeof (av1394_it_frame_info_t), KM_SLEEP); bufsz_max = AV1394_IXL_BUFSZ_MAX / icp->ic_pktsz; n = icp->ic_param.cp_n; @@ -480,7 +477,7 @@ av1394_it_ixl_bld_data(av1394_ic_t *icp) tb_flags |= AV1394_IT_IXL_BUF_EOF; } bp = av1394_it_ixl_bld_buf(icp, nfull, segnum, segoff, - tb_flags, framenum); + tb_flags, framenum); if (itp->it_ixl_data == NULL) { itp->it_ixl_data = &bp->tb_common; @@ -499,7 +496,7 @@ av1394_it_ixl_bld_data(av1394_ic_t *icp) if (segoff == segsz) { if (++segnum < pool->ip_nsegs) { segsz = pool->ip_seg[segnum].is_size / - icp->ic_pktsz; + icp->ic_pktsz; } segoff = 0; } @@ -523,12 +520,12 @@ av1394_it_ixl_bld_data(av1394_ic_t *icp) av1394_it_ixl_complete_buf(bp, ep); } av1394_it_ixl_complete_empty_cip(ep, - (av1394_it_ixl_buf_t *)itp->it_ixl_data); + (av1394_it_ixl_buf_t *)itp->it_ixl_data); ep->te_jump.next_ixlp = NULL; ep->te_common.tc_next = NULL; } else { bp->tb_jump.label = (ixl1394_command_t *) - &(((av1394_it_ixl_buf_t *)itp->it_ixl_data)->tb_label); + &(((av1394_it_ixl_buf_t *)itp->it_ixl_data)->tb_label); } return (DDI_SUCCESS); @@ -547,7 +544,7 @@ av1394_it_ixl_destroy_data(av1394_ic_t *icp) itp->it_ixl_data = NULL; kmem_free(itp->it_frame_info, - icp->ic_nframes * sizeof (av1394_it_frame_info_t)); + icp->ic_nframes * sizeof (av1394_it_frame_info_t)); } static av1394_it_ixl_buf_t * @@ -573,7 +570,7 @@ av1394_it_ixl_bld_buf(av1394_ic_t *icp, int cnt, int segnum, off_t off, bp->tb_buf.pkt_size = pktsz; bp->tb_buf.size = cnt * pktsz; bp->tb_buf.ixl_buf._dmac_ll = - isp->is_dma_cookie.dmac_laddress + off * pktsz; + isp->is_dma_cookie[0].dmac_laddress + off * pktsz; bp->tb_buf.mem_bufp = isp->is_kaddr + off * pktsz; if (flags & AV1394_IT_IXL_BUF_EOF) { @@ -602,7 +599,7 @@ av1394_it_ixl_bld_buf(av1394_ic_t *icp, int cnt, int segnum, off_t off, if (flags & AV1394_IT_IXL_BUF_SOF) { itp->it_frame_info[framenum].fi_first_buf = bp; itp->it_frame_info[framenum].fi_ts_off = bp->tb_buf.mem_bufp + - AV1394_TS_MODE_GET_OFF(icp->ic_param.cp_ts_mode); + AV1394_TS_MODE_GET_OFF(icp->ic_param.cp_ts_mode); } else if (flags & AV1394_IT_IXL_BUF_EOF) { itp->it_frame_info[framenum].fi_last_buf = bp; } @@ -617,7 +614,7 @@ av1394_it_ixl_complete_buf(av1394_it_ixl_buf_t *bp, { bp->tb_common.tc_next = &ep->te_common; bp->tb_jump.label = bp->tb_jump.next_ixlp = - (ixl1394_command_t *)&ep->te_label; + (ixl1394_command_t *)&ep->te_label; } static void @@ -626,7 +623,7 @@ av1394_it_ixl_complete_buf2(av1394_it_ixl_buf_t *bp, { bp->tb_common.tc_next = &nextbp->tb_common; bp->tb_jump.label = bp->tb_jump.next_ixlp = - (ixl1394_command_t *)&nextbp->tb_label; + (ixl1394_command_t *)&nextbp->tb_label; } static av1394_it_ixl_empty_cip_t * @@ -672,7 +669,7 @@ av1394_it_ixl_complete_empty_cip(av1394_it_ixl_empty_cip_t *ep, ep->te_pkt.mem_bufp = bp->tb_buf.mem_bufp; ep->te_jump.label = ep->te_jump.next_ixlp = - (ixl1394_command_t *)&bp->tb_label; + (ixl1394_command_t *)&bp->tb_label; } static void @@ -704,13 +701,13 @@ av1394_it_ixl_bld_begin(av1394_ic_t *icp) bep->be_empty_post[i].ixl_opcode = IXL1394_OP_SEND_PKT_ST; bep->be_empty_post[i].size = AV1394_CIPSZ; bep->be_empty_post[i].ixl_buf._dmac_ll = - bp->tb_buf.ixl_buf._dmac_ll; + bp->tb_buf.ixl_buf._dmac_ll; bep->be_empty_post[i].mem_bufp = bp->tb_buf.mem_bufp; bep->be_empty_post[i].next_ixlp = - (ixl1394_command_t *)&bep->be_empty_post[i + 1]; + (ixl1394_command_t *)&bep->be_empty_post[i + 1]; } bep->be_empty_post[AV1394_IT_IXL_BEGIN_NPOST - 1].next_ixlp = - (ixl1394_command_t *)&bep->be_jump; + (ixl1394_command_t *)&bep->be_jump; bep->be_jump.ixl_opcode = IXL1394_OP_JUMP_U; bep->be_jump.label = (ixl1394_command_t *)&bp->tb_label; @@ -726,7 +723,7 @@ av1394_it_ixl_begin_update_pkts(av1394_ic_t *icp, av1394_it_ixl_buf_t *bp) for (i = 0; i < AV1394_IT_IXL_BEGIN_NPOST; i++) { bep->be_empty_post[i].ixl_buf._dmac_ll = - bp->tb_buf.ixl_buf._dmac_ll; + bp->tb_buf.ixl_buf._dmac_ll; bep->be_empty_post[i].mem_bufp = bp->tb_buf.mem_bufp; } } @@ -783,7 +780,7 @@ static void av1394_it_dma_sync_frames(av1394_ic_t *icp, int idx, int cnt) { av1394_ic_dma_sync_frames(icp, idx, cnt, - &icp->ic_it.it_data_pool, DDI_DMA_SYNC_FORDEV); + &icp->ic_it.it_data_pool, DDI_DMA_SYNC_FORDEV); } /* @@ -818,9 +815,9 @@ av1394_it_ixl_begin_cb(opaque_t arg, struct ixl1394_callback *cb) ASSERT(itp->it_nfull <= icp->ic_nframes); syt = av1394_it_ts_syt_inc(itp->it_ts_init.ts_syt, - AV1394_IT_IXL_BEGIN_NPOST + av1394_it_syt_off); + AV1394_IT_IXL_BEGIN_NPOST + av1394_it_syt_off); first = (itp->it_last_full + icp->ic_nframes - itp->it_nfull + 1) % - icp->ic_nframes; + icp->ic_nframes; av1394_it_update_frame_syt(icp, first, itp->it_nfull, syt); mutex_exit(&icp->ic_mutex); @@ -860,7 +857,7 @@ av1394_it_ixl_eof_cb(av1394_it_ixl_buf_t *bp) if ((itp->it_nempty >= itp->it_hiwat) && (icp->ic_state == AV1394_IC_DMA)) { av1394_ic_trigger_softintr(icp, icp->ic_num, - AV1394_PREQ_IT_UNDERRUN); + AV1394_PREQ_IT_UNDERRUN); } mutex_exit(&icp->ic_mutex); mutex_exit(&ip->i_mutex); diff --git a/usr/src/uts/common/sys/1394/targets/av1394/av1394_impl.h b/usr/src/uts/common/sys/1394/targets/av1394/av1394_impl.h index 56c0e33263..c6f6715492 100644 --- a/usr/src/uts/common/sys/1394/targets/av1394/av1394_impl.h +++ b/usr/src/uts/common/sys/1394/targets/av1394/av1394_impl.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_1394_TARGETS_AV1394_IMPL_H #define _SYS_1394_TARGETS_AV1394_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * av1394 driver definitions */ @@ -48,6 +45,22 @@ extern "C" { #endif /* + * byte swapping support, stolen from SBP2 + */ +#ifdef _LITTLE_ENDIAN +#define AV_SWAP16(data) \ + ((((data) & 0xff) << 8) | ((data) >> 8)) + +#define AV_SWAP32(data) \ + (((uint32_t)AV_SWAP16((uint16_t)((data) & 0xffff)) << 16) | \ + (uint32_t)AV_SWAP16((uint16_t)((data) >> 16))) +#else +#define AV_SWAP16(data) (data) +#define AV_SWAP32(data) (data) +#endif + + +/* * double-linked list */ typedef struct av1394_list_item_s { diff --git a/usr/src/uts/common/sys/1394/targets/av1394/av1394_isoch.h b/usr/src/uts/common/sys/1394/targets/av1394/av1394_isoch.h index b7b1e0babd..75c6e33f80 100644 --- a/usr/src/uts/common/sys/1394/targets/av1394/av1394_isoch.h +++ b/usr/src/uts/common/sys/1394/targets/av1394/av1394_isoch.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_1394_TARGETS_AV1394_ISOCH_H #define _SYS_1394_TARGETS_AV1394_ISOCH_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * isoch module definitions */ @@ -39,6 +36,8 @@ extern "C" { #endif +#define COOKIES 100 + /* * isoch DMA memory management: segments and pools * @@ -50,8 +49,10 @@ typedef struct av1394_isoch_seg_s { ddi_umem_cookie_t is_umem_cookie; /* umem cookie */ size_t is_umem_size; /* umem size (page-aligned) */ ddi_dma_handle_t is_dma_hdl; /* bind handle */ - ddi_dma_cookie_t is_dma_cookie; /* dma cookie */ - uint_t is_dma_ncookies; /* # of cookies */ + ddi_dma_cookie_t is_dma_cookie[COOKIES]; + /* dma cookie */ + uint_t is_dma_ncookies; + /* # of cookies */ } av1394_isoch_seg_t; /* diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile index 9cd4ae55b4..e70ad92328 100644 --- a/usr/src/uts/common/sys/Makefile +++ b/usr/src/uts/common/sys/Makefile @@ -54,16 +54,12 @@ i386_HDRS= \ vuidmice.h \ ucode.h -AVHDRS= \ - av/iec61883.h - sparc_HDRS= \ audio/audiots.h \ audio/am_src2.h \ mouse.h \ scsi/targets/ssddef.h \ - $(MDESCHDRS) \ - $(AVHDRS) + $(MDESCHDRS) # Generated headers GENHDRS= \ @@ -665,6 +661,9 @@ AUDIOHDRS= \ audio_trace.h \ g711.h +AVHDRS= \ + iec61883.h + BSCHDRS= \ bscbus.h \ bscv_impl.h \ @@ -1096,6 +1095,7 @@ dcam/%.check: dcam/%.h CHECKHDRS= \ $($(MACH)_HDRS:%.h=%.check) \ $(AUDIOHDRS:%.h=audio/%.check) \ + $(AVHDRS:%.h=av/%.check) \ $(BSCHDRS:%.h=%.check) \ $(CHKHDRS:%.h=%.check) \ $(CPUDRVHDRS:%.h=%.check) \ @@ -1156,6 +1156,7 @@ CHECKHDRS= \ $(CHECKHDRS) \ $(ROOTHDRS) \ $(ROOTAUDHDRS) \ + $(ROOTAVHDRS) \ $(ROOTCRYPTOHDRS) \ $(ROOTDCAMHDRS) \ $(ROOTISOHDRS) \ @@ -1213,6 +1214,7 @@ install_h: \ .WAIT \ $(ROOTHDRS) \ $(ROOTAUDHDRS) \ + $(ROOTAVHDRS) \ $(ROOTCRYPTOHDRS) \ $(ROOTDCAMHDRS) \ $(ROOTISOHDRS) \ diff --git a/usr/src/uts/common/sys/Makefile.syshdrs b/usr/src/uts/common/sys/Makefile.syshdrs index bc18a6e042..1aa087df2a 100644 --- a/usr/src/uts/common/sys/Makefile.syshdrs +++ b/usr/src/uts/common/sys/Makefile.syshdrs @@ -18,7 +18,7 @@ # # CDDL HEADER END # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -154,8 +154,7 @@ ROOTDIR= $(ROOT)/usr/include/sys ROOTDKTPDIR= $(ROOTDIR)/dktp sparc_ROOTDIRS= $(ROOTDKTPDIR) $(ROOTDIR)/scsi/adapters \ - $(ROOTDIR)/scsi/targets \ - $(ROOTDIR)/av + $(ROOTDIR)/scsi/targets i386_ROOTDIRS= $(ROOTDKTPDIR) $(ROOTDIR)/scsi/adapters $(ROOTDIR)/scsi/targets \ $(ROOTDIR)/agp $(ROOTDIR)/sata @@ -163,6 +162,7 @@ i386_ROOTDIRS= $(ROOTDKTPDIR) $(ROOTDIR)/scsi/adapters $(ROOTDIR)/scsi/targets \ ROOTDIRS= \ $(ROOTDIR) \ $(ROOTDIR)/audio \ + $(ROOTDIR)/av \ $(ROOTDIR)/hotplug \ $(ROOTDIR)/hotplug/pci \ $(ROOTDIR)/crypto \ |