diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bio.h | 8 | ||||
-rw-r--r-- | include/linux/blkdev.h | 119 | ||||
-rw-r--r-- | include/linux/elevator.h | 4 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/ide.h | 27 | ||||
-rw-r--r-- | include/linux/loop.h | 3 | ||||
-rw-r--r-- | include/linux/mg_disk.h | 206 | ||||
-rw-r--r-- | include/linux/pipe_fs_i.h | 1 | ||||
-rw-r--r-- | include/linux/splice.h | 3 | ||||
-rw-r--r-- | include/linux/virtio_blk.h | 8 |
10 files changed, 100 insertions, 281 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 7b214fd672a2..d30ec6f30dd7 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -218,12 +218,12 @@ struct bio { | |||
218 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 218 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
219 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) | 219 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) |
220 | 220 | ||
221 | static inline unsigned int bio_cur_sectors(struct bio *bio) | 221 | static inline unsigned int bio_cur_bytes(struct bio *bio) |
222 | { | 222 | { |
223 | if (bio->bi_vcnt) | 223 | if (bio->bi_vcnt) |
224 | return bio_iovec(bio)->bv_len >> 9; | 224 | return bio_iovec(bio)->bv_len; |
225 | else /* dataless requests such as discard */ | 225 | else /* dataless requests such as discard */ |
226 | return bio->bi_size >> 9; | 226 | return bio->bi_size; |
227 | } | 227 | } |
228 | 228 | ||
229 | static inline void *bio_data(struct bio *bio) | 229 | static inline void *bio_data(struct bio *bio) |
@@ -506,7 +506,7 @@ static inline int bio_has_data(struct bio *bio) | |||
506 | } | 506 | } |
507 | 507 | ||
508 | /* | 508 | /* |
509 | * BIO list managment for use by remapping drivers (e.g. DM or MD). | 509 | * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. |
510 | * | 510 | * |
511 | * A bio_list anchors a singly-linked list of bios chained through the bi_next | 511 | * A bio_list anchors a singly-linked list of bios chained through the bi_next |
512 | * member of the bio. The bio_list also caches the last list member to allow | 512 | * member of the bio. The bio_list also caches the last list member to allow |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index b4f71f1a4af7..56ce53fce72e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -166,19 +166,9 @@ struct request { | |||
166 | enum rq_cmd_type_bits cmd_type; | 166 | enum rq_cmd_type_bits cmd_type; |
167 | unsigned long atomic_flags; | 167 | unsigned long atomic_flags; |
168 | 168 | ||
169 | /* Maintain bio traversal state for part by part I/O submission. | 169 | /* the following two fields are internal, NEVER access directly */ |
170 | * hard_* are block layer internals, no driver should touch them! | 170 | sector_t __sector; /* sector cursor */ |
171 | */ | 171 | unsigned int __data_len; /* total data len */ |
172 | |||
173 | sector_t sector; /* next sector to submit */ | ||
174 | sector_t hard_sector; /* next sector to complete */ | ||
175 | unsigned long nr_sectors; /* no. of sectors left to submit */ | ||
176 | unsigned long hard_nr_sectors; /* no. of sectors left to complete */ | ||
177 | /* no. of sectors left to submit in the current segment */ | ||
178 | unsigned int current_nr_sectors; | ||
179 | |||
180 | /* no. of sectors left to complete in the current segment */ | ||
181 | unsigned int hard_cur_sectors; | ||
182 | 172 | ||
183 | struct bio *bio; | 173 | struct bio *bio; |
184 | struct bio *biotail; | 174 | struct bio *biotail; |
@@ -211,8 +201,8 @@ struct request { | |||
211 | 201 | ||
212 | unsigned short ioprio; | 202 | unsigned short ioprio; |
213 | 203 | ||
214 | void *special; | 204 | void *special; /* opaque pointer available for LLD use */ |
215 | char *buffer; | 205 | char *buffer; /* kaddr of the current segment if available */ |
216 | 206 | ||
217 | int tag; | 207 | int tag; |
218 | int errors; | 208 | int errors; |
@@ -226,10 +216,9 @@ struct request { | |||
226 | unsigned char __cmd[BLK_MAX_CDB]; | 216 | unsigned char __cmd[BLK_MAX_CDB]; |
227 | unsigned char *cmd; | 217 | unsigned char *cmd; |
228 | 218 | ||
229 | unsigned int data_len; | ||
230 | unsigned int extra_len; /* length of alignment and padding */ | 219 | unsigned int extra_len; /* length of alignment and padding */ |
231 | unsigned int sense_len; | 220 | unsigned int sense_len; |
232 | void *data; | 221 | unsigned int resid_len; /* residual count */ |
233 | void *sense; | 222 | void *sense; |
234 | 223 | ||
235 | unsigned long deadline; | 224 | unsigned long deadline; |
@@ -415,7 +404,7 @@ struct request_queue | |||
415 | struct list_head tag_busy_list; | 404 | struct list_head tag_busy_list; |
416 | 405 | ||
417 | unsigned int nr_sorted; | 406 | unsigned int nr_sorted; |
418 | unsigned int in_flight; | 407 | unsigned int in_flight[2]; |
419 | 408 | ||
420 | unsigned int rq_timeout; | 409 | unsigned int rq_timeout; |
421 | struct timer_list timeout; | 410 | struct timer_list timeout; |
@@ -522,6 +511,11 @@ static inline void queue_flag_clear_unlocked(unsigned int flag, | |||
522 | __clear_bit(flag, &q->queue_flags); | 511 | __clear_bit(flag, &q->queue_flags); |
523 | } | 512 | } |
524 | 513 | ||
514 | static inline int queue_in_flight(struct request_queue *q) | ||
515 | { | ||
516 | return q->in_flight[0] + q->in_flight[1]; | ||
517 | } | ||
518 | |||
525 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | 519 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) |
526 | { | 520 | { |
527 | WARN_ON_ONCE(!queue_is_locked(q)); | 521 | WARN_ON_ONCE(!queue_is_locked(q)); |
@@ -752,6 +746,8 @@ extern void blk_rq_init(struct request_queue *q, struct request *rq); | |||
752 | extern void blk_put_request(struct request *); | 746 | extern void blk_put_request(struct request *); |
753 | extern void __blk_put_request(struct request_queue *, struct request *); | 747 | extern void __blk_put_request(struct request_queue *, struct request *); |
754 | extern struct request *blk_get_request(struct request_queue *, int, gfp_t); | 748 | extern struct request *blk_get_request(struct request_queue *, int, gfp_t); |
749 | extern struct request *blk_make_request(struct request_queue *, struct bio *, | ||
750 | gfp_t); | ||
755 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); | 751 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); |
756 | extern void blk_requeue_request(struct request_queue *, struct request *); | 752 | extern void blk_requeue_request(struct request_queue *, struct request *); |
757 | extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); | 753 | extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); |
@@ -768,12 +764,6 @@ extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |||
768 | struct scsi_ioctl_command __user *); | 764 | struct scsi_ioctl_command __user *); |
769 | 765 | ||
770 | /* | 766 | /* |
771 | * Temporary export, until SCSI gets fixed up. | ||
772 | */ | ||
773 | extern int blk_rq_append_bio(struct request_queue *q, struct request *rq, | ||
774 | struct bio *bio); | ||
775 | |||
776 | /* | ||
777 | * A queue has just exitted congestion. Note this in the global counter of | 767 | * A queue has just exitted congestion. Note this in the global counter of |
778 | * congested queues, and wake up anyone who was waiting for requests to be | 768 | * congested queues, and wake up anyone who was waiting for requests to be |
779 | * put back. | 769 | * put back. |
@@ -798,7 +788,6 @@ extern void blk_sync_queue(struct request_queue *q); | |||
798 | extern void __blk_stop_queue(struct request_queue *q); | 788 | extern void __blk_stop_queue(struct request_queue *q); |
799 | extern void __blk_run_queue(struct request_queue *); | 789 | extern void __blk_run_queue(struct request_queue *); |
800 | extern void blk_run_queue(struct request_queue *); | 790 | extern void blk_run_queue(struct request_queue *); |
801 | extern void blk_start_queueing(struct request_queue *); | ||
802 | extern int blk_rq_map_user(struct request_queue *, struct request *, | 791 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
803 | struct rq_map_data *, void __user *, unsigned long, | 792 | struct rq_map_data *, void __user *, unsigned long, |
804 | gfp_t); | 793 | gfp_t); |
@@ -831,41 +820,73 @@ static inline void blk_run_address_space(struct address_space *mapping) | |||
831 | blk_run_backing_dev(mapping->backing_dev_info, NULL); | 820 | blk_run_backing_dev(mapping->backing_dev_info, NULL); |
832 | } | 821 | } |
833 | 822 | ||
834 | extern void blkdev_dequeue_request(struct request *req); | 823 | /* |
824 | * blk_rq_pos() : the current sector | ||
825 | * blk_rq_bytes() : bytes left in the entire request | ||
826 | * blk_rq_cur_bytes() : bytes left in the current segment | ||
827 | * blk_rq_sectors() : sectors left in the entire request | ||
828 | * blk_rq_cur_sectors() : sectors left in the current segment | ||
829 | */ | ||
830 | static inline sector_t blk_rq_pos(const struct request *rq) | ||
831 | { | ||
832 | return rq->__sector; | ||
833 | } | ||
834 | |||
835 | static inline unsigned int blk_rq_bytes(const struct request *rq) | ||
836 | { | ||
837 | return rq->__data_len; | ||
838 | } | ||
839 | |||
840 | static inline int blk_rq_cur_bytes(const struct request *rq) | ||
841 | { | ||
842 | return rq->bio ? bio_cur_bytes(rq->bio) : 0; | ||
843 | } | ||
844 | |||
845 | static inline unsigned int blk_rq_sectors(const struct request *rq) | ||
846 | { | ||
847 | return blk_rq_bytes(rq) >> 9; | ||
848 | } | ||
849 | |||
850 | static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | ||
851 | { | ||
852 | return blk_rq_cur_bytes(rq) >> 9; | ||
853 | } | ||
854 | |||
855 | /* | ||
856 | * Request issue related functions. | ||
857 | */ | ||
858 | extern struct request *blk_peek_request(struct request_queue *q); | ||
859 | extern void blk_start_request(struct request *rq); | ||
860 | extern struct request *blk_fetch_request(struct request_queue *q); | ||
835 | 861 | ||
836 | /* | 862 | /* |
837 | * blk_end_request() and friends. | 863 | * Request completion related functions. |
838 | * __blk_end_request() and end_request() must be called with | 864 | * |
839 | * the request queue spinlock acquired. | 865 | * blk_update_request() completes given number of bytes and updates |
866 | * the request without completing it. | ||
867 | * | ||
868 | * blk_end_request() and friends. __blk_end_request() must be called | ||
869 | * with the request queue spinlock acquired. | ||
840 | * | 870 | * |
841 | * Several drivers define their own end_request and call | 871 | * Several drivers define their own end_request and call |
842 | * blk_end_request() for parts of the original function. | 872 | * blk_end_request() for parts of the original function. |
843 | * This prevents code duplication in drivers. | 873 | * This prevents code duplication in drivers. |
844 | */ | 874 | */ |
845 | extern int blk_end_request(struct request *rq, int error, | 875 | extern bool blk_update_request(struct request *rq, int error, |
846 | unsigned int nr_bytes); | 876 | unsigned int nr_bytes); |
847 | extern int __blk_end_request(struct request *rq, int error, | 877 | extern bool blk_end_request(struct request *rq, int error, |
848 | unsigned int nr_bytes); | 878 | unsigned int nr_bytes); |
849 | extern int blk_end_bidi_request(struct request *rq, int error, | 879 | extern void blk_end_request_all(struct request *rq, int error); |
850 | unsigned int nr_bytes, unsigned int bidi_bytes); | 880 | extern bool blk_end_request_cur(struct request *rq, int error); |
851 | extern void end_request(struct request *, int); | 881 | extern bool __blk_end_request(struct request *rq, int error, |
852 | extern int blk_end_request_callback(struct request *rq, int error, | 882 | unsigned int nr_bytes); |
853 | unsigned int nr_bytes, | 883 | extern void __blk_end_request_all(struct request *rq, int error); |
854 | int (drv_callback)(struct request *)); | 884 | extern bool __blk_end_request_cur(struct request *rq, int error); |
885 | |||
855 | extern void blk_complete_request(struct request *); | 886 | extern void blk_complete_request(struct request *); |
856 | extern void __blk_complete_request(struct request *); | 887 | extern void __blk_complete_request(struct request *); |
857 | extern void blk_abort_request(struct request *); | 888 | extern void blk_abort_request(struct request *); |
858 | extern void blk_abort_queue(struct request_queue *); | 889 | extern void blk_abort_queue(struct request_queue *); |
859 | extern void blk_update_request(struct request *rq, int error, | ||
860 | unsigned int nr_bytes); | ||
861 | |||
862 | /* | ||
863 | * blk_end_request() takes bytes instead of sectors as a complete size. | ||
864 | * blk_rq_bytes() returns bytes left to complete in the entire request. | ||
865 | * blk_rq_cur_bytes() returns bytes left to complete in the current segment. | ||
866 | */ | ||
867 | extern unsigned int blk_rq_bytes(struct request *rq); | ||
868 | extern unsigned int blk_rq_cur_bytes(struct request *rq); | ||
869 | 890 | ||
870 | /* | 891 | /* |
871 | * Access functions for manipulating queue properties | 892 | * Access functions for manipulating queue properties |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index c59b769f62b0..1cb3372e65d8 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
@@ -103,10 +103,8 @@ extern int elv_merge(struct request_queue *, struct request **, struct bio *); | |||
103 | extern void elv_merge_requests(struct request_queue *, struct request *, | 103 | extern void elv_merge_requests(struct request_queue *, struct request *, |
104 | struct request *); | 104 | struct request *); |
105 | extern void elv_merged_request(struct request_queue *, struct request *, int); | 105 | extern void elv_merged_request(struct request_queue *, struct request *, int); |
106 | extern void elv_dequeue_request(struct request_queue *, struct request *); | ||
107 | extern void elv_requeue_request(struct request_queue *, struct request *); | 106 | extern void elv_requeue_request(struct request_queue *, struct request *); |
108 | extern int elv_queue_empty(struct request_queue *); | 107 | extern int elv_queue_empty(struct request_queue *); |
109 | extern struct request *elv_next_request(struct request_queue *q); | ||
110 | extern struct request *elv_former_request(struct request_queue *, struct request *); | 108 | extern struct request *elv_former_request(struct request_queue *, struct request *); |
111 | extern struct request *elv_latter_request(struct request_queue *, struct request *); | 109 | extern struct request *elv_latter_request(struct request_queue *, struct request *); |
112 | extern int elv_register_queue(struct request_queue *q); | 110 | extern int elv_register_queue(struct request_queue *q); |
@@ -171,7 +169,7 @@ enum { | |||
171 | ELV_MQUEUE_MUST, | 169 | ELV_MQUEUE_MUST, |
172 | }; | 170 | }; |
173 | 171 | ||
174 | #define rq_end_sector(rq) ((rq)->sector + (rq)->nr_sectors) | 172 | #define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq)) |
175 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) | 173 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) |
176 | 174 | ||
177 | /* | 175 | /* |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 3b534e527e09..83d6b4397245 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2205,6 +2205,8 @@ extern int generic_segment_checks(const struct iovec *iov, | |||
2205 | /* fs/splice.c */ | 2205 | /* fs/splice.c */ |
2206 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, | 2206 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, |
2207 | struct pipe_inode_info *, size_t, unsigned int); | 2207 | struct pipe_inode_info *, size_t, unsigned int); |
2208 | extern ssize_t default_file_splice_read(struct file *, loff_t *, | ||
2209 | struct pipe_inode_info *, size_t, unsigned int); | ||
2208 | extern ssize_t generic_file_splice_write(struct pipe_inode_info *, | 2210 | extern ssize_t generic_file_splice_write(struct pipe_inode_info *, |
2209 | struct file *, loff_t *, size_t, unsigned int); | 2211 | struct file *, loff_t *, size_t, unsigned int); |
2210 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, | 2212 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 9fed365a598b..867cb68d8461 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -26,6 +26,9 @@ | |||
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | #include <asm/mutex.h> | 27 | #include <asm/mutex.h> |
28 | 28 | ||
29 | /* for request_sense */ | ||
30 | #include <linux/cdrom.h> | ||
31 | |||
29 | #if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300) | 32 | #if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300) |
30 | # define SUPPORT_VLB_SYNC 0 | 33 | # define SUPPORT_VLB_SYNC 0 |
31 | #else | 34 | #else |
@@ -324,7 +327,6 @@ struct ide_cmd { | |||
324 | unsigned int cursg_ofs; | 327 | unsigned int cursg_ofs; |
325 | 328 | ||
326 | struct request *rq; /* copy of request */ | 329 | struct request *rq; /* copy of request */ |
327 | void *special; /* valid_t generally */ | ||
328 | }; | 330 | }; |
329 | 331 | ||
330 | /* ATAPI packet command flags */ | 332 | /* ATAPI packet command flags */ |
@@ -360,11 +362,7 @@ struct ide_atapi_pc { | |||
360 | 362 | ||
361 | /* data buffer */ | 363 | /* data buffer */ |
362 | u8 *buf; | 364 | u8 *buf; |
363 | /* current buffer position */ | ||
364 | u8 *cur_pos; | ||
365 | int buf_size; | 365 | int buf_size; |
366 | /* missing/available data on the current buffer */ | ||
367 | int b_count; | ||
368 | 366 | ||
369 | /* the corresponding request */ | 367 | /* the corresponding request */ |
370 | struct request *rq; | 368 | struct request *rq; |
@@ -377,10 +375,6 @@ struct ide_atapi_pc { | |||
377 | */ | 375 | */ |
378 | u8 pc_buf[IDE_PC_BUFFER_SIZE]; | 376 | u8 pc_buf[IDE_PC_BUFFER_SIZE]; |
379 | 377 | ||
380 | /* idetape only */ | ||
381 | struct idetape_bh *bh; | ||
382 | char *b_data; | ||
383 | |||
384 | unsigned long timeout; | 378 | unsigned long timeout; |
385 | }; | 379 | }; |
386 | 380 | ||
@@ -593,16 +587,16 @@ struct ide_drive_s { | |||
593 | /* callback for packet commands */ | 587 | /* callback for packet commands */ |
594 | int (*pc_callback)(struct ide_drive_s *, int); | 588 | int (*pc_callback)(struct ide_drive_s *, int); |
595 | 589 | ||
596 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); | ||
597 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, | ||
598 | unsigned int, int); | ||
599 | |||
600 | ide_startstop_t (*irq_handler)(struct ide_drive_s *); | 590 | ide_startstop_t (*irq_handler)(struct ide_drive_s *); |
601 | 591 | ||
602 | unsigned long atapi_flags; | 592 | unsigned long atapi_flags; |
603 | 593 | ||
604 | struct ide_atapi_pc request_sense_pc; | 594 | struct ide_atapi_pc request_sense_pc; |
605 | struct request request_sense_rq; | 595 | |
596 | /* current sense rq and buffer */ | ||
597 | bool sense_rq_armed; | ||
598 | struct request sense_rq; | ||
599 | struct request_sense sense_data; | ||
606 | }; | 600 | }; |
607 | 601 | ||
608 | typedef struct ide_drive_s ide_drive_t; | 602 | typedef struct ide_drive_s ide_drive_t; |
@@ -1174,7 +1168,10 @@ int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); | |||
1174 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); | 1168 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); |
1175 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); | 1169 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); |
1176 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); | 1170 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); |
1177 | void ide_retry_pc(ide_drive_t *, struct gendisk *); | 1171 | void ide_retry_pc(ide_drive_t *drive); |
1172 | |||
1173 | void ide_prep_sense(ide_drive_t *drive, struct request *rq); | ||
1174 | int ide_queue_sense_rq(ide_drive_t *drive, void *special); | ||
1178 | 1175 | ||
1179 | int ide_cd_expiry(ide_drive_t *); | 1176 | int ide_cd_expiry(ide_drive_t *); |
1180 | 1177 | ||
diff --git a/include/linux/loop.h b/include/linux/loop.h index 40725447f5e0..66c194e2d9b9 100644 --- a/include/linux/loop.h +++ b/include/linux/loop.h | |||
@@ -56,8 +56,7 @@ struct loop_device { | |||
56 | gfp_t old_gfp_mask; | 56 | gfp_t old_gfp_mask; |
57 | 57 | ||
58 | spinlock_t lo_lock; | 58 | spinlock_t lo_lock; |
59 | struct bio *lo_bio; | 59 | struct bio_list lo_bio_list; |
60 | struct bio *lo_biotail; | ||
61 | int lo_state; | 60 | int lo_state; |
62 | struct mutex lo_ctl_mutex; | 61 | struct mutex lo_ctl_mutex; |
63 | struct task_struct *lo_thread; | 62 | struct task_struct *lo_thread; |
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h deleted file mode 100644 index 1f76b1ebf627..000000000000 --- a/include/linux/mg_disk.h +++ /dev/null | |||
@@ -1,206 +0,0 @@ | |||
1 | /* | ||
2 | * include/linux/mg_disk.c | ||
3 | * | ||
4 | * Support for the mGine m[g]flash IO mode. | ||
5 | * Based on legacy hd.c | ||
6 | * | ||
7 | * (c) 2008 mGine Co.,LTD | ||
8 | * (c) 2008 unsik Kim <donari75@gmail.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #ifndef __MG_DISK_H__ | ||
16 | #define __MG_DISK_H__ | ||
17 | |||
18 | #include <linux/blkdev.h> | ||
19 | #include <linux/ata.h> | ||
20 | |||
21 | /* name for block device */ | ||
22 | #define MG_DISK_NAME "mgd" | ||
23 | /* name for platform device */ | ||
24 | #define MG_DEV_NAME "mg_disk" | ||
25 | |||
26 | #define MG_DISK_MAJ 0 | ||
27 | #define MG_DISK_MAX_PART 16 | ||
28 | #define MG_SECTOR_SIZE 512 | ||
29 | #define MG_MAX_SECTS 256 | ||
30 | |||
31 | /* Register offsets */ | ||
32 | #define MG_BUFF_OFFSET 0x8000 | ||
33 | #define MG_STORAGE_BUFFER_SIZE 0x200 | ||
34 | #define MG_REG_OFFSET 0xC000 | ||
35 | #define MG_REG_FEATURE (MG_REG_OFFSET + 2) /* write case */ | ||
36 | #define MG_REG_ERROR (MG_REG_OFFSET + 2) /* read case */ | ||
37 | #define MG_REG_SECT_CNT (MG_REG_OFFSET + 4) | ||
38 | #define MG_REG_SECT_NUM (MG_REG_OFFSET + 6) | ||
39 | #define MG_REG_CYL_LOW (MG_REG_OFFSET + 8) | ||
40 | #define MG_REG_CYL_HIGH (MG_REG_OFFSET + 0xA) | ||
41 | #define MG_REG_DRV_HEAD (MG_REG_OFFSET + 0xC) | ||
42 | #define MG_REG_COMMAND (MG_REG_OFFSET + 0xE) /* write case */ | ||
43 | #define MG_REG_STATUS (MG_REG_OFFSET + 0xE) /* read case */ | ||
44 | #define MG_REG_DRV_CTRL (MG_REG_OFFSET + 0x10) | ||
45 | #define MG_REG_BURST_CTRL (MG_REG_OFFSET + 0x12) | ||
46 | |||
47 | /* "Drive Select/Head Register" bit values */ | ||
48 | #define MG_REG_HEAD_MUST_BE_ON 0xA0 /* These 2 bits are always on */ | ||
49 | #define MG_REG_HEAD_DRIVE_MASTER (0x00 | MG_REG_HEAD_MUST_BE_ON) | ||
50 | #define MG_REG_HEAD_DRIVE_SLAVE (0x10 | MG_REG_HEAD_MUST_BE_ON) | ||
51 | #define MG_REG_HEAD_LBA_MODE (0x40 | MG_REG_HEAD_MUST_BE_ON) | ||
52 | |||
53 | |||
54 | /* "Device Control Register" bit values */ | ||
55 | #define MG_REG_CTRL_INTR_ENABLE 0x0 | ||
56 | #define MG_REG_CTRL_INTR_DISABLE (0x1<<1) | ||
57 | #define MG_REG_CTRL_RESET (0x1<<2) | ||
58 | #define MG_REG_CTRL_INTR_POLA_ACTIVE_HIGH 0x0 | ||
59 | #define MG_REG_CTRL_INTR_POLA_ACTIVE_LOW (0x1<<4) | ||
60 | #define MG_REG_CTRL_DPD_POLA_ACTIVE_LOW 0x0 | ||
61 | #define MG_REG_CTRL_DPD_POLA_ACTIVE_HIGH (0x1<<5) | ||
62 | #define MG_REG_CTRL_DPD_DISABLE 0x0 | ||
63 | #define MG_REG_CTRL_DPD_ENABLE (0x1<<6) | ||
64 | |||
65 | /* Status register bit */ | ||
66 | /* error bit in status register */ | ||
67 | #define MG_REG_STATUS_BIT_ERROR 0x01 | ||
68 | /* corrected error in status register */ | ||
69 | #define MG_REG_STATUS_BIT_CORRECTED_ERROR 0x04 | ||
70 | /* data request bit in status register */ | ||
71 | #define MG_REG_STATUS_BIT_DATA_REQ 0x08 | ||
72 | /* DSC - Drive Seek Complete */ | ||
73 | #define MG_REG_STATUS_BIT_SEEK_DONE 0x10 | ||
74 | /* DWF - Drive Write Fault */ | ||
75 | #define MG_REG_STATUS_BIT_WRITE_FAULT 0x20 | ||
76 | #define MG_REG_STATUS_BIT_READY 0x40 | ||
77 | #define MG_REG_STATUS_BIT_BUSY 0x80 | ||
78 | |||
79 | /* handy status */ | ||
80 | #define MG_STAT_READY (MG_REG_STATUS_BIT_READY | MG_REG_STATUS_BIT_SEEK_DONE) | ||
81 | #define MG_READY_OK(s) (((s) & (MG_STAT_READY | \ | ||
82 | (MG_REG_STATUS_BIT_BUSY | \ | ||
83 | MG_REG_STATUS_BIT_WRITE_FAULT | \ | ||
84 | MG_REG_STATUS_BIT_ERROR))) == MG_STAT_READY) | ||
85 | |||
86 | /* Error register */ | ||
87 | #define MG_REG_ERR_AMNF 0x01 | ||
88 | #define MG_REG_ERR_ABRT 0x04 | ||
89 | #define MG_REG_ERR_IDNF 0x10 | ||
90 | #define MG_REG_ERR_UNC 0x40 | ||
91 | #define MG_REG_ERR_BBK 0x80 | ||
92 | |||
93 | /* error code for others */ | ||
94 | #define MG_ERR_NONE 0 | ||
95 | #define MG_ERR_TIMEOUT 0x100 | ||
96 | #define MG_ERR_INIT_STAT 0x101 | ||
97 | #define MG_ERR_TRANSLATION 0x102 | ||
98 | #define MG_ERR_CTRL_RST 0x103 | ||
99 | #define MG_ERR_INV_STAT 0x104 | ||
100 | #define MG_ERR_RSTOUT 0x105 | ||
101 | |||
102 | #define MG_MAX_ERRORS 6 /* Max read/write errors */ | ||
103 | |||
104 | /* command */ | ||
105 | #define MG_CMD_RD 0x20 | ||
106 | #define MG_CMD_WR 0x30 | ||
107 | #define MG_CMD_SLEEP 0x99 | ||
108 | #define MG_CMD_WAKEUP 0xC3 | ||
109 | #define MG_CMD_ID 0xEC | ||
110 | #define MG_CMD_WR_CONF 0x3C | ||
111 | #define MG_CMD_RD_CONF 0x40 | ||
112 | |||
113 | /* operation mode */ | ||
114 | #define MG_OP_CASCADE (1 << 0) | ||
115 | #define MG_OP_CASCADE_SYNC_RD (1 << 1) | ||
116 | #define MG_OP_CASCADE_SYNC_WR (1 << 2) | ||
117 | #define MG_OP_INTERLEAVE (1 << 3) | ||
118 | |||
119 | /* synchronous */ | ||
120 | #define MG_BURST_LAT_4 (3 << 4) | ||
121 | #define MG_BURST_LAT_5 (4 << 4) | ||
122 | #define MG_BURST_LAT_6 (5 << 4) | ||
123 | #define MG_BURST_LAT_7 (6 << 4) | ||
124 | #define MG_BURST_LAT_8 (7 << 4) | ||
125 | #define MG_BURST_LEN_4 (1 << 1) | ||
126 | #define MG_BURST_LEN_8 (2 << 1) | ||
127 | #define MG_BURST_LEN_16 (3 << 1) | ||
128 | #define MG_BURST_LEN_32 (4 << 1) | ||
129 | #define MG_BURST_LEN_CONT (0 << 1) | ||
130 | |||
131 | /* timeout value (unit: ms) */ | ||
132 | #define MG_TMAX_CONF_TO_CMD 1 | ||
133 | #define MG_TMAX_WAIT_RD_DRQ 10 | ||
134 | #define MG_TMAX_WAIT_WR_DRQ 500 | ||
135 | #define MG_TMAX_RST_TO_BUSY 10 | ||
136 | #define MG_TMAX_HDRST_TO_RDY 500 | ||
137 | #define MG_TMAX_SWRST_TO_RDY 500 | ||
138 | #define MG_TMAX_RSTOUT 3000 | ||
139 | |||
140 | /* device attribution */ | ||
141 | /* use mflash as boot device */ | ||
142 | #define MG_BOOT_DEV (1 << 0) | ||
143 | /* use mflash as storage device */ | ||
144 | #define MG_STORAGE_DEV (1 << 1) | ||
145 | /* same as MG_STORAGE_DEV, but bootloader already done reset sequence */ | ||
146 | #define MG_STORAGE_DEV_SKIP_RST (1 << 2) | ||
147 | |||
148 | #define MG_DEV_MASK (MG_BOOT_DEV | MG_STORAGE_DEV | MG_STORAGE_DEV_SKIP_RST) | ||
149 | |||
150 | /* names of GPIO resource */ | ||
151 | #define MG_RST_PIN "mg_rst" | ||
152 | /* except MG_BOOT_DEV, reset-out pin should be assigned */ | ||
153 | #define MG_RSTOUT_PIN "mg_rstout" | ||
154 | |||
155 | /* private driver data */ | ||
156 | struct mg_drv_data { | ||
157 | /* disk resource */ | ||
158 | u32 use_polling; | ||
159 | |||
160 | /* device attribution */ | ||
161 | u32 dev_attr; | ||
162 | |||
163 | /* internally used */ | ||
164 | struct mg_host *host; | ||
165 | }; | ||
166 | |||
167 | /* main structure for mflash driver */ | ||
168 | struct mg_host { | ||
169 | struct device *dev; | ||
170 | |||
171 | struct request_queue *breq; | ||
172 | spinlock_t lock; | ||
173 | struct gendisk *gd; | ||
174 | |||
175 | struct timer_list timer; | ||
176 | void (*mg_do_intr) (struct mg_host *); | ||
177 | |||
178 | u16 id[ATA_ID_WORDS]; | ||
179 | |||
180 | u16 cyls; | ||
181 | u16 heads; | ||
182 | u16 sectors; | ||
183 | u32 n_sectors; | ||
184 | u32 nres_sectors; | ||
185 | |||
186 | void __iomem *dev_base; | ||
187 | unsigned int irq; | ||
188 | unsigned int rst; | ||
189 | unsigned int rstout; | ||
190 | |||
191 | u32 major; | ||
192 | u32 error; | ||
193 | }; | ||
194 | |||
195 | /* | ||
196 | * Debugging macro and defines | ||
197 | */ | ||
198 | #undef DO_MG_DEBUG | ||
199 | #ifdef DO_MG_DEBUG | ||
200 | # define MG_DBG(fmt, args...) \ | ||
201 | printk(KERN_DEBUG "%s:%d "fmt, __func__, __LINE__, ##args) | ||
202 | #else /* CONFIG_MG_DEBUG */ | ||
203 | # define MG_DBG(fmt, args...) do { } while (0) | ||
204 | #endif /* CONFIG_MG_DEBUG */ | ||
205 | |||
206 | #endif | ||
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index c8f038554e80..b43a9e039059 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -152,5 +152,6 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void | |||
152 | void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); | 152 | void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); |
153 | int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); | 153 | int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); |
154 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); | 154 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); |
155 | void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); | ||
155 | 156 | ||
156 | #endif | 157 | #endif |
diff --git a/include/linux/splice.h b/include/linux/splice.h index 5f3faa9d15ae..18e7c7c0cae6 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h | |||
@@ -11,8 +11,7 @@ | |||
11 | #include <linux/pipe_fs_i.h> | 11 | #include <linux/pipe_fs_i.h> |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * splice is tied to pipes as a transport (at least for now), so we'll just | 14 | * Flags passed in from splice/tee/vmsplice |
15 | * add the splice flags here. | ||
16 | */ | 15 | */ |
17 | #define SPLICE_F_MOVE (0x01) /* move pages instead of copying */ | 16 | #define SPLICE_F_MOVE (0x01) /* move pages instead of copying */ |
18 | #define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */ | 17 | #define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */ |
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index 94c56d29869d..4dbcbc1c3481 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ | 15 | #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ |
16 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ | 16 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ |
17 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ | 17 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ |
18 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ | ||
18 | 19 | ||
19 | struct virtio_blk_config | 20 | struct virtio_blk_config |
20 | { | 21 | { |
@@ -55,6 +56,13 @@ struct virtio_blk_outhdr | |||
55 | __u64 sector; | 56 | __u64 sector; |
56 | }; | 57 | }; |
57 | 58 | ||
59 | struct virtio_scsi_inhdr { | ||
60 | __u32 errors; | ||
61 | __u32 data_len; | ||
62 | __u32 sense_len; | ||
63 | __u32 residual; | ||
64 | }; | ||
65 | |||
58 | /* And this is the final byte of the write scatter-gather list. */ | 66 | /* And this is the final byte of the write scatter-gather list. */ |
59 | #define VIRTIO_BLK_S_OK 0 | 67 | #define VIRTIO_BLK_S_OK 0 |
60 | #define VIRTIO_BLK_S_IOERR 1 | 68 | #define VIRTIO_BLK_S_IOERR 1 |