dumchar.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef __DUMCHAR_H__
  2. #define __DUMCHAR_H__
  3. #include <linux/ioctl.h>
  4. #include <linux/cdev.h>
  5. #include <linux/mtd/mtd.h>
  6. #include <linux/semaphore.h>
  7. /*#include <linux/mmc/sd_misc.h>*/
  8. /*
  9. * Macros to help debugging
  10. */
  11. /* #define DUMCHAR_DEBUG */
  12. /* #undef DUMCHAR_DEBUG */ /* undef it, just in case */
  13. /*
  14. #ifdef DUMCHAR_DEBUG
  15. #define DDEBUG(fmt, args...) printk(KERN_DEBUG "dumchar_debug: " fmt, ## args)
  16. #else
  17. #define DDEBUG(fmt, args...)
  18. #endif
  19. */
  20. #define DUMCHAR_MAJOR 0 /* dynamic major by default */
  21. #define MAX_SD_BUFFER (512)
  22. #define ALIE_LEN 512
  23. /* #define PrintBuff 1 */
  24. struct dumchar_dev {
  25. char *dumname; /* nvram boot userdata... */
  26. char actname[64]; /* full act name /dev/mt6573_sd0 /dev/mtd/mtd1 */
  27. struct semaphore sem; /* Mutual exclusion */
  28. dev_type type; /* nand device or emmc device? */
  29. unsigned long long size; /* partition size */
  30. struct cdev cdev;
  31. Region region; /* for emmc */
  32. unsigned long long start_address; /* for emmc */
  33. unsigned int mtd_index; /* for nand */
  34. };
  35. struct Region_Info {
  36. Region region;
  37. unsigned long long size_Byte;
  38. };
  39. struct file_obj {
  40. struct file *act_filp;
  41. int index; /* index in dumchar_dev arry */
  42. };
  43. #define REGION_NUM 8
  44. #define EXT_CSD_BOOT_SIZE_MULT 226 /* R */
  45. #define EXT_CSD_RPMB_SIZE_MULT 168 /* R */
  46. #define MSDC_RAW_DEVICE "/dev/misc-sd"
  47. #ifdef CONFIG_MTK_MTD_NAND
  48. extern u64 mtd_partition_start_address(struct mtd_info *mtd);
  49. #endif
  50. #define mtd_for_each_device(mtd) \
  51. for ((mtd) = __mtd_next_device(0); \
  52. (mtd) != NULL; \
  53. (mtd) = __mtd_next_device(mtd->index + 1))
  54. #ifndef CONFIG_MTK_NEW_COMBO_EMMC_SUPPORT
  55. #define EMMC_PART_BOOT1 (BOOT_1)
  56. #define EMMC_PART_BOOT2 (BOOT_2)
  57. #define EMMC_PART_RPMB (RPMB)
  58. #define EMMC_PART_GP1 (GP_1)
  59. #define EMMC_PART_GP2 (GP_2)
  60. #define EMMC_PART_GP3 (GP_3)
  61. #define EMMC_PART_GP4 (GP_4)
  62. #define EMMC_PART_USER (USER)
  63. #define NAND_PART_USER (USER)
  64. #endif
  65. #ifdef CONFIG_MTK_EMMC_SUPPORT
  66. extern int simple_sd_ioctl_rw(struct msdc_ioctl *msdc_ctl);
  67. extern int init_pmt(void);
  68. #ifdef CONFIG_MTK_EMMC_CACHE
  69. extern void msdc_get_cache_region(void);
  70. #endif
  71. #endif
  72. #ifdef CONFIG_MTK_MTD_NAND
  73. extern struct mtd_info *__mtd_next_device(int i);
  74. #endif
  75. #endif /*__DUMCHAR_H__ */