diff -drupN a/fs/squashfs/jz-lzma.h b/fs/squashfs/jz-lzma.h --- a/fs/squashfs/jz-lzma.h 1970-01-01 03:00:00.000000000 +0300 +++ b/fs/squashfs/jz-lzma.h 2022-06-09 05:02:35.000000000 +0300 @@ -0,0 +1,72 @@ +#ifndef __JZ_LZMA_MY_H__ +#define __JZ_LZMA_MY_H__ + +#include +#define LZMA_IOC_MAGIC 'L' +#define IOCTL_LZMA_DMA_GET_RANDOM _IO(JZlzma_IOC_MAGIC, 110) + +#define LZMA_CTRL 0x0 +#define LZMA_BS_BASE 0x4 +#define LZMA_BS_SIZE 0x8 +#define LZMA_DST_BASE 0xc +#define LZMA_ICRC 0x10 +#define LZMA_CRC 0x14 +#define LZMA_FINALSIZE 0x1c + +#define IN_FILE_SIZE 11 +#define OUT_FILE_SIZE 12 + +typedef struct lzma_operation { + struct miscdevice lzma_dev; + struct resource *res; + int state; + void __iomem *iomem; + struct clk *clk; + struct clk *clk_gate; + struct clk *ahb0_gate; + struct device *dev; + int irq; + char name[16]; + unsigned long in_file; + unsigned long out_file; + int opencnt; + struct mutex openmutex; +}lzma_operation_t; + +extern int unlzma_hardware(unsigned char *input,int in_len,unsigned char *output); + +extern long lzma_ioctl(struct file *file, unsigned int cmd, unsigned long val); + +#define miscdev_to_lzmaops(mdev) (container_of(mdev, struct lzma_operation, lzma_dev)) + +static inline unsigned int lzma_reg_read(struct lzma_operation *lzma_ope, int offset) +{ +// printk("%s, read:0x%08x, val = 0x%08x\n", __func__, lzma_ope->iomem + offset, readl(lzma_ope->iomem + offset)); + return readl(lzma_ope->iomem + offset); +} + +static inline void lzma_reg_write(struct lzma_operation *lzma_ope, int offset, unsigned int val) +{ + writel(val, lzma_ope->iomem + offset); +// printk("%s, write:0x%08x, val = 0x%08x\n", __func__, lzma_ope->iomem + offset, val); +} + +static inline void lzma_bit_set(struct lzma_operation *lzma_ope, int offset, unsigned int bit) +{ + unsigned int tmp = 0; + + tmp = lzma_reg_read(lzma_ope, offset); + tmp |= (1 << bit); + lzma_reg_write(lzma_ope, offset, tmp); +} + +static inline void lzma_bit_clr(struct lzma_operation *lzma_ope, int offset, unsigned int bit) +{ + unsigned int tmp = 0; + + tmp = lzma_reg_read(lzma_ope, offset); + tmp &= ~(1 << bit); + lzma_reg_write(lzma_ope, offset, tmp); +} + +#endif