diff -ru tx4650/linux/osd_inc.h tx4650-k38/linux/osd_inc.h
--- tx4650/linux/osd_inc.h	2008-02-04 10:12:49.000000000 +0300
+++ tx4650-k38/linux/osd_inc.h	2011-06-23 02:27:14.000000000 +0400
@@ -8,7 +8,6 @@
 
 #ifdef _64BPLATFORM
 #include <linux/syscalls.h>
-#include <linux/ioctl32.h>
 #endif
 /* add for SuSe 10(kernel 2.6.13.13-4) gcc_v4, undefind sys_ioctl,register_ioctl32_conversion, by sandy 20070117*/
 
diff -ru tx4650/linux/osd_ioctl.c tx4650-k38/linux/osd_ioctl.c
--- tx4650/linux/osd_ioctl.c	2007-08-17 10:40:36.000000000 +0400
+++ tx4650-k38/linux/osd_ioctl.c	2011-06-22 04:36:29.000000000 +0400
@@ -45,7 +45,7 @@
 
 struct file_operations t3_fops = {
 	owner:			THIS_MODULE,
-        ioctl:                  ft_ioctl,
+        unlocked_ioctl:         ft_compat_ioctl,
 #if defined (_64BPLATFORM) && (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,14))
 	compat_ioctl:		ft_compat_ioctl,
 #endif
diff -ru tx4650/linux/osd_main.c tx4650-k38/linux/osd_main.c
--- tx4650/linux/osd_main.c	2008-02-04 10:34:39.000000000 +0300
+++ tx4650-k38/linux/osd_main.c	2011-06-22 22:49:42.000000000 +0400
@@ -805,8 +805,8 @@
 	#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	if(cmd->cmnd[0] == READ_CAPACITY)
 	{
-		if(*(U32 *)cmd->request_buffer==0xffffffff)
-			((U8 *)cmd->request_buffer)[3] = 0xfe;
+		if(*(U32 *)scsi_sglist(cmd)==0xffffffff)
+			((U8 *)scsi_sglist(cmd))[3] = 0xfe;
 	}
 	#endif
 	
@@ -851,9 +851,9 @@
 	dma_addr_t dma_handle;
 	int us;
 	
-	if (cmd->use_sg){
-		sg = (struct scatterlist *) cmd->request_buffer;
-		pReq->SgTable.SGCount = (U16)pci_map_sg(pDev,sg,cmd->use_sg,scsi_to_pci_dma_dir(cmd->sc_data_direction));
+	if (scsi_sg_count(cmd)){
+		sg = (struct scatterlist *) scsi_sglist(cmd);
+		pReq->SgTable.SGCount = (U16)pci_map_sg(pDev,sg,scsi_sg_count(cmd),scsi_to_pci_dma_dir(cmd->sc_data_direction));
 
 		for (us = 0; us < pReq->SgTable.SGCount ; us++,sg++){
       			pReq->SgTable.table[us].Count  = (U32)sg_dma_len(sg);
@@ -866,20 +866,20 @@
 	}else{
 #if defined(CONFIG_X86_64)
 #if defined(CONFIG_DISCONTIGMEM) && (LINUX_VERSION_CODE>=KERNEL_VERSION(2,4,18) )
-		dma_handle = pci_map_page(pDev,virt_to_page(cmd->request_buffer),((unsigned long)cmd->request_buffer & ~PAGE_MASK),cmd->request_bufflen,scsi_to_pci_dma_dir(cmd->sc_data_direction));
+		dma_handle = pci_map_page(pDev,virt_to_page(scsi_sglist(cmd)),((unsigned long)scsi_sglist(cmd) & ~PAGE_MASK),scsi_bufflen(cmd),scsi_to_pci_dma_dir(cmd->sc_data_direction));
 #else
 		dma_handle = pci_map_single(pDev,
-						(cmd->request_buffer),
-						cmd->request_bufflen,
+						(scsi_sglist(cmd)),
+						scsi_bufflen(cmd),
 						scsi_to_pci_dma_dir(cmd->sc_data_direction) );
 #endif
 #else
 #if LINUX_VERSION_CODE>=KERNEL_VERSION(2,4,18) 
-	  	dma_handle = pci_map_page(pDev,virt_to_page(cmd->request_buffer),((unsigned long)cmd->request_buffer & ~PAGE_MASK),cmd->request_bufflen,scsi_to_pci_dma_dir(cmd->sc_data_direction));
+	  	dma_handle = pci_map_page(pDev,virt_to_page(scsi_sglist(cmd)),((unsigned long)scsi_sglist(cmd) & ~PAGE_MASK),scsi_bufflen(cmd),scsi_to_pci_dma_dir(cmd->sc_data_direction));
  #else
  		dma_handle = pci_map_single(pDev,
-						(cmd->request_buffer),
-						cmd->request_bufflen,
+						(scsi_sglist(cmd)),
+						scsi_bufflen(cmd),
 						scsi_to_pci_dma_dir(cmd->sc_data_direction) );
 #endif
 #endif
@@ -887,7 +887,7 @@
 
 		 pReq->SgTable.table[0].StartAddress.Value = cpu_to_le64(dma_handle);
 
-		 pReq->SgTable.table[0].Count   = cpu_to_le32((U32) cmd->request_bufflen);
+		 pReq->SgTable.table[0].Count   = cpu_to_le32((U32) scsi_bufflen(cmd));
 		 pReq->SgTable.table[0].CtrlFlag = SG_CF_EOT|SG_CF_64B | SG_CF_HOST;
  
 		  }
@@ -950,9 +950,9 @@
 	dma_addr_t dma_handle;
 	int us;
 	
-	if (cmd->use_sg){
-		sg = (struct scatterlist *) cmd->request_buffer;
-		pReq->SgTable.SGCount = (U16)pci_map_sg(pDev,sg,cmd->use_sg,scsi_to_pci_dma_dir(cmd->sc_data_direction));
+	if (scsi_sg_count(cmd)){
+		sg = (struct scatterlist *) scsi_sglist(cmd);
+		pReq->SgTable.SGCount = (U16)pci_map_sg(pDev,sg,scsi_sg_count(cmd),scsi_to_pci_dma_dir(cmd->sc_data_direction));
 
 		for (us = 0; us < pReq->SgTable.SGCount ; us++,sg++){
       			pReq->SgTable.table[us].Count  = (U32)sg_dma_len(sg);
@@ -974,9 +974,9 @@
 				if(!sg->page)
 	                                pReq->SgTable.table[us].Page = virt_to_page(sg->address);
 				else
-					pReq->SgTable.table[us].Page = sg->page;
+					pReq->SgTable.table[us].Page = sg_page(sg);
                         #else
-                                pReq->SgTable.table[us].Page = sg->page;
+                                pReq->SgTable.table[us].Page = sg_page(sg);
 				//pReq->SgTable.table[us].offset = sg->offset; //add by sandy 20071225
                         #endif
 			//add by sandy 20070111
@@ -986,11 +986,11 @@
 	}else{
 		
 #if LINUX_VERSION_CODE>=KERNEL_VERSION(2,4,18)
-	  	dma_handle = pci_map_page(pDev,virt_to_page(cmd->request_buffer),((unsigned long)cmd->request_buffer & ~PAGE_MASK),cmd->request_bufflen,scsi_to_pci_dma_dir(cmd->sc_data_direction));
+	  	dma_handle = pci_map_page(pDev,virt_to_page(scsi_sglist(cmd)),((unsigned long)scsi_sglist(cmd) & ~PAGE_MASK),scsi_bufflen(cmd),scsi_to_pci_dma_dir(cmd->sc_data_direction));
  #else
  		dma_handle = pci_map_single(pDev,
-						(cmd->request_buffer),
-						cmd->request_bufflen,
+						(scsi_sglist(cmd)),
+						scsi_bufflen(cmd),
 						scsi_to_pci_dma_dir(cmd->sc_data_direction) );
 #endif
  		//pReq->SgTable.SGCount = 1;
@@ -1003,13 +1003,13 @@
   		pReq->SgTable.table[0].StartAddress.u.Low = (U32)(dma_handle);
 #endif
 		//pReq->SgTable.table[0].Count   = (U32) cmd->request_bufflen;
-		pReq->SgTable.table[0].Count   = cpu_to_le32((U32) cmd->request_bufflen);
+		pReq->SgTable.table[0].Count   = cpu_to_le32((U32) scsi_bufflen(cmd));
 		pReq->SgTable.table[0].CtrlFlag = SG_CF_EOT|SG_CF_64B | SG_CF_HOST;
 
-		pReq->SgTable.table[0].Page = virt_to_page(cmd->request_buffer);//add
+		pReq->SgTable.table[0].Page = virt_to_page(scsi_sglist(cmd));//add
   	}
 	
-	pReq->req.wSize = (U32)cmd->request_bufflen; //add by sandy 20061025	
+	pReq->req.wSize = (U32)scsi_bufflen(cmd); //add by sandy 20061025	
   	pReq->req.pSgTable = &pReq->SgTable; 
   		
 }
@@ -1120,7 +1120,7 @@
  */
 
 static int
-t3_queue(Scsi_Cmnd *cmd, void (*fn)(Scsi_Cmnd *)){
+t3_queue_lck(Scsi_Cmnd *cmd, void (*fn)(Scsi_Cmnd *)){
 	bpOSD_COMP_EXTENSION bpOSDCompExtension=NULL;
 	bpOSD_COMP_EXTENSION p;
 	REQ_HEAD		*pReq;
@@ -1176,12 +1176,12 @@
    	pReq->req.bLUN    	= lun ;
    	pReq->req.bSenseSize     	= SCSI_SENSE_BUFFERSIZE ;
  	//pReq->req.p_buf          	= (unchar *)cmd->buffer ;
-	pReq->req.p_buf			= (unchar *)cmd->request_buffer ; //for kernel > 2.6.18, 20070423, sandy
+	pReq->req.p_buf			= (unchar *)scsi_sglist(cmd) ; //for kernel > 2.6.18, 20070423, sandy
        	pReq->req.p_sns          	= (unchar *)cmd->sense_buffer ;
 	
        	pReq->req.bCdbSize          	= cmd->cmd_len ;
        	//pReq->req.wSize          	= cmd->bufflen ;
-	pReq->req.wSize                 = cmd->request_bufflen ; //for kernel > 2.6.18, 20070423, sandy
+	pReq->req.wSize                 = scsi_bufflen(cmd) ; //for kernel > 2.6.18, 20070423, sandy
 
 	//if(pReq->ReqType)
 		//OSD_DPRINT( ("t3_queue: ReqType=0x%x\n",pReq->ReqType) );      
@@ -1260,6 +1260,8 @@
 	Local_StartIO( This, pReq, SynchronizeCacheCompletion);
 }
 
+DEF_SCSI_QCMD(t3_queue)
+
 int release_single_device(bpOSD_COMP_EXTENSION p)
 {
 	REQ_HEAD *pReq;
@@ -1565,7 +1567,7 @@
 
 	OSDI_InitializeComponents(pOSDExtension,  gVenDevID[Type], gVenDevID[Type]);
 	/* According to tony's advice, move request interrupt handle here to avoid unexpected operations */
-	rc = request_irq(fasttrak_dev->irq, (void *)t3_intr, SA_SHIRQ, FASTTRAK_DEV_NAME, (void *)pOSDExtension);
+	rc = request_irq(fasttrak_dev->irq, (void *)t3_intr, IRQF_SHARED, FASTTRAK_DEV_NAME, (void *)pOSDExtension);
 	if(rc){
 	   	OSD_DPRINT( ( " t3 %d request_irq %d error, rc = %d\n", pOSDExtension->host_no, fasttrak_dev->irq, rc) );
 	   	goto err_out_iounmap;
@@ -1999,7 +2001,7 @@
 	OSDI_InitializeComponents(pOSDExtension,  (pdev->vendor)<<16|pdev->device, (pdev->subsystem_vendor)<<16|pdev->subsystem_device);
 	
 	rc = request_irq( pdev->irq, (void *)t3_intr, 
-			  SA_SHIRQ, FASTTRAK_DEV_NAME, 
+			  IRQF_SHARED, FASTTRAK_DEV_NAME, 
 			  (void *)pOSDExtension );
 	if (rc) {
 	   	dev_err( &pdev->dev, "t3%x: request_irq()  %d error,"
diff -ru tx4650/Makefile tx4650-k38/Makefile
--- tx4650/Makefile	2007-08-31 14:23:21.000000000 +0400
+++ tx4650-k38/Makefile	2011-06-23 02:35:43.000000000 +0400
@@ -56,7 +56,7 @@
 
 # add for kernel version after 2.6.18  #
 ifeq ("x", "x$(KERNEL_VER)")
-        VERSIONFILE=$(KERNEL_BLD_DIR)/include/linux/utsrelease.h
+        VERSIONFILE=$(KERNEL_BLD_DIR)/include/generated/utsrelease.h
         KERNEL_VER = $(shell cat $(VERSIONFILE) | grep -m 1 UTS_RELEASE | cut -c22-24 | head -n 1)
 endif
 
@@ -132,7 +132,7 @@
 
 DEF_CFLAGS= $(OPTION) -D__KERNEL__ -DMODULE -D__linux__ -Wall -Wstrict-prototypes  -fno-strict-aliasing -fno-common -Wno-unused -pipe
 
-INCLUDE_DIR= -I$(KERNEL_BLD_DIR)include -I$(KERNEL_BLD_DIR)/include/scsi -I$(KERNEL_BLD_DIR)/drivers/scsi -I$(KERNEL_SRC_DIR)/include -I$(KERNEL_SRC_DIR)/include/scsi -I$(KERNEL_SRC_DIR)/drivers/scsi
+INCLUDE_DIR= -I$(KERNEL_BLD_DIR)/include -I$(KERNEL_BLD_DIR)/include/scsi -I$(KERNEL_BLD_DIR)/drivers/scsi -I$(KERNEL_SRC_DIR)/include -I$(KERNEL_SRC_DIR)/include/scsi -I$(KERNEL_SRC_DIR)/drivers/scsi
 
 ####for OEM FLAG Support####
 
