diff options
author | Alan Cox <alan@linux.intel.com> | 2010-03-29 13:38:00 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-05-11 15:01:10 -0400 |
commit | 8b6d043b7ee2d1b819dc833d677ea2aead71a0c0 (patch) | |
tree | 757e0be31fc4951d6e0688191a929542751d6e49 /include/linux | |
parent | d19f61f098ae9315b76a97962007f687683916d4 (diff) |
resource: shared I/O region support
SuperIO devices share regions and use lock/unlock operations to chip
select. We therefore need to be able to request a resource and wait for
it to be freed by whichever other SuperIO device currently hogs it.
Right now you have to poll which is horrible.
Add a MUXED field to IO port resources. If the MUXED field is set on the
resource and on the request (via request_muxed_region) then we block
until the previous owner of the muxed resource releases their region.
This allows us to implement proper resource sharing and locking for
superio chips using code of the form
enable_my_superio_dev() {
request_muxed_region(0x44, 0x02, "superio:watchdog");
outb() ..sequence to enable chip
}
disable_my_superio_dev() {
outb() .. sequence of disable chip
release_region(0x44, 0x02);
}
Signed-off-by: Giel van Schijndel <me@mortis.eu>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ioport.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 26fad187d661..b22790268b64 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -52,6 +52,7 @@ struct resource_list { | |||
52 | 52 | ||
53 | #define IORESOURCE_MEM_64 0x00100000 | 53 | #define IORESOURCE_MEM_64 0x00100000 |
54 | #define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ | 54 | #define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ |
55 | #define IORESOURCE_MUXED 0x00400000 /* Resource is software muxed */ | ||
55 | 56 | ||
56 | #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ | 57 | #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ |
57 | #define IORESOURCE_DISABLED 0x10000000 | 58 | #define IORESOURCE_DISABLED 0x10000000 |
@@ -143,7 +144,8 @@ static inline unsigned long resource_type(const struct resource *res) | |||
143 | } | 144 | } |
144 | 145 | ||
145 | /* Convenience shorthand with allocation */ | 146 | /* Convenience shorthand with allocation */ |
146 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) | 147 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) |
148 | #define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED) | ||
147 | #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl) | 149 | #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl) |
148 | #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0) | 150 | #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0) |
149 | #define request_mem_region_exclusive(start,n,name) \ | 151 | #define request_mem_region_exclusive(start,n,name) \ |