New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

3ware RAID driver


Post Reply New Thread Subscribe

 
Thread Tools
Das_Human

 
Member Since: Aug 05, 2009
Location: Vilnius
Posts: 4
Das_Human is on a distinguished road

Das_Human is offline
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
File Type: zip AMCC3ware7xxx8xxx.zip (657.5 KB, 4 views)
QUOTE Thanks
heathflic

 
Member Since: Aug 05, 2009
Posts: 1
heathflic is on a distinguished road

heathflic is offline
Hi guys..Glad to be here and looking forward to learning some new stuff!
QUOTE Thanks
Das_Human

 
Member Since: Aug 05, 2009
Location: Vilnius
Posts: 4
Das_Human is on a distinguished road

Das_Human is offline
Me too!
QUOTE Thanks
Das_Human

 
Member Since: Aug 05, 2009
Location: Vilnius
Posts: 4
Das_Human is on a distinguished road

Das_Human is offline
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
QUOTE Thanks
Das_Human

 
Member Since: Aug 05, 2009
Location: Vilnius
Posts: 4
Das_Human is on a distinguished road

Das_Human is offline
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!
QUOTE Thanks

Post Reply New Thread Subscribe


« Need help working with basic C in xcode | Using darwinports/development libraries »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Networking Printers FAQ cwa107 Internet, Networking, and Wireless 45 04-10-2010 09:43 AM
Mac Pro/Macbook Pro Joint Ventures jcrew2 Movies and Video 7 06-15-2009 08:16 PM
Networking Printers FAQ cwa107 Internet, Networking, and Wireless 22 01-20-2009 03:35 PM
Epson 1160 scarletjames Other Hardware and Peripherals 9 07-19-2008 02:44 AM
need a new sonnet duel 1.8 processor bluesdudeo Apple Desktops 12 05-26-2006 01:57 PM

All times are GMT -4. The time now is 02:23 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?