xref: /linux/arch/parisc/include/asm/parisc-device.h (revision ea7da3116015de801840f3e011dee907fb118f0c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_PARISC_PARISC_DEVICE_H_
3 #define _ASM_PARISC_PARISC_DEVICE_H_
4 
5 #include <linux/device.h>
6 #include <linux/device-id/parisc.h>
7 
8 struct parisc_device {
9 	struct resource hpa;		/* Hard Physical Address */
10 	struct parisc_device_id id;
11 	struct parisc_driver *driver;	/* Driver for this device */
12 	char		name[80];	/* The hardware description */
13 	int		irq;
14 	int		aux_irq;	/* Some devices have a second IRQ */
15 
16 	char		hw_path;        /* The module number on this bus */
17 	unsigned int	num_addrs;	/* some devices have additional address ranges. */
18 	unsigned long	*addr;          /* which will be stored here */
19 
20 #ifdef CONFIG_64BIT
21 	/* parms for pdc_pat_cell_module() call */
22 	unsigned long	pcell_loc;	/* Physical Cell location */
23 	unsigned long	mod_index;	/* PAT specific - Misc Module info */
24 
25 	/* generic info returned from pdc_pat_cell_module() */
26 	unsigned long	mod_info;	/* PAT specific - Misc Module info */
27 	unsigned long	pmod_loc;	/* physical Module location */
28 	unsigned long	mod0;
29 #endif
30 	u64		dma_mask;	/* DMA mask for I/O */
31 	struct device 	dev;
32 };
33 
34 struct parisc_driver {
35 	struct parisc_driver *next;
36 	char *name;
37 	const struct parisc_device_id *id_table;
38 	int (*probe)(struct parisc_device *dev); /* New device discovered */
39 	void (*remove)(struct parisc_device *dev);
40 	struct device_driver drv;
41 };
42 
43 
44 #define to_parisc_device(d)	container_of(d, struct parisc_device, dev)
45 #define to_parisc_driver(d)	container_of_const(d, struct parisc_driver, drv)
46 #define parisc_parent(d)	to_parisc_device(d->dev.parent)
47 
48 static inline const char *parisc_pathname(struct parisc_device *d)
49 {
50 	return dev_name(&d->dev);
51 }
52 
53 static inline void
54 parisc_set_drvdata(struct parisc_device *d, void *p)
55 {
56 	dev_set_drvdata(&d->dev, p);
57 }
58 
59 static inline void *
60 parisc_get_drvdata(struct parisc_device *d)
61 {
62 	return dev_get_drvdata(&d->dev);
63 }
64 
65 extern const struct bus_type parisc_bus_type;
66 
67 int iosapic_serial_irq(struct parisc_device *dev);
68 
69 #endif /*_ASM_PARISC_PARISC_DEVICE_H_*/
70