aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/lguest.h47
-rw-r--r--include/linux/lguest_bus.h5
-rw-r--r--include/linux/lguest_launcher.h60
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/netfilter/xt_connlimit.h4
-rw-r--r--include/linux/pnp.h191
-rw-r--r--include/linux/pnpbios.h60
-rw-r--r--include/linux/suspend.h3
10 files changed, 231 insertions, 148 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 12a1291855e2..86f9a3a6137d 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -15,8 +15,8 @@
15# define __acquire(x) __context__(x,1) 15# define __acquire(x) __context__(x,1)
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18extern void __chk_user_ptr(const void __user *); 18extern void __chk_user_ptr(const volatile void __user *);
19extern void __chk_io_ptr(const void __iomem *); 19extern void __chk_io_ptr(const volatile void __iomem *);
20#else 20#else
21# define __user 21# define __user
22# define __kernel 22# define __kernel
diff --git a/include/linux/device.h b/include/linux/device.h
index d9f0a57f5a2f..3a38d1f70cb7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -551,6 +551,9 @@ extern void put_device(struct device * dev);
551/* drivers/base/power/shutdown.c */ 551/* drivers/base/power/shutdown.c */
552extern void device_shutdown(void); 552extern void device_shutdown(void);
553 553
554/* drivers/base/sys.c */
555extern void sysdev_shutdown(void);
556
554 557
555/* drivers/base/firmware.c */ 558/* drivers/base/firmware.c */
556extern int __must_check firmware_register(struct kset *); 559extern int __must_check firmware_register(struct kset *);
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index 500aace21ca7..e76c151c7129 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -27,18 +27,38 @@
27#define LG_CLOCK_MIN_DELTA 100UL 27#define LG_CLOCK_MIN_DELTA 100UL
28#define LG_CLOCK_MAX_DELTA ULONG_MAX 28#define LG_CLOCK_MAX_DELTA ULONG_MAX
29 29
30/*G:031 First, how does our Guest contact the Host to ask for privileged
31 * operations? There are two ways: the direct way is to make a "hypercall",
32 * to make requests of the Host Itself.
33 *
34 * Our hypercall mechanism uses the highest unused trap code (traps 32 and
35 * above are used by real hardware interrupts). Seventeen hypercalls are
36 * available: the hypercall number is put in the %eax register, and the
37 * arguments (when required) are placed in %edx, %ebx and %ecx. If a return
38 * value makes sense, it's returned in %eax.
39 *
40 * Grossly invalid calls result in Sudden Death at the hands of the vengeful
41 * Host, rather than returning failure. This reflects Winston Churchill's
42 * definition of a gentleman: "someone who is only rude intentionally". */
30#define LGUEST_TRAP_ENTRY 0x1F 43#define LGUEST_TRAP_ENTRY 0x1F
31 44
32static inline unsigned long 45static inline unsigned long
33hcall(unsigned long call, 46hcall(unsigned long call,
34 unsigned long arg1, unsigned long arg2, unsigned long arg3) 47 unsigned long arg1, unsigned long arg2, unsigned long arg3)
35{ 48{
49 /* "int" is the Intel instruction to trigger a trap. */
36 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY) 50 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
51 /* The call is in %eax (aka "a"), and can be replaced */
37 : "=a"(call) 52 : "=a"(call)
53 /* The other arguments are in %eax, %edx, %ebx & %ecx */
38 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3) 54 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
55 /* "memory" means this might write somewhere in memory.
56 * This isn't true for all calls, but it's safe to tell
57 * gcc that it might happen so it doesn't get clever. */
39 : "memory"); 58 : "memory");
40 return call; 59 return call;
41} 60}
61/*:*/
42 62
43void async_hcall(unsigned long call, 63void async_hcall(unsigned long call,
44 unsigned long arg1, unsigned long arg2, unsigned long arg3); 64 unsigned long arg1, unsigned long arg2, unsigned long arg3);
@@ -52,31 +72,40 @@ struct hcall_ring
52 u32 eax, edx, ebx, ecx; 72 u32 eax, edx, ebx, ecx;
53}; 73};
54 74
55/* All the good stuff happens here: guest registers it with LGUEST_INIT */ 75/*G:032 The second method of communicating with the Host is to via "struct
76 * lguest_data". The Guest's very first hypercall is to tell the Host where
77 * this is, and then the Guest and Host both publish information in it. :*/
56struct lguest_data 78struct lguest_data
57{ 79{
58/* Fields which change during running: */ 80 /* 512 == enabled (same as eflags in normal hardware). The Guest
59 /* 512 == enabled (same as eflags) */ 81 * changes interrupts so often that a hypercall is too slow. */
60 unsigned int irq_enabled; 82 unsigned int irq_enabled;
61 /* Interrupts blocked by guest. */ 83 /* Fine-grained interrupt disabling by the Guest */
62 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS); 84 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
63 85
64 /* Virtual address of page fault. */ 86 /* The Host writes the virtual address of the last page fault here,
87 * which saves the Guest a hypercall. CR2 is the native register where
88 * this address would normally be found. */
65 unsigned long cr2; 89 unsigned long cr2;
66 90
67 /* Async hypercall ring. 0xFF == done, 0 == pending. */ 91 /* Async hypercall ring. Instead of directly making hypercalls, we can
92 * place them in here for processing the next time the Host wants.
93 * This batching can be quite efficient. */
94
95 /* 0xFF == done (set by Host), 0 == pending (set by Guest). */
68 u8 hcall_status[LHCALL_RING_SIZE]; 96 u8 hcall_status[LHCALL_RING_SIZE];
97 /* The actual registers for the hypercalls. */
69 struct hcall_ring hcalls[LHCALL_RING_SIZE]; 98 struct hcall_ring hcalls[LHCALL_RING_SIZE];
70 99
71/* Fields initialized by the hypervisor at boot: */ 100/* Fields initialized by the Host at boot: */
72 /* Memory not to try to access */ 101 /* Memory not to try to access */
73 unsigned long reserve_mem; 102 unsigned long reserve_mem;
74 /* ID of this guest (used by network driver to set ethernet address) */ 103 /* ID of this Guest (used by network driver to set ethernet address) */
75 u16 guestid; 104 u16 guestid;
76 /* KHz for the TSC clock. */ 105 /* KHz for the TSC clock. */
77 u32 tsc_khz; 106 u32 tsc_khz;
78 107
79/* Fields initialized by the guest at boot: */ 108/* Fields initialized by the Guest at boot: */
80 /* Instruction range to suppress interrupts even if enabled */ 109 /* Instruction range to suppress interrupts even if enabled */
81 unsigned long noirq_start, noirq_end; 110 unsigned long noirq_start, noirq_end;
82}; 111};
diff --git a/include/linux/lguest_bus.h b/include/linux/lguest_bus.h
index c9b4e05fee49..d27853ddc644 100644
--- a/include/linux/lguest_bus.h
+++ b/include/linux/lguest_bus.h
@@ -15,11 +15,14 @@ struct lguest_device {
15 void *private; 15 void *private;
16}; 16};
17 17
18/* By convention, each device can use irq index+1 if it wants to. */ 18/*D:380 Since interrupt numbers are arbitrary, we use a convention: each device
19 * can use the interrupt number corresponding to its index. The +1 is because
20 * interrupt 0 is not usable (it's actually the timer interrupt). */
19static inline int lgdev_irq(const struct lguest_device *dev) 21static inline int lgdev_irq(const struct lguest_device *dev)
20{ 22{
21 return dev->index + 1; 23 return dev->index + 1;
22} 24}
25/*:*/
23 26
24/* dma args must not be vmalloced! */ 27/* dma args must not be vmalloced! */
25void lguest_send_dma(unsigned long key, struct lguest_dma *dma); 28void lguest_send_dma(unsigned long key, struct lguest_dma *dma);
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index 0ba414a40c80..641670579446 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -9,14 +9,45 @@
9/* How many devices? Assume each one wants up to two dma arrays per device. */ 9/* How many devices? Assume each one wants up to two dma arrays per device. */
10#define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2) 10#define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2)
11 11
12/*D:200
13 * Lguest I/O
14 *
15 * The lguest I/O mechanism is the only way Guests can talk to devices. There
16 * are two hypercalls involved: SEND_DMA for output and BIND_DMA for input. In
17 * each case, "struct lguest_dma" describes the buffer: this contains 16
18 * addr/len pairs, and if there are fewer buffer elements the len array is
19 * terminated with a 0.
20 *
21 * I/O is organized by keys: BIND_DMA attaches buffers to a particular key, and
22 * SEND_DMA transfers to buffers bound to particular key. By convention, keys
23 * correspond to a physical address within the device's page. This means that
24 * devices will never accidentally end up with the same keys, and allows the
25 * Host use The Futex Trick (as we'll see later in our journey).
26 *
27 * SEND_DMA simply indicates a key to send to, and the physical address of the
28 * "struct lguest_dma" to send. The Host will write the number of bytes
29 * transferred into the "struct lguest_dma"'s used_len member.
30 *
31 * BIND_DMA indicates a key to bind to, a pointer to an array of "struct
32 * lguest_dma"s ready for receiving, the size of that array, and an interrupt
33 * to trigger when data is received. The Host will only allow transfers into
34 * buffers with a used_len of zero: it then sets used_len to the number of
35 * bytes transferred and triggers the interrupt for the Guest to process the
36 * new input. */
12struct lguest_dma 37struct lguest_dma
13{ 38{
14 /* 0 if free to be used, filled by hypervisor. */ 39 /* 0 if free to be used, filled by the Host. */
15 u32 used_len; 40 u32 used_len;
16 unsigned long addr[LGUEST_MAX_DMA_SECTIONS]; 41 unsigned long addr[LGUEST_MAX_DMA_SECTIONS];
17 u16 len[LGUEST_MAX_DMA_SECTIONS]; 42 u16 len[LGUEST_MAX_DMA_SECTIONS];
18}; 43};
44/*:*/
19 45
46/*D:460 This is the layout of a block device memory page. The Launcher sets up
47 * the num_sectors initially to tell the Guest the size of the disk. The Guest
48 * puts the type, sector and length of the request in the first three fields,
49 * then DMAs to the Host. The Host processes the request, sets up the result,
50 * then DMAs back to the Guest. */
20struct lguest_block_page 51struct lguest_block_page
21{ 52{
22 /* 0 is a read, 1 is a write. */ 53 /* 0 is a read, 1 is a write. */
@@ -28,27 +59,47 @@ struct lguest_block_page
28 u32 num_sectors; /* Disk length = num_sectors * 512 */ 59 u32 num_sectors; /* Disk length = num_sectors * 512 */
29}; 60};
30 61
31/* There is a shared page of these. */ 62/*D:520 The network device is basically a memory page where all the Guests on
63 * the network publish their MAC (ethernet) addresses: it's an array of "struct
64 * lguest_net": */
32struct lguest_net 65struct lguest_net
33{ 66{
34 /* Simply the mac address (with multicast bit meaning promisc). */ 67 /* Simply the mac address (with multicast bit meaning promisc). */
35 unsigned char mac[6]; 68 unsigned char mac[6];
36}; 69};
70/*:*/
37 71
38/* Where the Host expects the Guest to SEND_DMA console output to. */ 72/* Where the Host expects the Guest to SEND_DMA console output to. */
39#define LGUEST_CONSOLE_DMA_KEY 0 73#define LGUEST_CONSOLE_DMA_KEY 0
40 74
41/* We have a page of these descriptors in the lguest_device page. */ 75/*D:010
76 * Drivers
77 *
78 * The Guest needs devices to do anything useful. Since we don't let it touch
79 * real devices (think of the damage it could do!) we provide virtual devices.
80 * We could emulate a PCI bus with various devices on it, but that is a fairly
81 * complex burden for the Host and suboptimal for the Guest, so we have our own
82 * "lguest" bus and simple drivers.
83 *
84 * Devices are described by an array of LGUEST_MAX_DEVICES of these structs,
85 * placed by the Launcher just above the top of physical memory:
86 */
42struct lguest_device_desc { 87struct lguest_device_desc {
88 /* The device type: console, network, disk etc. */
43 u16 type; 89 u16 type;
44#define LGUEST_DEVICE_T_CONSOLE 1 90#define LGUEST_DEVICE_T_CONSOLE 1
45#define LGUEST_DEVICE_T_NET 2 91#define LGUEST_DEVICE_T_NET 2
46#define LGUEST_DEVICE_T_BLOCK 3 92#define LGUEST_DEVICE_T_BLOCK 3
47 93
94 /* The specific features of this device: these depends on device type
95 * except for LGUEST_DEVICE_F_RANDOMNESS. */
48 u16 features; 96 u16 features;
49#define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */ 97#define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */
50#define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */ 98#define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */
51 99
100 /* This is how the Guest reports status of the device: the Host can set
101 * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only
102 * ever manipulated by the Guest, and only ever set. */
52 u16 status; 103 u16 status;
53/* 256 and above are device specific. */ 104/* 256 and above are device specific. */
54#define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */ 105#define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */
@@ -58,9 +109,12 @@ struct lguest_device_desc {
58#define LGUEST_DEVICE_S_REMOVED_ACK 16 /* Driver has been told. */ 109#define LGUEST_DEVICE_S_REMOVED_ACK 16 /* Driver has been told. */
59#define LGUEST_DEVICE_S_FAILED 128 /* Something actually failed */ 110#define LGUEST_DEVICE_S_FAILED 128 /* Something actually failed */
60 111
112 /* Each device exists somewhere in Guest physical memory, over some
113 * number of pages. */
61 u16 num_pages; 114 u16 num_pages;
62 u32 pfn; 115 u32 pfn;
63}; 116};
117/*:*/
64 118
65/* Write command first word is a request. */ 119/* Write command first word is a request. */
66enum lguest_req 120enum lguest_req
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c456c3a1c28e..3e9e8fec5a41 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1246,7 +1246,7 @@ void drop_slab(void);
1246extern int randomize_va_space; 1246extern int randomize_va_space;
1247#endif 1247#endif
1248 1248
1249__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma); 1249const char * arch_vma_name(struct vm_area_struct *vma);
1250 1250
1251#endif /* __KERNEL__ */ 1251#endif /* __KERNEL__ */
1252#endif /* _LINUX_MM_H */ 1252#endif /* _LINUX_MM_H */
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h
index 90ae8b474cb8..37e933c9987d 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/linux/netfilter/xt_connlimit.h
@@ -5,8 +5,8 @@ struct xt_connlimit_data;
5 5
6struct xt_connlimit_info { 6struct xt_connlimit_info {
7 union { 7 union {
8 u_int32_t v4_mask; 8 __be32 v4_mask;
9 u_int32_t v6_mask[4]; 9 __be32 v6_mask[4];
10 }; 10 };
11 unsigned int limit, inverse; 11 unsigned int limit, inverse;
12 12
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 66edb2293184..16b46aace349 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -1,7 +1,6 @@
1/* 1/*
2 * Linux Plug and Play Support 2 * Linux Plug and Play Support
3 * Copyright by Adam Belay <ambx1@neo.rr.com> 3 * Copyright by Adam Belay <ambx1@neo.rr.com>
4 *
5 */ 4 */
6 5
7#ifndef _LINUX_PNP_H 6#ifndef _LINUX_PNP_H
@@ -23,7 +22,6 @@
23struct pnp_protocol; 22struct pnp_protocol;
24struct pnp_dev; 23struct pnp_dev;
25 24
26
27/* 25/*
28 * Resource Management 26 * Resource Management
29 */ 27 */
@@ -73,37 +71,37 @@ struct pnp_dev;
73#define PNP_PORT_FLAG_FIXED (1<<1) 71#define PNP_PORT_FLAG_FIXED (1<<1)
74 72
75struct pnp_port { 73struct pnp_port {
76 unsigned short min; /* min base number */ 74 unsigned short min; /* min base number */
77 unsigned short max; /* max base number */ 75 unsigned short max; /* max base number */
78 unsigned char align; /* align boundary */ 76 unsigned char align; /* align boundary */
79 unsigned char size; /* size of range */ 77 unsigned char size; /* size of range */
80 unsigned char flags; /* port flags */ 78 unsigned char flags; /* port flags */
81 unsigned char pad; /* pad */ 79 unsigned char pad; /* pad */
82 struct pnp_port *next; /* next port */ 80 struct pnp_port *next; /* next port */
83}; 81};
84 82
85#define PNP_IRQ_NR 256 83#define PNP_IRQ_NR 256
86struct pnp_irq { 84struct pnp_irq {
87 DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmaks for IRQ lines */ 85 DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmask for IRQ lines */
88 unsigned char flags; /* IRQ flags */ 86 unsigned char flags; /* IRQ flags */
89 unsigned char pad; /* pad */ 87 unsigned char pad; /* pad */
90 struct pnp_irq *next; /* next IRQ */ 88 struct pnp_irq *next; /* next IRQ */
91}; 89};
92 90
93struct pnp_dma { 91struct pnp_dma {
94 unsigned char map; /* bitmask for DMA channels */ 92 unsigned char map; /* bitmask for DMA channels */
95 unsigned char flags; /* DMA flags */ 93 unsigned char flags; /* DMA flags */
96 struct pnp_dma *next; /* next port */ 94 struct pnp_dma *next; /* next port */
97}; 95};
98 96
99struct pnp_mem { 97struct pnp_mem {
100 unsigned int min; /* min base number */ 98 unsigned int min; /* min base number */
101 unsigned int max; /* max base number */ 99 unsigned int max; /* max base number */
102 unsigned int align; /* align boundary */ 100 unsigned int align; /* align boundary */
103 unsigned int size; /* size of range */ 101 unsigned int size; /* size of range */
104 unsigned char flags; /* memory flags */ 102 unsigned char flags; /* memory flags */
105 unsigned char pad; /* pad */ 103 unsigned char pad; /* pad */
106 struct pnp_mem *next; /* next memory resource */ 104 struct pnp_mem *next; /* next memory resource */
107}; 105};
108 106
109#define PNP_RES_PRIORITY_PREFERRED 0 107#define PNP_RES_PRIORITY_PREFERRED 0
@@ -127,7 +125,6 @@ struct pnp_resource_table {
127 struct resource irq_resource[PNP_MAX_IRQ]; 125 struct resource irq_resource[PNP_MAX_IRQ];
128}; 126};
129 127
130
131/* 128/*
132 * Device Managemnt 129 * Device Managemnt
133 */ 130 */
@@ -139,14 +136,14 @@ struct pnp_card {
139 struct list_head protocol_list; /* node in protocol's list of cards */ 136 struct list_head protocol_list; /* node in protocol's list of cards */
140 struct list_head devices; /* devices attached to the card */ 137 struct list_head devices; /* devices attached to the card */
141 138
142 struct pnp_protocol * protocol; 139 struct pnp_protocol *protocol;
143 struct pnp_id * id; /* contains supported EISA IDs*/ 140 struct pnp_id *id; /* contains supported EISA IDs */
144 141
145 char name[PNP_NAME_LEN]; /* contains a human-readable name */ 142 char name[PNP_NAME_LEN]; /* contains a human-readable name */
146 unsigned char pnpver; /* Plug & Play version */ 143 unsigned char pnpver; /* Plug & Play version */
147 unsigned char productver; /* product version */ 144 unsigned char productver; /* product version */
148 unsigned int serial; /* serial number */ 145 unsigned int serial; /* serial number */
149 unsigned char checksum; /* if zero - checksum passed */ 146 unsigned char checksum; /* if zero - checksum passed */
150 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/isapnp */ 147 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/isapnp */
151}; 148};
152 149
@@ -159,18 +156,18 @@ struct pnp_card {
159 (card) = global_to_pnp_card((card)->global_list.next)) 156 (card) = global_to_pnp_card((card)->global_list.next))
160 157
161struct pnp_card_link { 158struct pnp_card_link {
162 struct pnp_card * card; 159 struct pnp_card *card;
163 struct pnp_card_driver * driver; 160 struct pnp_card_driver *driver;
164 void * driver_data; 161 void *driver_data;
165 pm_message_t pm_state; 162 pm_message_t pm_state;
166}; 163};
167 164
168static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) 165static inline void *pnp_get_card_drvdata(struct pnp_card_link *pcard)
169{ 166{
170 return pcard->driver_data; 167 return pcard->driver_data;
171} 168}
172 169
173static inline void pnp_set_card_drvdata (struct pnp_card_link *pcard, void *data) 170static inline void pnp_set_card_drvdata(struct pnp_card_link *pcard, void *data)
174{ 171{
175 pcard->driver_data = data; 172 pcard->driver_data = data;
176} 173}
@@ -186,22 +183,22 @@ struct pnp_dev {
186 struct list_head card_list; /* node in card's list of devices */ 183 struct list_head card_list; /* node in card's list of devices */
187 struct list_head rdev_list; /* node in cards list of requested devices */ 184 struct list_head rdev_list; /* node in cards list of requested devices */
188 185
189 struct pnp_protocol * protocol; 186 struct pnp_protocol *protocol;
190 struct pnp_card * card; /* card the device is attached to, none if NULL */ 187 struct pnp_card *card; /* card the device is attached to, none if NULL */
191 struct pnp_driver * driver; 188 struct pnp_driver *driver;
192 struct pnp_card_link * card_link; 189 struct pnp_card_link *card_link;
193 190
194 struct pnp_id * id; /* supported EISA IDs*/ 191 struct pnp_id *id; /* supported EISA IDs */
195 192
196 int active; 193 int active;
197 int capabilities; 194 int capabilities;
198 struct pnp_option * independent; 195 struct pnp_option *independent;
199 struct pnp_option * dependent; 196 struct pnp_option *dependent;
200 struct pnp_resource_table res; 197 struct pnp_resource_table res;
201 198
202 char name[PNP_NAME_LEN]; /* contains a human-readable name */ 199 char name[PNP_NAME_LEN]; /* contains a human-readable name */
203 unsigned short regs; /* ISAPnP: supported registers */ 200 unsigned short regs; /* ISAPnP: supported registers */
204 int flags; /* used by protocols */ 201 int flags; /* used by protocols */
205 struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */ 202 struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */
206 void *data; 203 void *data;
207}; 204};
@@ -220,19 +217,19 @@ struct pnp_dev {
220 (dev) = card_to_pnp_dev((dev)->card_list.next)) 217 (dev) = card_to_pnp_dev((dev)->card_list.next))
221#define pnp_dev_name(dev) (dev)->name 218#define pnp_dev_name(dev) (dev)->name
222 219
223static inline void *pnp_get_drvdata (struct pnp_dev *pdev) 220static inline void *pnp_get_drvdata(struct pnp_dev *pdev)
224{ 221{
225 return dev_get_drvdata(&pdev->dev); 222 return dev_get_drvdata(&pdev->dev);
226} 223}
227 224
228static inline void pnp_set_drvdata (struct pnp_dev *pdev, void *data) 225static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data)
229{ 226{
230 dev_set_drvdata(&pdev->dev, data); 227 dev_set_drvdata(&pdev->dev, data);
231} 228}
232 229
233struct pnp_fixup { 230struct pnp_fixup {
234 char id[7]; 231 char id[7];
235 void (*quirk_function)(struct pnp_dev *dev); /* fixup function */ 232 void (*quirk_function) (struct pnp_dev * dev); /* fixup function */
236}; 233};
237 234
238/* config parameters */ 235/* config parameters */
@@ -269,7 +266,6 @@ extern struct pnp_protocol pnpbios_protocol;
269#define pnp_device_is_pnpbios(dev) 0 266#define pnp_device_is_pnpbios(dev) 0
270#endif 267#endif
271 268
272
273/* status */ 269/* status */
274#define PNP_READY 0x0000 270#define PNP_READY 0x0000
275#define PNP_ATTACHED 0x0001 271#define PNP_ATTACHED 0x0001
@@ -287,17 +283,17 @@ extern struct pnp_protocol pnpbios_protocol;
287 283
288struct pnp_id { 284struct pnp_id {
289 char id[PNP_ID_LEN]; 285 char id[PNP_ID_LEN];
290 struct pnp_id * next; 286 struct pnp_id *next;
291}; 287};
292 288
293struct pnp_driver { 289struct pnp_driver {
294 char * name; 290 char *name;
295 const struct pnp_device_id *id_table; 291 const struct pnp_device_id *id_table;
296 unsigned int flags; 292 unsigned int flags;
297 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 293 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
298 void (*remove) (struct pnp_dev *dev); 294 void (*remove) (struct pnp_dev *dev);
299 int (*suspend) (struct pnp_dev *dev, pm_message_t state); 295 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
300 int (*resume) (struct pnp_dev *dev); 296 int (*resume) (struct pnp_dev *dev);
301 struct device_driver driver; 297 struct device_driver driver;
302}; 298};
303 299
@@ -305,13 +301,14 @@ struct pnp_driver {
305 301
306struct pnp_card_driver { 302struct pnp_card_driver {
307 struct list_head global_list; 303 struct list_head global_list;
308 char * name; 304 char *name;
309 const struct pnp_card_device_id *id_table; 305 const struct pnp_card_device_id *id_table;
310 unsigned int flags; 306 unsigned int flags;
311 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); 307 int (*probe) (struct pnp_card_link *card,
308 const struct pnp_card_device_id *card_id);
312 void (*remove) (struct pnp_card_link *card); 309 void (*remove) (struct pnp_card_link *card);
313 int (*suspend) (struct pnp_card_link *card, pm_message_t state); 310 int (*suspend) (struct pnp_card_link *card, pm_message_t state);
314 int (*resume) (struct pnp_card_link *card); 311 int (*resume) (struct pnp_card_link *card);
315 struct pnp_driver link; 312 struct pnp_driver link;
316}; 313};
317 314
@@ -321,29 +318,28 @@ struct pnp_card_driver {
321#define PNP_DRIVER_RES_DO_NOT_CHANGE 0x0001 /* do not change the state of the device */ 318#define PNP_DRIVER_RES_DO_NOT_CHANGE 0x0001 /* do not change the state of the device */
322#define PNP_DRIVER_RES_DISABLE 0x0003 /* ensure the device is disabled */ 319#define PNP_DRIVER_RES_DISABLE 0x0003 /* ensure the device is disabled */
323 320
324
325/* 321/*
326 * Protocol Management 322 * Protocol Management
327 */ 323 */
328 324
329struct pnp_protocol { 325struct pnp_protocol {
330 struct list_head protocol_list; 326 struct list_head protocol_list;
331 char * name; 327 char *name;
332 328
333 /* resource control functions */ 329 /* resource control functions */
334 int (*get)(struct pnp_dev *dev, struct pnp_resource_table *res); 330 int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res);
335 int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res); 331 int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res);
336 int (*disable)(struct pnp_dev *dev); 332 int (*disable) (struct pnp_dev *dev);
337 333
338 /* protocol specific suspend/resume */ 334 /* protocol specific suspend/resume */
339 int (*suspend)(struct pnp_dev *dev, pm_message_t state); 335 int (*suspend) (struct pnp_dev * dev, pm_message_t state);
340 int (*resume)(struct pnp_dev *dev); 336 int (*resume) (struct pnp_dev * dev);
341 337
342 /* used by pnp layer only (look but don't touch) */ 338 /* used by pnp layer only (look but don't touch) */
343 unsigned char number; /* protocol number*/ 339 unsigned char number; /* protocol number */
344 struct device dev; /* link to driver model */ 340 struct device dev; /* link to driver model */
345 struct list_head cards; 341 struct list_head cards;
346 struct list_head devices; 342 struct list_head devices;
347}; 343};
348 344
349#define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list) 345#define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list)
@@ -356,7 +352,6 @@ struct pnp_protocol {
356 (dev) != protocol_to_pnp_dev(&(protocol)->devices); \ 352 (dev) != protocol_to_pnp_dev(&(protocol)->devices); \
357 (dev) = protocol_to_pnp_dev((dev)->protocol_list.next)) 353 (dev) = protocol_to_pnp_dev((dev)->protocol_list.next))
358 354
359
360extern struct bus_type pnp_bus_type; 355extern struct bus_type pnp_bus_type;
361 356
362#if defined(CONFIG_PNP) 357#if defined(CONFIG_PNP)
@@ -376,21 +371,25 @@ void pnp_remove_card(struct pnp_card *card);
376int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); 371int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
377void pnp_remove_card_device(struct pnp_dev *dev); 372void pnp_remove_card_device(struct pnp_dev *dev);
378int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card); 373int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card);
379struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from); 374struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
380void pnp_release_card_device(struct pnp_dev * dev); 375 const char *id, struct pnp_dev *from);
381int pnp_register_card_driver(struct pnp_card_driver * drv); 376void pnp_release_card_device(struct pnp_dev *dev);
382void pnp_unregister_card_driver(struct pnp_card_driver * drv); 377int pnp_register_card_driver(struct pnp_card_driver *drv);
378void pnp_unregister_card_driver(struct pnp_card_driver *drv);
383extern struct list_head pnp_cards; 379extern struct list_head pnp_cards;
384 380
385/* resource management */ 381/* resource management */
386struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev); 382struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev);
387struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority); 383struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
384 int priority);
388int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data); 385int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data);
389int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data); 386int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data);
390int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data); 387int pnp_register_port_resource(struct pnp_option *option,
388 struct pnp_port *data);
391int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data); 389int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data);
392void pnp_init_resource_table(struct pnp_resource_table *table); 390void pnp_init_resource_table(struct pnp_resource_table *table);
393int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); 391int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
392 int mode);
394int pnp_auto_config_dev(struct pnp_dev *dev); 393int pnp_auto_config_dev(struct pnp_dev *dev);
395int pnp_validate_config(struct pnp_dev *dev); 394int pnp_validate_config(struct pnp_dev *dev);
396int pnp_start_dev(struct pnp_dev *dev); 395int pnp_start_dev(struct pnp_dev *dev);
@@ -398,11 +397,11 @@ int pnp_stop_dev(struct pnp_dev *dev);
398int pnp_activate_dev(struct pnp_dev *dev); 397int pnp_activate_dev(struct pnp_dev *dev);
399int pnp_disable_dev(struct pnp_dev *dev); 398int pnp_disable_dev(struct pnp_dev *dev);
400void pnp_resource_change(struct resource *resource, resource_size_t start, 399void pnp_resource_change(struct resource *resource, resource_size_t start,
401 resource_size_t size); 400 resource_size_t size);
402 401
403/* protocol helpers */ 402/* protocol helpers */
404int pnp_is_active(struct pnp_dev * dev); 403int pnp_is_active(struct pnp_dev *dev);
405int compare_pnp_id(struct pnp_id * pos, const char * id); 404int compare_pnp_id(struct pnp_id *pos, const char *id);
406int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev); 405int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev);
407int pnp_register_driver(struct pnp_driver *drv); 406int pnp_register_driver(struct pnp_driver *drv);
408void pnp_unregister_driver(struct pnp_driver *drv); 407void pnp_unregister_driver(struct pnp_driver *drv);
@@ -415,23 +414,24 @@ static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { }
415static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } 414static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; }
416static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } 415static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; }
417static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } 416static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
418static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } 417static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { }
418
419#define pnp_platform_devices 0 419#define pnp_platform_devices 0
420 420
421/* multidevice card support */ 421/* multidevice card support */
422static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; } 422static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; }
423static inline void pnp_remove_card(struct pnp_card *card) { ; } 423static inline void pnp_remove_card(struct pnp_card *card) { }
424static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; } 424static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; }
425static inline void pnp_remove_card_device(struct pnp_dev *dev) { ; } 425static inline void pnp_remove_card_device(struct pnp_dev *dev) { }
426static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; } 426static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
427static inline struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from) { return NULL; } 427static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; }
428static inline void pnp_release_card_device(struct pnp_dev * dev) { ; } 428static inline void pnp_release_card_device(struct pnp_dev *dev) { }
429static inline int pnp_register_card_driver(struct pnp_card_driver * drv) { return -ENODEV; } 429static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; }
430static inline void pnp_unregister_card_driver(struct pnp_card_driver * drv) { ; } 430static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { }
431 431
432/* resource management */ 432/* resource management */
433static inline struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev) { return NULL; } 433static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; }
434static inline struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; } 434static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; }
435static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; } 435static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; }
436static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; } 436static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; }
437static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; } 437static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; }
@@ -444,20 +444,17 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
444static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 444static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
445static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 445static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
446static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 446static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
447static inline void pnp_resource_change(struct resource *resource, 447static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { }
448 resource_size_t start,
449 resource_size_t size) { }
450 448
451/* protocol helpers */ 449/* protocol helpers */
452static inline int pnp_is_active(struct pnp_dev * dev) { return 0; } 450static inline int pnp_is_active(struct pnp_dev *dev) { return 0; }
453static inline int compare_pnp_id(struct pnp_id * pos, const char * id) { return -ENODEV; } 451static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; }
454static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; } 452static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; }
455static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } 453static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; }
456static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; } 454static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
457 455
458#endif /* CONFIG_PNP */ 456#endif /* CONFIG_PNP */
459 457
460
461#define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg) 458#define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg)
462#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg) 459#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg)
463#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg) 460#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg)
diff --git a/include/linux/pnpbios.h b/include/linux/pnpbios.h
index 0a282ac1f6b2..329192adc9dd 100644
--- a/include/linux/pnpbios.h
+++ b/include/linux/pnpbios.h
@@ -99,32 +99,32 @@
99 99
100#pragma pack(1) 100#pragma pack(1)
101struct pnp_dev_node_info { 101struct pnp_dev_node_info {
102 __u16 no_nodes; 102 __u16 no_nodes;
103 __u16 max_node_size; 103 __u16 max_node_size;
104}; 104};
105struct pnp_docking_station_info { 105struct pnp_docking_station_info {
106 __u32 location_id; 106 __u32 location_id;
107 __u32 serial; 107 __u32 serial;
108 __u16 capabilities; 108 __u16 capabilities;
109}; 109};
110struct pnp_isa_config_struc { 110struct pnp_isa_config_struc {
111 __u8 revision; 111 __u8 revision;
112 __u8 no_csns; 112 __u8 no_csns;
113 __u16 isa_rd_data_port; 113 __u16 isa_rd_data_port;
114 __u16 reserved; 114 __u16 reserved;
115}; 115};
116struct escd_info_struc { 116struct escd_info_struc {
117 __u16 min_escd_write_size; 117 __u16 min_escd_write_size;
118 __u16 escd_size; 118 __u16 escd_size;
119 __u32 nv_storage_base; 119 __u32 nv_storage_base;
120}; 120};
121struct pnp_bios_node { 121struct pnp_bios_node {
122 __u16 size; 122 __u16 size;
123 __u8 handle; 123 __u8 handle;
124 __u32 eisa_id; 124 __u32 eisa_id;
125 __u8 type_code[3]; 125 __u8 type_code[3];
126 __u16 flags; 126 __u16 flags;
127 __u8 data[0]; 127 __u8 data[0];
128}; 128};
129#pragma pack() 129#pragma pack()
130 130
@@ -133,22 +133,16 @@ struct pnp_bios_node {
133/* non-exported */ 133/* non-exported */
134extern struct pnp_dev_node_info node_info; 134extern struct pnp_dev_node_info node_info;
135 135
136extern int pnp_bios_dev_node_info (struct pnp_dev_node_info *data); 136extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
137extern int pnp_bios_get_dev_node (u8 *nodenum, char config, struct pnp_bios_node *data); 137extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
138extern int pnp_bios_set_dev_node (u8 nodenum, char config, struct pnp_bios_node *data); 138 struct pnp_bios_node *data);
139extern int pnp_bios_get_stat_res (char *info); 139extern int pnp_bios_set_dev_node(u8 nodenum, char config,
140extern int pnp_bios_isapnp_config (struct pnp_isa_config_struc *data); 140 struct pnp_bios_node *data);
141extern int pnp_bios_escd_info (struct escd_info_struc *data); 141extern int pnp_bios_get_stat_res(char *info);
142extern int pnp_bios_read_escd (char *data, u32 nvram_base); 142extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
143extern int pnp_bios_escd_info(struct escd_info_struc *data);
144extern int pnp_bios_read_escd(char *data, u32 nvram_base);
143extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data); 145extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
144#define needed 0
145#if needed
146extern int pnp_bios_get_event (u16 *message);
147extern int pnp_bios_send_message (u16 message);
148extern int pnp_bios_set_stat_res (char *info);
149extern int pnp_bios_apm_id_table (char *table, u16 *size);
150extern int pnp_bios_write_escd (char *data, u32 nvram_base);
151#endif
152 146
153#endif /* CONFIG_PNPBIOS */ 147#endif /* CONFIG_PNPBIOS */
154 148
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index e8e6da394c92..618f93c32b7f 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -125,6 +125,9 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
125static inline void register_nosave_region(unsigned long b, unsigned long e) 125static inline void register_nosave_region(unsigned long b, unsigned long e)
126{ 126{
127} 127}
128static inline void register_nosave_region_late(unsigned long b, unsigned long e)
129{
130}
128#endif 131#endif
129 132
130#endif /* _LINUX_SWSUSP_H */ 133#endif /* _LINUX_SWSUSP_H */