diff options
author | Tejun Heo <htejun@gmail.com> | 2008-03-24 23:22:49 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-17 15:44:17 -0400 |
commit | 68d1d07b510bb57a504588adc2bd2758adea0965 (patch) | |
tree | 94e8788a8ca40017b33044329f98bbe6552cc526 /include/linux/libata.h | |
parent | 6bd99b4e0998571808fc1f09d5162348f21ff8c1 (diff) |
libata: implement and use SHT initializers
libata lets low level drivers build scsi_host_template and register it
to the SCSI layer. This allows low level drivers high level of
flexibility but also burdens them with lots of boilerplate entries.
This patch implements SHT initializers which can be used to initialize
all the boilerplate entries in a sht. Three variants of them are
implemented - BASE, BMDMA and NCQ - for different types of drivers.
Note that entries can be overriden by putting individual initializers
after the helper macro.
All sht tables are identical before and after this patch.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 639298af583e..eccc38e17568 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -1071,6 +1071,63 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
1071 | ata_postreset_fn_t postreset); | 1071 | ata_postreset_fn_t postreset); |
1072 | 1072 | ||
1073 | /* | 1073 | /* |
1074 | * Base operations to inherit from and initializers for sht | ||
1075 | * | ||
1076 | * Operations | ||
1077 | * | ||
1078 | * base : Common to all libata drivers. | ||
1079 | * sata : SATA controllers w/ native interface. | ||
1080 | * pmp : SATA controllers w/ PMP support. | ||
1081 | * sff : SFF ATA controllers w/o BMDMA support. | ||
1082 | * bmdma : SFF ATA controllers w/ BMDMA support. | ||
1083 | * | ||
1084 | * sht initializers | ||
1085 | * | ||
1086 | * BASE : Common to all libata drivers. The user must set | ||
1087 | * sg_tablesize and dma_boundary. | ||
1088 | * PIO : SFF ATA controllers w/ only PIO support. | ||
1089 | * BMDMA : SFF ATA controllers w/ BMDMA support. sg_tablesize and | ||
1090 | * dma_boundary are set to BMDMA limits. | ||
1091 | * NCQ : SATA controllers supporting NCQ. The user must set | ||
1092 | * sg_tablesize, dma_boundary and can_queue. | ||
1093 | */ | ||
1094 | extern const struct ata_port_operations ata_base_port_ops; | ||
1095 | extern const struct ata_port_operations sata_port_ops; | ||
1096 | extern const struct ata_port_operations sata_pmp_port_ops; | ||
1097 | extern const struct ata_port_operations ata_sff_port_ops; | ||
1098 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1099 | |||
1100 | #define ATA_BASE_SHT(drv_name) \ | ||
1101 | .module = THIS_MODULE, \ | ||
1102 | .name = drv_name, \ | ||
1103 | .ioctl = ata_scsi_ioctl, \ | ||
1104 | .queuecommand = ata_scsi_queuecmd, \ | ||
1105 | .can_queue = ATA_DEF_QUEUE, \ | ||
1106 | .this_id = ATA_SHT_THIS_ID, \ | ||
1107 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, \ | ||
1108 | .emulated = ATA_SHT_EMULATED, \ | ||
1109 | .use_clustering = ATA_SHT_USE_CLUSTERING, \ | ||
1110 | .proc_name = drv_name, \ | ||
1111 | .slave_configure = ata_scsi_slave_config, \ | ||
1112 | .slave_destroy = ata_scsi_slave_destroy, \ | ||
1113 | .bios_param = ata_std_bios_param | ||
1114 | |||
1115 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ | ||
1116 | #define ATA_PIO_SHT(drv_name) \ | ||
1117 | ATA_BASE_SHT(drv_name), \ | ||
1118 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1119 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1120 | |||
1121 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1122 | ATA_BASE_SHT(drv_name), \ | ||
1123 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1124 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1125 | |||
1126 | #define ATA_NCQ_SHT(drv_name) \ | ||
1127 | ATA_BASE_SHT(drv_name), \ | ||
1128 | .change_queue_depth = ata_scsi_change_queue_depth | ||
1129 | |||
1130 | /* | ||
1074 | * printk helpers | 1131 | * printk helpers |
1075 | */ | 1132 | */ |
1076 | #define ata_port_printk(ap, lv, fmt, args...) \ | 1133 | #define ata_port_printk(ap, lv, fmt, args...) \ |