···721721 /* drop floating-point and debug-register state if it exists: */722722 current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);723723 ia64_drop_fpu(current);724724+#ifdef CONFIG_IA32_SUPPORT724725 if (IS_IA32_PROCESS(ia64_task_regs(current))) {725726 ia32_drop_partial_page_list(current);726727 current->thread.task_size = IA32_PAGE_OFFSET;727728 set_fs(USER_DS);728729 }730730+#endif729731}730732731733/*
+1-9
drivers/ide/Kconfig
···807807 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX808808endchoice809809810810-config BLK_DEV_IDE_AU1XXX_BURSTABLE_ON811811- bool "Enable burstable Mode on DbDMA"812812- default false813813- depends BLK_DEV_IDE_AU1XXX814814- help815815- This option enable the burstable Flag on DbDMA controller816816- (cf. "AMD Alchemy 'Au1200' Processor Data Book - PRELIMINARY").817817-818810config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ819811 int "Maximum transfer size (KB) per request (up to 128)"820812 default "128"···932940933941config BLK_DEV_MPC8xx_IDE934942 bool "MPC8xx IDE support"935935- depends on 8xx943943+ depends on 8xx && IDE=y && BLK_DEV_IDE=y936944 help937945 This option provides support for IDE on Motorola MPC8xx Systems.938946 Please see 'Type of MPC8xx IDE interface' for details.
-7
drivers/ide/ide-cd.c
···12921292 struct cdrom_info *info = drive->driver_data;1293129312941294 info->dma = 0;12951295- info->cmd = 0;12961295 info->start_seek = jiffies;12971296 return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation);12981297}···13421343 if ((rq->sector & (sectors_per_frame - 1)) ||13431344 (rq->nr_sectors & (sectors_per_frame - 1)))13441345 info->dma = 0;13451345-13461346- info->cmd = READ;1347134613481347 /* Start sending the read request to the drive. */13491348 return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation);···14811484 struct cdrom_info *info = drive->driver_data;1482148514831486 info->dma = 0;14841484- info->cmd = 0;14851487 rq->flags &= ~REQ_FAILED;14861488 len = rq->data_len;14871489···18871891 /* use dma, if possible. we don't need to check more, since we18881892 * know that the transfer is always (at least!) frame aligned */18891893 info->dma = drive->using_dma ? 1 : 0;18901890- info->cmd = WRITE;1891189418921895 info->devinfo.media_written = 1;18931896···19111916 rq->flags |= REQ_QUIET;1912191719131918 info->dma = 0;19141914- info->cmd = 0;1915191919161920 /*19171921 * sg request···19191925 int mask = drive->queue->dma_alignment;19201926 unsigned long addr = (unsigned long) page_address(bio_page(rq->bio));1921192719221922- info->cmd = rq_data_dir(rq);19231928 info->dma = drive->using_dma;1924192919251930 /*
-1
drivers/ide/ide-cd.h
···480480481481 struct request request_sense_request;482482 int dma;483483- int cmd;484483 unsigned long last_block;485484 unsigned long start_seek;486485 /* Buffer to hold mechanism status and changer slot table. */
···3131 */3232#undef REALLY_SLOW_IO /* most systems can safely undef this */33333434-#include <linux/config.h> /* for CONFIG_BLK_DEV_IDEPCI */3534#include <linux/types.h>3635#include <linux/module.h>3736#include <linux/kernel.h>3837#include <linux/delay.h>3939-#include <linux/timer.h>4040-#include <linux/mm.h>4141-#include <linux/ioport.h>4242-#include <linux/hdreg.h>3838+#include <linux/platform_device.h>3939+4340#include <linux/init.h>4441#include <linux/ide.h>4542#include <linux/sysdev.h>46434744#include <linux/dma-mapping.h>48454646+#include "ide-timing.h"4747+4948#include <asm/io.h>5049#include <asm/mach-au1x00/au1xxx.h>5150#include <asm/mach-au1x00/au1xxx_dbdma.h>5252-5353-#if CONFIG_PM5454-#include <asm/mach-au1x00/au1xxx_pm.h>5555-#endif56515752#include <asm/mach-au1x00/au1xxx_ide.h>58535954#define DRV_NAME "au1200-ide"6055#define DRV_VERSION "1.0"6161-#define DRV_AUTHOR "AMD PCS / Pete Popov <ppopov@embeddedalley.com>"6262-#define DRV_DESC "Au1200 IDE"5656+#define DRV_AUTHOR "Enrico Walther <enrico.walther@amd.com> / Pete Popov <ppopov@embeddedalley.com>"5757+5858+/* enable the burstmode in the dbdma */5959+#define IDE_AU1XXX_BURSTMODE 163606461static _auide_hwif auide_hwif;6565-static spinlock_t ide_tune_drive_spin_lock = SPIN_LOCK_UNLOCKED;6666-static spinlock_t ide_tune_chipset_spin_lock = SPIN_LOCK_UNLOCKED;6767-static int dbdma_init_done = 0;6262+static int dbdma_init_done;68636969-/*7070- * local I/O functions7171- */7272-u8 auide_inb(unsigned long port)7373-{7474- return (au_readb(port));7575-}7676-7777-u16 auide_inw(unsigned long port)7878-{7979- return (au_readw(port));8080-}8181-8282-u32 auide_inl(unsigned long port)8383-{8484- return (au_readl(port));8585-}6464+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)86658766void auide_insw(unsigned long port, void *addr, u32 count)8867{8989-#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)6868+ _auide_hwif *ahwif = &auide_hwif;6969+ chan_tab_t *ctp;7070+ au1x_ddma_desc_t *dp;90719191- _auide_hwif *ahwif = &auide_hwif;9292- chan_tab_t *ctp;9393- au1x_ddma_desc_t *dp;9494-9595- if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1,9696- DDMA_FLAGS_NOIE)) {9797- printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);9898- return;9999- }100100- ctp = *((chan_tab_t **)ahwif->rx_chan);101101- dp = ctp->cur_ptr;102102- while (dp->dscr_cmd0 & DSCR_CMD0_V)103103- ;104104- ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);105105-#else106106- while (count--)107107- {108108- *(u16 *)addr = au_readw(port);109109- addr +=2 ;110110- }111111-#endif112112-}113113-114114-void auide_insl(unsigned long port, void *addr, u32 count)115115-{116116- while (count--)117117- {118118- *(u32 *)addr = au_readl(port);119119- /* NOTE: For IDE interfaces over PCMCIA,120120- * 32-bit access does not work121121- */122122- addr += 4;123123- }124124-}125125-126126-void auide_outb(u8 addr, unsigned long port)127127-{128128- return (au_writeb(addr, port));129129-}130130-131131-void auide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port)132132-{133133- return (au_writeb(addr, port));134134-}135135-136136-void auide_outw(u16 addr, unsigned long port)137137-{138138- return (au_writew(addr, port));139139-}140140-141141-void auide_outl(u32 addr, unsigned long port)142142-{143143- return (au_writel(addr, port));7272+ if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1, 7373+ DDMA_FLAGS_NOIE)) {7474+ printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);7575+ return;7676+ }7777+ ctp = *((chan_tab_t **)ahwif->rx_chan);7878+ dp = ctp->cur_ptr;7979+ while (dp->dscr_cmd0 & DSCR_CMD0_V)8080+ ;8181+ ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);14482}1458314684void auide_outsw(unsigned long port, void *addr, u32 count)14785{148148-#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)149149- _auide_hwif *ahwif = &auide_hwif;150150- chan_tab_t *ctp;151151- au1x_ddma_desc_t *dp;8686+ _auide_hwif *ahwif = &auide_hwif;8787+ chan_tab_t *ctp;8888+ au1x_ddma_desc_t *dp;15289153153- if(!put_source_flags(ahwif->tx_chan, (void*)addr,154154- count << 1, DDMA_FLAGS_NOIE)) {155155- printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);156156- return;157157- }158158- ctp = *((chan_tab_t **)ahwif->tx_chan);159159- dp = ctp->cur_ptr;160160- while (dp->dscr_cmd0 & DSCR_CMD0_V)161161- ;162162- ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);163163-#else164164- while (count--)165165- {166166- au_writew(*(u16 *)addr, port);167167- addr += 2;168168- }9090+ if(!put_source_flags(ahwif->tx_chan, (void*)addr,9191+ count << 1, DDMA_FLAGS_NOIE)) {9292+ printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);9393+ return;9494+ }9595+ ctp = *((chan_tab_t **)ahwif->tx_chan);9696+ dp = ctp->cur_ptr;9797+ while (dp->dscr_cmd0 & DSCR_CMD0_V)9898+ ;9999+ ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);100100+}101101+169102#endif170170-}171171-172172-void auide_outsl(unsigned long port, void *addr, u32 count)173173-{174174- while (count--)175175- {176176- au_writel(*(u32 *)addr, port);177177- /* NOTE: For IDE interfaces over PCMCIA,178178- * 32-bit access does not work179179- */180180- addr += 4;181181- }182182-}183103184104static void auide_tune_drive(ide_drive_t *drive, byte pio)185105{186186- int mem_sttime;187187- int mem_stcfg;188188- unsigned long flags;189189- u8 speed;106106+ int mem_sttime;107107+ int mem_stcfg;108108+ u8 speed;190109191191- /* get the best pio mode for the drive */192192- pio = ide_get_best_pio_mode(drive, pio, 4, NULL);110110+ /* get the best pio mode for the drive */111111+ pio = ide_get_best_pio_mode(drive, pio, 4, NULL);193112194194- printk("%s: setting Au1XXX IDE to PIO mode%d\n",195195- drive->name, pio);113113+ printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n",114114+ drive->name, pio);196115197197- spin_lock_irqsave(&ide_tune_drive_spin_lock, flags);116116+ mem_sttime = 0;117117+ mem_stcfg = au_readl(MEM_STCFG2);198118199199- mem_sttime = 0;200200- mem_stcfg = au_readl(MEM_STCFG2);119119+ /* set pio mode! */120120+ switch(pio) {121121+ case 0:122122+ mem_sttime = SBC_IDE_TIMING(PIO0);201123202202- /* set pio mode! */203203- switch(pio) {204204- case 0:205205- /* set timing parameters for RCS2# */206206- mem_sttime = SBC_IDE_PIO0_TWCS207207- | SBC_IDE_PIO0_TCSH208208- | SBC_IDE_PIO0_TCSOFF209209- | SBC_IDE_PIO0_TWP210210- | SBC_IDE_PIO0_TCSW211211- | SBC_IDE_PIO0_TPM212212- | SBC_IDE_PIO0_TA;213213- /* set configuration for RCS2# */214214- mem_stcfg |= TS_MASK;215215- mem_stcfg &= ~TCSOE_MASK;216216- mem_stcfg &= ~TOECS_MASK;217217- mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS;124124+ /* set configuration for RCS2# */125125+ mem_stcfg |= TS_MASK;126126+ mem_stcfg &= ~TCSOE_MASK;127127+ mem_stcfg &= ~TOECS_MASK;128128+ mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS;129129+ break;218130219219- au_writel(mem_sttime,MEM_STTIME2);220220- au_writel(mem_stcfg,MEM_STCFG2);221221- break;131131+ case 1:132132+ mem_sttime = SBC_IDE_TIMING(PIO1);222133223223- case 1:224224- /* set timing parameters for RCS2# */225225- mem_sttime = SBC_IDE_PIO1_TWCS226226- | SBC_IDE_PIO1_TCSH227227- | SBC_IDE_PIO1_TCSOFF228228- | SBC_IDE_PIO1_TWP229229- | SBC_IDE_PIO1_TCSW230230- | SBC_IDE_PIO1_TPM231231- | SBC_IDE_PIO1_TA;232232- /* set configuration for RCS2# */233233- mem_stcfg |= TS_MASK;234234- mem_stcfg &= ~TCSOE_MASK;235235- mem_stcfg &= ~TOECS_MASK;236236- mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS;237237- break;134134+ /* set configuration for RCS2# */135135+ mem_stcfg |= TS_MASK;136136+ mem_stcfg &= ~TCSOE_MASK;137137+ mem_stcfg &= ~TOECS_MASK;138138+ mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS;139139+ break;238140239239- case 2:240240- /* set timing parameters for RCS2# */241241- mem_sttime = SBC_IDE_PIO2_TWCS242242- | SBC_IDE_PIO2_TCSH243243- | SBC_IDE_PIO2_TCSOFF244244- | SBC_IDE_PIO2_TWP245245- | SBC_IDE_PIO2_TCSW246246- | SBC_IDE_PIO2_TPM247247- | SBC_IDE_PIO2_TA;248248- /* set configuration for RCS2# */249249- mem_stcfg &= ~TS_MASK;250250- mem_stcfg &= ~TCSOE_MASK;251251- mem_stcfg &= ~TOECS_MASK;252252- mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS;253253- break;141141+ case 2:142142+ mem_sttime = SBC_IDE_TIMING(PIO2);254143255255- case 3:256256- /* set timing parameters for RCS2# */257257- mem_sttime = SBC_IDE_PIO3_TWCS258258- | SBC_IDE_PIO3_TCSH259259- | SBC_IDE_PIO3_TCSOFF260260- | SBC_IDE_PIO3_TWP261261- | SBC_IDE_PIO3_TCSW262262- | SBC_IDE_PIO3_TPM263263- | SBC_IDE_PIO3_TA;264264- /* set configuration for RCS2# */265265- mem_stcfg |= TS_MASK;266266- mem_stcfg &= ~TS_MASK;267267- mem_stcfg &= ~TCSOE_MASK;268268- mem_stcfg &= ~TOECS_MASK;269269- mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS;144144+ /* set configuration for RCS2# */145145+ mem_stcfg &= ~TS_MASK;146146+ mem_stcfg &= ~TCSOE_MASK;147147+ mem_stcfg &= ~TOECS_MASK;148148+ mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS;149149+ break;270150271271- break;151151+ case 3:152152+ mem_sttime = SBC_IDE_TIMING(PIO3);272153273273- case 4:274274- /* set timing parameters for RCS2# */275275- mem_sttime = SBC_IDE_PIO4_TWCS276276- | SBC_IDE_PIO4_TCSH277277- | SBC_IDE_PIO4_TCSOFF278278- | SBC_IDE_PIO4_TWP279279- | SBC_IDE_PIO4_TCSW280280- | SBC_IDE_PIO4_TPM281281- | SBC_IDE_PIO4_TA;282282- /* set configuration for RCS2# */283283- mem_stcfg &= ~TS_MASK;284284- mem_stcfg &= ~TCSOE_MASK;285285- mem_stcfg &= ~TOECS_MASK;286286- mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS;287287- break;288288- }154154+ /* set configuration for RCS2# */155155+ mem_stcfg &= ~TS_MASK;156156+ mem_stcfg &= ~TCSOE_MASK;157157+ mem_stcfg &= ~TOECS_MASK;158158+ mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS;289159290290- au_writel(mem_sttime,MEM_STTIME2);291291- au_writel(mem_stcfg,MEM_STCFG2);160160+ break;292161293293- spin_unlock_irqrestore(&ide_tune_drive_spin_lock, flags);162162+ case 4:163163+ mem_sttime = SBC_IDE_TIMING(PIO4);294164295295- speed = pio + XFER_PIO_0;296296- ide_config_drive_speed(drive, speed);165165+ /* set configuration for RCS2# */166166+ mem_stcfg &= ~TS_MASK;167167+ mem_stcfg &= ~TCSOE_MASK;168168+ mem_stcfg &= ~TOECS_MASK;169169+ mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS;170170+ break;171171+ }172172+173173+ au_writel(mem_sttime,MEM_STTIME2);174174+ au_writel(mem_stcfg,MEM_STCFG2);175175+176176+ speed = pio + XFER_PIO_0;177177+ ide_config_drive_speed(drive, speed);297178}298179299180static int auide_tune_chipset (ide_drive_t *drive, u8 speed)300181{301301- u8 mode = 0;302302- int mem_sttime;303303- int mem_stcfg;304304- unsigned long flags;305305-#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA306306- struct hd_driveid *id = drive->id;182182+ int mem_sttime;183183+ int mem_stcfg;184184+ unsigned long mode;307185308308- /*309309- * Now see what the current drive is capable of,310310- * selecting UDMA only if the mate said it was ok.311311- */312312- if (id && (id->capability & 1) && drive->autodma &&313313- !__ide_dma_bad_drive(drive)) {314314- if (!mode && (id->field_valid & 2) && (id->dma_mword & 7)) {315315- if (id->dma_mword & 4)316316- mode = XFER_MW_DMA_2;317317- else if (id->dma_mword & 2)318318- mode = XFER_MW_DMA_1;319319- else if (id->dma_mword & 1)320320- mode = XFER_MW_DMA_0;321321- }322322- }186186+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA187187+ if (ide_use_dma(drive))188188+ mode = ide_dma_speed(drive, 0);323189#endif324190325325- spin_lock_irqsave(&ide_tune_chipset_spin_lock, flags);191191+ mem_sttime = 0;192192+ mem_stcfg = au_readl(MEM_STCFG2);326193327327- mem_sttime = 0;328328- mem_stcfg = au_readl(MEM_STCFG2);329329-330330- switch(speed) {331331- case XFER_PIO_4:332332- case XFER_PIO_3:333333- case XFER_PIO_2:334334- case XFER_PIO_1:335335- case XFER_PIO_0:336336- auide_tune_drive(drive, (speed - XFER_PIO_0));337337- break;194194+ if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {195195+ auide_tune_drive(drive, speed - XFER_PIO_0);196196+ return 0;197197+ }198198+199199+ switch(speed) {338200#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA339339- case XFER_MW_DMA_2:340340- /* set timing parameters for RCS2# */341341- mem_sttime = SBC_IDE_MDMA2_TWCS342342- | SBC_IDE_MDMA2_TCSH343343- | SBC_IDE_MDMA2_TCSOFF344344- | SBC_IDE_MDMA2_TWP345345- | SBC_IDE_MDMA2_TCSW346346- | SBC_IDE_MDMA2_TPM347347- | SBC_IDE_MDMA2_TA;348348- /* set configuration for RCS2# */349349- mem_stcfg &= ~TS_MASK;350350- mem_stcfg &= ~TCSOE_MASK;351351- mem_stcfg &= ~TOECS_MASK;352352- mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS;201201+ case XFER_MW_DMA_2:202202+ mem_sttime = SBC_IDE_TIMING(MDMA2);353203354354- mode = XFER_MW_DMA_2;355355- break;356356- case XFER_MW_DMA_1:357357- /* set timing parameters for RCS2# */358358- mem_sttime = SBC_IDE_MDMA1_TWCS359359- | SBC_IDE_MDMA1_TCSH360360- | SBC_IDE_MDMA1_TCSOFF361361- | SBC_IDE_MDMA1_TWP362362- | SBC_IDE_MDMA1_TCSW363363- | SBC_IDE_MDMA1_TPM364364- | SBC_IDE_MDMA1_TA;365365- /* set configuration for RCS2# */366366- mem_stcfg &= ~TS_MASK;367367- mem_stcfg &= ~TCSOE_MASK;368368- mem_stcfg &= ~TOECS_MASK;369369- mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS;204204+ /* set configuration for RCS2# */205205+ mem_stcfg &= ~TS_MASK;206206+ mem_stcfg &= ~TCSOE_MASK;207207+ mem_stcfg &= ~TOECS_MASK;208208+ mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS;370209371371- mode = XFER_MW_DMA_1;372372- break;373373- case XFER_MW_DMA_0:374374- /* set timing parameters for RCS2# */375375- mem_sttime = SBC_IDE_MDMA0_TWCS376376- | SBC_IDE_MDMA0_TCSH377377- | SBC_IDE_MDMA0_TCSOFF378378- | SBC_IDE_MDMA0_TWP379379- | SBC_IDE_MDMA0_TCSW380380- | SBC_IDE_MDMA0_TPM381381- | SBC_IDE_MDMA0_TA;382382- /* set configuration for RCS2# */383383- mem_stcfg |= TS_MASK;384384- mem_stcfg &= ~TCSOE_MASK;385385- mem_stcfg &= ~TOECS_MASK;386386- mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS;210210+ mode = XFER_MW_DMA_2;211211+ break;212212+ case XFER_MW_DMA_1:213213+ mem_sttime = SBC_IDE_TIMING(MDMA1);387214388388- mode = XFER_MW_DMA_0;389389- break;215215+ /* set configuration for RCS2# */216216+ mem_stcfg &= ~TS_MASK;217217+ mem_stcfg &= ~TCSOE_MASK;218218+ mem_stcfg &= ~TOECS_MASK;219219+ mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS;220220+221221+ mode = XFER_MW_DMA_1;222222+ break;223223+ case XFER_MW_DMA_0:224224+ mem_sttime = SBC_IDE_TIMING(MDMA0);225225+226226+ /* set configuration for RCS2# */227227+ mem_stcfg |= TS_MASK;228228+ mem_stcfg &= ~TCSOE_MASK;229229+ mem_stcfg &= ~TOECS_MASK;230230+ mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS;231231+232232+ mode = XFER_MW_DMA_0;233233+ break;390234#endif391391- default:392392- return 1;393393- }235235+ default:236236+ return 1;237237+ }238238+239239+ if (ide_config_drive_speed(drive, mode))240240+ return 1;394241395395- /*396396- * Tell the drive to switch to the new mode; abort on failure.397397- */398398- if (!mode || ide_config_drive_speed(drive, mode))399399- {400400- return 1; /* failure */401401- }242242+ au_writel(mem_sttime,MEM_STTIME2);243243+ au_writel(mem_stcfg,MEM_STCFG2);402244403403-404404- au_writel(mem_sttime,MEM_STTIME2);405405- au_writel(mem_stcfg,MEM_STCFG2);406406-407407- spin_unlock_irqrestore(&ide_tune_chipset_spin_lock, flags);408408-409409- return 0;245245+ return 0;410246}411247412248/*413249 * Multi-Word DMA + DbDMA functions414250 */415415-#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA416251417417-static int in_drive_list(struct hd_driveid *id,418418- const struct drive_list_entry *drive_table)419419-{420420- for ( ; drive_table->id_model ; drive_table++){421421- if ((!strcmp(drive_table->id_model, id->model)) &&422422- ((strstr(drive_table->id_firmware, id->fw_rev)) ||423423- (!strcmp(drive_table->id_firmware, "ALL")))424424- )425425- return 1;426426- }427427- return 0;428428-}252252+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA429253430254static int auide_build_sglist(ide_drive_t *drive, struct request *rq)431255{432432- ide_hwif_t *hwif = drive->hwif;433433- _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;434434- struct scatterlist *sg = hwif->sg_table;256256+ ide_hwif_t *hwif = drive->hwif;257257+ _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;258258+ struct scatterlist *sg = hwif->sg_table;435259436436- ide_map_sg(drive, rq);260260+ ide_map_sg(drive, rq);437261438438- if (rq_data_dir(rq) == READ)439439- hwif->sg_dma_direction = DMA_FROM_DEVICE;440440- else441441- hwif->sg_dma_direction = DMA_TO_DEVICE;262262+ if (rq_data_dir(rq) == READ)263263+ hwif->sg_dma_direction = DMA_FROM_DEVICE;264264+ else265265+ hwif->sg_dma_direction = DMA_TO_DEVICE;442266443443- return dma_map_sg(ahwif->dev, sg, hwif->sg_nents,444444- hwif->sg_dma_direction);267267+ return dma_map_sg(ahwif->dev, sg, hwif->sg_nents,268268+ hwif->sg_dma_direction);445269}446270447271static int auide_build_dmatable(ide_drive_t *drive)448272{449449- int i, iswrite, count = 0;450450- ide_hwif_t *hwif = HWIF(drive);273273+ int i, iswrite, count = 0;274274+ ide_hwif_t *hwif = HWIF(drive);451275452452- struct request *rq = HWGROUP(drive)->rq;276276+ struct request *rq = HWGROUP(drive)->rq;453277454454- _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;455455- struct scatterlist *sg;278278+ _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;279279+ struct scatterlist *sg;456280457457- iswrite = (rq_data_dir(rq) == WRITE);458458- /* Save for interrupt context */459459- ahwif->drive = drive;281281+ iswrite = (rq_data_dir(rq) == WRITE);282282+ /* Save for interrupt context */283283+ ahwif->drive = drive;460284461461- /* Build sglist */462462- hwif->sg_nents = i = auide_build_sglist(drive, rq);285285+ /* Build sglist */286286+ hwif->sg_nents = i = auide_build_sglist(drive, rq);463287464464- if (!i)465465- return 0;288288+ if (!i)289289+ return 0;466290467467- /* fill the descriptors */468468- sg = hwif->sg_table;469469- while (i && sg_dma_len(sg)) {470470- u32 cur_addr;471471- u32 cur_len;291291+ /* fill the descriptors */292292+ sg = hwif->sg_table;293293+ while (i && sg_dma_len(sg)) {294294+ u32 cur_addr;295295+ u32 cur_len;472296473473- cur_addr = sg_dma_address(sg);474474- cur_len = sg_dma_len(sg);297297+ cur_addr = sg_dma_address(sg);298298+ cur_len = sg_dma_len(sg);475299476476- while (cur_len) {477477- u32 flags = DDMA_FLAGS_NOIE;478478- unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;300300+ while (cur_len) {301301+ u32 flags = DDMA_FLAGS_NOIE;302302+ unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;479303480480- if (++count >= PRD_ENTRIES) {481481- printk(KERN_WARNING "%s: DMA table too small\n",482482- drive->name);483483- goto use_pio_instead;484484- }304304+ if (++count >= PRD_ENTRIES) {305305+ printk(KERN_WARNING "%s: DMA table too small\n",306306+ drive->name);307307+ goto use_pio_instead;308308+ }485309486486- /* Lets enable intr for the last descriptor only */487487- if (1==i)488488- flags = DDMA_FLAGS_IE;489489- else490490- flags = DDMA_FLAGS_NOIE;310310+ /* Lets enable intr for the last descriptor only */311311+ if (1==i)312312+ flags = DDMA_FLAGS_IE;313313+ else314314+ flags = DDMA_FLAGS_NOIE;491315492492- if (iswrite) {493493- if(!put_source_flags(ahwif->tx_chan,494494- (void*)(page_address(sg->page)495495- + sg->offset),496496- tc, flags)) {497497- printk(KERN_ERR "%s failed %d\n",498498- __FUNCTION__, __LINE__);316316+ if (iswrite) {317317+ if(!put_source_flags(ahwif->tx_chan, 318318+ (void*)(page_address(sg->page) 319319+ + sg->offset), 320320+ tc, flags)) { 321321+ printk(KERN_ERR "%s failed %d\n", 322322+ __FUNCTION__, __LINE__);499323 }500500- } else324324+ } else 501325 {502502- if(!put_dest_flags(ahwif->rx_chan,503503- (void*)(page_address(sg->page)504504- + sg->offset),505505- tc, flags)) {506506- printk(KERN_ERR "%s failed %d\n",507507- __FUNCTION__, __LINE__);326326+ if(!put_dest_flags(ahwif->rx_chan, 327327+ (void*)(page_address(sg->page) 328328+ + sg->offset), 329329+ tc, flags)) { 330330+ printk(KERN_ERR "%s failed %d\n", 331331+ __FUNCTION__, __LINE__);508332 }509509- }333333+ }510334511511- cur_addr += tc;512512- cur_len -= tc;513513- }514514- sg++;515515- i--;516516- }335335+ cur_addr += tc;336336+ cur_len -= tc;337337+ }338338+ sg++;339339+ i--;340340+ }517341518518- if (count)519519- return 1;342342+ if (count)343343+ return 1;520344521521-use_pio_instead:522522- dma_unmap_sg(ahwif->dev,523523- hwif->sg_table,524524- hwif->sg_nents,525525- hwif->sg_dma_direction);345345+ use_pio_instead:346346+ dma_unmap_sg(ahwif->dev,347347+ hwif->sg_table,348348+ hwif->sg_nents,349349+ hwif->sg_dma_direction);526350527527- return 0; /* revert to PIO for this request */351351+ return 0; /* revert to PIO for this request */528352}529353530354static int auide_dma_end(ide_drive_t *drive)531355{532532- ide_hwif_t *hwif = HWIF(drive);533533- _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;356356+ ide_hwif_t *hwif = HWIF(drive);357357+ _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;534358535535- if (hwif->sg_nents) {536536- dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents,537537- hwif->sg_dma_direction);538538- hwif->sg_nents = 0;539539- }359359+ if (hwif->sg_nents) {360360+ dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents,361361+ hwif->sg_dma_direction);362362+ hwif->sg_nents = 0;363363+ }540364541541- return 0;365365+ return 0;542366}543367544368static void auide_dma_start(ide_drive_t *drive )545369{546546-// printk("%s\n", __FUNCTION__);547370}548371549549-ide_startstop_t auide_dma_intr(ide_drive_t *drive)550550-{551551- //printk("%s\n", __FUNCTION__);552552-553553- u8 stat = 0, dma_stat = 0;554554-555555- dma_stat = HWIF(drive)->ide_dma_end(drive);556556- stat = HWIF(drive)->INB(IDE_STATUS_REG); /* get drive status */557557- if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {558558- if (!dma_stat) {559559- struct request *rq = HWGROUP(drive)->rq;560560-561561- ide_end_request(drive, 1, rq->nr_sectors);562562- return ide_stopped;563563- }564564- printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",565565- drive->name, dma_stat);566566- }567567- return ide_error(drive, "dma_intr", stat);568568-}569372570373static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command)571374{572572- //printk("%s\n", __FUNCTION__);573573-574574- /* issue cmd to drive */575575- ide_execute_command(drive, command, &auide_dma_intr,576576- (2*WAIT_CMD), NULL);375375+ /* issue cmd to drive */376376+ ide_execute_command(drive, command, &ide_dma_intr,377377+ (2*WAIT_CMD), NULL);577378}578379579380static int auide_dma_setup(ide_drive_t *drive)580580-{581581-// printk("%s\n", __FUNCTION__);381381+{ 382382+ struct request *rq = HWGROUP(drive)->rq;582383583583- if (drive->media != ide_disk)584584- return 1;384384+ if (!auide_build_dmatable(drive)) {385385+ ide_map_sg(drive, rq);386386+ return 1;387387+ }585388586586- if (!auide_build_dmatable(drive))587587- /* try PIO instead of DMA */588588- return 1;589589-590590- drive->waiting_for_dma = 1;591591-592592- return 0;389389+ drive->waiting_for_dma = 1;390390+ return 0;593391}594392595393static int auide_dma_check(ide_drive_t *drive)596394{597597-// printk("%s\n", __FUNCTION__);395395+ u8 speed;598396599397#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA600600- if( !dbdma_init_done ){601601- auide_hwif.white_list = in_drive_list(drive->id,602602- dma_white_list);603603- auide_hwif.black_list = in_drive_list(drive->id,604604- dma_black_list);605605- auide_hwif.drive = drive;606606- auide_ddma_init(&auide_hwif);607607- dbdma_init_done = 1;608608- }398398+399399+ if( dbdma_init_done == 0 ){400400+ auide_hwif.white_list = ide_in_drive_list(drive->id,401401+ dma_white_list);402402+ auide_hwif.black_list = ide_in_drive_list(drive->id,403403+ dma_black_list);404404+ auide_hwif.drive = drive;405405+ auide_ddma_init(&auide_hwif);406406+ dbdma_init_done = 1;407407+ }609408#endif610409611611- /* Is the drive in our DMA black list? */612612- if ( auide_hwif.black_list ) {613613- drive->using_dma = 0;614614- printk("%s found in dma_blacklist[]! Disabling DMA.\n",615615- drive->id->model);616616- }617617- else618618- drive->using_dma = 1;410410+ /* Is the drive in our DMA black list? */619411620620- return HWIF(drive)->ide_dma_host_on(drive);412412+ if ( auide_hwif.black_list ) {413413+ drive->using_dma = 0;414414+415415+ /* Borrowed the warning message from ide-dma.c */416416+417417+ printk(KERN_WARNING "%s: Disabling DMA for %s (blacklisted)\n",418418+ drive->name, drive->id->model); 419419+ }420420+ else421421+ drive->using_dma = 1;422422+423423+ speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA);424424+425425+ if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)426426+ return HWIF(drive)->ide_dma_on(drive);427427+428428+ return HWIF(drive)->ide_dma_off_quietly(drive);621429}622430623431static int auide_dma_test_irq(ide_drive_t *drive)624624-{625625-// printk("%s\n", __FUNCTION__);626626-627627- if (!drive->waiting_for_dma)628628- printk(KERN_WARNING "%s: ide_dma_test_irq \432432+{ 433433+ if (drive->waiting_for_dma == 0)434434+ printk(KERN_WARNING "%s: ide_dma_test_irq \629435 called while not waiting\n", drive->name);630436631631- /* If dbdma didn't execute the STOP command yet, the632632- * active bit is still set437437+ /* If dbdma didn't execute the STOP command yet, the438438+ * active bit is still set633439 */634634- drive->waiting_for_dma++;635635- if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) {636636- printk(KERN_WARNING "%s: timeout waiting for ddma to \440440+ drive->waiting_for_dma++;441441+ if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) {442442+ printk(KERN_WARNING "%s: timeout waiting for ddma to \637443 complete\n", drive->name);638638- return 1;639639- }640640- udelay(10);641641- return 0;444444+ return 1;445445+ }446446+ udelay(10);447447+ return 0;642448}643449644450static int auide_dma_host_on(ide_drive_t *drive)645451{646646-// printk("%s\n", __FUNCTION__);647647- return 0;452452+ return 0;648453}649454650455static int auide_dma_on(ide_drive_t *drive)651456{652652-// printk("%s\n", __FUNCTION__);653653- drive->using_dma = 1;654654- return auide_dma_host_on(drive);457457+ drive->using_dma = 1;458458+ return auide_dma_host_on(drive);655459}656460657461658462static int auide_dma_host_off(ide_drive_t *drive)659463{660660-// printk("%s\n", __FUNCTION__);661661- return 0;464464+ return 0;662465}663466664467static int auide_dma_off_quietly(ide_drive_t *drive)665468{666666-// printk("%s\n", __FUNCTION__);667667- drive->using_dma = 0;668668- return auide_dma_host_off(drive);469469+ drive->using_dma = 0;470470+ return auide_dma_host_off(drive);669471}670472671473static int auide_dma_lostirq(ide_drive_t *drive)672474{673673-// printk("%s\n", __FUNCTION__);674674-675675- printk(KERN_ERR "%s: IRQ lost\n", drive->name);676676- return 0;475475+ printk(KERN_ERR "%s: IRQ lost\n", drive->name);476476+ return 0;677477}678478679479static void auide_ddma_tx_callback(int irq, void *param, struct pt_regs *regs)680480{681681-// printk("%s\n", __FUNCTION__);682682-683683- _auide_hwif *ahwif = (_auide_hwif*)param;684684- ahwif->drive->waiting_for_dma = 0;685685- return;481481+ _auide_hwif *ahwif = (_auide_hwif*)param;482482+ ahwif->drive->waiting_for_dma = 0;686483}687484688485static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs)689486{690690-// printk("%s\n", __FUNCTION__);691691-692692- _auide_hwif *ahwif = (_auide_hwif*)param;693693- ahwif->drive->waiting_for_dma = 0;694694- return;487487+ _auide_hwif *ahwif = (_auide_hwif*)param;488488+ ahwif->drive->waiting_for_dma = 0;695489}490490+491491+#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */492492+493493+static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags)494494+{495495+ dev->dev_id = dev_id;496496+ dev->dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;497497+ dev->dev_intlevel = 0;498498+ dev->dev_intpolarity = 0;499499+ dev->dev_tsize = tsize;500500+ dev->dev_devwidth = devwidth;501501+ dev->dev_flags = flags;502502+}503503+504504+#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)696505697506static int auide_dma_timeout(ide_drive_t *drive)698507{699508// printk("%s\n", __FUNCTION__);700509701701- printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);510510+ printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);702511703703- if (HWIF(drive)->ide_dma_test_irq(drive))704704- return 0;512512+ if (HWIF(drive)->ide_dma_test_irq(drive))513513+ return 0;705514706706- return HWIF(drive)->ide_dma_end(drive);515515+ return HWIF(drive)->ide_dma_end(drive);707516}708708-#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */517517+709518519519+static int auide_ddma_init(_auide_hwif *auide) {520520+521521+ dbdev_tab_t source_dev_tab, target_dev_tab;522522+ u32 dev_id, tsize, devwidth, flags;523523+ ide_hwif_t *hwif = auide->hwif;710524525525+ dev_id = AU1XXX_ATA_DDMA_REQ;526526+527527+ if (auide->white_list || auide->black_list) {528528+ tsize = 8;529529+ devwidth = 32;530530+ }531531+ else { 532532+ tsize = 1;533533+ devwidth = 16;534534+535535+ printk(KERN_ERR "au1xxx-ide: %s is not on ide driver whitelist.\n",auide_hwif.drive->id->model);536536+ printk(KERN_ERR " please read 'Documentation/mips/AU1xxx_IDE.README'");537537+ }538538+539539+#ifdef IDE_AU1XXX_BURSTMODE 540540+ flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE;541541+#else542542+ flags = DEV_FLAGS_SYNC;543543+#endif544544+545545+ /* setup dev_tab for tx channel */546546+ auide_init_dbdma_dev( &source_dev_tab,547547+ dev_id,548548+ tsize, devwidth, DEV_FLAGS_OUT | flags);549549+ auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );550550+551551+ auide_init_dbdma_dev( &source_dev_tab,552552+ dev_id,553553+ tsize, devwidth, DEV_FLAGS_IN | flags);554554+ auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );555555+556556+ /* We also need to add a target device for the DMA */557557+ auide_init_dbdma_dev( &target_dev_tab,558558+ (u32)DSCR_CMD0_ALWAYS,559559+ tsize, devwidth, DEV_FLAGS_ANYUSE);560560+ auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab); 561561+562562+ /* Get a channel for TX */563563+ auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id,564564+ auide->tx_dev_id,565565+ auide_ddma_tx_callback,566566+ (void*)auide);567567+568568+ /* Get a channel for RX */569569+ auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,570570+ auide->target_dev_id,571571+ auide_ddma_rx_callback,572572+ (void*)auide);573573+574574+ auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,575575+ NUM_DESCRIPTORS);576576+ auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,577577+ NUM_DESCRIPTORS);578578+579579+ hwif->dmatable_cpu = dma_alloc_coherent(auide->dev,580580+ PRD_ENTRIES * PRD_BYTES, /* 1 Page */581581+ &hwif->dmatable_dma, GFP_KERNEL);582582+583583+ au1xxx_dbdma_start( auide->tx_chan );584584+ au1xxx_dbdma_start( auide->rx_chan );585585+586586+ return 0;587587+} 588588+#else589589+711590static int auide_ddma_init( _auide_hwif *auide )712591{713713-// printk("%s\n", __FUNCTION__);592592+ dbdev_tab_t source_dev_tab;593593+ int flags;714594715715- dbdev_tab_t source_dev_tab;716716-#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)717717- dbdev_tab_t target_dev_tab;718718- ide_hwif_t *hwif = auide->hwif;719719- char warning_output [2][80];720720- int i;721721-#endif722722-723723- /* Add our custom device to DDMA device table */724724- /* Create our new device entries in the table */725725-#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)726726- source_dev_tab.dev_id = AU1XXX_ATA_DDMA_REQ;727727-728728- if( auide->white_list || auide->black_list ){729729- source_dev_tab.dev_tsize = 8;730730- source_dev_tab.dev_devwidth = 32;731731- source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;732732- source_dev_tab.dev_intlevel = 0;733733- source_dev_tab.dev_intpolarity = 0;734734-735735- /* init device table for target - static bus controller - */736736- target_dev_tab.dev_id = DSCR_CMD0_ALWAYS;737737- target_dev_tab.dev_tsize = 8;738738- target_dev_tab.dev_devwidth = 32;739739- target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;740740- target_dev_tab.dev_intlevel = 0;741741- target_dev_tab.dev_intpolarity = 0;742742- target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE;743743- }744744- else{745745- source_dev_tab.dev_tsize = 1;746746- source_dev_tab.dev_devwidth = 16;747747- source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;748748- source_dev_tab.dev_intlevel = 0;749749- source_dev_tab.dev_intpolarity = 0;750750-751751- /* init device table for target - static bus controller - */752752- target_dev_tab.dev_id = DSCR_CMD0_ALWAYS;753753- target_dev_tab.dev_tsize = 1;754754- target_dev_tab.dev_devwidth = 16;755755- target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;756756- target_dev_tab.dev_intlevel = 0;757757- target_dev_tab.dev_intpolarity = 0;758758- target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE;759759-760760- sprintf(&warning_output[0][0],761761- "%s is not on ide driver white list.",762762- auide_hwif.drive->id->model);763763- for ( i=strlen(&warning_output[0][0]) ; i<76; i++ ){764764- sprintf(&warning_output[0][i]," ");765765- }766766-767767- sprintf(&warning_output[1][0],768768- "To add %s please read 'Documentation/mips/AU1xxx_IDE.README'.",769769- auide_hwif.drive->id->model);770770- for ( i=strlen(&warning_output[1][0]) ; i<76; i++ ){771771- sprintf(&warning_output[1][i]," ");772772- }773773-774774- printk("\n****************************************");775775- printk("****************************************\n");776776- printk("* %s *\n",&warning_output[0][0]);777777- printk("* Switch to safe MWDMA Mode! ");778778- printk(" *\n");779779- printk("* %s *\n",&warning_output[1][0]);780780- printk("****************************************");781781- printk("****************************************\n\n");782782- }595595+#ifdef IDE_AU1XXX_BURSTMODE 596596+ flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE;783597#else784784- source_dev_tab.dev_id = DSCR_CMD0_ALWAYS;785785- source_dev_tab.dev_tsize = 8;786786- source_dev_tab.dev_devwidth = 32;787787- source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;788788- source_dev_tab.dev_intlevel = 0;789789- source_dev_tab.dev_intpolarity = 0;598598+ flags = DEV_FLAGS_SYNC;790599#endif791600792792-#if CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON793793- /* set flags for tx channel */794794- source_dev_tab.dev_flags = DEV_FLAGS_OUT795795- | DEV_FLAGS_SYNC796796- | DEV_FLAGS_BURSTABLE;797797- auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );798798- /* set flags for rx channel */799799- source_dev_tab.dev_flags = DEV_FLAGS_IN800800- | DEV_FLAGS_SYNC801801- | DEV_FLAGS_BURSTABLE;802802- auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );803803-#else804804- /* set flags for tx channel */805805- source_dev_tab.dev_flags = DEV_FLAGS_OUT | DEV_FLAGS_SYNC;806806- auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );807807- /* set flags for rx channel */808808- source_dev_tab.dev_flags = DEV_FLAGS_IN | DEV_FLAGS_SYNC;809809- auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );810810-#endif601601+ /* setup dev_tab for tx channel */602602+ auide_init_dbdma_dev( &source_dev_tab,603603+ (u32)DSCR_CMD0_ALWAYS,604604+ 8, 32, DEV_FLAGS_OUT | flags);605605+ auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );811606812812-#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)813813-814814- auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab);815815-816816- /* Get a channel for TX */817817- auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id,818818- auide->tx_dev_id,819819- auide_ddma_tx_callback,820820- (void*)auide);821821- /* Get a channel for RX */822822- auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,823823- auide->target_dev_id,824824- auide_ddma_rx_callback,825825- (void*)auide);826826-#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */827827- /*828828- * Note: if call back is not enabled, update ctp->cur_ptr manually829829- */830830- auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS,831831- auide->tx_dev_id,832832- NULL,833833- (void*)auide);834834- auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,835835- DSCR_CMD0_ALWAYS,836836- NULL,837837- (void*)auide);838838-#endif839839- auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,840840- NUM_DESCRIPTORS);841841- auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,842842- NUM_DESCRIPTORS);843843-844844-#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)845845- hwif->dmatable_cpu = dma_alloc_coherent(auide->dev,846846- PRD_ENTRIES * PRD_BYTES, /* 1 Page */847847- &hwif->dmatable_dma, GFP_KERNEL);848848-849849- auide->sg_table = kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES,850850- GFP_KERNEL|GFP_DMA);851851- if (auide->sg_table == NULL) {852852- return -ENOMEM;853853- }854854-#endif855855- au1xxx_dbdma_start( auide->tx_chan );856856- au1xxx_dbdma_start( auide->rx_chan );857857- return 0;607607+ auide_init_dbdma_dev( &source_dev_tab,608608+ (u32)DSCR_CMD0_ALWAYS,609609+ 8, 32, DEV_FLAGS_IN | flags);610610+ auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );611611+612612+ /* Get a channel for TX */613613+ auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS,614614+ auide->tx_dev_id,615615+ NULL,616616+ (void*)auide);617617+618618+ /* Get a channel for RX */619619+ auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,620620+ DSCR_CMD0_ALWAYS,621621+ NULL,622622+ (void*)auide);623623+624624+ auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,625625+ NUM_DESCRIPTORS);626626+ auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,627627+ NUM_DESCRIPTORS);628628+629629+ au1xxx_dbdma_start( auide->tx_chan );630630+ au1xxx_dbdma_start( auide->rx_chan );631631+632632+ return 0;858633}634634+#endif859635860636static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)861637{862862- int i;863863-#define ide_ioreg_t unsigned long864864- ide_ioreg_t *ata_regs = hw->io_ports;638638+ int i;639639+ unsigned long *ata_regs = hw->io_ports;865640866866- /* fixme */867867- for (i = 0; i < IDE_CONTROL_OFFSET; i++) {868868- *ata_regs++ = (ide_ioreg_t) ahwif->regbase869869- + (ide_ioreg_t)(i << AU1XXX_ATA_REG_OFFSET);870870- }641641+ /* FIXME? */642642+ for (i = 0; i < IDE_CONTROL_OFFSET; i++) {643643+ *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET);644644+ }871645872872- /* set the Alternative Status register */873873- *ata_regs = (ide_ioreg_t) ahwif->regbase874874- + (ide_ioreg_t)(14 << AU1XXX_ATA_REG_OFFSET);646646+ /* set the Alternative Status register */647647+ *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET);875648}876649877650static int au_ide_probe(struct device *dev)878651{879652 struct platform_device *pdev = to_platform_device(dev);880880- _auide_hwif *ahwif = &auide_hwif;881881- ide_hwif_t *hwif;653653+ _auide_hwif *ahwif = &auide_hwif;654654+ ide_hwif_t *hwif;882655 struct resource *res;883656 int ret = 0;884657885658#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)886886- char *mode = "MWDMA2";659659+ char *mode = "MWDMA2";887660#elif defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)888888- char *mode = "PIO+DDMA(offload)";661661+ char *mode = "PIO+DDMA(offload)";889662#endif890663891891- memset(&auide_hwif, 0, sizeof(_auide_hwif));892892- auide_hwif.dev = 0;664664+ memset(&auide_hwif, 0, sizeof(_auide_hwif));665665+ auide_hwif.dev = 0;893666894667 ahwif->dev = dev;895668 ahwif->irq = platform_get_irq(pdev, 0);···675902 goto out;676903 }677904678678- if (!request_mem_region (res->start, res->end-res->start, pdev->name)) {905905+ if (!request_mem_region (res->start, res->end-res->start, pdev->name)) {679906 pr_debug("%s: request_mem_region failed\n", DRV_NAME);680680- ret = -EBUSY;907907+ ret = -EBUSY;681908 goto out;682682- }909909+ }683910684911 ahwif->regbase = (u32)ioremap(res->start, res->end-res->start);685912 if (ahwif->regbase == 0) {···687914 goto out;688915 }689916690690- hwif = &ide_hwifs[pdev->id];691691- hw_regs_t *hw = &hwif->hw;692692- hwif->irq = hw->irq = ahwif->irq;693693- hwif->chipset = ide_au1xxx;917917+ /* FIXME: This might possibly break PCMCIA IDE devices */694918695695- auide_setup_ports(hw, ahwif);919919+ hwif = &ide_hwifs[pdev->id];920920+ hw_regs_t *hw = &hwif->hw;921921+ hwif->irq = hw->irq = ahwif->irq;922922+ hwif->chipset = ide_au1xxx;923923+924924+ auide_setup_ports(hw, ahwif);696925 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));697926698698-#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ699699- hwif->rqsize = CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ;700700- hwif->rqsize = ((hwif->rqsize > AU1XXX_ATA_RQSIZE)701701- || (hwif->rqsize < 32)) ? AU1XXX_ATA_RQSIZE : hwif->rqsize;702702-#else /* if kernel config is not set */703703- hwif->rqsize = AU1XXX_ATA_RQSIZE;704704-#endif705705-706706- hwif->ultra_mask = 0x0; /* Disable Ultra DMA */927927+ hwif->ultra_mask = 0x0; /* Disable Ultra DMA */707928#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA708708- hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */709709- hwif->swdma_mask = 0x07;929929+ hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */930930+ hwif->swdma_mask = 0x00;710931#else711711- hwif->mwdma_mask = 0x0;712712- hwif->swdma_mask = 0x0;932932+ hwif->mwdma_mask = 0x0;933933+ hwif->swdma_mask = 0x0;713934#endif714714- //hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];715715- hwif->noprobe = 0;716716- hwif->drives[0].unmask = 1;717717- hwif->drives[1].unmask = 1;718935719719- /* hold should be on in all cases */720720- hwif->hold = 1;721721- hwif->mmio = 2;936936+ hwif->noprobe = 0;937937+ hwif->drives[0].unmask = 1;938938+ hwif->drives[1].unmask = 1;722939723723- /* set up local I/O function entry points */724724- hwif->INB = auide_inb;725725- hwif->INW = auide_inw;726726- hwif->INL = auide_inl;727727- hwif->INSW = auide_insw;728728- hwif->INSL = auide_insl;729729- hwif->OUTB = auide_outb;730730- hwif->OUTBSYNC = auide_outbsync;731731- hwif->OUTW = auide_outw;732732- hwif->OUTL = auide_outl;733733- hwif->OUTSW = auide_outsw;734734- hwif->OUTSL = auide_outsl;940940+ /* hold should be on in all cases */941941+ hwif->hold = 1;942942+ hwif->mmio = 2;735943736736- hwif->tuneproc = &auide_tune_drive;737737- hwif->speedproc = &auide_tune_chipset;944944+ /* If the user has selected DDMA assisted copies,945945+ then set up a few local I/O function entry points 946946+ */947947+948948+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA 949949+ hwif->INSW = auide_insw;950950+ hwif->OUTSW = auide_outsw;951951+#endif952952+953953+ hwif->tuneproc = &auide_tune_drive;954954+ hwif->speedproc = &auide_tune_chipset;738955739956#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA740740- hwif->ide_dma_off_quietly = &auide_dma_off_quietly;741741- hwif->ide_dma_timeout = &auide_dma_timeout;957957+ hwif->ide_dma_off_quietly = &auide_dma_off_quietly;958958+ hwif->ide_dma_timeout = &auide_dma_timeout;742959743743- hwif->ide_dma_check = &auide_dma_check;744744- hwif->dma_exec_cmd = &auide_dma_exec_cmd;745745- hwif->dma_start = &auide_dma_start;746746- hwif->ide_dma_end = &auide_dma_end;747747- hwif->dma_setup = &auide_dma_setup;748748- hwif->ide_dma_test_irq = &auide_dma_test_irq;749749- hwif->ide_dma_host_off = &auide_dma_host_off;750750- hwif->ide_dma_host_on = &auide_dma_host_on;751751- hwif->ide_dma_lostirq = &auide_dma_lostirq;752752- hwif->ide_dma_on = &auide_dma_on;960960+ hwif->ide_dma_check = &auide_dma_check;961961+ hwif->dma_exec_cmd = &auide_dma_exec_cmd;962962+ hwif->dma_start = &auide_dma_start;963963+ hwif->ide_dma_end = &auide_dma_end;964964+ hwif->dma_setup = &auide_dma_setup;965965+ hwif->ide_dma_test_irq = &auide_dma_test_irq;966966+ hwif->ide_dma_host_off = &auide_dma_host_off;967967+ hwif->ide_dma_host_on = &auide_dma_host_on;968968+ hwif->ide_dma_lostirq = &auide_dma_lostirq;969969+ hwif->ide_dma_on = &auide_dma_on;753970754754- hwif->autodma = 1;755755- hwif->drives[0].autodma = hwif->autodma;756756- hwif->drives[1].autodma = hwif->autodma;757757- hwif->atapi_dma = 1;758758- hwif->drives[0].using_dma = 1;759759- hwif->drives[1].using_dma = 1;971971+ hwif->autodma = 1;972972+ hwif->drives[0].autodma = hwif->autodma;973973+ hwif->drives[1].autodma = hwif->autodma;974974+ hwif->atapi_dma = 1;975975+760976#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */761761- hwif->autodma = 0;762762- hwif->channel = 0;763763- hwif->hold = 1;764764- hwif->select_data = 0; /* no chipset-specific code */765765- hwif->config_data = 0; /* no chipset-specific code */977977+ hwif->autodma = 0;978978+ hwif->channel = 0;979979+ hwif->hold = 1;980980+ hwif->select_data = 0; /* no chipset-specific code */981981+ hwif->config_data = 0; /* no chipset-specific code */766982767767- hwif->drives[0].autodma = 0;768768- hwif->drives[0].drive_data = 0; /* no drive data */769769- hwif->drives[0].using_dma = 0;770770- hwif->drives[0].waiting_for_dma = 0;771771- hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */772772- /* secondary hdd not supported */773773- hwif->drives[1].autodma = 0;774774-775775- hwif->drives[1].drive_data = 0;776776- hwif->drives[1].using_dma = 0;777777- hwif->drives[1].waiting_for_dma = 0;778778- hwif->drives[1].autotune = 2; /* 1=autotune, 2=noautotune, 0=default */983983+ hwif->drives[0].autodma = 0;984984+ hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */779985#endif780780- hwif->drives[0].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */781781- hwif->drives[1].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */986986+ hwif->drives[0].no_io_32bit = 1; 782987783783- /*Register Driver with PM Framework*/784784-#ifdef CONFIG_PM785785- auide_hwif.pm.lock = SPIN_LOCK_UNLOCKED;786786- auide_hwif.pm.stopped = 0;988988+ auide_hwif.hwif = hwif;989989+ hwif->hwif_data = &auide_hwif;787990788788- auide_hwif.pm.dev = new_au1xxx_power_device( "ide",789789- &au1200ide_pm_callback,790790- NULL);791791- if ( auide_hwif.pm.dev == NULL )792792- printk(KERN_INFO "Unable to create a power management \793793- device entry for the au1200-IDE.\n");794794- else795795- printk(KERN_INFO "Power management device entry for the \796796- au1200-IDE loaded.\n");797797-#endif798798-799799- auide_hwif.hwif = hwif;800800- hwif->hwif_data = &auide_hwif;801801-802802-#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA803803- auide_ddma_init(&auide_hwif);804804- dbdma_init_done = 1;991991+#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA 992992+ auide_ddma_init(&auide_hwif);993993+ dbdma_init_done = 1;805994#endif806995807996 probe_hwif_init(hwif);808997 dev_set_drvdata(dev, hwif);809998810810- printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );999999+ printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );8111000812812-out:813813- return ret;10011001+ out:10021002+ return ret;8141003}81510048161005static int au_ide_remove(struct device *dev)···7801045 struct platform_device *pdev = to_platform_device(dev);7811046 struct resource *res;7821047 ide_hwif_t *hwif = dev_get_drvdata(dev);783783- _auide_hwif *ahwif = &auide_hwif;10481048+ _auide_hwif *ahwif = &auide_hwif;78410497851050 ide_unregister(hwif - ide_hwifs);7861051···8041069 return driver_register(&au1200_ide_driver);8051070}8061071807807-static void __init au_ide_exit(void)10721072+static void __exit au_ide_exit(void)8081073{8091074 driver_unregister(&au1200_ide_driver);8101075}811811-812812-#ifdef CONFIG_PM813813-int au1200ide_pm_callback( au1xxx_power_dev_t *dev,\814814- au1xxx_request_t request, void *data) {815815-816816- unsigned int d, err = 0;817817- unsigned long flags;818818-819819- spin_lock_irqsave(auide_hwif.pm.lock, flags);820820-821821- switch (request){822822- case AU1XXX_PM_SLEEP:823823- err = au1xxxide_pm_sleep(dev);824824- break;825825- case AU1XXX_PM_WAKEUP:826826- d = *((unsigned int*)data);827827- if ( d > 0 && d <= 99) {828828- err = au1xxxide_pm_standby(dev);829829- }830830- else {831831- err = au1xxxide_pm_resume(dev);832832- }833833- break;834834- case AU1XXX_PM_GETSTATUS:835835- err = au1xxxide_pm_getstatus(dev);836836- break;837837- case AU1XXX_PM_ACCESS:838838- err = au1xxxide_pm_access(dev);839839- break;840840- case AU1XXX_PM_IDLE:841841- err = au1xxxide_pm_idle(dev);842842- break;843843- case AU1XXX_PM_CLEANUP:844844- err = au1xxxide_pm_cleanup(dev);845845- break;846846- default:847847- err = -1;848848- break;849849- }850850-851851- spin_unlock_irqrestore(auide_hwif.pm.lock, flags);852852-853853- return err;854854-}855855-856856-static int au1xxxide_pm_standby( au1xxx_power_dev_t *dev ) {857857- return 0;858858-}859859-860860-static int au1xxxide_pm_sleep( au1xxx_power_dev_t *dev ) {861861-862862- int retval;863863- ide_hwif_t *hwif = auide_hwif.hwif;864864- struct request rq;865865- struct request_pm_state rqpm;866866- ide_task_t args;867867-868868- if(auide_hwif.pm.stopped)869869- return -1;870870-871871- /*872872- * wait until hard disc is ready873873- */874874- if ( wait_for_ready(&hwif->drives[0], 35000) ) {875875- printk("Wait for drive sleep timeout!\n");876876- retval = -1;877877- }878878-879879- /*880880- * sequenz to tell the high level ide driver that pm is resuming881881- */882882- memset(&rq, 0, sizeof(rq));883883- memset(&rqpm, 0, sizeof(rqpm));884884- memset(&args, 0, sizeof(args));885885- rq.flags = REQ_PM_SUSPEND;886886- rq.special = &args;887887- rq.pm = &rqpm;888888- rqpm.pm_step = ide_pm_state_start_suspend;889889- rqpm.pm_state = PMSG_SUSPEND;890890-891891- retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_wait);892892-893893- if (wait_for_ready (&hwif->drives[0], 35000)) {894894- printk("Wait for drive sleep timeout!\n");895895- retval = -1;896896- }897897-898898- /*899899- * stop dbdma channels900900- */901901- au1xxx_dbdma_reset(auide_hwif.tx_chan);902902- au1xxx_dbdma_reset(auide_hwif.rx_chan);903903-904904- auide_hwif.pm.stopped = 1;905905-906906- return retval;907907-}908908-909909-static int au1xxxide_pm_resume( au1xxx_power_dev_t *dev ) {910910-911911- int retval;912912- ide_hwif_t *hwif = auide_hwif.hwif;913913- struct request rq;914914- struct request_pm_state rqpm;915915- ide_task_t args;916916-917917- if(!auide_hwif.pm.stopped)918918- return -1;919919-920920- /*921921- * start dbdma channels922922- */923923- au1xxx_dbdma_start(auide_hwif.tx_chan);924924- au1xxx_dbdma_start(auide_hwif.rx_chan);925925-926926- /*927927- * wait until hard disc is ready928928- */929929- if (wait_for_ready ( &hwif->drives[0], 35000)) {930930- printk("Wait for drive wake up timeout!\n");931931- retval = -1;932932- }933933-934934- /*935935- * sequenz to tell the high level ide driver that pm is resuming936936- */937937- memset(&rq, 0, sizeof(rq));938938- memset(&rqpm, 0, sizeof(rqpm));939939- memset(&args, 0, sizeof(args));940940- rq.flags = REQ_PM_RESUME;941941- rq.special = &args;942942- rq.pm = &rqpm;943943- rqpm.pm_step = ide_pm_state_start_resume;944944- rqpm.pm_state = PMSG_ON;945945-946946- retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_head_wait);947947-948948- /*949949- * wait for hard disc950950- */951951- if ( wait_for_ready(&hwif->drives[0], 35000) ) {952952- printk("Wait for drive wake up timeout!\n");953953- retval = -1;954954- }955955-956956- auide_hwif.pm.stopped = 0;957957-958958- return retval;959959-}960960-961961-static int au1xxxide_pm_getstatus( au1xxx_power_dev_t *dev ) {962962- return dev->cur_state;963963-}964964-965965-static int au1xxxide_pm_access( au1xxx_power_dev_t *dev ) {966966- if (dev->cur_state != AWAKE_STATE)967967- return 0;968968- else969969- return -1;970970-}971971-972972-static int au1xxxide_pm_idle( au1xxx_power_dev_t *dev ) {973973- return 0;974974-}975975-976976-static int au1xxxide_pm_cleanup( au1xxx_power_dev_t *dev ) {977977- return 0;978978-}979979-#endif /* CONFIG_PM */98010769811077MODULE_LICENSE("GPL");9821078MODULE_DESCRIPTION("AU1200 IDE driver");
+7-1
drivers/ide/pci/sgiioc4.c
···622622 ide_hwif_t *hwif;623623 int h;624624625625+ /*626626+ * Find an empty HWIF; if none available, return -ENOMEM.627627+ */625628 for (h = 0; h < MAX_HWIFS; ++h) {626629 hwif = &ide_hwifs[h];627627- /* Find an empty HWIF */628630 if (hwif->chipset == ide_unknown)629631 break;632632+ }633633+ if (h == MAX_HWIFS) {634634+ printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", d->name);635635+ return -ENOMEM;630636 }631637632638 /* Get the CmdBlk and CtrlBlk Base Registers */
···679679}680680681681/*682682- * Apply power to the MMC stack.682682+ * Apply power to the MMC stack. This is a two-stage process.683683+ * First, we enable power to the card without the clock running.684684+ * We then wait a bit for the power to stabilise. Finally,685685+ * enable the bus drivers and clock to the card.686686+ *687687+ * We must _NOT_ enable the clock prior to power stablising.688688+ *689689+ * If a host does all the power sequencing itself, ignore the690690+ * initial MMC_POWER_UP stage.683691 */684692static void mmc_power_up(struct mmc_host *host)685693{
···14051405 goal->iu = 0;14061406 goal->dt = 0;14071407 goal->qas = 0;14081408- goal->period = 0;14091408 goal->offset = 0;14101409 return;14111410 }···14641465 * Many devices implement PPR in a buggy way, so only use it if we14651466 * really want to.14661467 */14671467- if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) {14681468+ if (goal->offset &&14691469+ (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) {14681470 nego = NS_PPR;14691471 } else if (spi_width(starget) != goal->width) {14701472 nego = NS_WIDE;
+18-8
fs/reiserfs/inode.c
···3232 JOURNAL_PER_BALANCE_CNT * 2 +3333 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);3434 struct reiserfs_transaction_handle th;3535+ int err;35363637 truncate_inode_pages(&inode->i_data, 0);3738···5049 }5150 reiserfs_update_inode_transaction(inode);52515353- if (reiserfs_delete_object(&th, inode)) {5454- up(&inode->i_sem);5555- goto out;5656- }5252+ err = reiserfs_delete_object(&th, inode);57535854 /* Do quota update inside a transaction for journaled quotas. We must do that5955 * after delete_object so that quota updates go into the same transaction as6056 * stat data deletion */6161- DQUOT_FREE_INODE(inode);5757+ if (!err) 5858+ DQUOT_FREE_INODE(inode);62596360 if (journal_end(&th, inode->i_sb, jbegin_count)) {6461 up(&inode->i_sem);···6465 }65666667 up(&inode->i_sem);6868+6969+ /* check return value from reiserfs_delete_object after7070+ * ending the transaction7171+ */7272+ if (err)7373+ goto out;67746875 /* all items of file are deleted, so we can remove "save" link */6976 remove_save_link(inode, 0 /* not truncate */ ); /* we can't do anything···21042099 struct page *page = NULL;21052100 int error;21062101 struct buffer_head *bh = NULL;21022102+ int err2;2107210321082104 reiserfs_write_lock(p_s_inode->i_sb);21092105···21422136 transaction of truncating gets committed - on reboot the file21432137 either appears truncated properly or not truncated at all */21442138 add_save_link(&th, p_s_inode, 1);21452145- error = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps);21462146- if (error)21472147- goto out;21392139+ err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps);21482140 error =21492141 journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1);21502142 if (error)21512143 goto out;2152214421452145+ /* check reiserfs_do_truncate after ending the transaction */21462146+ if (err2) {21472147+ error = err2;21482148+ goto out;21492149+ }21502150+21532151 if (update_timestamps) {21542152 error = remove_save_link(p_s_inode, 1 /* truncate */ );21552153 if (error)
+14-4
fs/reiserfs/journal.c
···10391039 }10401040 atomic_dec(&journal->j_async_throttle);1041104110421042+ /* We're skipping the commit if there's an error */10431043+ if (retval || reiserfs_is_journal_aborted(journal))10441044+ barrier = 0;10451045+10421046 /* wait on everything written so far before writing the commit10431047 * if we are in barrier mode, send the commit down now10441048 */···10811077 BUG_ON(atomic_read(&(jl->j_commit_left)) != 1);1082107810831079 if (!barrier) {10841084- if (buffer_dirty(jl->j_commit_bh))10851085- BUG();10861086- mark_buffer_dirty(jl->j_commit_bh);10871087- sync_dirty_buffer(jl->j_commit_bh);10801080+ /* If there was a write error in the journal - we can't commit10811081+ * this transaction - it will be invalid and, if successful,10821082+ * will just end up propogating the write error out to10831083+ * the file system. */10841084+ if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {10851085+ if (buffer_dirty(jl->j_commit_bh))10861086+ BUG();10871087+ mark_buffer_dirty(jl->j_commit_bh) ;10881088+ sync_dirty_buffer(jl->j_commit_bh) ;10891089+ }10881090 } else10891091 wait_on_buffer(jl->j_commit_bh);10901092
···256256257257source "usr/Kconfig"258258259259+config CC_OPTIMIZE_FOR_SIZE260260+ bool "Optimize for size (Look out for broken compilers!)"261261+ default y262262+ depends on ARM || H8300 || EXPERIMENTAL263263+ depends on !SPARC64264264+ help265265+ Enabling this option will pass "-Os" instead of "-O2" to gcc266266+ resulting in a smaller kernel.267267+268268+ WARNING: some versions of gcc may generate incorrect code with this269269+ option. If problems are observed, a gcc upgrade may be needed.270270+271271+ If unsure, say N.272272+259273menuconfig EMBEDDED260274 bool "Configure standard kernel features (for small systems)"261275 help···351337 help352338 Disabling this option will cause the kernel to be built without353339 support for epoll family of system calls.354354-355355-config CC_OPTIMIZE_FOR_SIZE356356- bool "Optimize for size"357357- default y if ARM || H8300358358- help359359- Enabling this option will pass "-Os" instead of "-O2" to gcc360360- resulting in a smaller kernel.361361-362362- WARNING: some versions of gcc may generate incorrect code with this363363- option. If problems are observed, a gcc upgrade may be needed.364364-365365- If unsure, say N.366340367341config SHMEM368342 bool "Use full shmem filesystem" if EMBEDDED
+3
net/8021q/vlan_dev.c
···165165166166 skb_pull(skb, VLAN_HLEN); /* take off the VLAN header (4 bytes currently) */167167168168+ /* Need to correct hardware checksum */169169+ skb_postpull_rcsum(skb, vhdr, VLAN_HLEN);170170+168171 /* Ok, lets check to make sure the device (dev) we169172 * came in on is what this VLAN is attached to.170173 */