diff -Naru linux-2.6.18.6.orig/arch/arm/mach-mv88fxx81/Board/SATA/CoreDriver/mvStorageDev.c linux-2.6.18.6/arch/arm/mach-mv88fxx81/Board/SATA/CoreDriver/mvStorageDev.c --- linux-2.6.18.6.orig/arch/arm/mach-mv88fxx81/Board/SATA/CoreDriver/mvStorageDev.c 2009-05-11 04:46:37.000000000 +0300 +++ linux-2.6.18.6/arch/arm/mach-mv88fxx81/Board/SATA/CoreDriver/mvStorageDev.c 2008-01-31 09:32:21.000000000 +0200 @@ -156,7 +156,6 @@ short PowerManagementSupport[2]={-1,-1}; int SATA_hd_read_write[2]={0,0}; -unsigned short SATA_State_Counter[2] = {0, 0}; int hd_flag[4] = {0,0,0,0}; unsigned long PowerSavingModeStatus = 0; #ifdef SOFTWARE_CONTROL_LED @@ -165,11 +164,7 @@ static int PowerSavingFlag = 0; static int TimerState = STOP; struct timer_list pm_timer; - -unsigned long timer_period = 60; -unsigned long suspend_time_counter = 0; - - +unsigned short time_to_power_save = 30*60; //default 30mins //DLink /******************************************************************************* * waitWhileStorageDevIsBusy - Wait for the storage device to be released from @@ -905,13 +900,10 @@ //printk("EnablePowerSaving \n"); //printk("PowerSavingTime = %d\n",PowerSavingTime); - - - spin_lock(disk_power_ctrl_timer_lock); + if( ( hd_flag[0] == NO_HD ) && ( hd_flag[1] == NO_HD ) ) { printk("No found HD\n"); - spin_unlock(disk_power_ctrl_timer_lock); return -1; } if( ( hd_flag[0] == FOUND_HD ) || ( hd_flag[1] == FOUND_HD ) ) @@ -932,7 +924,6 @@ if(SATA_hd_read_write[i] != SATA_HD_STANDBY ) { SATA_hd_read_write[i] = SATA_HD_NO_ACTIVE ; - SATA_State_Counter[i] = 0; // suspend counter = 0 } } else @@ -940,19 +931,19 @@ } } + spin_lock(disk_power_ctrl_timer_lock); if ( PowerSavingTime > 0 ) - suspend_time_counter = PowerSavingTime ; + time_to_power_save = PowerSavingTime * 60; if ( TimerState == START ) del_timer(&pm_timer); pm_timer.function = (void *)timer_run; pm_timer.data = 0; - pm_timer.expires = jiffies + HZ*timer_period; + pm_timer.expires = jiffies + HZ*time_to_power_save; TimerState = START; add_timer(&pm_timer); - } - - spin_unlock(disk_power_ctrl_timer_lock); + spin_unlock(disk_power_ctrl_timer_lock); + } return 0; } @@ -967,10 +958,6 @@ TimerState = STOP; SATA_hd_read_write[0] = SATA_HD_ACTIVE; SATA_hd_read_write[1] = SATA_HD_ACTIVE; - - SATA_State_Counter[0] = 0; - SATA_State_Counter[1] = 0; - spin_unlock(disk_power_ctrl_timer_lock); } @@ -1041,7 +1028,7 @@ init_timer(&pm_timer); pm_timer.function = (void *)timer_run; pm_timer.data = 0; - pm_timer.expires = jiffies + HZ*timer_period; + pm_timer.expires = jiffies + HZ*time_to_power_save; } void timer_run(void) @@ -1066,20 +1053,12 @@ case SATA_HD_NO_ACTIVE: if ( PowerManagementSupport[i] == 1 ) { - if(SATA_State_Counter[i] == suspend_time_counter) - { - SATA_hd_read_write[i] = SATA_HD_STANDBY; - printk(KERN_DEBUG"\n***************************************\n"); - printk(KERN_DEBUG"* HD%d stand by now! *\n",i); - printk(KERN_DEBUG"***************************************\n"); - //to do send standby command - SendPowerSavingModeCommand(i); - } - else - { - printk(KERN_DEBUG"Hard %d, counter %d\n", i, SATA_State_Counter[i]); - SATA_State_Counter[i]++; - } + SATA_hd_read_write[i] = SATA_HD_STANDBY; + //printk(KERN_ERR"\n***************************************\n"); + //printk(KERN_ERR"* HD%d stand by now! *\n",i); + //printk(KERN_ERR"***************************************\n"); + //to do send standby command + SendPowerSavingModeCommand(i); } if ( ( hd_flag[0] == FOUND_HD ) && ( hd_flag[1] == FOUND_HD ) ) @@ -1101,7 +1080,6 @@ case SATA_HD_ACTIVE: //printk("clear HD read write flag \n"); SATA_hd_read_write[i] = SATA_HD_NO_ACTIVE; - SATA_State_Counter[i] = 1; break; default: @@ -1116,8 +1094,8 @@ { pm_timer.function = (void *)timer_run; pm_timer.data = 0; - //printk(KERN_ERR"//--- power saving time = %d ---//\n", time_to_power_save); - pm_timer.expires = jiffies + HZ*timer_period; + printk(KERN_ERR"//--- power saving time = %d ---//\n", time_to_power_save); + pm_timer.expires = jiffies + HZ*time_to_power_save; TimerState = START; add_timer(&pm_timer); } diff -Naru linux-2.6.18.6.orig/arch/arm/mach-mv88fxx81/LSP/mvSata/mvLinuxIalHt.c linux-2.6.18.6/arch/arm/mach-mv88fxx81/LSP/mvSata/mvLinuxIalHt.c --- linux-2.6.18.6.orig/arch/arm/mach-mv88fxx81/LSP/mvSata/mvLinuxIalHt.c 2009-05-11 04:46:37.000000000 +0300 +++ linux-2.6.18.6/arch/arm/mach-mv88fxx81/LSP/mvSata/mvLinuxIalHt.c 2008-01-31 09:32:21.000000000 +0200 @@ -1,7 +1,7 @@ /******************************************************************************* Copyright (C) Marvell International Ltd. and its affiliates -This software file (the "File") is owned and distributed by Marvell +This software file (the "File") is owned and distributed by Marvell International Ltd. and/or its affiliates ("Marvell") under the following alternative licensing terms. Once you have made an election to distribute the File under one of the following license alternatives, please (i) delete this @@ -13,16 +13,16 @@ ******************************************************************************** Marvell GPL License Option -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty +If you received this File from Marvell, you may opt to use, redistribute and/or +modify this File in accordance with the terms and conditions of the General +Public License Version 2, June 1991 (the "GPL License"), a copy of which is +available along with the File in the license.txt file or by writing to the Free +Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or +on the worldwide web at http://www.gnu.org/licenses/gpl.txt. + +THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED +WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY +DISCLAIMED. The GPL License provides additional details about this warranty disclaimer. *******************************************************************************/ /******************************************************************************* @@ -93,17 +93,6 @@ #include "mvIALCommon.h" #include "mvLinuxIalSmart.h" - -//GeorgeKang: external reference to power saving funtions -extern int hd_flag[4]; -extern int SATA_hd_read_write[4]; -extern unsigned long SATA_State_Counter[4]; -extern int EnablePowerSaving(unsigned long PowerSavingTime ); -extern void DisablePowerSaving(void); -extern void SendPowerSavingModeCommand(int channel); -extern spinlock_t disk_power_ctrl_timer_lock; - - extern Scsi_Host_Template driver_template; static void mv_ial_init_log(void); @@ -173,155 +162,13 @@ #endif IAL_ADAPTER_T *pSocAdapter = NULL; -//*** GeorgeKang@ZyXEL: Add proc for set/get disk suspending time ***// - -extern unsigned long suspend_time_counter; - -//Output the disk status -static int disk_suspdtime_read_fn(char *buf, char **start, off_t offset, - int count, int *eof, void *data) -{ - unsigned short time_to_power_save_mins; - int len= 0, limit = count - 80 , i; - int SATA_Status[4]; - - - - spin_lock(disk_power_ctrl_timer_lock); - - time_to_power_save_mins = suspend_time_counter; - - for(i = 0 ; i < 4 ; i++) - { - if(hd_flag[i]) - SATA_Status[i] = SATA_hd_read_write[i]; - else - SATA_Status[i] = -1; - } - spin_unlock(disk_power_ctrl_timer_lock); - - len += sprintf(buf, "SuspendingTime = %d\n", time_to_power_save_mins); - buf = buf + len; - - for(i = 0 ; i < 2 ; i++) - { - int len1; - - if(SATA_Status[i] == -1) - len1 = sprintf(buf, "Disk%d: No_Disk\n", i); - else - { - if(SATA_Status[i] == 0) //SATA_HD_NO_ACTIVE = 0 - len1 = sprintf(buf, "Disk%d: NO_ACTIVE\n", i); - else if(SATA_Status[i] == 1) //SATA_HD_NO_ACTIVE = 1 - len1 = sprintf(buf, "Disk%d: ACTIVE\n", i); - else if(SATA_Status[i] == 2) //SATA_HD_NO_ACTIVE = 2 - len1 = sprintf(buf, "Disk%d: STANDBY\n", i); - else - len1 = sprintf(buf, "Disk%d: Unknown\n", i); - } - - len += len1; - buf += len1; - } - - - - if(len > limit) printk(KERN_ERR"Out of page buf\n"); - - - *eof = 1; - - return len; -} - -//Set disk controller -//access case 1: set the suspending time for all disks -//access case 2: set the disk suspending immediately -static int disk_suspdtime_write_fn(struct file *file, const char __user *buffer, - unsigned long count, void *data) -{ - char my_buf[50]; - int i, value1 = 0, value2 = 0, access_case = 1; - int channelIndex, state; - - - - if(count > 50) - { - printk(KERN_ERR"Fail to write to proc.\n"); - return -EFAULT; - } - - copy_from_user(my_buf, buffer, count); - - - for(i = 0 ; i < count ; i++) - { - if(my_buf[i] < '0' || my_buf[i] > '9') - { - if(my_buf[i] == ',') access_case = 2; - continue; - } - - if(access_case == 1) - value1 = value1 * 10 + (my_buf[i] - '0'); - else - value2 = value2 * 10 + (my_buf[i] - '0'); - } - - - - if(access_case == 1) - { - if(value1 == 0) - { - DisablePowerSaving(); - suspend_time_counter = 0; - } - else - { - DisablePowerSaving(); - suspend_time_counter = 0; - EnablePowerSaving(value1); - } - } - else - { - if(value1 > 4) return -EFAULT; - - channelIndex = value1; - state = value2; - - if(channelIndex < 0 || channelIndex > 3 ) - return -EFAULT; - else - { - if(state == 0) - { - hd_flag[channelIndex] = 0; - SATA_hd_read_write[channelIndex] = 0; // SATA_HD_NO_ACTIVE - SATA_State_Counter[channelIndex] = 0; - SendPowerSavingModeCommand(channelIndex); - } - } - } - - return count; - -} -//*** GeorgeKang@ZyXE: End of Adding read, write code for /proc/d_susptime - static int __init mv_ial_init(void) { MV_U32 vaule32; - int ret; - struct proc_dir_entry *p; - mv_ial_init_log(); mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "mvSata init.\n"); - + driver_template.module = THIS_MODULE; #ifdef CONFIG_ARCH_MV88fxx81 if ( (MV_5182_DEV_ID == mvCtrlModelGet()) || (MV_5082_DEV_ID == mvCtrlModelGet()) ) @@ -331,17 +178,7 @@ } #endif - ret = pci_module_init(&mv_ial_pci_driver); - - //GeorgeKang: Add code to register /proc/d_suspdtime - DisablePowerSaving(); - p = create_proc_entry("d_suspdtime", 0 , NULL); - p->read_proc = disk_suspdtime_read_fn; - p->write_proc = disk_suspdtime_write_fn; - - rbm_workqueue = create_workqueue("sata2rbm"); - - return ret; + return (int)pci_module_init(&mv_ial_pci_driver); } static void __exit mv_ial_exit(void) @@ -353,14 +190,7 @@ mv_ial_remove_device(NULL); } #endif - - //GeorgeKang: Unregister /rpoc/d_suspdtime - DisablePowerSaving(); - pci_unregister_driver(&mv_ial_pci_driver); - remove_proc_entry("d_suspdtime", NULL); - pci_unregister_driver(&mv_ial_pci_driver); - destroy_workqueue(rbm_workqueue); mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "mvSata exit.\n"); } @@ -567,7 +397,7 @@ pAdapter->host[i]->scsi_cmnd_done_head = NULL; pAdapter->host[i]->scsi_cmnd_done_tail = NULL; } - + pAdapter->host[0]->scsihost->base = pci_resource_start(pcidev, 0); for (i = 1; i < pAdapter->maxHosts; i++) { @@ -580,7 +410,7 @@ if (!pMvSataAdapter->adapterIoBaseAddress) { mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG_ERROR, "Failed to remap memory io spcae\n"); - + mv_ial_free_scsi_hosts(pAdapter, MV_TRUE); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) pci_release_regions(pcidev); @@ -593,7 +423,7 @@ mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "io base address 0x%08lx\n", (ulong)pMvSataAdapter->adapterIoBaseAddress); } - + pMvSataAdapter->adapterId = adapterId++; /* get the revision ID */ if (pci_read_config_byte(pcidev, PCI_REVISION_ID, &pAdapter->rev_id)) @@ -623,7 +453,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) init_MUTEX(&pAdapter->rescan_mutex); atomic_set(&pAdapter->stopped, 1); -#endif +#endif if (mvSataInitAdapter(pMvSataAdapter) == MV_FALSE) { mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG_ERROR, "[%d]: core failed to initialize the adapter\n", @@ -836,7 +666,7 @@ pAdapter->maxHosts = MV_SATA_5182_PORT_NUM; else if(MV_5082_DEV_ID == mvCtrlModelGet()) pAdapter->maxHosts = MV_SATA_5082_PORT_NUM; - + for (i = 0; i < pAdapter->maxHosts; i++) { struct Scsi_Host *pshost = scsi_host_alloc(&driver_template, sizeof(IAL_HOST_T)); @@ -862,22 +692,22 @@ pAdapter->host[i]->scsi_cmnd_done_head = NULL; pAdapter->host[i]->scsi_cmnd_done_tail = NULL; } - + pAdapter->host[0]->scsihost->base = 0/*pci_resource_start(pcidev, 0)*/; for (i = 1; i < pAdapter->maxHosts; i++) { if (pAdapter->host[i] != NULL) pAdapter->host[i]->scsihost->base = pAdapter->host[0]->scsihost->base; } - pMvSataAdapter->adapterIoBaseAddress = (MV_BUS_ADDR_T)(INTER_REGS_BASE + SATA_REG_BASE - + pMvSataAdapter->adapterIoBaseAddress = (MV_BUS_ADDR_T)(INTER_REGS_BASE + SATA_REG_BASE - 0x20000); - + mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "io base address 0x%08lx\n", (ulong)pMvSataAdapter->adapterIoBaseAddress); - + pMvSataAdapter->adapterId = adapterId++; /* get the revision ID */ - + pMvSataAdapter->pciConfigRevisionId = 0; pMvSataAdapter->pciConfigDeviceId = mvCtrlModelGet(); if (set_device_regs(pMvSataAdapter, NULL)) @@ -889,7 +719,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) init_MUTEX(&pAdapter->rescan_mutex); atomic_set(&pAdapter->stopped, 1); -#endif +#endif if (mvSataInitAdapter(pMvSataAdapter) == MV_FALSE) { mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG_ERROR, @@ -956,7 +786,7 @@ } pAdapter->host[i]->scsihost->irq = SATA_IRQ_NUM; pAdapter->host[i]->scsihost->max_id = MV_SATA_PM_MAX_PORTS; - + pAdapter->host[i]->scsihost->max_lun = 1; pAdapter->host[i]->scsihost->max_channel = 0; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) @@ -1013,12 +843,12 @@ } /*Enable hotplug handler*/ atomic_set(&pAdapter->stopped, 0); -#endif +#endif EnablePowerSaving(30); //default suspending time return 0; } -#endif +#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) /**************************************************************** @@ -1360,7 +1190,7 @@ else { mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "in queuecommand: Data command for ATA device\n"); - + } if (mv_ial_lib_generate_prd(pMvSataAdapter, SCpnt, completion_info)) { @@ -1410,7 +1240,7 @@ sg = (struct scatterlist *) SCpnt->request_buffer; mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "SCpnt %p, cmd %x need to use" " temp data buffer.lengh %d \n", SCpnt, *cmd ,sg->length); - /* those commands alwasy with data direction from Device to Host, so no need to fill */ + /* those commands alwasy with data direction from Device to Host, so no need to fill */ /* the temp data buffer, besides, this buffer may now being used by another command */ completion_info->pSALBlock->pDataBuffer = (MV_U8 *) pAdapter->tempDataBuffer; completion_info->pSALBlock->dataBufferLength = sg->length; @@ -1656,7 +1486,7 @@ len += snprintf (buffer + len, length - len, "\nPCI location: Bus %d, Slot %d\n", pAdapter->pcidev->bus->number, PCI_SLOT(pAdapter->pcidev->devfn)); - + if (len >= length) { goto out; @@ -1664,7 +1494,7 @@ len += snprintf (buffer + len, length - len, "DeviceID: %x, Rev %x," " adapterId %d, channel %d \n", pAdapter->mvSataAdapter.pciConfigDeviceId, - pAdapter->mvSataAdapter.pciConfigRevisionId, + pAdapter->mvSataAdapter.pciConfigRevisionId, pAdapter->mvSataAdapter.adapterId, pHost->channelIndex); @@ -1678,17 +1508,17 @@ len += snprintf (buffer + len, length - len, "\nIntegrated Sata adapterId %d, " "channel %d\n",pAdapter->mvSataAdapter.adapterId, pHost->channelIndex); - + if (len >= length) { goto out; - } + } } if (pMvSataAdapter->sataChannel[temp]) { if (pMvSataAdapter->sataChannel[temp]->deviceType == MV_SATA_DEVICE_TYPE_PM) { - len += snprintf (buffer + len, length - len, + len += snprintf (buffer + len, length - len, "Port Multiplier connected, switching mode: %s\n", (pMvSataAdapter->sataChannel[temp]->FBSEnabled == MV_TRUE) ? "FBS":"CBS"); @@ -1735,7 +1565,7 @@ { goto out; } - + if (pMvSataAdapter->sataChannel[temp]) { for (pmPort = 0; pmPort < MV_SATA_PM_MAX_PORTS; pmPort++) @@ -1902,10 +1732,10 @@ shost_for_each_device(pDevice, scsiHost) { int deviceQDepth = 2; - + if(pHost->pAdapter->ataScsiAdapterExt->ataDriveData[pHost->channelIndex][pDevice->id].identifyInfo.deviceType == MV_SATA_DEVICE_TYPE_ATAPI_DEVICE) { - mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "[%d %d %d]: ATAPI device found\n", + mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG, "[%d %d %d]: ATAPI device found\n", pHost->pAdapter->mvSataAdapter.adapterId, pHost->channelIndex, pDevice->id); pDevice->use_10_for_rw = 1; @@ -1952,7 +1782,7 @@ struct scsi_device* pDevice; if (ial_host != NULL) { - + /* linux 2.4 queue depth is not tunable, so we set the device queue */ /* to the max value (MV_SATA_SW_QUEUE_SIZE), and limit the number queued */ /* commands using the cmd_per_lun */ @@ -1961,7 +1791,7 @@ /* channel). This may casue startvation if PortMultiplier is connected*/ pHost->cmd_per_lun = 31; if (ial_host->mode != MV_EDMA_MODE_NOT_QUEUED) - { + { if (ial_host->use128Entries == MV_TRUE) { pHost->can_queue = MV_SATA_GEN2E_SW_QUEUE_SIZE; @@ -1976,7 +1806,7 @@ { pHost->can_queue = MV_DEFAULT_QUEUE_DEPTH; } - + /*always allocate the max number of commands */ for (pDevice = pDevs; pDevice; pDevice = pDevice->next) @@ -2013,7 +1843,7 @@ channel = pHost->channelIndex; pAdapter = MV_IAL_ADAPTER(SCpnt->device->host); pMvSataAdapter = &pAdapter->mvSataAdapter; - + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) if (SCpnt->serial_number != SCpnt->serial_number_at_timeout) { diff -Naru linux-2.6.18.6.orig/arch/arm/mach-mv88fxx81/LSP/mvSata/mvScsiAtaLayer.c linux-2.6.18.6/arch/arm/mach-mv88fxx81/LSP/mvSata/mvScsiAtaLayer.c --- linux-2.6.18.6.orig/arch/arm/mach-mv88fxx81/LSP/mvSata/mvScsiAtaLayer.c 2009-05-11 04:46:37.000000000 +0300 +++ linux-2.6.18.6/arch/arm/mach-mv88fxx81/LSP/mvSata/mvScsiAtaLayer.c 2008-01-31 09:32:21.000000000 +0200 @@ -1,7 +1,7 @@ /******************************************************************************* Copyright (C) Marvell International Ltd. and its affiliates -This software file (the "File") is owned and distributed by Marvell +This software file (the "File") is owned and distributed by Marvell International Ltd. and/or its affiliates ("Marvell") under the following alternative licensing terms. Once you have made an election to distribute the File under one of the following license alternatives, please (i) delete this @@ -13,16 +13,16 @@ ******************************************************************************** Marvell GPL License Option -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty +If you received this File from Marvell, you may opt to use, redistribute and/or +modify this File in accordance with the terms and conditions of the General +Public License Version 2, June 1991 (the "GPL License"), a copy of which is +available along with the File in the license.txt file or by writing to the Free +Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or +on the worldwide web at http://www.gnu.org/licenses/gpl.txt. + +THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED +WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY +DISCLAIMED. The GPL License provides additional details about this warranty disclaimer. *******************************************************************************/ /******************************************************************************* @@ -45,9 +45,6 @@ #define SAL_SPRINTF sprintf #endif -struct workqueue_struct *rbm_workqueue; -static DECLARE_WORK(sata_to_rbm, NULL, NULL); - /* ATA defines */ /* Bits for HD_ERROR */ #define NM_ERR 0x02 /* media present */ @@ -59,8 +56,10 @@ #define WP_ERR 0x40 /* write protect */ #define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ +//DLink #define SATA_HD_ACTIVE 1 #define SATA_HD_STANDBY 2 +//DLink #ifdef MV_LOGGER static MV_VOID reportScbCompletion(MV_SATA_ADAPTER* pSataAdapter, MV_SATA_SCSI_CMD_BLOCK *pScb); @@ -145,8 +144,7 @@ static MV_VOID mvScsiAtaSendReadLookAhead(IN MV_SATA_ADAPTER* pSataAdapter, IN MV_SATA_SCSI_CMD_BLOCK *pScb); extern unsigned long PowerSavingModeStatus; -extern int SATA_hd_read_write[2]; -extern unsigned long SATA_State_Counter[2]; +extern int SATA_hd_read_write[2]; //DLink static MV_VOID mvAta2HostString(IN MV_U16 *source, OUT MV_U16 *target, @@ -458,7 +456,7 @@ pUdmaParams->singleDataRegion = pScb->singleDataRegion; pUdmaParams->byteCount = pScb->byteCount; #endif -#else +#else MV_QUEUE_COMMAND_INFO commandInfo = { MV_QUEUED_COMMAND_TYPE_UDMA, @@ -1959,7 +1957,7 @@ if(pScb->commandType == MV_QUEUED_COMMAND_TYPE_PACKET) { if ((registerStruct->statusRegister & MV_ATA_ERROR_STATUS) || - (registerStruct->statusRegister & MV_ATA_DEVICE_FAULT_STATUS)) + (registerStruct->statusRegister & MV_ATA_DEVICE_FAULT_STATUS)) { pScb->ScsiStatus = MV_SCSI_STATUS_CHECK_CONDITION; mvLogMsg(MV_SAL_LOG_ID, MV_DEBUG, "packet command completed ", @@ -2424,7 +2422,7 @@ "completionStatus %d\n", pScb, pScb->ScsiStatus, pScb->ScsiCommandCompletion); } - + } #endif static MV_VOID mvScsiAtaSendSplittedVerifyCommand(IN MV_SATA_SCSI_CMD_BLOCK *pScb) @@ -2589,7 +2587,7 @@ } } #ifdef MV_SUPPORT_ATAPI -MV_SCSI_COMMAND_STATUS_TYPE mvScsiAtaSendATAPICommand(MV_SATA_ADAPTER *pSataAdapter, +MV_SCSI_COMMAND_STATUS_TYPE mvScsiAtaSendATAPICommand(MV_SATA_ADAPTER *pSataAdapter, MV_SATA_SCSI_CMD_BLOCK *pScb) { #ifdef MV_SATA_STORE_COMMANDS_INFO_ON_IAL_STACK @@ -2600,14 +2598,14 @@ #endif MV_QUEUE_COMMAND_RESULT result; - + mvLogMsg(MV_SAL_LOG_ID, MV_DEBUG, "Send Packet command, adapter %d bus %d target %d lun %" "d pScb %p\n dir(%d) Data Buffer %p (%d), cdb %p (%d)\n", pSataAdapter->adapterId, pScb->bus, pScb->target, pScb->lun, pScb, pScb->dataDirection, - pScb->pDataBuffer, + pScb->pDataBuffer, pScb->dataBufferLength, pScb->ScsiCdb, pScb->ScsiCdbLength); - + pScb->commandType = MV_QUEUED_COMMAND_TYPE_PACKET; pCommandInfo->type = MV_QUEUED_COMMAND_TYPE_PACKET; @@ -2622,7 +2620,7 @@ pCommandInfo->commandParams.packetCommand.commandId = (MV_VOID_PTR) pScb; pCommandInfo->commandParams.packetCommand.prdLowAddr = pScb->PRDTableLowPhyAddress; pCommandInfo->commandParams.packetCommand.prdHighAddr = pScb->PRDTableHighPhyAddress; - + if((pScb->dataDirection == MV_SCSI_COMMAND_DATA_DIRECTION_IN) && (pScb->pDataBuffer == NULL)) { pCommandInfo->commandParams.packetCommand.protocolType = MV_NON_UDMA_PROTOCOL_PACKET_DMA; @@ -2661,10 +2659,6 @@ return MV_SCSI_COMMAND_STATUS_QUEUED; } #endif -void zyxel_rbm(void *in) -{ - call_usermodehelper("/bin/rbm.sh", NULL, NULL, 0);//Perform recycle-bin management when HD spins up -} MV_SCSI_COMMAND_STATUS_TYPE mvSataExecuteScsiCommand(MV_SATA_SCSI_CMD_BLOCK *pScb) { MV_U8 *cmd = pScb->ScsiCdb; @@ -2844,36 +2838,30 @@ case SCSI_OPCODE_READ10: case SCSI_OPCODE_WRITE6: case SCSI_OPCODE_WRITE10: - //change SATA Power model + //DLink , change SATA Power model if ( pScb->bus == 0 ) { if( SATA_hd_read_write[0] == SATA_HD_STANDBY ) { - printk("\n#######################################\n"); - printk(KERN_ERR"# HD0 awaked by %s ! #\n", current->comm); - printk("#######################################\n"); - PREPARE_WORK(&sata_to_rbm, zyxel_rbm, NULL); - queue_work(rbm_workqueue, &sata_to_rbm); + //printk("\n#######################################\n"); + //printk("# HD0 awake now ! #\n"); + //printk("#######################################\n"); } SATA_hd_read_write[0] = SATA_HD_ACTIVE; - SATA_State_Counter[0] = 0; PowerSavingModeStatus = SATA_HD_ACTIVE; } - else if ( pScb->bus == 1 ) + else if ( pScb->bus == 1 ) { if( SATA_hd_read_write[1] == SATA_HD_STANDBY ) { - printk("\n#######################################\n"); - printk(KERN_ERR"# HD1 awaked by %s ! #\n", current->comm); - printk("#######################################\n"); - PREPARE_WORK(&sata_to_rbm, zyxel_rbm, NULL); - queue_work(rbm_workqueue, &sata_to_rbm); + //printk("\n#######################################\n"); + //printk("# HD1 awake now ! #\n"); + //printk("#######################################\n"); } SATA_hd_read_write[1] = SATA_HD_ACTIVE; - SATA_State_Counter[1] = 0; PowerSavingModeStatus = SATA_HD_ACTIVE; } - //End + //DLink End return mvScsiAtaSendDataCommand(pSataAdapter, pScb); case SCSI_OPCODE_INQUIRY: return mvScsiAtaGetInquiryData(pSataAdapter, pScb); diff -Naru linux-2.6.18.6.orig/block/Kconfig linux-2.6.18.6/block/Kconfig --- linux-2.6.18.6.orig/block/Kconfig 2009-05-11 04:46:25.000000000 +0300 +++ linux-2.6.18.6/block/Kconfig 2008-01-31 09:32:14.000000000 +0200 @@ -5,7 +5,7 @@ #for instance. config LBD bool "Support for Large Block Devices" - depends on X86 || ARM || (MIPS && 32BIT) || PPC32 || (S390 && !64BIT) || SUPERH || UML + depends on X86 || (MIPS && 32BIT) || PPC32 || (S390 && !64BIT) || SUPERH || UML help Say Y here if you want to attach large (bigger than 2TB) discs to your machine, or if you want to have a raid or loopback device diff -Naru linux-2.6.18.6.linux/drivers/scsi/scsi_lib.c linux-2.6.18.6/drivers/scsi/scsi_lib.c --- linux-2.6.18.6.orig/drivers/scsi/scsi_lib.c 2009-05-11 04:47:16.000000000 +0300 +++ linux-2.6.18.6/drivers/scsi/scsi_lib.c 2008-01-31 09:32:40.000000000 +0200 @@ -30,7 +30,6 @@ #include "scsi_logging.h" /* ZyXEL mod start: Michael/George 20070704 */ -static DECLARE_WORK(scsi_to_zylog, NULL, NULL); #define MV_REG_WRITE(addr, data) \ ((*((volatile unsigned int*)(addr))) = ((unsigned int)(data))) @@ -80,7 +79,7 @@ //EXPORT_SYMBOL(scsi_to_zylog_workqueue); -//static struct work_struct scsi_to_zylog; +static struct work_struct scsi_to_zylog; static void scsi_run_queue(struct request_queue *q); @@ -834,7 +833,7 @@ case '0': if (ZyXEL_disk1==0) { ZyXEL_disk1 = 1; - PREPARE_WORK(&scsi_to_zylog, zydisk_error_handler, 1); + INIT_WORK(&scsi_to_zylog, zydisk_error_handler, 1); queue_work(scsi_to_zylog_workqueue, &scsi_to_zylog); } /* HD1 GPIO Dataout Enable */ @@ -849,7 +848,7 @@ case '1': if (ZyXEL_disk2==0) { ZyXEL_disk2=1; - PREPARE_WORK(&scsi_to_zylog, zydisk_error_handler, 2); + INIT_WORK(&scsi_to_zylog, zydisk_error_handler, 2); queue_work(scsi_to_zylog_workqueue, &scsi_to_zylog); } /* HD2 GPIO Dataout Enable */