ide-floppy.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef __IDE_FLOPPY_H
  2. #define __IDE_FLOPPY_H
  3. #define DRV_NAME "ide-floppy"
  4. #define PFX DRV_NAME ": "
  5. /* define to see debug info */
  6. #define IDEFLOPPY_DEBUG_LOG 0
  7. #if IDEFLOPPY_DEBUG_LOG
  8. #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args)
  9. #else
  10. #define ide_debug_log(lvl, fmt, args...) do {} while (0)
  11. #endif
  12. /*
  13. * Most of our global data which we need to save even as we leave the driver
  14. * due to an interrupt or a timer event is stored in a variable of type
  15. * idefloppy_floppy_t, defined below.
  16. */
  17. typedef struct ide_floppy_obj {
  18. ide_drive_t *drive;
  19. ide_driver_t *driver;
  20. struct gendisk *disk;
  21. struct kref kref;
  22. unsigned int openers; /* protected by BKL for now */
  23. /* Last failed packet command */
  24. struct ide_atapi_pc *failed_pc;
  25. /* used for blk_{fs,pc}_request() requests */
  26. struct ide_atapi_pc queued_pc;
  27. /* Last error information */
  28. u8 sense_key, asc, ascq;
  29. int progress_indication;
  30. /* Device information */
  31. /* Current format */
  32. int blocks, block_size, bs_factor;
  33. /* Last format capacity descriptor */
  34. u8 cap_desc[8];
  35. /* Copy of the flexible disk page */
  36. u8 flexible_disk_page[32];
  37. } idefloppy_floppy_t;
  38. /*
  39. * Pages of the SELECT SENSE / MODE SENSE packet commands.
  40. * See SFF-8070i spec.
  41. */
  42. #define IDEFLOPPY_CAPABILITIES_PAGE 0x1b
  43. #define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05
  44. /* IOCTLs used in low-level formatting. */
  45. #define IDEFLOPPY_IOCTL_FORMAT_SUPPORTED 0x4600
  46. #define IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY 0x4601
  47. #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602
  48. #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603
  49. sector_t ide_gd_capacity(ide_drive_t *);
  50. /* ide-floppy.c */
  51. void ide_floppy_create_mode_sense_cmd(struct ide_atapi_pc *, u8);
  52. void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *);
  53. int ide_floppy_get_capacity(ide_drive_t *);
  54. void ide_floppy_setup(ide_drive_t *);
  55. ide_startstop_t ide_floppy_do_request(ide_drive_t *, struct request *, sector_t);
  56. int ide_floppy_end_request(ide_drive_t *, int, int);
  57. /* ide-floppy_ioctl.c */
  58. int ide_floppy_ioctl(struct inode *, struct file *, unsigned, unsigned long);
  59. #ifdef CONFIG_IDE_PROC_FS
  60. /* ide-floppy_proc.c */
  61. extern ide_proc_entry_t ide_floppy_proc[];
  62. extern const struct ide_proc_devset ide_floppy_settings[];
  63. #endif
  64. #endif /*__IDE_FLOPPY_H */