diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:47 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:47 -0400 |
commit | 2bbd57cad3d72334c9fcc4e229a5a5b04dc6aebc (patch) | |
tree | c0866cb7b4a3e12d11179c65d86e2ba012db5002 /include | |
parent | ffa15a6915b7f6f6f69b4a66e1100a9c68d11250 (diff) |
ide: switch to DMA-mapping API part #2
Follow-up to commit 5c05ff68b9a9b40a9be949497e0aa980185565cf
("ide: switch to DMA-mapping API"):
* pci_{alloc,free}_consistent() -> dma_{alloc,free}_coherent()
in ide_{allocate,release}_dma_engine().
* Add ->prd_max_nents and ->prd_ent_size fields to ide_hwif_t
(+ set default values in ide_allocate_dma_engine()).
* Make ide_{allocate,release}_dma_engine() available also
for CONFIG_BLK_DEV_IDEDMA_SFF=n. Then convert au1xxx-ide.c,
scc_pata.c and sgiioc4.c to use them.
* Add missing ->init_dma method to scc_pata.
This patch also fixes:
- ->dmatable_cpu leak for au1xxx-ide
- too early realease of ->dmatable_cpu for scc_pata
- wrong amount of ->dmatable_cpu memory being freed for sgiioc4
While at it:
- remove superfluous ->dma_base check from ide_unregister()
- return -ENOMEM on error in ide_release_dma_engine()
- beautify error message in ide_release_dma_engine()
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ide.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index 39aaff8ff457..8121aa9240c4 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -788,6 +788,12 @@ typedef struct hwif_s { | |||
788 | unsigned int *dmatable_cpu; | 788 | unsigned int *dmatable_cpu; |
789 | /* dma physical region descriptor table (dma view) */ | 789 | /* dma physical region descriptor table (dma view) */ |
790 | dma_addr_t dmatable_dma; | 790 | dma_addr_t dmatable_dma; |
791 | |||
792 | /* maximum number of PRD table entries */ | ||
793 | int prd_max_nents; | ||
794 | /* PRD entry size in bytes */ | ||
795 | int prd_ent_size; | ||
796 | |||
791 | /* Scatter-gather list used to build the above */ | 797 | /* Scatter-gather list used to build the above */ |
792 | struct scatterlist *sg_table; | 798 | struct scatterlist *sg_table; |
793 | int sg_max_nents; /* Maximum number of entries in it */ | 799 | int sg_max_nents; /* Maximum number of entries in it */ |
@@ -1423,14 +1429,14 @@ int ide_set_dma(ide_drive_t *); | |||
1423 | void ide_check_dma_crc(ide_drive_t *); | 1429 | void ide_check_dma_crc(ide_drive_t *); |
1424 | ide_startstop_t ide_dma_intr(ide_drive_t *); | 1430 | ide_startstop_t ide_dma_intr(ide_drive_t *); |
1425 | 1431 | ||
1432 | int ide_allocate_dma_engine(ide_hwif_t *); | ||
1433 | void ide_release_dma_engine(ide_hwif_t *); | ||
1434 | |||
1426 | int ide_build_sglist(ide_drive_t *, struct request *); | 1435 | int ide_build_sglist(ide_drive_t *, struct request *); |
1427 | void ide_destroy_dmatable(ide_drive_t *); | 1436 | void ide_destroy_dmatable(ide_drive_t *); |
1428 | 1437 | ||
1429 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1438 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
1430 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1439 | extern int ide_build_dmatable(ide_drive_t *, struct request *); |
1431 | int ide_allocate_dma_engine(ide_hwif_t *); | ||
1432 | void ide_release_dma_engine(ide_hwif_t *); | ||
1433 | |||
1434 | void ide_dma_host_set(ide_drive_t *, int); | 1440 | void ide_dma_host_set(ide_drive_t *, int); |
1435 | extern int ide_dma_setup(ide_drive_t *); | 1441 | extern int ide_dma_setup(ide_drive_t *); |
1436 | void ide_dma_exec_cmd(ide_drive_t *, u8); | 1442 | void ide_dma_exec_cmd(ide_drive_t *, u8); |
@@ -1453,11 +1459,8 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; } | |||
1453 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1459 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1454 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1460 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1455 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | 1461 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } |
1456 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | ||
1457 | |||
1458 | #ifndef CONFIG_BLK_DEV_IDEDMA_SFF | ||
1459 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } | 1462 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
1460 | #endif | 1463 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1461 | 1464 | ||
1462 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1465 | #ifdef CONFIG_BLK_DEV_IDEACPI |
1463 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); | 1466 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); |