blob: c91315826da2259a6271bbfa47b6becb38c2d235 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001extern spinlock_t pnp_lock;
2void *pnp_alloc(long size);
Bjorn Helgaas62cfb292008-04-28 16:34:40 -06003
4int pnp_register_protocol(struct pnp_protocol *protocol);
5void pnp_unregister_protocol(struct pnp_protocol *protocol);
6
Bjorn Helgaas25eb8462008-04-28 16:33:53 -06007#define PNP_EISA_ID_MASK 0x7fffffff
8void pnp_eisa_id_to_string(u32 id, char *str);
Bjorn Helgaasbda1e4e2008-04-28 16:33:54 -06009struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id, char *pnpid);
Bjorn Helgaas6bf2aab2008-04-28 16:33:58 -060010struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
Bjorn Helgaas62cfb292008-04-28 16:34:40 -060011
12int pnp_add_device(struct pnp_dev *dev);
Bjorn Helgaas772defc2008-04-28 16:33:52 -060013struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id);
Linus Torvalds1da177e2005-04-16 15:20:36 -070014int pnp_interface_attach_device(struct pnp_dev *dev);
Bjorn Helgaas62cfb292008-04-28 16:34:40 -060015
16int pnp_add_card(struct pnp_card *card);
17struct pnp_id *pnp_add_card_id(struct pnp_card *card, char *id);
18void pnp_remove_card(struct pnp_card *card);
19int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
20void pnp_remove_card_device(struct pnp_dev *dev);
21
Rene Hermanbc033c92008-05-14 16:05:34 -070022struct pnp_option *pnp_build_option(int priority);
Bjorn Helgaas62cfb292008-04-28 16:34:40 -060023struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev);
24struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
25 int priority);
26int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_option *option,
27 struct pnp_irq *data);
28int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option,
29 struct pnp_dma *data);
30int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option,
31 struct pnp_port *data);
32int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option,
33 struct pnp_mem *data);
34void pnp_init_resources(struct pnp_dev *dev);
35
Linus Torvalds1da177e2005-04-16 15:20:36 -070036void pnp_fixup_device(struct pnp_dev *dev);
37void pnp_free_option(struct pnp_option *option);
38int __pnp_add_device(struct pnp_dev *dev);
39void __pnp_remove_device(struct pnp_dev *dev);
40
Bjorn Helgaasf5d94ff2008-04-28 16:34:22 -060041int pnp_check_port(struct pnp_dev *dev, struct resource *res);
42int pnp_check_mem(struct pnp_dev *dev, struct resource *res);
43int pnp_check_irq(struct pnp_dev *dev, struct resource *res);
44int pnp_check_dma(struct pnp_dev *dev, struct resource *res);
Bjorn Helgaas81b5c752008-04-28 16:34:08 -060045
Bjorn Helgaas9fdee4e2008-06-27 16:56:55 -060046char *pnp_resource_type_name(struct resource *res);
Bjorn Helgaas81b5c752008-04-28 16:34:08 -060047void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
Bjorn Helgaasd948a8d2008-04-28 16:34:13 -060048
49void pnp_init_resource(struct resource *res);
Bjorn Helgaas940e98d2008-06-27 16:56:54 -060050int pnp_resource_type(struct resource *res);
Bjorn Helgaas02d83b52008-04-28 16:34:28 -060051
Bjorn Helgaas0a977f12008-04-28 16:34:31 -060052struct pnp_resource *pnp_get_pnp_resource(struct pnp_dev *dev,
53 unsigned int type, unsigned int num);
54
Bjorn Helgaas02d83b52008-04-28 16:34:28 -060055#define PNP_MAX_PORT 40
56#define PNP_MAX_MEM 24
57#define PNP_MAX_IRQ 2
58#define PNP_MAX_DMA 2
59
Bjorn Helgaas784f01d2008-04-28 16:34:30 -060060struct pnp_resource {
61 struct resource res;
62};
63
Bjorn Helgaas02d83b52008-04-28 16:34:28 -060064struct pnp_resource_table {
Bjorn Helgaas784f01d2008-04-28 16:34:30 -060065 struct pnp_resource port[PNP_MAX_PORT];
66 struct pnp_resource mem[PNP_MAX_MEM];
67 struct pnp_resource dma[PNP_MAX_DMA];
68 struct pnp_resource irq[PNP_MAX_IRQ];
Bjorn Helgaas02d83b52008-04-28 16:34:28 -060069};
Bjorn Helgaasdbddd032008-04-28 16:34:34 -060070
71struct pnp_resource *pnp_add_irq_resource(struct pnp_dev *dev, int irq,
72 int flags);
Bjorn Helgaasdc16f5f2008-04-28 16:34:35 -060073struct pnp_resource *pnp_add_dma_resource(struct pnp_dev *dev, int dma,
74 int flags);
Bjorn Helgaascc8c2e32008-04-28 16:34:36 -060075struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
76 resource_size_t start,
77 resource_size_t end, int flags);
Bjorn Helgaasd6180f32008-04-28 16:34:37 -060078struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
79 resource_size_t start,
80 resource_size_t end, int flags);