-typedef struct irq_info_t {
- u_int Attributes;
- int time_share, dyn_share;
- struct pcmcia_socket *Socket;
-} irq_info_t;
-
-/* Table of IRQ assignments */
-static irq_info_t irq_table[NR_IRQS];
-
-#endif
-
-/*======================================================================
-
- Linux resource management extensions
-
-======================================================================*/
-
-static struct resource *
-make_resource(unsigned long b, unsigned long n, int flags, char *name)
-{
- struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL);
-
- if (res) {
- memset(res, 0, sizeof(*res));
- res->name = name;
- res->start = b;
- res->end = b + n - 1;
- res->flags = flags | IORESOURCE_BUSY;
- }
- return res;
-}
-
-static struct resource *
-claim_region(struct pcmcia_socket *s, unsigned long base, unsigned long size,
- int type, char *name)
-{
- struct resource *res, *parent;
-
- parent = type & IORESOURCE_MEM ? &iomem_resource : &ioport_resource;
- res = make_resource(base, size, type | IORESOURCE_BUSY, name);
-
- if (res) {
-#ifdef CONFIG_PCI
- if (s && s->cb_dev)
- parent = pci_find_parent_resource(s->cb_dev, res);
-#endif
- if (!parent || request_resource(parent, res)) {
- kfree(res);
- res = NULL;
- }
- }
- return res;
-}
-
-static void free_region(struct resource *res)
-{
- if (res) {
- release_resource(res);
- kfree(res);
- }
-}
-
-/*======================================================================
-
- These manage the internal databases of available resources.
-
-======================================================================*/
-
-static int add_interval(resource_map_t *map, u_long base, u_long num)
-{
- resource_map_t *p, *q;
-
- for (p = map; ; p = p->next) {
- if ((p != map) && (p->base+p->num-1 >= base))
- return -1;
- if ((p->next == map) || (p->next->base > base+num-1))
- break;
- }
- q = kmalloc(sizeof(resource_map_t), GFP_KERNEL);
- if (!q) return CS_OUT_OF_RESOURCE;
- q->base = base; q->num = num;
- q->next = p->next; p->next = q;
- return CS_SUCCESS;
-}
-
-/*====================================================================*/
-
-static int sub_interval(resource_map_t *map, u_long base, u_long num)
-{
- resource_map_t *p, *q;
-
- for (p = map; ; p = q) {
- q = p->next;
- if (q == map)
- break;
- if ((q->base+q->num > base) && (base+num > q->base)) {
- if (q->base >= base) {
- if (q->base+q->num <= base+num) {
- /* Delete whole block */
- p->next = q->next;
- kfree(q);
- /* don't advance the pointer yet */
- q = p;
- } else {
- /* Cut off bit from the front */
- q->num = q->base + q->num - base - num;
- q->base = base + num;
- }
- } else if (q->base+q->num <= base+num) {
- /* Cut off bit from the end */
- q->num = base - q->base;
- } else {
- /* Split the block into two pieces */
- p = kmalloc(sizeof(resource_map_t), GFP_KERNEL);
- if (!p) return CS_OUT_OF_RESOURCE;
- p->base = base+num;
- p->num = q->base+q->num - p->base;
- q->num = base - q->base;
- p->next = q->next ; q->next = p;
- }
- }
- }
- return CS_SUCCESS;
-}
-
-/*======================================================================
-
- These routines examine a region of IO or memory addresses to
- determine what ranges might be genuinely available.
-
-======================================================================*/
-
-#ifdef CONFIG_PCMCIA_PROBE
-static void do_io_probe(ioaddr_t base, ioaddr_t num)