2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
25 * IONetworkController.h
27 * Network controller driver superclass.
30 * 9-Dec-1998 Joe Liu (jliu) created.
34 #ifndef _IONETWORKCONTROLLER_H
35 #define _IONETWORKCONTROLLER_H
37 /*! @defined kIONetworkControllerClass
38 @abstract kIONetworkControllerClass is the name of the
39 IONetworkController class. */
41 #define kIONetworkControllerClass "IONetworkController"
43 /*! @defined kIOVendor
44 @abstract kIOVendor is a property of IONetworkController objects.
45 It has an OSString value.
46 @discussion The kIOVendor property is a string describing the
47 vendor of the network controller. */
49 #define kIOVendor "IOVendor"
52 @abstract kIOModel is a property of IONetworkController objects.
53 It has an OSString value.
54 @discussion The kIOModel property is a string describing the
55 model of the network controller. */
57 #define kIOModel "IOModel"
59 /*! @defined kIORevision
60 @abstract kIORevision is a property of IONetworkController objects.
61 It has an OSString value.
62 @discussion The kIORevision property is a string describing the
63 revision level of the network controller. */
65 #define kIORevision "IORevision"
67 /*! @defined kIOFeatures
68 @abstract kIOFeatures is a property of IONetworkController objects.
69 It has an OSNumber value.
70 @discussion The kIOFeatures property describes generic features
71 defined by IONetworkController that are supported by the
72 network controller. */
74 #define kIOFeatures "IOFeatures"
76 /*! @defined kIOMediumDictionary
77 @abstract kIOMediumDictionary is a property of IONetworkController
78 objects. It has an OSDictionary value.
79 @discussion The kIOMediumDictionary property is a container for the
80 collection of IONetworkMedium objects that represent the media
81 types supported by the network controller.
82 Each entry in the dictionary is a key/value pair consisting of
83 the medium name, and a dictionary value that contains the
84 properties for that medium entry. */
86 #define kIOMediumDictionary "IOMediumDictionary"
88 /*! @defined kIODefaultMedium
89 @abstract kIODefaultMedium is a property of IONetworkController
90 objects. It has an OSString value.
91 @discussion The kIODefaultMedium property describes the name of the
92 default medium. This definition may change or disappear in the
95 #define kIODefaultMedium "IODefaultMedium"
97 /*! @defined kIOSelectedMedium
98 @abstract kIOSelectedMedium is a property of IONetworkController
99 objects. It has an OSSymbol value.
100 @discussion The kIOSelectedMedium property describes the name of the
101 current selected medium. This name can be used as a key into the
102 medium dictionary to gather additional information about the
105 #define kIOSelectedMedium "IOSelectedMedium"
107 /*! @defined kIOActiveMedium
108 @abstract kIOActiveMedium is a property of IONetworkController
109 objects. It has an OSSymbol value.
110 @discussion The kIOActiveMedium property describes the name of the
111 active medium. This is the name of the medium where an active
112 link has been established. This name can be used as a key into
113 the medium dictionary to gather additional information about the
116 #define kIOActiveMedium "IOActiveMedium"
118 /*! @defined kIOLinkSpeed
119 @abstract kIOLinkSpeed is a property of IONetworkController
120 objects. It has an OSNumber value.
121 @discussion The kIOLinkSpeed property describes the speed of the
122 link established over the active medium in bits per second. */
124 #define kIOLinkSpeed "IOLinkSpeed"
126 /*! @defined kIOLinkStatus
127 @abstract kIOLinkStatus is a property of IONetworkController
128 objects. It has an OSNumber value.
129 @discussion The kIOLinkStatus property describes the current network
130 link status. See IONetworkMedium for the definition of the link
133 #define kIOLinkStatus "IOLinkStatus"
135 /*! @defined kIOLinkData
136 @abstract kIOLinkData is a property of IONetworkController
137 objects. It has an OSData value.
138 @discussion The kIOLinkData property contains additional information,
139 that describes the active link that was established.
140 Its interpretation is not defined. */
142 #define kIOLinkData "IOLinkData"
144 /*! @defined kIOPacketFilters
145 @abstract kIOPacketFilters is a property of IONetworkController
146 objects. It has an OSDictionary value.
147 @discussion The kIOPacketFilters property describes the entire
148 set of packet filters supported by the controller. Each entry
149 in the dictionary is a key/value pair consisting of the filter
150 group name, and an OSNumber describing the set of supported
151 filters for that group. */
153 #define kIOPacketFilters "IOPacketFilters"
155 /*! @defined kIOMACAddress
156 @abstract kIOMACAddress is a property of IONetworkController
157 objects. It has an OSData value.
158 @discussion The kIOMACAddress property describes the hardware
159 MAC (media access controller) address, or station address,
160 of the network controller. */
162 #define kIOMACAddress "IOMACAddress"
164 /*! @defined kIOMaxPacketSize
165 @abstract kIOMaxPacketSize is a property of IONetworkController
166 objects. It has an OSNumber value.
167 @discussion The kIOMaxPacketSize property describes the maximum
168 packet size supported by the controller. */
170 #define kIOMaxPacketSize "IOMaxPacketSize"
172 /*! @defined kIOMinPacketSize
173 @abstract kIOMinPacketSize is a property of IONetworkController
174 objects. It has an OSNumber value.
175 @discussion The kIOMinPacketSize property describes the minimum
176 packet size supported by the controller. */
178 #define kIOMinPacketSize "IOMinPacketSize"
180 /*! @defined kIONetworkFilterGroup
181 @abstract kIONetworkFilterGroup describes the name assigned to the
182 standard network filter group. */
184 #define kIONetworkFilterGroup "IONetworkFilterGroup"
186 /*! @enum Enumeration of standard packet filters.
187 @discussion An enumeration of all standard packet filters. Each
188 filter will allow the reception of certain class of packets
189 depending on its destination MAC address.
190 @constant kIOPacketFilterUnicast Reception of unicast packets.
191 @constant kIOPacketFilterBroadcast Reception of broadcast packets.
192 @constant kIOPacketFilterMulticast Reception of multicast packets
193 addressed to a set of multicast addresses.
194 @constant kIOPacketFilterMulticastAll Reception of all multicast
196 @constant kIOPacketFilterPromiscuous Reception of all packets.
197 @constant kIOPacketFilterPromiscuousAll Reception of all packets,
198 including bad packets. */
201 kIOPacketFilterUnicast
= 0x1,
202 kIOPacketFilterBroadcast
= 0x2,
203 kIOPacketFilterMulticast
= 0x10,
204 kIOPacketFilterMulticastAll
= 0x20,
205 kIOPacketFilterPromiscuous
= 0x100,
206 kIOPacketFilterPromiscuousAll
= 0x200,
209 /*! @enum Feature flags returned by the getFeatures() method.
210 @constant kIONetworkFeatureNoBSDWait Set this bit in the value
211 returned by getFeatures() to disable the automatic wait for
212 "IOBSD" resource by the IONetworkController::start() method. */
215 kIONetworkFeatureNoBSDWait
= 0x01,
221 #if defined(KERNEL) && defined(__cplusplus)
223 #include <IOKit/IOService.h>
224 #include <IOKit/IOWorkLoop.h>
225 #include <IOKit/network/IONetworkInterface.h>
226 #include <IOKit/network/IOKernelDebugger.h>
228 struct mbuf
; // forward declarations
231 class IONetworkMedium
;
233 /*! @typedef IOPacketBufferConstraints
234 @discussion Constraint parameters, specified by a driver,
235 for the data buffer in a packet mbuf. This is observed by
236 allocatePacket() to satisfy the stated requirements.
237 @field alignStart Starting address byte alignment.
238 @field alignLength Buffer length byte alignment. */
244 } IOPacketBufferConstraints
;
246 // Some frequently used alignment constants.
249 kIOPacketBufferAlign1
= 1,
250 kIOPacketBufferAlign2
= 2,
251 kIOPacketBufferAlign4
= 4,
252 kIOPacketBufferAlign8
= 8,
253 kIOPacketBufferAlign16
= 16,
254 kIOPacketBufferAlign32
= 32,
257 /*! @defined gIONetworkFilterGroup
258 @discussion gIONetworkFilterGroup is an OSSymbol object that contains
259 the name of the standard network filter group as defined by
260 kIONetworkFilterGroup. */
262 extern const OSSymbol
* gIONetworkFilterGroup
;
264 /*! @class IONetworkController : public IOService
265 @abstract IONetworkController implements the framework for a generic
266 network controller. A subclass of IONetworkController must provide
267 additional functionality specific for a particular networking type.
268 In addition, the driver must implement (override) a basic set of
269 hardware dependent methods to create a working driver.
271 IONetworkController attaches itself to the data link layer (DLIL) via
272 an IONetworkInterface object. A controller object without a companion
273 interface is not accessible to the networking system. The controller
274 interacts with DLIL by calling methods defined by the interface object.
275 And conversely, DLIL will issue commands and packets to the controller
276 through the interface object.
278 IONetworkController will create an IOCommandGate and attach this
279 event source to an IOWorkLoop object. All commands sent from the
280 interface object are handled through the IOCommandGate object,
281 which will serialize access to the controller. Outbound packets sent
282 from the interface to the controller have no implicit serialization.
283 Drivers must implement an output function that is thread safe, or use
284 an IOOutputQueue object which will provide a serialization model.
287 class IONetworkController
: public IOService
289 OSDeclareAbstractStructors( IONetworkController
)
293 IOWorkLoop
* _workLoop
;
294 IOCommandGate
* _cmdGate
;
295 IOOutputQueue
* _outputQueue
;
297 OSCollectionIterator
* _clientSetIter
;
298 OSObject
* _cmdClient
;
301 UInt32 _alignPadding
;
302 bool _propertiesPublished
;
303 IOLock
* _mediumLock
;
304 IODebuggerLockState _debugLockState
;
305 SInt32 _debugLockCount
;
306 OSNumber
* _linkStatus
;
307 OSNumber
* _linkSpeed
;
308 const OSData
* _lastLinkData
;
309 const OSSymbol
* _lastActiveMediumName
;
310 const OSSymbol
* _lastCurrentMediumName
;
311 struct mbuf
* _freeList
;
313 struct ExpansionData
{ };
315 Reserved for future use. (Internal use only) */
316 ExpansionData
* _reserved
;
319 bool _broadcastEvent(UInt32 type
, void * data
= 0);
321 static void debugRxHandler(IOService
* handler
,
326 static void debugTxHandler(IOService
* handler
,
330 static IOReturn
executeCommandAction(OSObject
* owner
,
336 static IOReturn
handleCommand(void * target
,
344 /*! @function initialize
345 @abstract IONetworkController class initializer.
346 @discussion Create frequently used OSSymbol objects that are used as keys.
347 This method is called explicitly by a line in IOStartIOKit.cpp and not
348 by the OSDefineMetaClassAndInit() mechanism, to ensure that this method
349 is called after the OSSymbol class (pool) is initialized. */
351 static void initialize();
354 @abstract Initialize the IONetworkController object.
355 @discussion Instance variables are initialized, then super::init()
357 @param properties A dictionary object containing a property table
358 associated with this instance.
359 @result true on success, false otherwise. */
361 virtual bool init(OSDictionary
* properties
);
364 @abstract Start the network controller.
365 @discussion After the controller driver has successfully matched
366 to a provider, this method is called to start the network controller.
367 IONetworkController will allocate resources and gather controller
368 properties in its implementation. No I/O will be performed until
369 the subclass tries to attach a client object. A driver must override
370 this method, and call super::start() at the beginning of its own
371 implementation. Then check the return value to make sure that its
372 superclass was started successfully before proceeding. Tasks that
373 are usually performed by a driver's start method are; resource
374 allocation, hardware initialization, allocation of IOEventSources
375 and attaching them to a workloop, publishing a medium dictionary,
376 and finally, attaching an interface object when it is ready to
377 handle client requests.
378 @param provider The provider that the controller was matched
380 @result true on success, false otherwise. */
382 virtual bool start(IOService
* provider
);
385 @abstract Stop the network controller.
386 @discussion The counterpart of start(). The controller has been
387 instructed to stop running. The stop() method should release
388 resources and undo actions performed by the start() method.
389 Subclasses must override this method and call super::stop()
390 at the end of its implementation.
391 @param provider The provider that the controller was matched
392 (and attached) to. */
394 virtual void stop(IOService
* provider
);
396 /*! @typedef IONetworkController::Action
397 @discussion Definition of a C function that can be called
398 through executeCommand().
399 @param target The first argument passed to action.
400 @param param0 Action parameter 0.
401 @param param1 Action parameter 1.
402 @param param2 Action parameter 2.
403 @param param3 Action parameter 3. */
405 typedef IOReturn (*Action
)(void * target
, void * param0
,
410 /*! @function executeCommand
411 @abstract Make a C function call through the command gate.
412 @discussion Make a call to a C function that will be synchronized
413 with the workloop thread, and any other threads that are called
414 with the workloop's gate closed.
415 @param client The client requesting the action. This parameter is not
416 passed to the function.
417 @param action Pointer to a C function to be executed.
418 @param target The first parameter in the action callout.
419 @param param0 Action parameter 0.
420 @param param1 Action parameter 1.
421 @param param2 Action parameter 2.
422 @param param3 Action parameter 3.
423 @result The value returned by the action. */
425 virtual IOReturn
executeCommand(OSObject
* client
,
433 /*! @function outputPacket
434 @abstract Transmit an output packet.
435 @discussion If an IOOutputQueue was created by createOutputQueue(),
436 then this method will be called by the output queue object.
437 Otherwise, an interface object will call this method directly when
438 it receives an output packet from the data link layer.
440 There is no upper limit on the number of mbufs, hence the number of
441 memory fragments, in the mbuf chain provided. Drivers must be able to
442 handle cases when the mbuf count might exceed the limit supported by their
443 DMA engines, and perform coalescing to copy the various memory fragments
444 into a lesser number of fragments. This complexity can be hidden from
445 the driver when an IOMbufMemoryCursor is used, which is able to convert
446 a mbuf chain into a physical address scatter-gather list that will not
447 exceed a specified number of physically contiguous memory segments.
448 See IOMbufMemoryCursor.
450 The implementation in IONetworkController performs no useful action
451 and will drop all packets. A driver must override this method and
452 process the output packet provided. The implementation in the driver
453 must not block, since this may cause the network stack to be reentered
454 from an unsafe point.
455 @param packet A mbuf chain containing the output packet to be sent on
457 @param param A parameter provided by the caller.
458 @result A return code defined by the caller. */
460 virtual UInt32
outputPacket(struct mbuf
* packet
, void * param
);
462 /*! @function getFeatures
463 @abstract Report generic features supported by the controller and/or
465 @result This method will always return 0. Subclasses may override
466 this method and return a bit mask of all supported features. */
468 virtual UInt32
getFeatures() const;
470 /*! @function newVendorString
471 @result Return a string describing the vendor of the network controller.
472 The caller is responsible for releasing the string object returned. */
474 virtual const OSString
* newVendorString() const;
476 /*! @function newModelString
477 @result Return a string describing the model of the network controller.
478 The caller is responsible for releasing the string object returned. */
480 virtual const OSString
* newModelString() const;
482 /*! @function newRevisionString
483 @result Return a string describing the hardware revision of the
484 network controller. The caller is responsible for releasing the
485 string object returned. */
487 virtual const OSString
* newRevisionString() const;
489 /*! @function getSelectedMedium
490 @abstract Get the current selected medium.
491 @discussion If the driver has previously called setSelectedMedium()
492 to indicate its current media selection, then this method will return
493 that medium object. Otherwise, the driver's property table is
494 consulted and a default medium property is examined, and the
495 corresponding entry in the medium dictionary is returned.
496 @result The current selected medium, the default medium, or 0. */
498 virtual const IONetworkMedium
* getSelectedMedium() const;
499 inline const IONetworkMedium
* getCurrentMedium() const;
501 /*! @function getMediumDictionary
502 @abstract Returns the medium dictionary published by the driver.
503 @discussion Returns the medium dictionary published by the driver
504 through publishMediumDictionary(). Use copyMediumDictionary() to
505 create and get a copy of the medium dictionary.
506 @result The published medium dictionary, or 0 if the driver has not
507 yet published a medium dictionary through publishMediumDictionary(). */
509 virtual const OSDictionary
* getMediumDictionary() const;
511 /*! @function copyMediumDictionary
512 @abstract Returns a copy of the medium dictionary published by the
514 @discussion The caller is responsible for releasing the dictionary
515 object returned. Use getMediumDictionary() to get a reference to the
516 published medium dictionary instead of creating a copy.
517 @result A copy of the medium dictionary, or 0 if the driver has not
518 published a medium dictionary through publishMediumDictionary(). */
520 virtual OSDictionary
* copyMediumDictionary() const;
522 /*! @function getOutputHandler
523 @abstract Get the address of the method designated to handle output
524 packets for the network controller.
525 @result A pointer to the outputPacket() method is returned. */
527 virtual IOOutputAction
getOutputHandler() const;
529 /*! @function doEnable
530 @abstract Make a synchronized call to enable() through executeCommand().
531 @discussion Do not use this method, it may be removed in the future.
534 virtual IOReturn
doEnable(IOService
* client
);
536 /*! @function doDisable
537 @abstract Make a synchronized call to disable() through executeCommand().
538 @discussion Do not use this method, it may be removed in the future.
541 virtual IOReturn
doDisable(IOService
* client
);
543 /*! @function getCommandGate
544 @abstract Get the IOCommandGate object created by IONetworkController.
545 @discussion When IONetworkController is started, an IOCommandGate object
546 is instantiated and attached to the workloop returned by getWorkLoop().
547 This IOCommandGate object is used internally to synchronize client
548 commands handled through executeCommand(). Subclasses that need an
549 IOCommandGate should try to reuse the object returned by this method,
550 rather than creating a new instance. See IOCommandGate documentation.
551 @result The IOCommandGate object created by IONetworkController. */
553 virtual IOCommandGate
* getCommandGate() const;
555 /*! @function getHardwareAddress
556 @abstract Get the network controller's permanent hardware/station
557 address. This method call is synchronized by the workloop's gate.
558 @param addr The buffer where the controller's hardware address should
560 @param inOutAddrBytes The size of the address buffer provided by the
561 client, and replaced by this method with the actual size of
562 the hardware address in bytes.
563 @result kIOReturnSuccess on success, or an error otherwise. */
565 virtual IOReturn
getHardwareAddress(void * addr
,
566 UInt32
* inOutAddrBytes
) = 0;
568 /*! @function setHardwareAddress
569 @abstract Set or change the station address used by the network
570 controller. This method call is synchronized by the workloop's gate.
571 @param buffer The buffer containing the hardware address provided by
573 @param addrBytes The size of the address buffer provided by the
575 @result kIOReturnSuccess on success, or an error otherwise. */
577 virtual IOReturn
setHardwareAddress(const void * addr
,
578 UInt32 addrBytes
) = 0;
581 @abstract An enable request from a client.
582 @discussion Handle an enable request from a client. A client will call
583 enable after it has opened the controller, and before it starts to use
584 the controller to send and to receive packets over the network. The
585 client object provided is typecasted using OSDynamicCast, and depending
586 on whether the client is an IOKernelDebugger or an IONetworkInterface,
587 then an overloaded enable method that takes a more specific argument
588 type is called. If the client matches neither type, then
589 kIOReturnBadArgument is returned. A driver has the option of overriding
590 this base enable method, or the overloaded form. This method call is
591 synchronized by the workloop's gate.
592 @param client The client object requesting the enable.
593 @result The return value from the overloaded enable() method, or
594 kIOReturnBadArgument if the client type is unknown. */
596 virtual IOReturn
enable(IOService
* client
);
598 /*! @function disable
599 @abstract A disable request from a client.
600 @discussion Handle a disable request from a client. A client will call
601 disable if it has previously enabled the controller, and it no longer
602 needs to transport packets or perform I/O using the controller.
603 The client object is typecasted using OSDynamicCast, and depending on
604 whether the client is an IOKernelDebugger or an IONetworkInterface,
605 then an overloaded disable method that takes a more specific argument
606 type is called. If the client matches neither type, then
607 kIOReturnBadArgument is returned. A driver has the option of overriding
608 this base disable method, or the overloaded form. This method call is
609 synchronized by the workloop's gate.
610 @param client The client object requesting the disable.
611 @result The return from the overloaded disable() method, or
612 kIOReturnBadArgument if the client type is unknown. */
614 virtual IOReturn
disable(IOService
* client
);
616 /*! @function setMaxPacketSize
617 @abstract A client request to change the maximum packet size.
618 @discussion This method call is synchronized by the workloop's gate.
619 @param maxSize The new maximum packet size.
620 @result kIOReturnUnsupported. Drivers may override this method
621 and return either kIOReturnSuccess to indicate that the new size
622 was accepted and is in effect, or an error code to indicate failure. */
624 virtual IOReturn
setMaxPacketSize(UInt32 maxSize
);
626 /*! @function getMaxPacketSize
627 @abstract Get the maximum packet size supported by the controller.
628 @param maxSize Pointer to the return value.
629 @result kIOReturnSuccess on success, or an error code otherwise. */
631 virtual IOReturn
getMaxPacketSize(UInt32
* maxSize
) const = 0;
633 /*! @function getMinPacketSize
634 @abstract Get the minimum packet size supported by the controller.
635 @param minSize Pointer to the return value.
636 @result kIOReturnSuccess on success, or an error code otherwise. */
638 virtual IOReturn
getMinPacketSize(UInt32
* minSize
) const = 0;
640 /*! @function selectMedium
641 @abstract A client request to change the medium selection.
642 @discussion This method is called when a client issues a command
643 for the controller to change its current medium selection.
644 The implementation must call setSelectedMedium() after the change
645 has occurred. This method call is synchronized by the workloop's
647 @param medium An entry from the published medium dictionary that
648 represents the selection chosen by the client.
649 @result kIOReturnUnsupported. Drivers may override this method and
650 return kIOReturnSuccess if the selection was successful,
651 or an error code otherwise. */
653 virtual IOReturn
selectMedium(const IONetworkMedium
* medium
);
655 /*! @function selectMediumWithName
656 @abstract A client request to change the medium selection.
657 @discussion This method is called when a client issues a command
658 for the controller to change its current medium selection.
659 This implementation will look for an entry in the medium
660 dictionary published by the driver that is associated with the
661 key given. If a match is found, then selectMedium() is called to
662 perform the selection, otherwise an error is reported back to the
663 client. Subclasses should override selectMedium() and not this
664 method. This method call is synchronized by the workloop's gate.
665 @param mediumName An OSSymbol object that describes the name of the
666 new medium selected by the client.
667 @result The return from selectMedium() if a matching entry was found
668 from the medium dictionary. kIOReturnUnsupported if a medium
669 dictionary does not exist, or kIOReturnBadArgument if the name given
670 does not match any entry in the medium dictionary. */
672 virtual IOReturn
selectMediumWithName(const OSSymbol
* mediumName
);
674 /*! @function getPacketFilters
675 @abstract Get the set of packet filters supported by the network
676 controller for the given filter group.
677 @discussion A subclass must implement this method and report the
678 set of filters that are supported for the given filter group.
679 This method call is synchronized by the workloop's gate.
680 @param group The name of the filter group.
681 @param filters Pointer to the mask of supported filters returned by
683 @result kIOReturnSuccess on success, or an error to indicate a
684 failure to discover the set of supported filters. */
686 virtual IOReturn
getPacketFilters(const OSSymbol
* group
,
687 UInt32
* filters
) const = 0;
689 /*! @function enablePacketFilter
690 @abstract Enable one of the supported packet filters from the
692 @discussion A client will call this method to enable a supported filter
693 from the filter group specified. If the client wishes to enable more
694 than one filter, it must call this method multiple times to enable the
695 desired set of filters. This method call is synchronized by the
697 @param group The name of the filter group containing the filter to be
699 @param aFilter The filter to enable.
700 @param enabledFilters All filters currently enabled by the client.
701 @param options Optional flags for the enable request.
702 @result kIOReturnSuccess on success, or an error otherwise. */
704 virtual IOReturn
enablePacketFilter(const OSSymbol
* group
,
706 UInt32 enabledFilters
,
707 IOOptionBits options
= 0) = 0;
709 /*! @function disablePacketFilter
710 @abstract Disable a packet filter that is currently enabled from the
712 @discussion After a supported filter has been successfully enabled,
713 a client can call this method to disable that filter. This method call
714 is synchronized by the workloop's gate.
715 @param group The name of the filter group containing the filter to be
717 @param aFilter The filter to disable.
718 @param enabledFilters All filters currently enabled by the client.
719 @param options Optional flags for the disable request.
720 @result kIOReturnSuccess on success, or an error otherwise. */
722 virtual IOReturn
disablePacketFilter(const OSSymbol
* group
,
724 UInt32 enabledFilters
,
725 IOOptionBits options
= 0) = 0;
727 /*! @function getOutputQueue
728 @abstract Get the IOOutputQueue object created by createOutputQueue().
729 @result Return a reference to the output queue object created by
730 createOutputQueue(). */
732 virtual IOOutputQueue
* getOutputQueue() const;
734 /*! @function getPacketBufferConstraints
735 @abstract Get the controller's packet buffer constraints.
736 @discussion Called by start() to obtain the constraints on the
737 memory buffer for each mbuf packet allocated through allocatePacket().
738 Drivers can override this method to specify the buffer constraints
739 imposed by their bus master hardware. Note that outbound packets,
740 those that originate from the network stack, are not currently
741 subject to the constraints reported here.
742 @param constraints A pointer to an IOPacketBufferConstraints
743 structure that this method is expected to initialize.
744 See IOPacketBufferConstraints structure definition. */
746 virtual void getPacketBufferConstraints(
747 IOPacketBufferConstraints
* constraints
) const;
749 /*! @function allocatePacket
750 @abstract Allocate a packet with a data buffer that is larger than
751 or equal to the size specified.
752 @discussion This method will always return a single mbuf unless the
753 size requested (plus the alignment padding) is greater than MCLBYTES.
754 The data buffer for the mbuf (or a mbuf chain) returned is aligned
755 according to the constraints reported by getPacketBufferConstraints().
756 The length fields in each mbuf returned is set by this method, thus
757 allowing the mbuf to be passed directly to an IOMbufMemoryCursor object
758 in order to convert the mbuf to a physical address scatter-gather list.
759 @param size The minimum size of the data buffer for the mbuf
761 @result A mbuf packet, or 0 if allocation failed. */
763 virtual struct mbuf
* allocatePacket(UInt32 size
);
765 /*! @function copyPacket
766 @abstract Allocate a new packet, containing data copied from an
767 existing source packet.
768 @discussion The source packet is not modified by this method.
769 @param m The source packet.
770 @param size The number of bytes to copy. If set to 0, then the
771 entire data buffer from the source packet is copied.
772 @result A new packet containing the same data as the source packet. */
774 virtual struct mbuf
* copyPacket(const struct mbuf
* m
, UInt32 size
= 0);
776 /*! @function replacePacket
777 @abstract Allocate a new packet to replace an existing packet, the
778 existing packet is then returned.
779 @param mp A handle to the existing packet.
780 @param size If size is 0, then the new packet shall have the same buffer
781 size as the original packet that is being replaced. Otherwise, the new
782 packet shall have the buffer size specified by this value.
783 @result If packet allocation was successful, then a replacement will
784 take place and the original packet will be returned. Otherwise, 0
785 is returned, and the original packet will be left untouched. */
787 virtual struct mbuf
* replacePacket(struct mbuf
** mp
, UInt32 size
= 0);
789 /*! @function replaceOrCopyPacket
790 @abstract A helper method that combines the functionality of
791 copyPacket() and replacePacket() to process a packet containing
793 @discussion This method will either make a copy or replace the existing
794 packet, whichever is more time efficient. Packets containing small frames
795 are copied, otherwise they are replaced. If replaced, then the existing
796 packet is returned, and a new packet with the same buffer size is created
797 to take its place. If copied, the existing packet is left intact, while a
798 copy is returned that will hold a copy of the data from the source packet.
799 @param mp A handle to the existing packet that may be replaced.
800 @param length The number of bytes received held in the packet.
801 Must be greater than zero.
802 @param replaced Pointer to a return value that is set to true to indicate
803 that the existing packet was replaced, or false to indicate that the
804 existing packet was not replaced, and a copy was created.
805 @result A replacement or a copy of the existing packet, or 0 if packet
806 allocation failed. */
808 virtual struct mbuf
* replaceOrCopyPacket(struct mbuf
** mp
,
816 /*! @function freePacket
817 @abstract Release the packet given back to the free pool.
818 @param m The packet to be freed.
819 @param options When kDelayFree option is set, then the packet
820 provided to this function will be queued on the free packet queue.
821 A subsequent call to releaseFreePackets() will release all queued
822 packets by making a single BSD function call. Without the kDelayFree
823 option, the packet provided will be released immediately. */
825 virtual void freePacket(struct mbuf
* m
, IOOptionBits options
= 0);
827 /*! @function releaseFreePackets
828 @abstract Release all packets held in the free packet queue.
829 @discussion The free packet queue is not protected by a lock. This
830 function must be called in a single threaded manner with respect to
831 all calls to freePacket() with the kDelayFree option set.
832 @result The number of packets queued and released. */
834 virtual UInt32
releaseFreePackets();
836 /*! @enum An enumeration of TCP/IP checksums that may be supported by the
838 @constant kChecksumFamilyTCPIP A value that describes the collection
840 @constant kChecksumIP An IP header checksum.
841 @constant kChecksumTCP A TCP checksum that covers the TCP header and TCP
843 @constant kChecksumUDP An UDP checksum that covers the UDP header and UDP
845 @constant kChecksumTCPNoPseudoHeader A TCP checksum that covers the TCP
846 header and the TCP data, but the pseudo header is not included in the
847 checksum computation. A partial 16-bit checksum value must be provided
848 to allow the protocol stacks to calculate and verify the final checksum.
849 This type of checksum is not currently supported on the output path.
850 @constant kChecksumUDPNoPseudoHeader An UDP checksum that covers the UDP
851 header and the UDP data, but the pseudo header is not included in the
852 checksum computation. A partial 16-bit checksum value must be provided
853 to allow the protocol stacks to calculate and verify the final checksum.
854 This type of checksum is not currently supported on the output path.
855 @constant kChecksumTCPSum16 The hardware has a simple checksum engine
856 that can perform a TCP style ones complement sum of 16-bit words over
857 a certain range of bytes in a packet. The hardware does not have the
858 ability to scan for IP or TCP headers, and the driver must pass/get
859 additional parameter(s) to or from the protocol stack to coordinate
860 the checksumming effort. */
863 kChecksumFamilyTCPIP
= 0x00000001,
864 kChecksumIP
= 0x0001,
865 kChecksumTCP
= 0x0002,
866 kChecksumUDP
= 0x0004,
867 kChecksumTCPNoPseudoHeader
= 0x0100,
868 kChecksumUDPNoPseudoHeader
= 0x0200,
869 kChecksumTCPSum16
= 0x0400,
872 /*! @function getChecksumSupport
873 @abstract Get checksums that are supported by the network controller for
874 the given checksum family.
875 @discussion A network controller that is capable of inserting and verifying
876 checksums on output and input packets, should override this method and
877 advertise its capability in order to assist or offload the software checksum
878 calculations performed by the protocol stacks.
879 @param checksumMask A pointer to the mask of supported checksums returned
881 @param checksumFamily A value that specifies the checksum family.
882 @param isOutput Set to true to query the support for checksum insertion on
883 output packets, or false to query the support for checksum verification
884 on input packets. Controllers that have symmetric hardware checksum support
885 can return a fixed checksum mask value, and ignore this argument.
886 @result Default return is kIOReturnUnsupported. Controllers that override
887 this method must return kIOReturnSuccess. Any other return value will be
888 interpretated as a lack of checksum support, regardless of the value
889 returned through the first argument. */
891 virtual IOReturn
getChecksumSupport( UInt32
* checksumMask
,
892 UInt32 checksumFamily
,
895 /*! @function setChecksumResult
896 @abstract Encode a received packet with the checksum result reported
898 @discussion A network controller that can verify the checksum(s) for a
899 received packet, should call this method to encode the result on the
900 packet, before passing it up towards the protocol stacks.
901 @param packet A mbuf containing a packet that has been checksummed by
903 @param checksumFamily A value that specifies the checksum family.
904 @param resultMask A mask of all checksums that were checked or computed.
905 Setting a bit implies that the driver is able to report the result of
906 the checksum computation, by asserting the validity of the checksum,
907 or by returning a partial checksum value.
908 @param validMask A mask of all checksums are were computed and verified
909 by the hardware as valid. Certain types of checksum performed by the
910 hardware are inheritely incomplete, and therefore should never be marked
911 as valid. A checksum cannot be marked valid unless it has also been
913 @param param0 Optional parameter 0, defaults to 0.
914 @param param1 Optional parameter 1, defaults to 0.
915 @result true if the checksum family is valid and the packet has been
916 encoded with the checksum result provided, false otherwise. */
918 virtual bool setChecksumResult( struct mbuf
* packet
,
919 UInt32 checksumFamily
,
925 /*! @function getChecksumDemand
926 @abstract Fetch the demand for hardware checksum computation and insertion
927 for the given packet before it is transmitted on the network.
928 @discussion A network controller that can insert a checksum for output
929 packets must call this method to obtain the set of checksums that it must
930 compute, and insert into the appropriate fields in the given output packet.
931 @param packet A mbuf containing a packet that may be missing one or more
932 checksums in the specified checksum family.
933 @param checksumFamily A value which specifies the checksum family.
934 @param demandMask A mask of all checksums that the hardware must compute
935 and insert into the appropriate checksum fields in the packet.
936 @param param0 Optional parameter 0, defaults to 0.
937 @param param1 Optional parameter 1, defaults to 0. */
939 virtual void getChecksumDemand( const struct mbuf
* packet
,
940 UInt32 checksumFamily
,
945 /*! @function publishMediumDictionary
946 @abstract Publish a dictionary of IONetworkMedium objects to
947 advertise the media selection supported by the network controller.
948 @discussion Called by drivers to publish their medium dictionary.
949 Each entry in the dictionary is an IONetworkMedium object that
950 represents a single medium that is supported by the controller.
951 This method will make a copy of the dictionary provided, then add
952 the copy to the driver's property table. The dictionary provided
953 can be released by the caller upon returning from this method.
954 It is permissible to call this method multiple times, which may be
955 necessary if the hardware's media capability changes dynamically.
956 However, if the capability is static, which is often the case,
957 then drivers will typically call this method only once from
960 Several methods depend on the presence of a medium dictionary.
961 They should be called after the medium dictionary has been
962 published. Those methods are:
965 getMediumDictionary()
966 copyMediumDictionary()
968 @param mediumDict A dictionary of IONetworkMedium objects.
969 @result true if the dictionary is valid, and was successfully
970 exported to the property table, false otherwise. */
972 virtual bool publishMediumDictionary(const OSDictionary
* mediumDict
);
974 /*! @function setSelectedMedium
975 @abstract Designate an entry in the published medium dictionary as
976 the current selected medium.
977 @discussion After the driver has configured the hardware to select
978 one of its supported media types, it must call this method to inform
979 its parent about the change that has occurred. IONetworkController
980 will update a property in the registry to reflect the current selection.
981 @param medium A medium object representing the current selection.
982 @result true if the property table update was successful,
983 false if the update failed, or if the medium provided does not match
984 any entry from the published medium dictionary. */
986 virtual bool setSelectedMedium(const IONetworkMedium
* medium
);
987 inline bool setCurrentMedium(const IONetworkMedium
* medium
);
989 /*! @function setLinkStatus
990 @abstract Report the link status and the active medium.
991 @discussion Drivers must call this method when a link change is
992 detected. IONetworkController will update the link status properties
993 in the registry, and generate an event to inform the upper layers
995 @param status Link status bits.
996 See IONetworkMedium for the definition of the link status bits.
997 @param activeMedium An object in the published medium dictionary
998 that represents the active medium. This may not be the same as
999 the selected medium. Set this to 0 if the link is inactive.
1000 @param speed Link speed in units of bits per second. If zero, then
1001 the link speed is taken from the medium object provided.
1002 @param data An OSData containing any additional link parameter that
1003 the driver wishes to publish to the registry.
1004 @result true if all link properties were successfully updated,
1007 virtual bool setLinkStatus(
1009 const IONetworkMedium
* activeMedium
= 0,
1016 @abstract Free the IONetworkController object.
1017 @discussion Free the IONetworkController object by releasing all
1018 allocated resources, followed by a call to super::free(). */
1020 virtual void free();
1022 /*! @function registerWithPolicyMaker
1023 @abstract Implemented by controller drivers to register with
1024 the power management policy-maker.
1025 @discussion Drivers that are able to power manage their hardware
1026 should override this method and register with the policy-maker
1027 provided by calling IOService::registerPowerDriver().
1028 IONetworkController will call this method before the initial
1029 attempt is made to attach a client.
1030 @param policyMaker The policy-maker chosen to manage power for
1031 this network controller.
1032 @result kIOReturnSuccess on success, kIOReturnUnsupported if the
1033 driver does not support power management, or an appropriate error
1034 return code. The default return is kIOReturnUnsupported. */
1036 virtual IOReturn
registerWithPolicyMaker(IOService
* policyMaker
);
1038 /*! @function createWorkLoop
1039 @abstract Method called by IONetworkController prior to the initial
1041 @discussion Before IONetworkController calls getWorkLoop() in its
1042 start() method, it will call createWorkLoop() to make sure that a
1043 subclass that wants to create a workloop, will do so before its
1045 @result True to indicate success, false otherwise. Returning false
1046 will fail IONetworkController::start(). */
1048 virtual bool createWorkLoop();
1050 /*! @function prepare
1051 @abstract Prepare the controller before an IOService is created and
1052 attached as a client.
1053 @discussion This method is called by attachInterface() or
1054 attachDebuggerClient() to prepare the controller before the new client
1055 object is attached. This method will call publishProperties() to publish
1056 controller capabilities and properties that may be used by client objects.
1057 However, publishProperties() will be called only once, even if prepare()
1058 is called multiple times. This method call is synchronized by the
1060 @result kIOReturnSuccess on success, or an error code otherwise.
1061 Returning an error will fail the client attach. */
1063 virtual IOReturn
prepare();
1065 /*! @function publishProperties
1066 @abstract Publish controller properties and capabilities.
1067 @discussion Called by IONetworkController to discover controller
1068 properties, and publish them to the property table in the I/O Kit
1069 registry. This method is called once by prepare().
1070 @result true if all properties were discovered and published
1071 successfully, false otherwise. Returning false will prevent client
1072 objects from attaching to the controller, since a property that
1073 a client relies upon may be missing. */
1075 virtual bool publishProperties();
1077 /*! @function getCommandClient
1078 @abstract Get the command client object.
1079 @discussion Methods called on the workloop context to service a
1080 client request can call this method to get the client object which
1081 initiated the command.
1082 @result The command client. If the caller is not running on the
1083 workloop thread, or if the thread does not have the workloop's gate
1084 closed, then 0 is returned. */
1086 virtual OSObject
* getCommandClient() const;
1088 /*! @function handleOpen
1089 @abstract Handle a client open.
1090 @discussion Handle a client open on the controller object. IOService
1091 calls this method with the arbitration lock held. Subclasses
1092 should not override this method.
1093 @param client The client that is attempting to open the controller.
1094 @param options Not used. See IOService.
1095 @param argument Not used. See IOService.
1096 @result true to accept the client open, false to refuse it. */
1098 virtual bool handleOpen(IOService
* client
,
1099 IOOptionBits options
,
1102 /*! @function handleClose
1103 @abstract Handle a client close.
1104 @discussion Handle a close from one of the client objects. IOService
1105 calls this method with the arbitration lock held. Subclasses
1106 should not override this method.
1107 @param client The client that is closing the controller.
1108 @param options Not used. See IOService. */
1110 virtual void handleClose(IOService
* client
, IOOptionBits options
);
1112 /*! @function handleIsOpen
1113 @abstract Query whether a client has an open on the controller.
1114 @discussion This method is always called by IOService with the
1115 arbitration lock held. Subclasses should not override this method.
1116 @result true if the specified client, or any client if none (0) is
1117 specified, presently has an open on this object. */
1119 virtual bool handleIsOpen(const IOService
* client
) const;
1121 /*! @function enable
1122 @abstract A request from an interface client to enable the controller.
1123 @discussion Called by an interface client to enable the controller.
1124 Upon receiving this command, the controller driver must bring up the
1125 hardware and become ready to transmit and receive packets. A driver
1126 should also delay the allocation of most runtime resources until this
1127 method is called in order to conserve system resources. This method call
1128 is synchronized by the workloop's gate.
1129 @param interface The interface client object that requested the enable.
1130 @result kIOReturnUnsupported. Drivers that override this method must
1131 return kIOReturnSuccess on success, or an error code otherwise. */
1133 virtual IOReturn
enable(IONetworkInterface
* interface
);
1135 /*! @function disable
1136 @abstract A request from an interface client to disable the controller.
1137 @discussion Called by an interface client to disable the controller.
1138 This method should stop the hardware and disable hardware interrupt
1139 sources. Any resources allocated by enable() should also be deallocated.
1140 This method call is synchronized by the workloop's gate.
1141 @param interface The interface object that requested the disable.
1142 @result kIOReturnUnsupported. Drivers that override this method must
1143 return kIOReturnSuccess on success, or an error code otherwise. */
1145 virtual IOReturn
disable(IONetworkInterface
* interface
);
1147 /*! @function attachInterface
1148 @abstract Attach a new interface client object.
1149 @discussion Create a new interface object and attach it to the
1150 controller. The createInterface() method is called to perform
1151 the interface allocation and initialization, followed by a call to
1152 configureInterface() to configure it. Subclasses can override those
1153 two methods to customize the interface client attached. Drivers will
1154 usually call this method from start(), after they are ready to process
1155 client requests. Since most drivers will have a single interface
1156 client, this method will likely be called only once.
1157 @param interface Upon success (return value is true), the
1158 interface object will be written to the handle provided.
1159 @param doRegister If true, then registerService() is called to register
1160 the interface, which will trigger the matching process, and will ultimately
1161 cause the interface to become registered with the data link layer.
1162 Drivers that wish to delay the registration can set doRegister to false,
1163 and call registerService() on the interface object when the controller
1164 becomes ready. This allows the driver to attach an interface without
1165 making its services available to the rest of the system.
1166 @result true on success, false otherwise. */
1168 virtual bool attachInterface(IONetworkInterface
** interface
,
1169 bool doRegister
= true);
1171 /*! @function detachInterface
1172 @abstract Detach an interface client object.
1173 @discussion This method will verify that the object provided is indeed
1174 an IONetworkInterface instance, and then call its terminate() method.
1175 Note that an interface object will close and detach from its
1176 controller after the data link layer has removed all references to
1177 all data structures exposed by the interface. The interface object
1178 should be released following this call.
1179 @param interface An interface object to be detached and terminated.
1180 @param sync If true, the interface is terminated synchronously.
1181 This may cause this method to block for an indeterminate
1184 virtual void detachInterface(IONetworkInterface
* interface
,
1187 /*! @function createInterface
1188 @abstract Create a new network interface object.
1189 @discussion This method is called by attachInterface() to perform
1190 allocation and initialization of a new interface object. A subclass of
1191 IONetworkController must implement this method and return a matching
1192 interface object. For example, IOEthernetController's implementation
1193 will return an IOEthernetInterface object when createInterface() is
1195 @result A newly allocated and initialized interface object. */
1197 virtual IONetworkInterface
* createInterface() = 0;
1199 /*! @function configureInterface
1200 @abstract Configure a newly created network interface object.
1201 @discussion Configure an interface object that was created by
1202 createInterface(). Subclasses can override this method to customize,
1203 and examine the interface object that will be attached to the
1204 controller as a client.
1205 @param interface The interface object to be configured.
1206 @result true if the operation was successful, false otherwise
1207 (this will cause attachInterface() to fail and return 0). */
1209 virtual bool configureInterface(IONetworkInterface
* interface
);
1211 /*! @function createOutputQueue
1212 @abstract Create an IOOutputQueue to handle output packet queueing,
1213 and also to resolve contention for the controller's transmitter from
1214 multiple client threads.
1215 @discussion Called by start() to create an IOOutputQueue object to
1216 handle output packet queueing. The default implementation will always
1217 return 0, hence no output queue will be created. A driver may override
1218 this method and return a subclass of IOOutputQueue. IONetworkController
1219 will keep a reference to the queue created, and will release this
1220 object when IONetworkController is freed. Also see getOutputQueue().
1221 @result A newly allocated and initialized IOOutputQueue object. */
1223 virtual IOOutputQueue
* createOutputQueue();
1225 /*! @function enable
1226 @abstract An enable request from an IOKernelDebugger client.
1227 @discussion Drivers that provide debugging support may either override
1228 this method and setup the hardware to support the polled-mode send and
1229 receive methods; receivePacket() and sendPacket(). Or override the base
1230 enable() and disable() methods that take an IOService argument.
1231 @param debugger The IOKernelDebugger client requesting the enable.
1232 @result kIOReturnSuccess. Drivers must return kIOReturnSuccess
1233 on success, or an error otherwise. */
1235 virtual IOReturn
enable(IOKernelDebugger
* debugger
);
1237 /*! @function disable
1238 @abstract A disable request from an IOKernelDebugger client.
1239 @discussion Drivers that provide debugging support may either override
1240 this method to disable support for the polled-mode send and receive
1241 methods. Or override the base enable() and disable() methods that
1242 take an IOService argument.
1243 @param debugger The IOKernelDebugger client requesting the disable.
1244 @result kIOReturnSuccess. Drivers must return kIOReturnSuccess
1245 on success, or an error otherwise. */
1247 virtual IOReturn
disable(IOKernelDebugger
* debugger
);
1249 /*! @function attachDebuggerClient
1250 @abstract Attach a new IOKernelDebugger client object.
1251 @discussion Allocate an IOKernelDebugger object and attach it as
1252 a client. Having a debugger client implies that the controller
1253 supports kernel debugging, and therefore must implement the two
1254 polled-mode methods that are called by the debugger client. See
1255 sendPacket() and receivePacket(). Only a single debugger client
1256 should be attached to each controller.
1257 @param debuggerP A handle that will return the new
1258 IOKernelDebugger object created.
1259 @result true on success, false otherwise. */
1261 virtual bool attachDebuggerClient(IOKernelDebugger
** debuggerP
);
1263 /*! @function detachDebuggerClient
1264 @abstract Detach an IOKernelDebugger client object.
1265 @discussion Detach and terminate the IOKernelDebugger client object
1266 provided. A synchronous termination is issued, and this method will
1267 return after the debugger client has been terminated. The debugger
1268 client should be released following this call.
1269 @param debugger The IOKernelDebugger object to be detached and
1270 terminated. If the argument provided is NULL or is not an
1271 IOKernelDebugger, this method will return immediately. */
1273 virtual void detachDebuggerClient(IOKernelDebugger
* debugger
);
1275 /*! @function reserveDebuggerLock
1276 @abstract Take the global debugger lock.
1277 @discussion This method should not be used. Instead, call the
1278 lock() method provided by IOKernelDebugger. */
1280 void reserveDebuggerLock();
1282 /*! @function releaseDebuggerLock
1283 @abstract Release the global debugger lock.
1284 @discussion This method should not be used. Instead, call the
1285 unlock() method provided by IOKernelDebugger. */
1287 void releaseDebuggerLock();
1289 /*! @function receivePacket
1290 @abstract Debugger polled-mode receive handler.
1291 @discussion This method must be implemented by a driver that supports
1292 kernel debugging. After a debugger client has been attached through
1293 attachDebuggerClient(), this method will be called by the debugger
1294 client to poll for a incoming packet when the kernel debugger is active.
1295 This method may be called from the primary interrupt context, and the
1296 implementation must avoid any memory allocation, and must never block.
1297 The receivePacket() method in IONetworkController is used as a placeholder,
1298 it performs no useful action, and should not be called. A driver that
1299 attaches a debugger client must override this method.
1300 @param pkt Address of a receive buffer where the received packet should
1301 be stored. This buffer has room for 1518 bytes.
1302 @param pktSize Address where the number of bytes received must be
1303 recorded. Set this to zero if no packets were received during
1304 the timeout interval.
1305 @param timeout The maximum amount of time in milliseconds to poll for
1306 a packet to arrive before this method must return. */
1308 virtual void receivePacket(void * pkt
, UInt32
* pktSize
, UInt32 timeout
);
1310 /*! @function sendPacket
1311 @abstract Debugger polled-mode transmit handler.
1312 @discussion This method must be implemented by a driver that supports
1313 kernel debugging. After a debugger client has been attached through
1314 attachDebuggerClient(), this method will be called by the debugger
1315 to send an outbound packet only when the kernel debugger is active.
1316 This method may be called from the primary interrupt context, and the
1317 implementation must avoid any memory allocation, and must never block.
1318 The sendPacket() method in IONetworkController is used as a placeholder,
1319 it performs no useful action, and should not be called. A driver that
1320 attaches a debugger client must override this method.
1321 @param pkt Pointer to a transmit buffer containing the packet to be
1322 sent on the network.
1323 @param pktSize The size of the transmit buffer in bytes. */
1325 virtual void sendPacket(void * pkt
, UInt32 pktSize
);
1327 // Virtual function padding
1328 OSMetaClassDeclareReservedUnused( IONetworkController
, 0);
1329 OSMetaClassDeclareReservedUnused( IONetworkController
, 1);
1330 OSMetaClassDeclareReservedUnused( IONetworkController
, 2);
1331 OSMetaClassDeclareReservedUnused( IONetworkController
, 3);
1332 OSMetaClassDeclareReservedUnused( IONetworkController
, 4);
1333 OSMetaClassDeclareReservedUnused( IONetworkController
, 5);
1334 OSMetaClassDeclareReservedUnused( IONetworkController
, 6);
1335 OSMetaClassDeclareReservedUnused( IONetworkController
, 7);
1336 OSMetaClassDeclareReservedUnused( IONetworkController
, 8);
1337 OSMetaClassDeclareReservedUnused( IONetworkController
, 9);
1338 OSMetaClassDeclareReservedUnused( IONetworkController
, 10);
1339 OSMetaClassDeclareReservedUnused( IONetworkController
, 11);
1340 OSMetaClassDeclareReservedUnused( IONetworkController
, 12);
1341 OSMetaClassDeclareReservedUnused( IONetworkController
, 13);
1342 OSMetaClassDeclareReservedUnused( IONetworkController
, 14);
1343 OSMetaClassDeclareReservedUnused( IONetworkController
, 15);
1344 OSMetaClassDeclareReservedUnused( IONetworkController
, 16);
1345 OSMetaClassDeclareReservedUnused( IONetworkController
, 17);
1346 OSMetaClassDeclareReservedUnused( IONetworkController
, 18);
1347 OSMetaClassDeclareReservedUnused( IONetworkController
, 19);
1348 OSMetaClassDeclareReservedUnused( IONetworkController
, 20);
1349 OSMetaClassDeclareReservedUnused( IONetworkController
, 21);
1350 OSMetaClassDeclareReservedUnused( IONetworkController
, 22);
1351 OSMetaClassDeclareReservedUnused( IONetworkController
, 23);
1352 OSMetaClassDeclareReservedUnused( IONetworkController
, 24);
1353 OSMetaClassDeclareReservedUnused( IONetworkController
, 25);
1354 OSMetaClassDeclareReservedUnused( IONetworkController
, 26);
1355 OSMetaClassDeclareReservedUnused( IONetworkController
, 27);
1356 OSMetaClassDeclareReservedUnused( IONetworkController
, 28);
1357 OSMetaClassDeclareReservedUnused( IONetworkController
, 29);
1358 OSMetaClassDeclareReservedUnused( IONetworkController
, 30);
1359 OSMetaClassDeclareReservedUnused( IONetworkController
, 31);
1362 inline const IONetworkMedium
* IONetworkController::getCurrentMedium() const
1364 return getSelectedMedium();
1367 inline bool IONetworkController::setCurrentMedium(const IONetworkMedium
* medium
)
1369 return setSelectedMedium(medium
);
1372 #endif /* defined(KERNEL) && defined(__cplusplus) */
1374 #endif /* !_IONETWORKCONTROLLER_H */