diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-04-26 13:09:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-04-26 13:09:45 -0700 |
commit | 36006b1d5c04692924f011aa949e8788f1c604de (patch) | |
tree | 18d70c93d1aa84d0bf1a2a6b37cd560bcaa4f59f /include | |
parent | 48dc810012a6b4f4ba94073d6b7edb4f76edeb72 (diff) | |
parent | 140b26035b2d379d94e6e3936ab2e0adf94efe46 (diff) | |
download | lwn-36006b1d5c04692924f011aa949e8788f1c604de.tar.gz lwn-36006b1d5c04692924f011aa949e8788f1c604de.zip |
Merge tag 'ata-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata
Pull ata updates from Damien Le Moal:
- Many cleanups of the pata_parport driver and of its protocol modules
(Ondrej)
- Remove unused code (ata_id_xxx() functions) (Sergey)
- Add Add UniPhier SATA controller DT bindings (Kunihiko)
- Fix dependencies for the Freescale QorIQ AHCI SATA controller driver
(Geert)
- DT property handling improvements (Rob)
* tag 'ata-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata: (57 commits)
ata: pata_parport-bpck6: Declare mode_map as static
ata: pata_parport-bpck6: Remove dependency on 64BIT
ata: pata_parport-bpck6: reduce indents in bpck6_open
ata: pata_parport-bpck6: delete ppc6lnx.c
ata: pata_parport-bpck6: move defines and mode_map to bpck6.c
ata: pata_parport-bpck6: move ppc6_wr_data_byte to bpck6.c and rename
ata: pata_parport-bpck6: move ppc6_rd_data_byte to bpck6.c and rename
ata: pata_parport-bpck6: move ppc6_send_cmd to bpck6.c and rename
ata: pata_parport-bpck6: move ppc6_deselect to bpck6.c and rename
ata: pata_parport-bpck6: merge ppc6_select into bpck6_open
ata: pata_parport-bpck6: move ppc6_open to bpck6.c and rename
ata: pata_parport-bpck6: move ppc6_wr_extout to bpck6.c and rename
ata: pata_parport-bpck6: move ppc6_wait_for_fifo to bpck6.c and rename
ata: pata_parport-bpck6: merge ppc6_wr_data_blk into bpck6_write_block
ata: pata_parport-bpck6: merge ppc6_rd_data_blk into bpck6_read_block
ata: pata_parport-bpck6: merge ppc6_wr_port16_blk into bpck6_write_block
ata: pata_parport-bpck6: merge ppc6_rd_port16_blk into bpck6_read_block
ata: pata_parport-bpck6: merge ppc6_wr_port into bpck6_write_regr
ata: pata_parport-bpck6: merge ppc6_rd_port into bpck6_read_regr
ata: pata_parport-bpck6: remove ppc6_close
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ata.h | 71 | ||||
-rw-r--r-- | include/linux/pata_parport.h | 111 | ||||
-rw-r--r-- | include/uapi/linux/parport.h | 3 |
3 files changed, 3 insertions, 182 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 0c18499f60b6..c224dbddb9b2 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -16,7 +16,6 @@ #include <linux/bits.h> #include <linux/string.h> #include <linux/types.h> -#include <asm/byteorder.h> /* defines only for the constants which don't work well as enums */ #define ATA_DMA_BOUNDARY 0xffffUL @@ -1017,76 +1016,6 @@ static inline bool atapi_id_dmadir(const u16 *dev_id) return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); } -/* - * ata_id_is_lba_capacity_ok() performs a sanity check on - * the claimed LBA capacity value for the device. - * - * Returns 1 if LBA capacity looks sensible, 0 otherwise. - * - * It is called only once for each device. - */ -static inline bool ata_id_is_lba_capacity_ok(u16 *id) -{ - unsigned long lba_sects, chs_sects, head, tail; - - /* No non-LBA info .. so valid! */ - if (id[ATA_ID_CYLS] == 0) - return true; - - lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); - - /* - * The ATA spec tells large drives to return - * C/H/S = 16383/16/63 independent of their size. - * Some drives can be jumpered to use 15 heads instead of 16. - * Some drives can be jumpered to use 4092 cyls instead of 16383. - */ - if ((id[ATA_ID_CYLS] == 16383 || - (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) && - id[ATA_ID_SECTORS] == 63 && - (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && - (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) - return true; - - chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; - - /* perform a rough sanity check on lba_sects: within 10% is OK */ - if (lba_sects - chs_sects < chs_sects/10) - return true; - - /* some drives have the word order reversed */ - head = (lba_sects >> 16) & 0xffff; - tail = lba_sects & 0xffff; - lba_sects = head | (tail << 16); - - if (lba_sects - chs_sects < chs_sects/10) { - *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); - return true; /* LBA capacity is (now) good */ - } - - return false; /* LBA capacity value may be bad */ -} - -static inline void ata_id_to_hd_driveid(u16 *id) -{ -#ifdef __BIG_ENDIAN - /* accessed in struct hd_driveid as 8-bit values */ - id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]); - id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]); - id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]); - id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]); - id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]); - - /* as 32-bit values */ - *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY); - *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG); - - /* as 64-bit value */ - *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] = - ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); -#endif -} - static inline bool ata_ok(u8 status) { return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) diff --git a/include/linux/pata_parport.h b/include/linux/pata_parport.h deleted file mode 100644 index 58781846f282..000000000000 --- a/include/linux/pata_parport.h +++ /dev/null @@ -1,111 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * pata_parport.h (c) 1997-8 Grant R. Guenther <grant@torque.net> - * Under the terms of the GPL. - * - * This file defines the interface for parallel port IDE adapter chip drivers. - */ - -#ifndef LINUX_PATA_PARPORT_H -#define LINUX_PATA_PARPORT_H - -#include <linux/libata.h> - -#define PI_PCD 1 /* dummy for paride protocol modules */ - -struct pi_adapter { - struct device dev; - struct pi_protocol *proto; /* adapter protocol */ - int port; /* base address of parallel port */ - int mode; /* transfer mode in use */ - int delay; /* adapter delay setting */ - int devtype; /* dummy for paride protocol modules */ - char *device; /* dummy for paride protocol modules */ - int unit; /* unit number for chained adapters */ - int saved_r0; /* saved port state */ - int saved_r2; /* saved port state */ - unsigned long private; /* for protocol module */ - struct pardevice *pardev; /* pointer to pardevice */ -}; - -typedef struct pi_adapter PIA; /* for paride protocol modules */ - -/* registers are addressed as (cont,regr) - * cont: 0 for command register file, 1 for control register(s) - * regr: 0-7 for register number. - */ - -/* macros and functions exported to the protocol modules */ -#define delay_p (pi->delay ? udelay(pi->delay) : (void)0) -#define out_p(offs, byte) do { outb(byte, pi->port + offs); delay_p; } while (0) -#define in_p(offs) (delay_p, inb(pi->port + offs)) - -#define w0(byte) out_p(0, byte) -#define r0() in_p(0) -#define w1(byte) out_p(1, byte) -#define r1() in_p(1) -#define w2(byte) out_p(2, byte) -#define r2() in_p(2) -#define w3(byte) out_p(3, byte) -#define w4(byte) out_p(4, byte) -#define r4() in_p(4) -#define w4w(data) do { outw(data, pi->port + 4); delay_p; } while (0) -#define w4l(data) do { outl(data, pi->port + 4); delay_p; } while (0) -#define r4w() (delay_p, inw(pi->port + 4)) -#define r4l() (delay_p, inl(pi->port + 4)) - -static inline u16 pi_swab16(char *b, int k) -{ - union { u16 u; char t[2]; } r; - - r.t[0] = b[2 * k + 1]; r.t[1] = b[2 * k]; - return r.u; -} - -static inline u32 pi_swab32(char *b, int k) -{ - union { u32 u; char f[4]; } r; - - r.f[0] = b[4 * k + 1]; r.f[1] = b[4 * k]; - r.f[2] = b[4 * k + 3]; r.f[3] = b[4 * k + 2]; - return r.u; -} - -struct pi_protocol { - char name[8]; - - int max_mode; - int epp_first; /* modes >= this use 8 ports */ - - int default_delay; - int max_units; /* max chained units probed for */ - - void (*write_regr)(struct pi_adapter *pi, int cont, int regr, int val); - int (*read_regr)(struct pi_adapter *pi, int cont, int regr); - void (*write_block)(struct pi_adapter *pi, char *buf, int count); - void (*read_block)(struct pi_adapter *pi, char *buf, int count); - - void (*connect)(struct pi_adapter *pi); - void (*disconnect)(struct pi_adapter *pi); - - int (*test_port)(struct pi_adapter *pi); - int (*probe_unit)(struct pi_adapter *pi); - int (*test_proto)(struct pi_adapter *pi, char *scratch, int verbose); - void (*log_adapter)(struct pi_adapter *pi, char *scratch, int verbose); - - int (*init_proto)(struct pi_adapter *pi); - void (*release_proto)(struct pi_adapter *pi); - struct module *owner; - struct device_driver driver; - struct scsi_host_template sht; -}; - -#define PATA_PARPORT_SHT ATA_PIO_SHT - -int pata_parport_register_driver(struct pi_protocol *pr); -void pata_parport_unregister_driver(struct pi_protocol *pr); -/* defines for old paride protocol modules */ -#define paride_register pata_parport_register_driver -#define paride_unregister pata_parport_unregister_driver - -#endif /* LINUX_PATA_PARPORT_H */ diff --git a/include/uapi/linux/parport.h b/include/uapi/linux/parport.h index f41388f88dc3..fe93e41fc205 100644 --- a/include/uapi/linux/parport.h +++ b/include/uapi/linux/parport.h @@ -90,6 +90,9 @@ typedef enum { /* Flags for block transfer operations. */ #define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */ #define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */ +#define PARPORT_EPP_FAST_32 PARPORT_EPP_FAST /* 32-bit EPP transfers */ +#define PARPORT_EPP_FAST_16 (1<<2) /* 16-bit EPP transfers */ +#define PARPORT_EPP_FAST_8 (1<<3) /* 8-bit EPP transfers */ /* The rest is for the kernel only */ #endif /* _UAPI_PARPORT_H_ */ |