Initio 9100u -- Mike Christie's 2.6.0-test11 Patch -- Kernel Errors
First off..
Mike, thank you for your work on this driver. James, thank you for pointing out the patch.
I finally had time to take the server down and recompile with vga mode selection support.. so, with 80x60, the entire scsi setup stays on the screen at the time of panic.. here we go:
i91u: PCI Base=0xEC00, IRQ=12, BIOS=0xC8000, SCSI ID=7
i91u: Reset SCSI Bus ...
ERROR: SCSI host `INI9100U' has no error handling
ERROR: This is not a safe way to run your SCSI host
ERROR: The error handling must be added to this driver
Call Trace: [<c029cfd1>] scsi_host_alloc+0x291/0x2a0 [<c029cff1>] scsi_register+0x11/0x60 [<c02a4ed1>] i91u_detect+0x1d1/0x3c0 [<c0290e28>] ide_register_driver+0xe8/0x120 [<c03628b3>] init_this_scsi_driver+0x53/0x100 [<c035276c>] do_initcalls+0x2c/0xa0 [<c01050ed>] init+0x2d/0x140 [<c01050c0>] init+0x0/0x140 [<c0107329>] kernel_thread_helper+0x5/0x1c
It then goes on to ID the drive correctly, and loads the sd driver, which again IDs the drive correctly.. and we get:
SCSI device sda: 17783240 512-byte hdwr sectors (9105 MB) SCSI device sda: drive cache: write back /dev/scsi/host0/bus0/target1/lun0: unknown partition table Attached scsi disk sda at scsi0, channel 0, id 1, lun 0
which results in the end:
VFS: Cannot open root device "801" or sda1 Please append a correct "root=" boot option kernel panic: VFS: Unable to mount root fs on sda1
Hope this helps in the debugging.. as you may guess, the whole box works absolutely fine under 2.4.23...
- James Daniel
Quoted 5 lines · James Daniel
i91u: PCI Base=0xEC00, IRQ=12, BIOS=0xC8000, SCSI ID=7
i91u: Reset SCSI Bus ...
ERROR: SCSI host `INI9100U' has no error handling
ERROR: This is not a safe way to run your SCSI host
ERROR: The error handling must be added to this driver
Quoted 10 lines
Call Trace: [<c029cfd1>] scsi_host_alloc+0x291/0x2a0 [<c029cff1>] scsi_register+0x11/0x60 [<c02a4ed1>] i91u_detect+0x1d1/0x3c0 [<c0290e28>] ide_register_driver+0xe8/0x120 [<c03628b3>] init_this_scsi_driver+0x53/0x100 [<c035276c>] do_initcalls+0x2c/0xa0 [<c01050ed>] init+0x2d/0x140 [<c01050c0>] init+0x0/0x140 [<c0107329>] kernel_thread_helper+0x5/0x1c
This one's expected: although the driver was made compilable and converted to the new dma API, it still needs a new error handler, which is what the complaint is about.
Quoted 7 lines
It then goes on to ID the drive correctly, and loads the sd driver, which again IDs the drive correctly.. and we get:
SCSI device sda: 17783240 512-byte hdwr sectors (9105 MB) SCSI device sda: drive cache: write back
/dev/scsi/host0/bus0/target1/lun0: unknown partition table Attached scsi disk sda at scsi0, channel 0, id 1, lun 0
This one's really strange, because clearly the INQUIRY and the READ_CAPACITY both succeeded and returned apparently good values. The READ10 to the DOS parition sector has failed (with no errors).
The only difference is that the READ10 is generated in the partition code (via read_dev_sector), so it will be a sg read (probably with scsi_device->use_sg set to 1)...I'm travelling today, so if Mike hasn't found the problem by the tomorrow, I'll take a look.
James
Quoted 10 lines
Quoted 8 lines
It then goes on to ID the drive correctly, and loads the sd driver, which again IDs the drive correctly.. and we get:
SCSI device sda: 17783240 512-byte hdwr sectors (9105 MB) SCSI device sda: drive cache: write back
/dev/scsi/host0/bus0/target1/lun0: unknown partition table Attached scsi disk sda at scsi0, channel 0, id 1, lun 0
Quoted 9 lines
This one's really strange, because clearly the INQUIRY and the
READ_CAPACITYboth succeeded and returned apparently good values. The READ10 to the DOS parition sector has failed (with no errors).The only difference is that the READ10 is generated in the partition code (via
read_dev_sector), so it will be a sg read (probably withscsi_device->use_sgset to 1)...I'm travelling today, so if Mike hasn't found the problem by the tomorrow, I'll take a look.
For use_sg == 1 the driver was doing this:
- if (SCpnt->use_sg == 1) { /* If only one entry in the list *//* treat it as regular I/O */
- pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->address);
- TotalLen = pSrbSG->length;
- pSCB->SCB_SGLen = 0;
but I had changed it to do sg io instead not knowing why it needed to treat it is as regular I/O. I will send a new patch in the next mail.
mike
Quoted 28 lines · Mike Christie
Quoted 10 lines
Quoted 8 lines
It then goes on to ID the drive correctly, and loads the sd driver, which again IDs the drive correctly.. and we get:
SCSI device sda: 17783240 512-byte hdwr sectors (9105 MB) SCSI device sda: drive cache: write back
/dev/scsi/host0/bus0/target1/lun0: unknown partition table Attached scsi disk sda at scsi0, channel 0, id 1, lun 0Quoted 9 lines
This one's really strange, because clearly the INQUIRY and the
READ_CAPACITYboth succeeded and returned apparently good values. The READ10 to the DOS parition sector has failed (with no errors).The only difference is that the READ10 is generated in the partition code (via
read_dev_sector), so it will be a sg read (probably withscsi_device->use_sgset to 1)...I'm travelling today, so if Mike hasn't found the problem by the tomorrow, I'll take a look.For
use_sg== 1 the driver was doing this:(quoted diff) +0
-1- if (SCpnt->use_sg == 1) { /* If only one entry in the list *//*treat it as regular I/O */
(quoted diff) +0
-3- pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->address); - TotalLen = pSrbSG->length; - pSCB->SCB_SGLen = 0;
Quoted 3 lines
but I had changed it to do sg io instead not knowing why it needed to treat it is as regular I/O. I will send a new patch in the next mail.
Ignore my comment above.
Try the attached patch. It was built against 2.6.0-test11. I do not have the HW and the other testers I know about are only using their card for scsi cd writers, so I only know it compiles.
mike
drivers/scsi/i91uscsi.c +2 -2
@@ -1747,9 +1747,9 @@ int tul_state_5(HCS * pCurHcb) xcnt += (long ) sgp->SG_Len;/* xcnt == bytes xferred in this sgp */ sgp->SG_Ptr += (U32 ) xcnt;/* new ptr to be xfer */ sgp->SG_Len -= (U32 ) xcnt;/* new len to be xfer */ - pCurScb->SCB_BufPtr += ((U32 ) (i - pCurScb->SCB_SGIdx) <<3 ); + pCurScb->SCB_BufPtr = sgp->SG_Ptr;/* new SG table ptr */ - pCurScb->SCB_SGLen = (BYTE ) (pCurScb->SCB_SGMax - i); + pCurScb->SCB_SGLen = sgp->SG_Len;/* new SG table len */ pCurScb->SCB_SGIdx = (WORD ) i;/* for next disc and come in this loop */
drivers/scsi/ini9100u.c +68 -39
211 lines not on this page · raw message
Quoted 6 lines
Try the attached patch. It was built against 2.6.0-test11. I do not have the HW and the other testers I know about are only using their card for scsi cd writers, so I only know it compiles.
mike
// all prior lines same as previous, including the error handler messages.. SCSI device sda: drive cache: write back
sda:/*~25 second pause*/scsi: Device offlined - not ready after error
recover: host 0 channel 0 id 1 lun 0
SCSI error : <0 0 1 0> return code - 0x6000000end_request: I/O error, dev sda, sector 0
Buffer I/O error on device sda, logical block 0
scsi0 (1:0): rejection I/O to offline device
Buffer I/O error on device sda, logical block 0
unable to read partition table
Attached scsi disk sda at scsi0, channel 0, id 1, lun 0
still no root fs.
The errors have changed.. and I consider that a degree of progress. Thank you Mike :)
-- James Daniel
Quoted 13 lines
// all prior lines same as previous, including the error handler messages.. SCSI device sda: drive cache: write back
sda:/*~25 second pause*/scsi: Device offlined - not ready after error
recover: host 0 channel 0 id 1 lun 0
SCSI error : <0 0 1 0> return code -0x6000000end_request: I/O error, dev sda, sector 0
Buffer I/O error on device sda, logical block 0
scsi0 (1:0): rejection I/O to offline device
Buffer I/O error on device sda, logical block 0
unable to read partition table
Attached scsi disk sda at scsi0, channel 0, id 1, lun 0
Ok, in the orginal patch I forgot to replace the shared buffer with a DMA-API equiv. This will take some time.
mike
Quoted 14 lines · Mike Christie
Quoted 13 lines
// all prior lines same as previous, including the error handler messages.. SCSI device sda: drive cache: write back
sda:/*~25 second pause*/scsi: Device offlined - not ready after error
recover: host 0 channel 0 id 1 lun 0
SCSI error : <0 0 1 0> return code -0x6000000end_request: I/O error, dev sda, sector 0
Buffer I/O error on device sda, logical block 0
scsi0 (1:0): rejection I/O to offline device
Buffer I/O error on device sda, logical block 0
unable to read partition table
Attached scsi disk sda at scsi0, channel 0, id 1, lun 0
Quoted 3 lines
Ok, in the orginal patch I forgot to replace the shared buffer with a DMA-API equiv. This will take some time.
Here is another try. It should compile against 2.6.0-test11/2.6.0.
mike
Mike Christie
[email protected]
drivers/scsi/ini9100u.c +75 -44
@@ -104,12 +104,12 @@* Now fixed. * 05/07/99 bv - v1.03g * - Changed the assumption that HZ = 100 +* 10/17/03 mc - v1.04 +* - added new DMA API support **************************************************************************/ #define CVT_LINUX_VERSION (V ,P ,S ) (V * 65536 + P * 256 + S) -#error Please convert me to Documentation/DMA-mapping.txt -#ifndef LINUX_VERSION_CODE #include <linux/version.h> #endif
@@ -143,13 +143,12 @@ unsigned int i91u_debug = DEBUG_DEFAULT;static Scsi_Host_Template driver_template = { .proc_name ="INI9100U" , - .proc_info ="INI9100U" , .name = i91u_REVID, .detect = i91u_detect, .release = i91u_release, .queuecommand = i91u_queue, - .abort = i91u_abort, - .reset = i91u_reset, +// .abort = i91u_abort, +// .reset = i91u_reset, .bios_param = i91u_biosparam, .can_queue =1 , .this_id =1 ,
@@ -162,7 +161,7 @@ static Scsi_Host_Template driver_templatchar *i91uCopyright ="Copyright (C) 1996-98" ;char *i91uInitioName ="by Initio Corporation" ;char *i91uProductName ="INI-9X00U/UW" ; -char *i91uVersion ="v1.03g" ; +char *i91uVersion ="v1.04" ;#define TULSZ (sz) (sizeof(sz) / sizeof(sz[0]))#define TUL_RDWORD (x,y) (short)(inl((int)((ULONG)((ULONG)x+(UCHAR)y)) ))
@@ -238,12 +237,12 @@ static void i91uAppendSRBToQueue(HCS * pULONG flags;spin_lock_irqsave (&(pHCB->pSRB_lock), flags); - pSRB->next =NULL ;/* Pointer to next */ + pSRB->host_scribble =NULL ;/* Pointer to next */ if (pHCB->pSRB_head ==NULL ) pHCB->pSRB_head = pSRB;else - pHCB->pSRB_tail->next = pSRB;/* Pointer to next */ + pHCB->pSRB_tail->host_scribble = (char *)pSRB;/* Pointer to next */ pHCB->pSRB_tail = pSRB;spin_unlock_irqrestore (&(pHCB->pSRB_lock), flags);
@@ -265,8 +264,8 @@ static Scsi_Cmnd *i91uPopSRBFromQueue(HCspin_lock_irqsave (&(pHCB->pSRB_lock), flags);if ((pSRB = pHCB->pSRB_head) !=NULL ) { - pHCB->pSRB_head = pHCB->pSRB_head->next; - pSRB->next =NULL ; + pHCB->pSRB_head = (struct scsi_cmnd *)pHCB->pSRB_head->host_scribble; + pSRB->host_scribble =NULL ; }spin_unlock_irqrestore (&(pHCB->pSRB_lock), flags);
@@ -308,6 +307,12 @@ int tul_NewReturnNumberOfAdapters(void)if (((dRegValue &0xFF00 ) >>8 ) ==0xFF ) dRegValue =0 ; wBIOS = (wBIOS <<8 ) + ((UWORD ) ((dRegValue &0xFF00 ) >>8 )); +if (pci_set_dma_mask (pDev,0xffffffff )) { +printk (KERN_WARNING +"i91u: Could not set 32 bit DMA mask\n" ); +continue ; + } + if (Addi91u_into_Adapter_table(wBIOS, (pDev->resource[0].start), pDev->irq,
@@ -323,7 +328,6 @@ int tul_NewReturnNumberOfAdapters(void)int i91u_detect (Scsi_Host_Template * tpnt) { -SCB *pSCB;HCS *pHCB;struct Scsi_Host *hreg;unsigned long i;/* 01/14/98 */
@@ -346,12 +350,7 @@ int i91u_detect(Scsi_Host_Template * tpn#endif }/* Get total number of adapters in the motherboard */ -#ifdef CONFIG_PCI iAdapters =tul_NewReturnNumberOfAdapters (); -#else - iAdapters =tul_ReturnNumberOfAdapters (); -#endif -if (iAdapters ==0 )/* If no tulip founded, return */ return (0 );
@@ -379,11 +378,6 @@ int i91u_detect(Scsi_Host_Template * tpn }memset ((unsigned char *) tul_scb,0 , i); - pSCB = tul_scb; -for (i =0 ; i < tul_num_ch * tul_num_scb; i++, pSCB++) { - pSCB->SCB_SGPAddr = (U32 )VIRT_TO_BUS (&pSCB->SCB_SGList[0 ]); - } -for (i =0 , pHCB = &tul_hcs[0 ];/* Get pointer for control block */ i < tul_num_ch; i++, pHCB++) {
@@ -476,6 +470,7 @@ static void i91uBuildSCB(HCS * pHCB, SCBSG *pSG;/* Pointer to SG list */ int i;long TotalLen; +dma_addr_t dma_addr; pSCB->SCB_Post = i91uSCBPost;/* i91u's callback routine */ pSCB->SCB_Srb = SCpnt;
@@ -484,11 +479,13 @@ static void i91uBuildSCB(HCS * pHCB, SCB pSCB->SCB_Target = SCpnt->device->id; pSCB->SCB_Lun = SCpnt->device->lun; pSCB->SCB_Ident = SCpnt->device->lun |DISC_ALLOW ; - pSCB->SCB_Flags |=SCF_SENSE ;/* Turn on auto request sense */ - - pSCB->SCB_SensePtr = (U32 )VIRT_TO_BUS (SCpnt->sense_buffer); + pSCB->SCB_Flags |=SCF_SENSE ;/* Turn on auto request sense */ + dma_addr =dma_map_single (&pHCB->pci_dev->dev, SCpnt->sense_buffer, +SENSE_SIZE ,DMA_FROM_DEVICE ); + pSCB->SCB_SensePtr =cpu_to_le32 ((u32 )dma_addr); pSCB->SCB_SenseLen =SENSE_SIZE ; + SCpnt->SCp.ptr = (char *)(unsigned long )dma_addr; pSCB->SCB_CDBLen = SCpnt->cmd_len; pSCB->SCB_HaStat =0 ;
@@ -500,33 +497,39 @@ static void i91uBuildSCB(HCS * pHCB, SCB }else { pSCB->SCB_TagMsg =0 ;/* No tag support */ } - +/* todo handle map_sg error */ if (SCpnt->use_sg) { + dma_addr =dma_map_single (&pHCB->pci_dev->dev, &pSCB->SCB_SGList[0 ], +sizeof (struct SG_Struc ) *TOTAL_SG_ENTRY , +DMA_BIDIRECTIONAL ); + pSCB->SCB_BufPtr = dma_addr; + SCpnt->SCp.dma_handle = dma_addr; + pSrbSG = (struct scatterlist *) SCpnt->request_buffer; -if (SCpnt->use_sg ==1 ) {/* If only one entry in the list *//* treat it as regular I/O */ - pSCB->SCB_BufPtr = (U32 )VIRT_TO_BUS (pSrbSG->address); - TotalLen = pSrbSG->length; - pSCB->SCB_SGLen =0 ; - }else {/* Assign SG physical address */ - pSCB->SCB_BufPtr = pSCB->SCB_SGPAddr; - pSCB->SCB_Flags |=SCF_SG ;/* Turn on SG list flag */ -for (i =0 , TotalLen =0 , pSG = &pSCB->SCB_SGList[0 ];/* 1.01g */ - i < SCpnt->use_sg; - i++, pSG++, pSrbSG++) { - pSG->SG_Ptr = (U32 )VIRT_TO_BUS (pSrbSG->address); - TotalLen += pSG->SG_Len = pSrbSG->length; - } - pSCB->SCB_SGLen = i; + pSCB->SCB_SGLen =dma_map_sg (&pHCB->pci_dev->dev, pSrbSG, + SCpnt->use_sg, SCpnt->sc_data_direction); + + pSCB->SCB_Flags |=SCF_SG ;/* Turn on SG list flag */ +for (i =0 , TotalLen =0 , pSG = &pSCB->SCB_SGList[0 ];/* 1.01g */ + i < pSCB->SCB_SGLen; i++, pSG++, pSrbSG++) { + pSG->SG_Ptr = (u32 )sg_dma_address (pSrbSG); + TotalLen += pSG->SG_Len = (u32 )sg_dma_len (pSrbSG); } + pSCB->SCB_BufLen = (SCpnt->request_bufflen > TotalLen) ? TotalLen : SCpnt->request_bufflen; - }else {/* Non SG */ - pSCB->SCB_BufPtr = (U32 )VIRT_TO_BUS (SCpnt->request_buffer); - pSCB->SCB_BufLen = SCpnt->request_bufflen; + }else if (SCpnt->request_bufflen) {/* Non SG */ + dma_addr =dma_map_single (&pHCB->pci_dev->dev, SCpnt->request_buffer, + SCpnt->request_bufflen, + SCpnt->sc_data_direction); + SCpnt->SCp.dma_handle = dma_addr; + pSCB->SCB_BufPtr = (u32 )dma_addr; + pSCB->SCB_BufLen = (u32 )SCpnt->request_bufflen; + pSCB->SCB_SGLen =0 ; + }else { + pSCB->SCB_BufLen =0 ; pSCB->SCB_SGLen =0 ; } - -return ; }/*
@@ -623,6 +626,32 @@ int i91u_biosparam(struct scsi_device *sreturn 0 ; } +static void i91u_unmap_cmnd (struct pci_dev *pci_dev,struct scsi_cmnd *cmnd) +{ +/* auto sense buffer */ +if (cmnd->SCp.ptr) { +dma_unmap_single (&pci_dev->dev, + (dma_addr_t)((unsigned long )cmnd->SCp.ptr), +SENSE_SIZE ,SCSI_DATA_READ ); + cmnd->SCp.ptr =NULL ; + } + +/* request buffer */ +if (cmnd->use_sg) { +dma_unmap_single (&pci_dev->dev, cmnd->SCp.dma_handle, +sizeof (struct SG_Struc ) *TOTAL_SG_ENTRY , +DMA_BIDIRECTIONAL ); + +dma_unmap_sg (&pci_dev->dev, cmnd->request_buffer, + cmnd->use_sg, + cmnd->sc_data_direction); + }else if (cmnd->request_bufflen) { +dma_unmap_single (&pci_dev->dev, cmnd->SCp.dma_handle, + cmnd->request_bufflen, + cmnd->sc_data_direction); + } +} +/***************************************************************************** Function name : i91uSCBPost Description : This is callback routine be called when tulip finish one
@@ -686,6 +715,8 @@ static void i91uSCBPost(BYTE * pHcb, BYTif (pSRB ==NULL ) {printk ("pSRB is NULL\n" ); } + +i91u_unmap_cmnd (pHCB->pci_dev, pSRB); pSRB->scsi_done (pSRB);/* Notify system DONE */ if ((pSRB =i91uPopSRBFromQueue (pHCB)) !=NULL )/* Find the next pending SRB */
[FIXED] Initio 9100u -- It lives
Quoted 7 lines · Mike Christie
Quoted 4 lines
Ok, in the orginal patch I forgot to replace the shared buffer with a DMA-API equiv. This will take some time.
Here is another try. It should compile against 2.6.0-test11/2.6.0.
It appears to be working again. Mad props.
The card has left my server, however. I dug up a 2940u2w. The ini9100u now resides in a test box which is still actively using the card and actually has a monitor permanently attached, so I'll be able to do much better diagnostics on it now. Currently it's loaded as a module, not being used for root fs, and is reading the drive attached to the card quite nicely. As soon as I have a distro running 2.6 running a root partition via scsi, I'll be sure to let the list know how it goes.
Thanks Mike =)
Quoted 1 line · Mike Christie
Here is another try. It should compile against 2.6.0-test11/2.6.0.
That's great thanks. I've put it in the scsi tree.
I did notice in the diffs between this one and the previous patch things like:
- pSG->SG_Ptr = cpu_to_le32((u32)sg_dma_address(pSrbSG));
- TotalLen += pSG->SG_Len = cpu_to_le32((u32)sg_dma_len(pSrbSG));
+ pSG->SG_Ptr = (u32)sg_dma_address(pSrbSG);
+ TotalLen += pSG->SG_Len = (u32)sg_dma_len(pSrbSG);
Which is obviously incorrect, since sg_dma_address() does return the address in CPU endianness (and the device SG list needs to be in PCI endiannes), but I think, since it was hard enough to find anyone with one of these things, that the chances of finding one on a non-x86 box are zero.
James
Quoted 14 lines · James Bottomley
Quoted 1 line · Mike Christie
Here is another try. It should compile against 2.6.0-test11/2.6.0.
That's great thanks. I've put it in the scsi tree.
I did notice in the diffs between this one and the previous patch things like:
(quoted diff) +2
-2- pSG->SG_Ptr = cpu_to_le32((u32)sg_dma_address(pSrbSG)); - TotalLen += pSG->SG_Len = cpu_to_le32((u32)sg_dma_len(pSrbSG)); + pSG->SG_Ptr = (u32)sg_dma_address(pSrbSG); + TotalLen += pSG->SG_Len = (u32)sg_dma_len(pSrbSG);
Quoted 3 lines
Which is obviously incorrect, since
sg_dma_address()does return the address in CPU endianness (and the device SG list needs to be in PCI endiannes),
I read the docs and added the cpu_to_le32 calls, but when the patch failed for JamesD I looked at the Initio driver that was already converted and noticed it was not managing the endiannes so I put 2 and 2 together and got 3.
but I think, since it was hard enough to find anyone with
Quoted 3 lines
one of these things, that the chances of finding one on a non-x86 box are zero.
The attached patch adds the cpu_to_le32 calls just in case. It was built against my previous patch.
mike
drivers/scsi/ini9100u.c +6 -6
@@ -484,7 +484,7 @@ static void i91uBuildSCB(HCS * pHCB, SCB dma_addr =dma_map_single (&pHCB->pci_dev->dev, SCpnt->sense_buffer,SENSE_SIZE ,DMA_FROM_DEVICE ); pSCB->SCB_SensePtr =cpu_to_le32 ((u32 )dma_addr); - pSCB->SCB_SenseLen =SENSE_SIZE ; + pSCB->SCB_SenseLen =cpu_to_le32 (SENSE_SIZE ); SCpnt->SCp.ptr = (char *)(unsigned long )dma_addr; pSCB->SCB_CDBLen = SCpnt->cmd_len;
@@ -502,7 +502,7 @@ static void i91uBuildSCB(HCS * pHCB, SCB dma_addr =dma_map_single (&pHCB->pci_dev->dev, &pSCB->SCB_SGList[0 ],sizeof (struct SG_Struc ) *TOTAL_SG_ENTRY ,DMA_BIDIRECTIONAL ); - pSCB->SCB_BufPtr = dma_addr; + pSCB->SCB_BufPtr =cpu_to_le32 ((u32 )dma_addr); SCpnt->SCp.dma_handle = dma_addr; pSrbSG = (struct scatterlist *) SCpnt->request_buffer;
@@ -512,8 +512,8 @@ static void i91uBuildSCB(HCS * pHCB, SCB pSCB->SCB_Flags |=SCF_SG ;/* Turn on SG list flag */ for (i =0 , TotalLen =0 , pSG = &pSCB->SCB_SGList[0 ];/* 1.01g */ i < pSCB->SCB_SGLen; i++, pSG++, pSrbSG++) { - pSG->SG_Ptr = (u32 )sg_dma_address (pSrbSG); - TotalLen += pSG->SG_Len = (u32 )sg_dma_len (pSrbSG); + pSG->SG_Ptr =cpu_to_le32 ((u32 )sg_dma_address (pSrbSG)); + TotalLen += pSG->SG_Len =cpu_to_le32 ((u32 )sg_dma_len (pSrbSG)); } pSCB->SCB_BufLen = (SCpnt->request_bufflen > TotalLen) ?
@@ -523,8 +523,8 @@ static void i91uBuildSCB(HCS * pHCB, SCB SCpnt->request_bufflen, SCpnt->sc_data_direction); SCpnt->SCp.dma_handle = dma_addr; - pSCB->SCB_BufPtr = (u32 )dma_addr; - pSCB->SCB_BufLen = (u32 )SCpnt->request_bufflen; + pSCB->SCB_BufPtr =cpu_to_le32 ((u32 )dma_addr); + pSCB->SCB_BufLen =cpu_to_le32 ((u32 )SCpnt->request_bufflen); pSCB->SCB_SGLen =0 ; }else { pSCB->SCB_BufLen =0 ;