|
|
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: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
24: *
25: * HISTORY
26: * 21 May 99 wgulland created.
27: *
28: */
29:
30: #define DEBUGGING_LEVEL 0 // 1 = low; 2 = high; 3 = extreme
31: #define DEBUGLOG kprintf
32: #include <IOKit/assert.h>
33:
34: #include <IOKit/IOMessage.h>
35: #include <IOKit/firewire/IOFireWireUnit.h>
36: #include <IOKit/firewire/IOFireWireDevice.h>
37: #include <IOKit/firewire/IOFireWireController.h>
38:
39: #define super IOFireWireNub
40:
41: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
42:
43: OSDefineMetaClassAndStructors(IOFireWireUnit, IOFireWireNub)
44:
45: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
46:
47: bool IOFireWireUnit::attach(IOService *provider)
48: {
49: fDevice = OSDynamicCast(IOFireWireDevice, provider);
50: if(!fDevice)
51: return false;
52: if( !super::attach(provider))
53: return (false);
54: fControl = fDevice->fControl;
55:
56: fROM = fDevice->fROM;
57: fROMSize = fDevice->fROMSize;
58: fNodeID = fDevice->fNodeID;
59: fLocalNodeID = fDevice->fLocalNodeID;
60: fGeneration = fDevice->fGeneration;
61:
62: return(true);
63: }
64:
65: IOReturn IOFireWireUnit::message( UInt32 mess, IOService * provider,
66: void * argument )
67: {
68: if(provider == fDevice) {
69: fNodeID = fDevice->fNodeID;
70: fLocalNodeID = fDevice->fLocalNodeID;
71: fGeneration = fDevice->fGeneration;
72: messageClients( mess );
73: }
74: return kIOReturnSuccess;
75: }
76:
77: /*
78: * Create an iterator for the device ROM
79: */
80: IOReturn IOFireWireUnit::CSRROMCreateIterator (CSRROMEntryIterator *pCSRROMIterator)
81: {
82: CSRROMEntryIteratorRecPtr pIteratorRec;
83: UInt32 hdrSize;
84:
85: // Allocate memory for iterator record.
86: pIteratorRec = (CSRROMEntryIteratorRecPtr)IOMalloc (sizeof (CSRROMEntryIteratorRec));
87: if (pIteratorRec == NULL)
88: return kIOReturnNoMemory;
89:
90: // Fill in other record fields.
91: // Set relationship to descendants.
92: pIteratorRec->relationship = kIterateDescendants;
93: // Find start of root directory.
94: hdrSize = ((fROM[0] & kCSRBusInfoBlockLength) >> kCSRBusInfoBlockLengthPhase) + 1;
95: pIteratorRec->data = fROM;
96: pIteratorRec->logicalPath[0] = 0;
97: pIteratorRec->physicalPath[0] = hdrSize;
98:
99: pIteratorRec->logicalPath[1] = 0;
100: pIteratorRec->physicalPath[1] = pIteratorRec->physicalPath[0] + 1;
101:
102: pIteratorRec->pathSize = 2;
103: pIteratorRec->reset = true;
104:
105: // Return iterator.
106: *pCSRROMIterator = (CSRROMEntryIterator) pIteratorRec;
107:
108: return (kIOReturnSuccess);
109: }
110:
111: /**
112: ** Matching methods
113: **/
114: bool IOFireWireUnit::matchPropertyTable(OSDictionary * table)
115: {
116: //
117: // If the service object wishes to compare some of its properties in its
118: // property table against the supplied matching dictionary,
119: // it should do so in this method and return truth on success.
120: //
121: if (!super::matchPropertyTable(table)) return false;
122:
123: // We return success if the following expression is true -- individual
124: // comparisions evaluate to truth if the named property is not present
125: // in the supplied matching dictionary.
126:
127: bool res = compareProperty(table, gFireWireUnit_Spec_ID) &&
128: compareProperty(table, gFireWireUnit_SW_Version) &&
129: compareProperty(table, gFireWireVendor_ID) &&
130: compareProperty(table, gFireWire_GUID);
131: return res;
132: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.