Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | extern spinlock_t pnp_lock; |
2 | void *pnp_alloc(long size); | |
62cfb298 BH |
3 | |
4 | int pnp_register_protocol(struct pnp_protocol *protocol); | |
5 | void pnp_unregister_protocol(struct pnp_protocol *protocol); | |
6 | ||
25eb8461 BH |
7 | #define PNP_EISA_ID_MASK 0x7fffffff |
8 | void pnp_eisa_id_to_string(u32 id, char *str); | |
bda1e4e5 | 9 | struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id, char *pnpid); |
6bf2aab2 | 10 | struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid); |
62cfb298 BH |
11 | |
12 | int pnp_add_device(struct pnp_dev *dev); | |
772defc6 | 13 | struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id); |
1da177e4 | 14 | int pnp_interface_attach_device(struct pnp_dev *dev); |
62cfb298 BH |
15 | |
16 | int pnp_add_card(struct pnp_card *card); | |
17 | struct pnp_id *pnp_add_card_id(struct pnp_card *card, char *id); | |
18 | void pnp_remove_card(struct pnp_card *card); | |
19 | int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); | |
20 | void pnp_remove_card_device(struct pnp_dev *dev); | |
21 | ||
a1802c42 | 22 | struct pnp_port { |
169aaffe BH |
23 | resource_size_t min; /* min base number */ |
24 | resource_size_t max; /* max base number */ | |
25 | resource_size_t align; /* align boundary */ | |
26 | resource_size_t size; /* size of range */ | |
a1802c42 BH |
27 | unsigned char flags; /* port flags */ |
28 | unsigned char pad; /* pad */ | |
29 | struct pnp_port *next; /* next port */ | |
30 | }; | |
31 | ||
32 | #define PNP_IRQ_NR 256 | |
7aefff51 BH |
33 | typedef struct { DECLARE_BITMAP(bits, PNP_IRQ_NR); } pnp_irq_mask_t; |
34 | ||
a1802c42 | 35 | struct pnp_irq { |
7aefff51 | 36 | pnp_irq_mask_t map; /* bitmap for IRQ lines */ |
a1802c42 BH |
37 | unsigned char flags; /* IRQ flags */ |
38 | unsigned char pad; /* pad */ | |
39 | struct pnp_irq *next; /* next IRQ */ | |
40 | }; | |
41 | ||
42 | struct pnp_dma { | |
43 | unsigned char map; /* bitmask for DMA channels */ | |
44 | unsigned char flags; /* DMA flags */ | |
45 | struct pnp_dma *next; /* next port */ | |
46 | }; | |
47 | ||
48 | struct pnp_mem { | |
169aaffe BH |
49 | resource_size_t min; /* min base number */ |
50 | resource_size_t max; /* max base number */ | |
51 | resource_size_t align; /* align boundary */ | |
52 | resource_size_t size; /* size of range */ | |
a1802c42 BH |
53 | unsigned char flags; /* memory flags */ |
54 | unsigned char pad; /* pad */ | |
55 | struct pnp_mem *next; /* next memory resource */ | |
56 | }; | |
57 | ||
58 | #define PNP_RES_PRIORITY_PREFERRED 0 | |
59 | #define PNP_RES_PRIORITY_ACCEPTABLE 1 | |
60 | #define PNP_RES_PRIORITY_FUNCTIONAL 2 | |
61 | #define PNP_RES_PRIORITY_INVALID 65535 | |
62 | ||
63 | struct pnp_option { | |
64 | unsigned short priority; /* priority */ | |
65 | struct pnp_port *port; /* first port */ | |
66 | struct pnp_irq *irq; /* first IRQ */ | |
67 | struct pnp_dma *dma; /* first DMA */ | |
68 | struct pnp_mem *mem; /* first memory resource */ | |
69 | struct pnp_option *next; /* used to chain dependent resources */ | |
70 | }; | |
71 | ||
bc033c9b | 72 | struct pnp_option *pnp_build_option(int priority); |
62cfb298 BH |
73 | struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev); |
74 | struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, | |
75 | int priority); | |
76 | int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option, | |
77 | struct pnp_irq *data); | |
78 | int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option, | |
79 | struct pnp_dma *data); | |
80 | int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option, | |
81 | struct pnp_port *data); | |
82 | int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option, | |
83 | struct pnp_mem *data); | |
84 | void pnp_init_resources(struct pnp_dev *dev); | |
85 | ||
1da177e4 LT |
86 | void pnp_fixup_device(struct pnp_dev *dev); |
87 | void pnp_free_option(struct pnp_option *option); | |
88 | int __pnp_add_device(struct pnp_dev *dev); | |
89 | void __pnp_remove_device(struct pnp_dev *dev); | |
90 | ||
f5d94ff0 BH |
91 | int pnp_check_port(struct pnp_dev *dev, struct resource *res); |
92 | int pnp_check_mem(struct pnp_dev *dev, struct resource *res); | |
93 | int pnp_check_irq(struct pnp_dev *dev, struct resource *res); | |
94 | int pnp_check_dma(struct pnp_dev *dev, struct resource *res); | |
81b5c75f | 95 | |
9fdee4e0 | 96 | char *pnp_resource_type_name(struct resource *res); |
81b5c75f | 97 | void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc); |
d948a8da | 98 | |
aee3ad81 | 99 | void pnp_free_resources(struct pnp_dev *dev); |
940e98db | 100 | int pnp_resource_type(struct resource *res); |
02d83b5d | 101 | |
784f01d5 | 102 | struct pnp_resource { |
aee3ad81 | 103 | struct list_head list; |
784f01d5 BH |
104 | struct resource res; |
105 | }; | |
106 | ||
aee3ad81 | 107 | void pnp_free_resource(struct pnp_resource *pnp_res); |
dbddd038 BH |
108 | |
109 | struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq, | |
110 | int flags); | |
dc16f5f2 BH |
111 | struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma, |
112 | int flags); | |
cc8c2e30 BH |
113 | struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev, |
114 | resource_size_t start, | |
115 | resource_size_t end, int flags); | |
d6180f36 BH |
116 | struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev, |
117 | resource_size_t start, | |
118 | resource_size_t end, int flags); |