|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 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: *
24: * IOFireWireNub.h
25: *
26: *
27: * Note: IOFWCommand(s) are allocated by methods in this class.
28: * The remaining methods to setup and submit IOFWCommands are defined in
29: * IOFWCommand.h
30: */
31: #ifndef _IOKIT_IOFIREWIRENUB_H
32: #define _IOKIT_IOFIREWIRENUB_H
33:
34: #include <IOKit/IOService.h>
35: #include <IOKit/firewire/IOFWCommand.h>
36: #include <IOKit/firewire/IOFWAddressSpace.h>
37: class IOFireWireController;
38:
39: class IOFireWireNub : public IOService
40: {
41: OSDeclareDefaultStructors(IOFireWireNub)
42:
43: /*------------------Useful info about device (also available in the registry)--------*/
44: public:
45: int fDeviceSpeed; // Max supported by device
46: int fCommsSpeed; // Max speed this node can communicate with device
47: UInt16 fNodeID; // Current node ID (could change after bus reset!)
48: UInt32 fLocalNodeID; // ID of the local node (could change after bus reset!)
49: UInt32 fGeneration; // ID Of bus topology that fNodeID is valid for.
50: CSRNodeUniqueID fUniqueID; // Device's globally unique ID (never changes)
51: mach_timespec_t fAsyncTimeout; // Guesstimate of how long to wait for response
52: // from device when making async requests
53: // Different values for quad/block transfers?
54: // OS8 FW has 40/100 mSec.
55:
56: const UInt32 * fROM;
57: UInt32 fROMSize;
58:
59: IOFireWireController *fControl;
60:
61: // More info to come - device type, CSR ROM etc.
62:
63: protected:
64: // Create an IOUserClient object to handle communication with User task
65: virtual IOReturn newUserClient( task_t owningTask,
66: void * security_id,
67: UInt32 type,
68: IOUserClient ** handler );
69:
70: /*------------------Methods provided to FireWire device clients-----------------------*/
71: public:
72: // How fast can this system talk to the node?
73: virtual IOFWSpeed FWSpeed() const;
74:
75: // How fast can this node talk to another node?
76: virtual IOFWSpeed FWSpeed(const IOFireWireNub *dst) const;
77:
78: // How big (as a power of two) can packets sent to/received from the node be?
79: virtual int maxPackLog(bool forSend) const;
80:
81: // How big (as a power of two) can packets sent from this node to dst node/received from dst be?
82: virtual int maxPackLog(bool forSend, const IOFireWireNub *dst) const;
83:
84: /*
85: * Create various FireWire commands to send to the device
86: */
87: virtual IOFWReadCommand *createReadCommand(FWAddress devAddress, IOMemoryDescriptor *hostMem,
88: FWDeviceCallback completion=NULL, void *refcon=NULL,
89: bool failOnReset=false);
90: virtual IOFWReadQuadCommand *createReadQuadCommand(FWAddress devAddress, UInt32 *quads, int numQuads,
91: FWDeviceCallback completion=NULL, void *refcon=NULL,
92: bool failOnReset=false);
93:
94: virtual IOFWWriteCommand *createWriteCommand(FWAddress devAddress, IOMemoryDescriptor *hostMem,
95: FWDeviceCallback completion=NULL, void *refcon=NULL,
96: bool failOnReset=false);
97: virtual IOFWWriteQuadCommand *createWriteQuadCommand(FWAddress devAddress, UInt32 *quads, int numQuads,
98: FWDeviceCallback completion=NULL, void *refcon=NULL,
99: bool failOnReset=false);
100:
101: // size is 1 for 32 bit compare, 2 for 64 bit.
102: virtual IOFWCompareAndSwapCommand *createCompareAndSwapCommand(FWAddress devAddress,
103: const UInt32 *cmpVal, const UInt32 *newVal, int size,
104: FWDeviceCallback completion=NULL, void *refcon=NULL,
105: bool failOnReset=false);
106: /*
107: * Create local FireWire address spaces for the device to access
108: */
109: virtual IOFWPhysicalAddressSpace *createPhysicalAddressSpace(IOMemoryDescriptor *mem);
110: virtual IOFWPseudoAddressSpace *createPseudoAddressSpace(FWAddress addr, UInt32 len,
111: FWReadCallback reader, FWWriteCallback writer, void *refcon);
112:
113: /*
114: * Create commands to activate/deactivate local FireWire address spaces
115: */
116: virtual IOFWAllocAddressCommand *createAllocAddrCommand(IOFWAddressSpace *space,
117: FWBusCallback completion = 0, void *refcon = 0);
118: virtual IOFWDeallocAddressCommand *createDeallocAddrCommand(IOFWAddressSpace *space,
119: FWBusCallback completion = 0, void *refcon = 0);
120:
121: /*
122: * Create an iterator for the device ROM
123: * Device nub iterates over whle ROM, Unit nub over Unit directory
124: */
125: virtual IOReturn CSRROMCreateIterator (CSRROMEntryIterator *pCSRROMIterator) = 0;
126:
127: /*
128: * Standard nub initialization
129: */
130: virtual bool init(OSDictionary * propTable);
131:
132: };
133:
134: #endif /* ! _IOKIT_IOFIREWIRENUB_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.