cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

ecard.h (6119B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * arch/arm/include/asm/ecard.h
      4 *
      5 * definitions for expansion cards
      6 *
      7 * This is a new system as from Linux 1.2.3
      8 *
      9 * Changelog:
     10 *  11-12-1996	RMK	Further minor improvements
     11 *  12-09-1997	RMK	Added interrupt enable/disable for card level
     12 *
     13 * Reference: Acorns Risc OS 3 Programmers Reference Manuals.
     14 */
     15
     16#ifndef __ASM_ECARD_H
     17#define __ASM_ECARD_H
     18
     19/*
     20 * Currently understood cards (but not necessarily
     21 * supported):
     22 *                        Manufacturer  Product ID
     23 */
     24#define MANU_ACORN		0x0000
     25#define PROD_ACORN_SCSI			0x0002
     26#define PROD_ACORN_ETHER1		0x0003
     27#define PROD_ACORN_MFM			0x000b
     28
     29#define MANU_ANT2		0x0011
     30#define PROD_ANT_ETHER3			0x00a4
     31
     32#define MANU_ATOMWIDE		0x0017
     33#define PROD_ATOMWIDE_3PSERIAL		0x0090
     34
     35#define MANU_IRLAM_INSTRUMENTS	0x001f
     36#define MANU_IRLAM_INSTRUMENTS_ETHERN	0x5678
     37
     38#define MANU_OAK		0x0021
     39#define PROD_OAK_SCSI			0x0058
     40
     41#define MANU_MORLEY		0x002b
     42#define PROD_MORLEY_SCSI_UNCACHED	0x0067
     43
     44#define MANU_CUMANA		0x003a
     45#define PROD_CUMANA_SCSI_2		0x003a
     46#define PROD_CUMANA_SCSI_1		0x00a0
     47
     48#define MANU_ICS		0x003c
     49#define PROD_ICS_IDE			0x00ae
     50
     51#define MANU_ICS2		0x003d
     52#define PROD_ICS2_IDE			0x00ae
     53
     54#define MANU_SERPORT		0x003f
     55#define PROD_SERPORT_DSPORT		0x00b9
     56
     57#define MANU_ARXE		0x0041
     58#define PROD_ARXE_SCSI			0x00be
     59
     60#define MANU_I3			0x0046
     61#define PROD_I3_ETHERLAN500		0x00d4
     62#define PROD_I3_ETHERLAN600		0x00ec
     63#define PROD_I3_ETHERLAN600A		0x011e
     64
     65#define MANU_ANT		0x0053
     66#define PROD_ANT_ETHERM			0x00d8
     67#define PROD_ANT_ETHERB			0x00e4
     68
     69#define MANU_ALSYSTEMS		0x005b
     70#define PROD_ALSYS_SCSIATAPI		0x0107
     71
     72#define MANU_MCS		0x0063
     73#define PROD_MCS_CONNECT32		0x0125
     74
     75#define MANU_EESOX		0x0064
     76#define PROD_EESOX_SCSI2		0x008c
     77
     78#define MANU_YELLOWSTONE	0x0096
     79#define PROD_YELLOWSTONE_RAPIDE32	0x0120
     80
     81#ifdef ECARD_C
     82#define CONST
     83#else
     84#define CONST const
     85#endif
     86
     87#define MAX_ECARDS	9
     88
     89struct ecard_id {			/* Card ID structure		*/
     90	unsigned short	manufacturer;
     91	unsigned short	product;
     92	void		*data;
     93};
     94
     95struct in_ecid {			/* Packed card ID information	*/
     96	unsigned short	product;	/* Product code			*/
     97	unsigned short	manufacturer;	/* Manufacturer code		*/
     98	unsigned char	id:4;		/* Simple ID			*/
     99	unsigned char	cd:1;		/* Chunk dir present		*/
    100	unsigned char	is:1;		/* Interrupt status pointers	*/
    101	unsigned char	w:2;		/* Width			*/
    102	unsigned char	country;	/* Country			*/
    103	unsigned char	irqmask;	/* IRQ mask			*/
    104	unsigned char	fiqmask;	/* FIQ mask			*/
    105	unsigned long	irqoff;		/* IRQ offset			*/
    106	unsigned long	fiqoff;		/* FIQ offset			*/
    107};
    108
    109typedef struct expansion_card ecard_t;
    110typedef unsigned long *loader_t;
    111
    112typedef struct expansion_card_ops {	/* Card handler routines	*/
    113	void (*irqenable)(ecard_t *ec, int irqnr);
    114	void (*irqdisable)(ecard_t *ec, int irqnr);
    115	int  (*irqpending)(ecard_t *ec);
    116	void (*fiqenable)(ecard_t *ec, int fiqnr);
    117	void (*fiqdisable)(ecard_t *ec, int fiqnr);
    118	int  (*fiqpending)(ecard_t *ec);
    119} expansioncard_ops_t;
    120
    121#define ECARD_NUM_RESOURCES	(6)
    122
    123#define ECARD_RES_IOCSLOW	(0)
    124#define ECARD_RES_IOCMEDIUM	(1)
    125#define ECARD_RES_IOCFAST	(2)
    126#define ECARD_RES_IOCSYNC	(3)
    127#define ECARD_RES_MEMC		(4)
    128#define ECARD_RES_EASI		(5)
    129
    130#define ecard_resource_start(ec,nr)	((ec)->resource[nr].start)
    131#define ecard_resource_end(ec,nr)	((ec)->resource[nr].end)
    132#define ecard_resource_len(ec,nr)	((ec)->resource[nr].end - \
    133					 (ec)->resource[nr].start + 1)
    134#define ecard_resource_flags(ec,nr)	((ec)->resource[nr].flags)
    135
    136/*
    137 * This contains all the info needed on an expansion card
    138 */
    139struct expansion_card {
    140	struct expansion_card  *next;
    141
    142	struct device		dev;
    143	struct resource		resource[ECARD_NUM_RESOURCES];
    144
    145	/* Public data */
    146	void __iomem		*irqaddr;	/* address of IRQ register	*/
    147	void __iomem		*fiqaddr;	/* address of FIQ register	*/
    148	unsigned char		irqmask;	/* IRQ mask			*/
    149	unsigned char		fiqmask;	/* FIQ mask			*/
    150	unsigned char  		claimed;	/* Card claimed?		*/
    151	unsigned char		easi;		/* EASI card			*/
    152
    153	void			*irq_data;	/* Data for use for IRQ by card	*/
    154	void			*fiq_data;	/* Data for use for FIQ by card	*/
    155	const expansioncard_ops_t *ops;		/* Enable/Disable Ops for card	*/
    156
    157	CONST unsigned int	slot_no;	/* Slot number			*/
    158	CONST unsigned int	dma;		/* DMA number (for request_dma)	*/
    159	CONST unsigned int	irq;		/* IRQ number (for request_irq)	*/
    160	CONST unsigned int	fiq;		/* FIQ number (for request_irq)	*/
    161	CONST struct in_ecid	cid;		/* Card Identification		*/
    162
    163	/* Private internal data */
    164	const char		*card_desc;	/* Card description		*/
    165	CONST loader_t		loader;		/* loader program */
    166	u64			dma_mask;
    167};
    168
    169void ecard_setirq(struct expansion_card *ec, const struct expansion_card_ops *ops, void *irq_data);
    170
    171struct in_chunk_dir {
    172	unsigned int start_offset;
    173	union {
    174		unsigned char string[256];
    175		unsigned char data[1];
    176	} d;
    177};
    178
    179/*
    180 * Read a chunk from an expansion card
    181 * cd : where to put read data
    182 * ec : expansion card info struct
    183 * id : id number to find
    184 * num: (n+1)'th id to find.
    185 */
    186extern int ecard_readchunk (struct in_chunk_dir *cd, struct expansion_card *ec, int id, int num);
    187
    188/*
    189 * Request and release ecard resources
    190 */
    191extern int ecard_request_resources(struct expansion_card *ec);
    192extern void ecard_release_resources(struct expansion_card *ec);
    193
    194void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res,
    195			   unsigned long offset, unsigned long maxsize);
    196#define ecardm_iounmap(__ec, __addr)	devm_iounmap(&(__ec)->dev, __addr)
    197
    198extern struct bus_type ecard_bus_type;
    199
    200#define ECARD_DEV(_d)	container_of((_d), struct expansion_card, dev)
    201
    202struct ecard_driver {
    203	int			(*probe)(struct expansion_card *, const struct ecard_id *id);
    204	void			(*remove)(struct expansion_card *);
    205	void			(*shutdown)(struct expansion_card *);
    206	const struct ecard_id	*id_table;
    207	unsigned int		id;
    208	struct device_driver	drv;
    209};
    210
    211#define ECARD_DRV(_d)	container_of((_d), struct ecard_driver, drv)
    212
    213#define ecard_set_drvdata(ec,data)	dev_set_drvdata(&(ec)->dev, (data))
    214#define ecard_get_drvdata(ec)		dev_get_drvdata(&(ec)->dev)
    215
    216int ecard_register_driver(struct ecard_driver *);
    217void ecard_remove_driver(struct ecard_driver *);
    218
    219#endif