1/*
2 * Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License").  You may not use this file except in compliance with the
9 * License.  Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * Copyright (c) 2000 Apple Computer, Inc.  All rights reserved.
24 *
25 * HISTORY
26 * 09 Nov 2000 wgulland created.
27 *
28 */
29
30// public
31#import <IOKit/firewire/IOFireWireDevice.h>
32#import <IOKit/firewire/IOFWDCLPool.h>
33
34// protected
35#include <IOKit/firewire/IOFireWireLink.h>
36#import <IOKit/firewire/IOFWWorkLoop.h>
37
38/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
39
40OSDefineMetaClass( IOFireWireLink, IOService )
41OSDefineAbstractStructors(IOFireWireLink, IOService)
42
43OSMetaClassDefineReservedUnused(IOFireWireLink, 0);
44OSMetaClassDefineReservedUnused(IOFireWireLink, 1);
45OSMetaClassDefineReservedUnused(IOFireWireLink, 2);
46OSMetaClassDefineReservedUnused(IOFireWireLink, 3);
47OSMetaClassDefineReservedUnused(IOFireWireLink, 4);
48OSMetaClassDefineReservedUnused(IOFireWireLink, 5);
49OSMetaClassDefineReservedUnused(IOFireWireLink, 6);
50OSMetaClassDefineReservedUnused(IOFireWireLink, 7);
51OSMetaClassDefineReservedUnused(IOFireWireLink, 8);
52
53/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
54
55IOFireWireController * IOFireWireLink::createController()
56{
57    IOFireWireController *control;
58
59    control = OSTypeAlloc( IOFireWireController );
60    if(NULL == control)
61        return NULL;
62
63    if(!control->init(this)) {
64        control->release();
65        control = NULL;
66    }
67    return control;
68}
69
70IOFWWorkLoop * IOFireWireLink::createWorkLoop()
71{
72    return IOFWWorkLoop::workLoop();
73}
74
75IOFireWireDevice *
76IOFireWireLink::createDeviceNub(CSRNodeUniqueID guid, const IOFWNodeScan *scan)
77{
78    IOFireWireDevice *newDevice;
79    OSDictionary *propTable;
80
81    newDevice = OSTypeAlloc( IOFireWireDevice );
82
83    if (!newDevice)
84        return NULL;
85
86    do {
87        OSObject * prop;
88        propTable = OSDictionary::withCapacity(6);
89        if (!propTable)
90            continue;
91
92        prop = OSNumber::withNumber(guid, 64);
93        if(prop) {
94            propTable->setObject(gFireWire_GUID, prop);
95            prop->release();
96        }
97		prop = OSNumber::withNumber((OSSwapBigToHostInt32(scan->fSelfIDs[0]) & kFWSelfID0SP) >> kFWSelfID0SPPhase, 32);
98		if(prop) {
99            propTable->setObject(gFireWireSpeed, prop);
100            prop->release();
101        }
102
103        if(!newDevice->init(propTable, scan)) {
104            newDevice->release();
105            newDevice = NULL;
106        }
107
108//        IOLog("IOFireWireLink::createDeviceNub - GUID is 0x%llx\n", guid );
109
110        // use quadlet reads for config rom
111		newDevice->setMaxPackLog(false, true, 2);
112    } while (false);
113    if(propTable)
114        propTable->release();	// done with it after init
115
116    return newDevice;
117}
118
119IOFireWireController * IOFireWireLink::getController() const
120{
121    return fControl;
122}
123
124IOWorkLoop * IOFireWireLink::getWorkLoop() const
125{
126    return fWorkLoop;
127}
128
129IOFWWorkLoop * IOFireWireLink::getFireWireWorkLoop() const
130{
131    return fWorkLoop;
132}
133
134IOFWDCLPool *
135IOFireWireLink::createDCLPool (
136	UInt32				capacity )
137{
138	return NULL ;
139}
140
141void IOFireWireLink::disablePHYPortOnSleep( UInt32 mask )
142{
143	// nothing to do
144}
145
146UInt32 * IOFireWireLink::getPingTimes ()
147{
148	return NULL ;
149}
150
151IOReturn IOFireWireLink::handleAsyncCompletion( IOFWCommand *cmd, IOReturn status )
152{
153	// nothing to do
154
155	return kIOReturnSuccess;
156}
157
158void IOFireWireLink::handleSystemShutDown( UInt32 messageType )
159{
160	// nothing to do
161}
162
163void IOFireWireLink::configureAsyncRobustness( bool enabled )
164{
165	// nothing to do
166}
167
168bool IOFireWireLink::isPhysicalAccessEnabledForNodeID( UInt16 nodeID )
169{
170	return false;
171}
172
173void IOFireWireLink::notifyInvalidSelfIDs (void)
174{
175
176}
177
178IOReturn IOFireWireLink::asyncPHYPacket( UInt32 data, UInt32 data2, IOFWAsyncPHYCommand * cmd )
179{
180	return kIOReturnUnsupported;
181}
182
183bool IOFireWireLink::enterLoggingMode( void )
184{
185	return false;
186}
187
188IOReturn IOFireWireLink::getCycleTimeAndUpTime( UInt32 &cycleTime, UInt64 &uptime )
189{
190	return kIOReturnUnsupported;
191}
192
193UInt32 IOFireWireLink::setLinkMode( UInt32 arg1, UInt32 arg2 )
194{
195	return 0;
196}
197