From 2eae6ebbf99a083687466c010e3129fede9cdb4b Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 1 Feb 2008 23:09:16 +0100 Subject: ide: small ide-scan-pci.c cleanup - ide_scan_pcibus() can become static - instead of ide_scan_pci() we can use ide_scan_pcibus() directly in module_init() Signed-off-by: Adrian Bunk Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 27cb39de2ae..c4d58b0e650 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1017,7 +1017,6 @@ void ide_init_disk(struct gendisk *, ide_drive_t *); #ifdef CONFIG_IDEPCI_PCIBUS_ORDER extern int ide_scan_direction; -int __init ide_scan_pcibus(void); extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) #else -- cgit v1.2.3 From da6f4c7f6fe02f92aff72071ed541f59e5880398 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 1 Feb 2008 23:09:16 +0100 Subject: ide: make wait_drive_not_busy() static again After commit 7267c3377443322588cddaf457cf106839a60463 wait_drive_not_busy() can become static again. Signed-off-by: Adrian Bunk Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index c4d58b0e650..7072c535f7c 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -986,8 +986,6 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); void task_end_request(ide_drive_t *, struct request *, u8); -u8 wait_drive_not_busy(ide_drive_t *); - int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); -- cgit v1.2.3 From a1bb9457f06439f22571e93bddcca63144a08296 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:24 +0100 Subject: ide-cd: move lba_to_msf() and msf_to_lba() to * Move lba_to_msf() and msf_to_lba() to (use 'u8' type instead of 'byte' while at it). * Remove msf_to_lba() copy from drivers/cdrom/cdrom.c. Acked-by: Jens Axboe Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/cdrom.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index fcdc11b9609..a5cd2047624 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -1187,6 +1187,20 @@ struct media_event_desc { extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med); +static inline void lba_to_msf(int lba, u8 *m, u8 *s, u8 *f) +{ + lba += CD_MSF_OFFSET; + lba &= 0xffffff; /* negative lbas use only 24 bits */ + *m = lba / (CD_SECS * CD_FRAMES); + lba %= (CD_SECS * CD_FRAMES); + *s = lba / CD_FRAMES; + *f = lba % CD_FRAMES; +} + +static inline int msf_to_lba(u8 m, u8 s, u8 f) +{ + return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET; +} #endif /* End of kernel only stuff */ #endif /* _LINUX_CDROM_H */ -- cgit v1.2.3 From 7b9f25b539c3fa3c7b8c82775488a0021d90220f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:28 +0100 Subject: ide: add ide_dump_identify() debug helper * Add ide_dump_identify() debug helper for dumping raw identify data in the hdparm friendly format (== the identify data can be extracted from dmesg output and passed to hdparm --Istdin). * Dump identify data in ide-probe.c::do_identify() if DEBUG is enabled. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 7072c535f7c..34542186fb1 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1288,6 +1288,11 @@ extern struct bus_type ide_bus_type; #define ide_id_has_flush_cache_ext(id) \ (((id)->cfs_enable_2 & 0x2400) == 0x2400) +static inline void ide_dump_identify(u8 *id) +{ + print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); +} + static inline int hwif_to_node(ide_hwif_t *hwif) { struct pci_dev *dev = hwif->pci_dev; -- cgit v1.2.3 From ecf32796395ed0e27667e7f735946d6dc60e1765 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Fri, 1 Feb 2008 23:09:30 +0100 Subject: ide: ide_setup_dma() assumes 8 ports According to http://marc.info/?l=linux-ide&m=114346138611631, the drivers must always register 8 DMA ports with ide_setup_dma(), so its last argument is not needed. While at it, kill some useless parens in that function... Signed-off-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 34542186fb1..f1a10c8380b 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1155,7 +1155,7 @@ extern int ide_build_sglist(ide_drive_t *, struct request *); extern int ide_build_dmatable(ide_drive_t *, struct request *); extern void ide_destroy_dmatable(ide_drive_t *); extern int ide_release_dma(ide_hwif_t *); -extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); +extern void ide_setup_dma(ide_hwif_t *, unsigned long); void ide_dma_host_set(ide_drive_t *, int); extern int ide_dma_setup(ide_drive_t *); -- cgit v1.2.3 From 8ac2b42a45896641ed292deaf038a1d2703d85a6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:30 +0100 Subject: ide: add IDE_HFLAG_CLEAR_SIMPLEX host flag * Rename 'simplex_stat' variable to 'dma_stat' in ide_get_or_set_dma_base(). * Factor out code for forcing host out of "simplex" mode from ide_get_or_set_dma_base() to ide_pci_clear_simplex() helper. * Add IDE_HFLAG_CLEAR_SIMPLEX host flag and set it in alim15x3 (for M5229), amd74xx (for AMD 7409), cmd64x (for CMD643), generic (for Netcell) and serverworks (for CSB5) host drivers. * Make ide_get_or_set_dma_base() test for IDE_HFLAG_CLEAR_SIMPLEX host flag instead of checking dev->device (BTW the code was buggy because it didn't check for dev->vendor, luckily none of these PCI Device IDs was used by some other vendor for PCI IDE controller). Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index f1a10c8380b..1b31597e743 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1093,6 +1093,8 @@ enum { IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), /* host is CY82C693 */ IDE_HFLAG_CY82C693 = (1 << 27), + /* force host out of "simplex" mode */ + IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.2.3 From 4166c1993b9e7f87c4d08e2e27f83ada890c2599 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:30 +0100 Subject: ide: add IDE_HFLAG_NO_DSC host flag * Add IDE_HFLAG_NO_DSC host flag for hosts that doesn't support DSC overlap. * Set it in aec62xx (for ATP850UF only) and hpt34x host drivers. * Convert ide-tape device driver to check for IDE_HFLAG_NO_DSC flag. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 1b31597e743..af352cc41db 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1095,6 +1095,8 @@ enum { IDE_HFLAG_CY82C693 = (1 << 27), /* force host out of "simplex" mode */ IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), + /* DSC overlap is unsupported */ + IDE_HFLAG_NO_DSC = (1 << 29), }; #ifdef CONFIG_BLK_DEV_OFFBOARD -- cgit v1.2.3 From 36501650ec45b1db308c3b51886044863be2d762 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:31 +0100 Subject: ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t Keep pointer to struct device instead of struct pci_dev in ide_hwif_t. While on it: * Use *dev->dma_mask instead of pci_dev->dma_mask in ide_toggle_bounce(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index af352cc41db..ae965a3de9e 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -503,7 +503,8 @@ typedef struct hwif_s { hwif_chipset_t chipset; /* sub-module for tuning.. */ - struct pci_dev *pci_dev; /* for pci chipsets */ + struct device *dev; + const struct ide_port_info *cds; /* chipset device struct */ ide_ack_intr_t *ack_intr; @@ -1299,7 +1300,7 @@ static inline void ide_dump_identify(u8 *id) static inline int hwif_to_node(ide_hwif_t *hwif) { - struct pci_dev *dev = hwif->pci_dev; + struct pci_dev *dev = to_pci_dev(hwif->dev); return dev ? pcibus_to_node(dev->bus) : -1; } -- cgit v1.2.3 From 5df37c34a3acf29d1eb6fc675d078654da0ab395 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:31 +0100 Subject: au1xxx-ide: use hwif->dev * Setup hwif->dev in au_ide_probe(). * Use hwif->dev instead of ahwif->dev in auide_build_sglist(), auide_build_dmatable(), auide_dma_end() and auide_ddma_init(). * Remove no longer needed 'dev' field from _auide_hwif type. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/asm-mips/mach-au1x00/au1xxx_ide.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h index aef0edbfe4c..e4fe26c160b 100644 --- a/include/asm-mips/mach-au1x00/au1xxx_ide.h +++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h @@ -74,7 +74,6 @@ typedef struct struct dbdma_cmd *dma_table_cpu; dma_addr_t dma_table_dma; #endif - struct device *dev; int irq; u32 regbase; #ifdef CONFIG_PM -- cgit v1.2.3 From 062f9f024dcdb927cfd35c9ee8a68f59cbb1136f Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:32 +0100 Subject: ide: use ide_build_sglist() and ide_destroy_dmatable() in non-PCI host drivers * Make ide_build_sglist() and ide_destroy_dmatable() available also when CONFIG_BLK_DEV_IDEDMA_PCI=n. * Use ide_build_sglist() and ide_destroy_dmatable() in {ics,au1xxx-}ide.c and remove no longer needed {ics,au}ide_build_sglist(). There should be no functionality changes caused by this patch. Cc: Russell King Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index ae965a3de9e..ae83c4a82c6 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1155,10 +1155,11 @@ void ide_dma_on(ide_drive_t *); int ide_set_dma(ide_drive_t *); ide_startstop_t ide_dma_intr(ide_drive_t *); +int ide_build_sglist(ide_drive_t *, struct request *); +void ide_destroy_dmatable(ide_drive_t *); + #ifdef CONFIG_BLK_DEV_IDEDMA_PCI -extern int ide_build_sglist(ide_drive_t *, struct request *); extern int ide_build_dmatable(ide_drive_t *, struct request *); -extern void ide_destroy_dmatable(ide_drive_t *); extern int ide_release_dma(ide_hwif_t *); extern void ide_setup_dma(ide_hwif_t *, unsigned long); -- cgit v1.2.3 From dac2242047666a6709df6a2574f11c0ac8ebcd0b Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:34 +0100 Subject: ide: don't include IDE doesn't need it. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index ae83c4a82c6..1fbf84af232 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From 76166952bbc81dda1c8a8c14e75a2aa06f6c052c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:34 +0100 Subject: is not used by kernel code Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/hdsmart.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h index 7974a47fe58..e69192159d4 100644 --- a/include/linux/hdsmart.h +++ b/include/linux/hdsmart.h @@ -17,6 +17,7 @@ #ifndef _LINUX_HDSMART_H #define _LINUX_HDSMART_H +#ifndef __KERNEL #define OFFLINE_FULL_SCAN 0 #define SHORT_SELF_TEST 1 #define EXTEND_SELF_TEST 2 @@ -120,5 +121,6 @@ typedef struct ata_smart_selftestlog_s { unsigned char resevered[2]; unsigned char chksum; } __attribute__ ((packed)) ata_smart_selftestlog_t; +#endif /* __KERNEL__ * #endif /* _LINUX_HDSMART_H */ -- cgit v1.2.3 From a6fbb1c8c312be902f1085824c98ca50c86d5893 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:35 +0100 Subject: ide: remove unused ide_hwgroup_t fields Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 1fbf84af232..4d8c12cc55e 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -628,8 +628,7 @@ typedef int (ide_expiry_t)(ide_drive_t *); typedef struct hwgroup_s { /* irq handler, if active */ ide_startstop_t (*handler)(ide_drive_t *); - /* irq handler, suspended if active */ - ide_startstop_t (*handler_save)(ide_drive_t *); + /* BOOL: protects all fields below */ volatile int busy; /* BOOL: wake us up on timer expiry */ @@ -644,25 +643,18 @@ typedef struct hwgroup_s { /* ptr to current hwif in linked-list */ ide_hwif_t *hwif; - /* for pci chipsets */ - struct pci_dev *pci_dev; - /* current request */ struct request *rq; + /* failsafe timer */ struct timer_list timer; - /* local copy of current write rq */ - struct request wrq; /* timeout value during long polls */ unsigned long poll_timeout; /* queried upon timeouts */ int (*expiry)(ide_drive_t *); - /* ide_system_bus_speed */ - int pio_clock; + int req_gen; int req_gen_timer; - - unsigned char cmd_buf[4]; } ide_hwgroup_t; typedef struct ide_driver_s ide_driver_t; -- cgit v1.2.3 From fbd130887a45341259cde02e134581fb3dac6e14 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 1 Feb 2008 23:09:36 +0100 Subject: ide: use ide_remove_port_from_hwgroup in init_irq() There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/ide.h b/include/linux/ide.h index 4d8c12cc55e..ec10b2a3bb6 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1191,6 +1191,7 @@ static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} #endif +void ide_remove_port_from_hwgroup(ide_hwif_t *); extern int ide_hwif_request_regions(ide_hwif_t *hwif); extern void ide_hwif_release_regions(ide_hwif_t* hwif); extern void ide_unregister (unsigned int index); -- cgit v1.2.3