Annotation of XNU/iokit/Drivers/usb/drvAppleOHCI/AppleOHCI_Optifixes.cpp, revision 1.1

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) 1998 Apple Computer, Inc.  All rights reserved.
        !            24:  *
        !            25:  * HISTORY
        !            26:  *
        !            27:  */
        !            28: 
        !            29: 
        !            30: #include "AppleOHCI.h"
        !            31: #include <libkern/OSByteOrder.h>
        !            32: 
        !            33: #define nil (0)
        !            34: 
        !            35: #define super IOUSBController
        !            36: #define self this
        !            37: 
        !            38: void AppleOHCI::DoOptiFix(OHCIEndpointDescriptorPtr pHead)
        !            39: {
        !            40:     OHCIEndpointDescriptorPtr pED;
        !            41:     OHCIGeneralTransferDescriptorPtr pTD;
        !            42:     int i = 0;
        !            43: 
        !            44: //  DebugStr ((ConstStr255Param) "DoOptiFix");
        !            45: 
        !            46:     for (i=0; i<27; i++) {
        !            47:         // allocate ED
        !            48:         pED = OHCIUIMAllocateED();
        !            49:         pED->pLogicalNext = nil;
        !            50:         //make ED and FA = 0
        !            51:         pED->flags = 0;
        !            52:         pTD = OHCIUIMAllocateTD();
        !            53:         pED->tdQueueHeadPtr = OSSwapInt32 ((UInt32) pTD->pPhysical);
        !            54:         pTD->nextTD = pED->tdQueueTailPtr;
        !            55:         pTD->pEndpoint = pED;
        !            56:         pTD->pType = kOHCIOptiLSBug;
        !            57:         pED->tdQueueTailPtr = OSSwapInt32 ((UInt32) pTD->pPhysical);
        !            58: 
        !            59:         pED->nextED = pHead->nextED;
        !            60:         pHead->nextED = OSSwapInt32((UInt32) pED->pPhysical);
        !            61:         pHead = pED;
        !            62:     }
        !            63: }
        !            64: 
        !            65: void AppleOHCI::OptiLSHSFix(void)
        !            66: {
        !            67: 
        !            68: //  Do Opti Errata stuff here!!!!!!
        !            69:     int i;
        !            70:     OHCIIntHeadPtr              pInterruptHead;
        !            71:     OHCIEndpointDescriptorPtr   pControlED;
        !            72:     OHCIRegistersPtr            pOHCIRegisters;
        !            73:     UInt32                     controlState;
        !            74: 
        !            75:     pOHCIRegisters = pOHCIUIMData->pOHCIRegisters;
        !            76: 
        !            77:     pOHCIUIMData->OptiOn = 1;
        !            78: 
        !            79:     //Turn off list processing
        !            80:     controlState = OSReadLittleInt32(&pOHCIRegisters->hcControl, 0);
        !            81:     OSWriteLittleInt32(&pOHCIRegisters->hcControl, 0, 
        !            82:        kOHCIFunctionalState_Operational << kOHCIHcControl_HCFSPhase);
        !            83: 
        !            84:     // wait a millisecond
        !            85:     IOSleep(2);             
        !            86: 
        !            87:     pInterruptHead = pOHCIUIMData->pInterruptHead;
        !            88: 
        !            89:     // add dummy EDs to 8ms interrupts
        !            90:     for ( i = 0; i< 8; i++)
        !            91:         DoOptiFix(pInterruptHead[48 + i].pHead);
        !            92: 
        !            93:     //Assign Tail of Control to point to head of Bulk
        !            94: 
        !            95:     pControlED = (OHCIEndpointDescriptorPtr) pOHCIUIMData->pControlTail;
        !            96:     pControlED->nextED = pOHCIRegisters->hcBulkHeadED;
        !            97: 
        !            98:     // add dummy EDs to end of Control
        !            99:     DoOptiFix( (OHCIEndpointDescriptorPtr) pOHCIUIMData->pControlTail);
        !           100: 
        !           101:     // turn on everything previous but Bulk
        !           102:     controlState &= ~kOHCIHcControl_BLE;
        !           103:     OSWriteLittleInt32(&pOHCIRegisters->hcControl, 0, controlState);
        !           104: 
        !           105:     //End of Opti Fix
        !           106: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.