Results 1 to 5 of 5
  1. #1


    Member Since
    Aug 05, 2009
    Location
    Vilnius
    Posts
    4
    Unhappy 3ware RAID driver
    Hi
    I'm new to programming, for OS X in particular (not the IT itself). Any way I'm forced to make the first steps towards.
    The reason is an urge need in driver for a 3ware Escalade 7xxx/8xxx PATA/SATA-RAID Controller. 3ware officially doesn't provide any. Only 9xxx cards are supported. My idea was to write the missing driver using AMCC3ware9000.kext as reference. The results are not as good as expected. I made following steps with Xcode:
    1) Composed new info.plist (based on the info.plist from AMCC3ware9000.kext)
    2) Composed .h and .cpp source (based on sample codes I've found in WEB)
    3) Compiled binary
    4) Loaded kext (the kext loads with no problems or bugs, but does nothing else)
    There is an output on the system boot:
    Aug 0 00:00:00 localhost kernel[0]: com_amcc_3ware_AMCC3ware7xxx8xxxController[0x665db00]::probe(0x663b380, 0x5ba23f0c)
    Aug 0 00:00:00 localhost kernel[0]: com_amcc_3ware_AMCC3ware7xxx8xxxController[0x665db00]::start(0x663b380)

    As far as I understand the *UserClient.h *UserClient.cpp are needed in this case for the driver to be fully functional. The is the point I can't go any further. The *UserClient.h *UserClient.cpp sources I've managed to create, doesn't compile. Compilation gives 56 (or so) errors. To make things simpler, I've attached the Xcode project. I need an advice on debugging and recomposing the source (in other words what needs to be changed or modified).
    Attached Files Attached Files

  2. #2


    Member Since
    Aug 05, 2009
    Posts
    1
    Just wanted to say hello
    Hi guys..Glad to be here and looking forward to learning some new stuff!

  3. #3


    Member Since
    Aug 05, 2009
    Location
    Vilnius
    Posts
    4
    :)
    Me too!

  4. #4


    Member Since
    Aug 05, 2009
    Location
    Vilnius
    Posts
    4
    Further development
    I'm currently developing newer driver version based on Linux/BSD and some other sources. The project is currently in debugging stage. The question is what exactly cosign those bugs? There is an error log with "problematic" code lines.

    Line Location TemagoCommand.cpp:350: note: candidates are: virtual void com_Inc_TemagoCommand::complete(bool)
    Line Location TemagoCommand.cpp:352: error: 'IOStorageCompletion' was not declared in this scope
    Line Location TemagoCommand.cpp:352: error: expected `;' before 'localCompletion'
    Line Location TemagoCommand.cpp:379: error: 'localCompletion' was not declared in this scope
    Line Location TemagoCommand.cpp:379: error: 'completion' was not declared in this scope
    Line Location TemagoCommand.cpp:392: error: 'IOStorage' has not been declared
    Line Location TemagoCommand.cpp:394: error: no matching function for call to 'com_Inc_TemagoCommand::complete(<type error>, int, long long unsigned int)'
    Code:
    // Handle completion of a command
    //
    // Note that this may be called either inside or outside the gate.
    void
    line 350 self::complete(bool postSuccess)
    {
        IOStorageCompletion localCompletion;
        IOByteCount	actualByteCount;
        bool	result;
    
        postResult = postSuccess;
        
        command->complete(kIODirectionOutIn);
        dequeueActive();
        
        // auto-complete if we have a parameter buffer
        if (paramBuffer != NULL)
    	paramBuffer->complete(kIODirectionOutIn);
    
        // if we have a copy buffer, finalise it
        if (copyBuffer != NULL)
    	finishCopyBuffer();
    
        // data buffers for SET_PARAM auto-release here
        if (commandPtr->generic.opcode == TWE_OP_SET_PARAM)
    	releaseParamBuffer();
    
        // Wake up a sleeping owner.
        // Owner is responsible for returning the command.
        if (waitingOwner) {
    	controller->wakeCommand(this);
        } else {
    	// save because we are going to release command first
    	localCompletion = completion;
    	actualByteCount = byteCount;
    	result = getResult();
    	if (!result) {
    	    debug(2, "I/O error 0x%02x/ox%02x", (uint)commandPtr->generic.status, (uint)commandPtr->generic.flags);
    	    print();
    	}
    	// Command submitter is gone, completion may know nothing
    	// about our command, so we have to tear it down it ourselves.
    	releaseDataBuffer();
    	returnCommand();
    
    	// Invoke completion
    	IOStorage::complete(localCompletion,
    		     result ? kIOReturnSuccess : kIOReturnError,
    line 394	     result ? byteCount : 0);
        }
    }
    Line Location TemagoCommand.cpp:562: error: 'IOStorageCompletion' has not been declared
    Line Location TemagoCommand.cpp:577: error: 'completion' was not declared in this scope
    Code:
    ////////////////////////////////////////////////////////////////////////////////
    // Build an I/O command
    void
    self::makeReadWrite(int unit,
    		    IOMemoryDescriptor *buf,
    		    UInt32 block,
    		    UInt32 nblks,
    line 562	    IOStorageCompletion withCompletion)
    {
    
        // select opcode
        if (buf->getDirection() == kIODirectionOut) {
    	commandPtr->io.opcode = TWE_OP_WRITE;
        } else {
    	commandPtr->io.opcode = TWE_OP_READ;
        }
        commandPtr->io.size = 3;
        commandPtr->io.host_unit = unit;
        commandPtr->io.status = 0;
        commandPtr->io.flags = 0;
        commandPtr->io.block_count = OSSwapHostToLittleInt16((UInt16)nblks);
        commandPtr->io.lba = OSSwapHostToLittleInt32(block);
    line 577    completion = withCompletion;
        setDataBuffer(buf);
    }
    End of part one

  5. #5


    Member Since
    Aug 05, 2009
    Location
    Vilnius
    Posts
    4
    Futher development
    Part two
    Line Location TemagoCommand.h:79: error: 'IOStorageCompletion' has not been declared
    Line Location TemagoCommand.h:134: error: 'IOStorageCompletion' does not name a type
    Code:
        // Command mutators
        //
        virtual void	makeInitConnection(UInt32 credits);
        virtual void	makeGetParam(int table, int param, size_t size);
        virtual void	makeSetParam(int table, int param, UInt8 value);
        virtual void	makeSetParam(int table, int param, UInt16 value);
        virtual void	makeSetParam(int table, int param, UInt32 value);
        virtual void	makeSetParam(int table, int param, void *vp, size_t vsize);
        virtual void	makeFlush(int unit);
        virtual void	makeReadWrite(int unit, IOMemoryDescriptor *buf, UInt32 block, UInt32 nblks,
    line 79			       IOStorageCompletion withCompletion);
        virtual void	makePowerSave(int state);	// 0 = spin down
    
        // temporary buffer, used to align unaligned requests
        IOBufferMemoryDescriptor	*copyBuffer;
        IOMemoryDescriptor		*realBuffer;
    
        // completion, set by ::makeReadWrite
    line 134    IOStorageCompletion		completion;
    Line Location TemagoController.cpp:993: error: 'IOStorageCompletion' has not been declared
    Line Location TemagoController.cpp:1068: error: 'class com_Inc_TemagoDrive' has no member named 'isOpen'
    Line Location TemagoController.cpp:1075: error: 'class com_Inc_TemagoDrive' has no member named 'terminate'
    Line Location TemagoController.cpp:1152: error: 'class com_Inc_TemagoDrive' has no member named 'init'
    Line Location TemagoController.cpp:1155: error: 'class com_Inc_TemagoDrive' has no member named 'release'
    Line Location TemagoController.cpp:1164: error: 'class com_Inc_TemagoDrive' has no member named 'registerService'
    Line Location TemagoController.cpp:1169: error: 'class com_Inc_TemagoDrive' has no member named 'release'
    Code:
    //
    IOReturn
    self::doAsyncReadWrite(int unit,
    		       IOMemoryDescriptor *buffer,
    		       UInt32 block,
    		       UInt32 nblks,
    line 993	       IOStorageCompletion completion)
    {
        TemagoCommand	*ec;
        bool		result;
    
        // check that drives are spun up
        checkPowerState();
    
        // do I/O
        ec = getCommand();
        ec->makeReadWrite(unit, buffer, block, nblks, completion);
        result = runAsynchronousCommand(ec);
        if (!result)
    	ec->returnCommand();
    
        return(result ? kIOReturnSuccess : kIOReturnIOError);
    }
    
    // Request termination of a given unit
    
    IOReturn
    self::doRemoveUnit(int unit, bool force)
    {
        TemagoDrive	*pUnit;
    
        // find unit and validate
        pUnit = logicalUnit[unit];
        if (!pUnit)
    	return(kIOReturnNoDevice);
    line 1068    if (!force && pUnit->isOpen()) {
    	error("attempt to remove busy unit %d", unit);
    	return(kIOReturnBusy);
        }
    
        // valid, terminate unit
        debug(3, "unit %d unbusy, terminating", unit);
    line 1075    pUnit->terminate();
        logicalUnit[unit] = NULL;
        return(kIOReturnSuccess);
    }
        // instantiate the drive
        if ((logicalUnit[unit] = new TemagoDrive) == NULL) {
    	error("could not instantiate TemagoDrive for unit %d", unit)
    	return(kIOReturnNoMemory);
        }
        logicalUnit[unit]->init(NULL);
        if (!logicalUnit[unit]->attach(this)) {
    	error("could not attach TemagoDrive for unit %d", unit);
    line 1155	logicalUnit[unit]->release();
    	logicalUnit[unit] = NULL;
    	return(kIOReturnError);
        }
        logicalUnit[unit]->setUnit(unit);
        logicalUnit[unit]->setSize(size);
        logicalUnit[unit]->setConfiguration(unitType);
    
        // all done, register unit for discovery
    line 1164    logicalUnit[unit]->registerService();
    
        // The IORegistry has retained the unit, so we don't here.
        // It might make sense for us to keep a reference on it
        // just in case...
        logicalUnit[unit]->release();
        
        return(kIOReturnSuccess);
    }
    Line Location TemagoController.h:120: error: 'IOStorageCompletion' has not been declared
    Code:
        // TemagoDrive interface
        //
        virtual char		*getControllerName(void);
        virtual char		*getControllerVersion(void);
        virtual IOReturn		doAsyncReadWrite(int unit, IOMemoryDescriptor *buffer,
    line 120				       UInt32 block, UInt32 nblks, IOStorageCompletion completion);
        virtual IOReturn		doSynchronizeCache(int unit);
    Line Location TemagoDrive.h:40: error: expected class-name before '{' token
    Code:
    class TemagoController;
    
    class TemagoDrive : public IOBlockStorageDevice
    line 40{
        OSDeclareDefaultStructors(TemagoDrive);
    
    public:
        // superclass overrides
    Line Location TemagoDrive.h:54: error: 'IOStorageCompletion' has not been declared
    Code:
        // IOBlockStorageDevice protocol
    line 54    virtual IOReturn	doAsyncReadWrite(IOMemoryDescriptor *buffer, UInt32 block, UInt32 nblks, IOStorageCompletion completion);
        virtual IOReturn	doEjectMedia(void);
        virtual IOReturn	doFormatMedia(UInt64 byteCapacity);
        virtual UInt32	doGetFormatCapacities(UInt64 *capacities,  UInt32 capacitiesMaxCount) const;
    The end. Sorry for such a long story Just trying to make a things clearer. Is it possible to identify the problem? Could the wrong info.plist values do such a mess?
    Any help is appreciated!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. RAID 01 or RAID 10 with OWC twin SSD's + 2TB HDD
    By MercedesTech in forum Apple Desktops
    Replies: 2
    Last Post: 01-21-2012, 12:44 AM
  2. Breaking a RAID 1, Creating Raid 0
    By SarahS in forum Other Hardware and Peripherals
    Replies: 0
    Last Post: 12-03-2008, 03:16 PM
  3. Hardware RAID or Mac OS X RAID?
    By tonyd7 in forum Other Hardware and Peripherals
    Replies: 0
    Last Post: 12-01-2008, 06:55 PM
  4. 2 X 10K Drive Raid 0 vs Single 15K Non-Raid
    By quadra in forum Apple Desktops
    Replies: 0
    Last Post: 11-24-2007, 12:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •