xref: /haiku/src/add-ons/kernel/busses/scsi/ahci/ahci_tracing.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 /*
2  * Copyright 2008, Bruno G. Albuquerque. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include <tracing.h>
7 
8 
9 #if AHCI_PORT_TRACING
10 
11 class AHCIController;
12 
13 namespace AHCIPortTracing {
14 
15 class AHCIPortTraceEntry : public AbstractTraceEntry {
16 	protected:
17 		AHCIPortTraceEntry(AHCIController* controller, int index)
18 		: fController(controller)
19 		, fIndex(index)
20 		{
21 		}
22 
23 		void AddDump(TraceOutput& out, const char* name)
24 		{
25 			out.Print("ahci port");
26 			out.Print(" - %s - ", name);
27 			out.Print("controller: %p", fController);
28 			out.Print(", index: %d", fIndex);
29 		}
30 
31 		AHCIController* fController;
32 		int fIndex;
33 };
34 
35 
36 class AHCIPortPrdTable : public AHCIPortTraceEntry {
37 	public:
38 		AHCIPortPrdTable(AHCIController* controller, int index, void* address,
39 			size_t size)
40 		: AHCIPortTraceEntry(controller, index)
41 		, fAddress(address)
42 		, fSize(size)
43 		{
44 			Initialized();
45 		}
46 
47 		void AddDump(TraceOutput& out)
48 		{
49 			AHCIPortTraceEntry::AddDump(out, "prd table");
50 
51 			out.Print(", address: %p", fAddress);
52 			out.Print(", size: %lu", fSize);
53 		}
54 
55 		void* fAddress;
56 		int fSize;
57 };
58 
59 
60 }	// namespace AHCIPortTracing
61 
62 #	define T_PORT(x)	new(std::nothrow) AHCIPortTracing::x
63 
64 #else
65 #	define T_PORT(x)
66 #endif	// AHCI_PORT_TRACING
67 
68