1 /** @file
2 This file provides the information dump support for OHCI when in debug mode.
3 
4 Copyright (c) 2013-2015 Intel Corporation.
5 
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution.  The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 
17 #include "Ohci.h"
18 
19 
20 /*++
21 
22   Print the data of ED and the TDs attached to the ED
23 
24   @param  Uhc                   Pointer to OHCI private data
25   @param  Ed                    Pointer to a ED to free
26   @param  Td                    Pointer to the Td head
27 
28   @retval EFI_SUCCESS           ED
29 
30 **/
31 EFI_STATUS
OhciDumpEdTdInfo(IN USB_OHCI_HC_DEV * Uhc,IN ED_DESCRIPTOR * Ed,IN TD_DESCRIPTOR * Td,BOOLEAN Stage)32 OhciDumpEdTdInfo (
33   IN USB_OHCI_HC_DEV      *Uhc,
34   IN ED_DESCRIPTOR        *Ed,
35   IN TD_DESCRIPTOR        *Td,
36   BOOLEAN                 Stage
37   )
38 {
39   UINT32                  Index;
40 
41   if (Stage) {
42     DEBUG ((EFI_D_INFO, "\n Before executing command\n"));
43   }else{
44     DEBUG ((EFI_D_INFO, "\n after executing command\n"));
45   }
46   if (Ed != NULL) {
47     DEBUG ((EFI_D_INFO, "\nED Address:%p, ED buffer:\n", Ed));
48     DEBUG ((EFI_D_INFO, "DWord0  :TD Tail :TD Head :Next ED\n"));
49     for (Index = 0; Index < sizeof (ED_DESCRIPTOR)/4; Index ++) {
50       DEBUG ((EFI_D_INFO, "%8x ", *((UINT32*)(Ed) + Index)  ));
51     }
52     DEBUG ((EFI_D_INFO, "\nNext TD buffer:%p\n", Td));
53   }
54   while (Td != NULL) {
55     if (Td->Word0.DirPID == TD_SETUP_PID) {
56       DEBUG ((EFI_D_INFO, "\nSetup PID "));
57     }else if (Td->Word0.DirPID == TD_OUT_PID) {
58       DEBUG ((EFI_D_INFO, "\nOut PID "));
59     }else if (Td->Word0.DirPID == TD_IN_PID) {
60       DEBUG ((EFI_D_INFO, "\nIn PID "));
61     }else if (Td->Word0.DirPID == TD_NODATA_PID) {
62       DEBUG ((EFI_D_INFO, "\nNo data PID "));
63     }
64     DEBUG ((EFI_D_INFO, "TD Address:%p, TD buffer:\n", Td));
65     DEBUG ((EFI_D_INFO, "DWord0  :CuBuffer:Next TD :Buff End:Next TD :DataBuff:ActLength\n"));
66     for (Index = 0; Index < sizeof (TD_DESCRIPTOR)/4; Index ++) {
67       DEBUG ((EFI_D_INFO, "%8x ", *((UINT32*)(Td) + Index)  ));
68     }
69     DEBUG ((EFI_D_INFO, "\nCurrent TD Data buffer(size%d)\n", (UINT32)Td->ActualSendLength));
70     for (Index = 0; Index < Td->ActualSendLength; Index ++) {
71       DEBUG ((EFI_D_INFO, "%2x ", *(UINT8 *)(UINTN)(Td->DataBuffer + Index) ));
72     }
73   Td = (TD_DESCRIPTOR *)(UINTN)(Td->NextTDPointer);
74   }
75   DEBUG ((EFI_D_INFO, "\n TD buffer End\n"));
76 
77   return EFI_SUCCESS;
78 }
79 
80 
81 
82 
83 
84 
85