Print this page
6639 uhci_qh walker contains whacky boolean logic


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 #include <gelf.h>
  30 
  31 #include <sys/mdb_modapi.h>
  32 #include <mdb/mdb_ks.h>
  33 
  34 #include <sys/usb/usba.h>
  35 #include <sys/usb/usba/usba_types.h>
  36 
  37 #include <sys/usb/hcd/uhci/uhci.h>
  38 #include <sys/usb/hcd/uhci/uhcid.h>
  39 #include <sys/usb/hcd/uhci/uhciutil.h>
  40 
  41 
  42 #define UHCI_TD 0
  43 #define UHCI_QH 1
  44 
  45 
  46 /* Prototypes */
  47 
  48 int     uhci_td(uintptr_t, uint_t, int, const mdb_arg_t *);


 567 
 568         if (mdb_vread(wsp->walk_data, sizeof (queue_head_t), wsp->walk_addr)
 569             == -1) {
 570                 mdb_warn("failure reading qh at %p", wsp->walk_addr);
 571                 return (WALK_DONE);
 572         }
 573 
 574         status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
 575             wsp->walk_cbdata);
 576 
 577         /* Next QH. */
 578         wsp->walk_addr = ((queue_head_t *)wsp->walk_data)->link_ptr;
 579 
 580 
 581         /* Check if we're at the last element */
 582         if (wsp->walk_addr == NULL || wsp->walk_addr & HC_END_OF_LIST)  {
 583                 return (WALK_DONE);
 584         }
 585 
 586         /* Make sure next element is a QH.  If a TD, stop.  */
 587         if (!  ((((queue_head_t *)wsp->walk_data)->link_ptr) & HC_QUEUE_HEAD)
 588             == HC_QUEUE_HEAD)  {
 589                 return (WALK_DONE);
 590         }
 591 
 592         /* Strip terminate etc. bits.  */
 593         wsp->walk_addr &= QH_LINK_PTR_MASK;
 594 
 595         if (wsp->walk_addr == NULL)
 596                 return (WALK_DONE);
 597 
 598         /*
 599          * Convert link_ptr paddr to vaddr
 600          * Note: uhcip needed by QH_VADDR macro
 601          */
 602         wsp->walk_addr = (uintptr_t)QH_VADDR(wsp->walk_addr);
 603 
 604         return (status);
 605 }
 606 
 607 /*
 608  * MDB module linkage information:




   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 


  27 #include <gelf.h>
  28 
  29 #include <sys/mdb_modapi.h>
  30 #include <mdb/mdb_ks.h>
  31 
  32 #include <sys/usb/usba.h>
  33 #include <sys/usb/usba/usba_types.h>
  34 
  35 #include <sys/usb/hcd/uhci/uhci.h>
  36 #include <sys/usb/hcd/uhci/uhcid.h>
  37 #include <sys/usb/hcd/uhci/uhciutil.h>
  38 
  39 
  40 #define UHCI_TD 0
  41 #define UHCI_QH 1
  42 
  43 
  44 /* Prototypes */
  45 
  46 int     uhci_td(uintptr_t, uint_t, int, const mdb_arg_t *);


 565 
 566         if (mdb_vread(wsp->walk_data, sizeof (queue_head_t), wsp->walk_addr)
 567             == -1) {
 568                 mdb_warn("failure reading qh at %p", wsp->walk_addr);
 569                 return (WALK_DONE);
 570         }
 571 
 572         status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
 573             wsp->walk_cbdata);
 574 
 575         /* Next QH. */
 576         wsp->walk_addr = ((queue_head_t *)wsp->walk_data)->link_ptr;
 577 
 578 
 579         /* Check if we're at the last element */
 580         if (wsp->walk_addr == NULL || wsp->walk_addr & HC_END_OF_LIST)  {
 581                 return (WALK_DONE);
 582         }
 583 
 584         /* Make sure next element is a QH.  If a TD, stop.  */
 585         if (((((queue_head_t *)wsp->walk_data)->link_ptr) & HC_QUEUE_HEAD)
 586             != HC_QUEUE_HEAD)  {
 587                 return (WALK_DONE);
 588         }
 589 
 590         /* Strip terminate etc. bits.  */
 591         wsp->walk_addr &= QH_LINK_PTR_MASK;
 592 
 593         if (wsp->walk_addr == NULL)
 594                 return (WALK_DONE);
 595 
 596         /*
 597          * Convert link_ptr paddr to vaddr
 598          * Note: uhcip needed by QH_VADDR macro
 599          */
 600         wsp->walk_addr = (uintptr_t)QH_VADDR(wsp->walk_addr);
 601 
 602         return (status);
 603 }
 604 
 605 /*
 606  * MDB module linkage information: