diff options
-rw-r--r-- | drivers/pcmcia/rsrc_mgr.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/rsrc_nonstatic.c | 58 | ||||
-rw-r--r-- | include/pcmcia/ss.h | 3 |
3 files changed, 61 insertions, 2 deletions
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index b6843f8d300d..b9269e66281a 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c | |||
@@ -72,7 +72,7 @@ int pcmcia_adjust_resource_info(adjust_t *adj) | |||
72 | /* you can't use the old interface if the new | 72 | /* you can't use the old interface if the new |
73 | * one was used before */ | 73 | * one was used before */ |
74 | spin_lock_irqsave(&s->lock, flags); | 74 | spin_lock_irqsave(&s->lock, flags); |
75 | if ((s->resource_setup_done) && | 75 | if ((s->resource_setup_new) && |
76 | !(s->resource_setup_old)) { | 76 | !(s->resource_setup_old)) { |
77 | spin_unlock_irqrestore(&s->lock, flags); | 77 | spin_unlock_irqrestore(&s->lock, flags); |
78 | continue; | 78 | continue; |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 6b463609a3aa..c8f21796c592 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
@@ -768,6 +768,58 @@ static int nonstatic_adjust_resource_info(struct pcmcia_socket *s, adjust_t *adj | |||
768 | return CS_UNSUPPORTED_FUNCTION; | 768 | return CS_UNSUPPORTED_FUNCTION; |
769 | } | 769 | } |
770 | 770 | ||
771 | #ifdef CONFIG_PCI | ||
772 | static int nonstatic_autoadd_resources(struct pcmcia_socket *s) | ||
773 | { | ||
774 | struct resource *res; | ||
775 | int i, done = 0; | ||
776 | |||
777 | if (!s->cb_dev || !s->cb_dev->bus) | ||
778 | return -ENODEV; | ||
779 | |||
780 | for (i=0; i < PCI_BUS_NUM_RESOURCES; i++) { | ||
781 | res = s->cb_dev->bus->resource[i]; | ||
782 | if (!res) | ||
783 | continue; | ||
784 | |||
785 | if (res->flags & IORESOURCE_IO) { | ||
786 | if (res == &ioport_resource) | ||
787 | continue; | ||
788 | printk(KERN_INFO "pcmcia: parent PCI bridge I/O window: 0x%lx - 0x%lx\n", | ||
789 | res->start, res->end); | ||
790 | if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) | ||
791 | done |= IORESOURCE_IO; | ||
792 | |||
793 | } | ||
794 | |||
795 | if (res->flags & IORESOURCE_MEM) { | ||
796 | if (res == &iomem_resource) | ||
797 | continue; | ||
798 | printk(KERN_INFO "pcmcia: parent PCI bridge Memory window: 0x%lx - 0x%lx\n", | ||
799 | res->start, res->end); | ||
800 | if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) | ||
801 | done |= IORESOURCE_MEM; | ||
802 | } | ||
803 | } | ||
804 | |||
805 | /* if we got at least one of IO, and one of MEM, we can be glad and | ||
806 | * activate the PCMCIA subsystem */ | ||
807 | if (done & (IORESOURCE_MEM | IORESOURCE_IO)) | ||
808 | s->resource_setup_done = 1; | ||
809 | |||
810 | return 0; | ||
811 | } | ||
812 | |||
813 | #else | ||
814 | |||
815 | static inline int nonstatic_autoadd_resources(struct pcmcia_socket *s) | ||
816 | { | ||
817 | return -ENODEV; | ||
818 | } | ||
819 | |||
820 | #endif | ||
821 | |||
822 | |||
771 | static int nonstatic_init(struct pcmcia_socket *s) | 823 | static int nonstatic_init(struct pcmcia_socket *s) |
772 | { | 824 | { |
773 | struct socket_data *data; | 825 | struct socket_data *data; |
@@ -782,6 +834,8 @@ static int nonstatic_init(struct pcmcia_socket *s) | |||
782 | 834 | ||
783 | s->resource_data = (void *) data; | 835 | s->resource_data = (void *) data; |
784 | 836 | ||
837 | nonstatic_autoadd_resources(s); | ||
838 | |||
785 | return 0; | 839 | return 0; |
786 | } | 840 | } |
787 | 841 | ||
@@ -862,6 +916,8 @@ static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size | |||
862 | return -EINVAL; | 916 | return -EINVAL; |
863 | 917 | ||
864 | ret = adjust_io(s, add, start_addr, end_addr); | 918 | ret = adjust_io(s, add, start_addr, end_addr); |
919 | if (!ret) | ||
920 | s->resource_setup_new = 1; | ||
865 | 921 | ||
866 | return ret ? ret : count; | 922 | return ret ? ret : count; |
867 | } | 923 | } |
@@ -912,6 +968,8 @@ static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, siz | |||
912 | return -EINVAL; | 968 | return -EINVAL; |
913 | 969 | ||
914 | ret = adjust_memory(s, add, start_addr, end_addr); | 970 | ret = adjust_memory(s, add, start_addr, end_addr); |
971 | if (!ret) | ||
972 | s->resource_setup_new = 1; | ||
915 | 973 | ||
916 | return ret ? ret : count; | 974 | return ret ? ret : count; |
917 | } | 975 | } |
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 67b867f31fe4..f8797767051d 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h | |||
@@ -216,8 +216,9 @@ struct pcmcia_socket { | |||
216 | 216 | ||
217 | /* is set to one if resource setup is done using adjust_resource_info() */ | 217 | /* is set to one if resource setup is done using adjust_resource_info() */ |
218 | u8 resource_setup_old:1; | 218 | u8 resource_setup_old:1; |
219 | u8 resource_setup_new:1; | ||
219 | 220 | ||
220 | u8 reserved:6; | 221 | u8 reserved:5; |
221 | 222 | ||
222 | /* socket operations */ | 223 | /* socket operations */ |
223 | struct pccard_operations * ops; | 224 | struct pccard_operations * ops; |