aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/sysfs-ibft23
-rw-r--r--Documentation/DocBook/kernel-api.tmpl5
-rw-r--r--Documentation/filesystems/sysfs.txt9
-rw-r--r--Documentation/firmware_class/firmware_sample_driver.c115
-rw-r--r--Documentation/firmware_class/firmware_sample_firmware_class.c207
-rw-r--r--Documentation/power/devices.txt5
6 files changed, 35 insertions, 329 deletions
diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft
new file mode 100644
index 000000000000..c2b7d1154bec
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-ibft
@@ -0,0 +1,23 @@
1What: /sys/firmware/ibft/initiator
2Date: November 2007
3Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
4Description: The /sys/firmware/ibft/initiator directory will contain
5 files that expose the iSCSI Boot Firmware Table initiator data.
6 Usually this contains the Initiator name.
7
8What: /sys/firmware/ibft/targetX
9Date: November 2007
10Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
11Description: The /sys/firmware/ibft/targetX directory will contain
12 files that expose the iSCSI Boot Firmware Table target data.
13 Usually this contains the target's IP address, boot LUN,
14 target name, and what NIC it is associated with. It can also
15 contain the CHAP name (and password), the reverse CHAP
16 name (and password)
17
18What: /sys/firmware/ibft/ethernetX
19Date: November 2007
20Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
21Description: The /sys/firmware/ibft/ethernetX directory will contain
22 files that expose the iSCSI Boot Firmware Table NIC data.
23 This can this can the IP address, MAC, and gateway of the NIC.
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index dc0f30c3e571..488dd4a4945b 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -297,11 +297,6 @@ X!Earch/x86/kernel/mca_32.c
297!Ikernel/acct.c 297!Ikernel/acct.c
298 </chapter> 298 </chapter>
299 299
300 <chapter id="pmfuncs">
301 <title>Power Management</title>
302!Ekernel/power/pm.c
303 </chapter>
304
305 <chapter id="devdrivers"> 300 <chapter id="devdrivers">
306 <title>Device drivers infrastructure</title> 301 <title>Device drivers infrastructure</title>
307 <sect1><title>Device Drivers Base</title> 302 <sect1><title>Device Drivers Base</title>
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 4598ef7b622b..7f27b8f840d0 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -176,8 +176,10 @@ implementations:
176 Recall that an attribute should only be exporting one value, or an 176 Recall that an attribute should only be exporting one value, or an
177 array of similar values, so this shouldn't be that expensive. 177 array of similar values, so this shouldn't be that expensive.
178 178
179 This allows userspace to do partial reads and seeks arbitrarily over 179 This allows userspace to do partial reads and forward seeks
180 the entire file at will. 180 arbitrarily over the entire file at will. If userspace seeks back to
181 zero or does a pread(2) with an offset of '0' the show() method will
182 be called again, rearmed, to fill the buffer.
181 183
182- On write(2), sysfs expects the entire buffer to be passed during the 184- On write(2), sysfs expects the entire buffer to be passed during the
183 first write. Sysfs then passes the entire buffer to the store() 185 first write. Sysfs then passes the entire buffer to the store()
@@ -192,6 +194,9 @@ implementations:
192 194
193Other notes: 195Other notes:
194 196
197- Writing causes the show() method to be rearmed regardless of current
198 file position.
199
195- The buffer will always be PAGE_SIZE bytes in length. On i386, this 200- The buffer will always be PAGE_SIZE bytes in length. On i386, this
196 is 4096. 201 is 4096.
197 202
diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c
deleted file mode 100644
index 6865cbe075ec..000000000000
--- a/Documentation/firmware_class/firmware_sample_driver.c
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * firmware_sample_driver.c -
3 *
4 * Copyright (c) 2003 Manuel Estrada Sainz
5 *
6 * Sample code on how to use request_firmware() from drivers.
7 *
8 */
9
10#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/device.h>
14#include <linux/string.h>
15
16#include "linux/firmware.h"
17
18static struct device ghost_device = {
19 .bus_id = "ghost0",
20};
21
22
23static void sample_firmware_load(char *firmware, int size)
24{
25 u8 buf[size+1];
26 memcpy(buf, firmware, size);
27 buf[size] = '\0';
28 printk(KERN_INFO "firmware_sample_driver: firmware: %s\n", buf);
29}
30
31static void sample_probe_default(void)
32{
33 /* uses the default method to get the firmware */
34 const struct firmware *fw_entry;
35 printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n");
36
37 if(request_firmware(&fw_entry, "sample_driver_fw", &ghost_device)!=0)
38 {
39 printk(KERN_ERR
40 "firmware_sample_driver: Firmware not available\n");
41 return;
42 }
43
44 sample_firmware_load(fw_entry->data, fw_entry->size);
45
46 release_firmware(fw_entry);
47
48 /* finish setting up the device */
49}
50static void sample_probe_specific(void)
51{
52 /* Uses some specific hotplug support to get the firmware from
53 * userspace directly into the hardware, or via some sysfs file */
54
55 /* NOTE: This currently doesn't work */
56
57 printk(KERN_INFO "firmware_sample_driver: a ghost device got inserted :)\n");
58
59 if(request_firmware(NULL, "sample_driver_fw", &ghost_device)!=0)
60 {
61 printk(KERN_ERR
62 "firmware_sample_driver: Firmware load failed\n");
63 return;
64 }
65
66 /* request_firmware blocks until userspace finished, so at
67 * this point the firmware should be already in the device */
68
69 /* finish setting up the device */
70}
71static void sample_probe_async_cont(const struct firmware *fw, void *context)
72{
73 if(!fw){
74 printk(KERN_ERR
75 "firmware_sample_driver: firmware load failed\n");
76 return;
77 }
78
79 printk(KERN_INFO "firmware_sample_driver: device pointer \"%s\"\n",
80 (char *)context);
81 sample_firmware_load(fw->data, fw->size);
82}
83static void sample_probe_async(void)
84{
85 /* Let's say that I can't sleep */
86 int error;
87 error = request_firmware_nowait (THIS_MODULE, FW_ACTION_NOHOTPLUG,
88 "sample_driver_fw", &ghost_device,
89 "my device pointer",
90 sample_probe_async_cont);
91 if(error){
92 printk(KERN_ERR
93 "firmware_sample_driver:"
94 " request_firmware_nowait failed\n");
95 }
96}
97
98static int sample_init(void)
99{
100 device_initialize(&ghost_device);
101 /* since there is no real hardware insertion I just call the
102 * sample probe functions here */
103 sample_probe_specific();
104 sample_probe_default();
105 sample_probe_async();
106 return 0;
107}
108static void __exit sample_exit(void)
109{
110}
111
112module_init (sample_init);
113module_exit (sample_exit);
114
115MODULE_LICENSE("GPL");
diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c
deleted file mode 100644
index 2de62854f0e5..000000000000
--- a/Documentation/firmware_class/firmware_sample_firmware_class.c
+++ /dev/null
@@ -1,207 +0,0 @@
1/*
2 * firmware_sample_firmware_class.c -
3 *
4 * Copyright (c) 2003 Manuel Estrada Sainz
5 *
6 * NOTE: This is just a probe of concept, if you think that your driver would
7 * be well served by this mechanism please contact me first.
8 *
9 * DON'T USE THIS CODE AS IS
10 *
11 */
12
13#include <linux/device.h>
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/timer.h>
17#include <linux/slab.h>
18#include <linux/string.h>
19#include <linux/firmware.h>
20
21
22MODULE_AUTHOR("Manuel Estrada Sainz");
23MODULE_DESCRIPTION("Hackish sample for using firmware class directly");
24MODULE_LICENSE("GPL");
25
26static inline struct class_device *to_class_dev(struct kobject *obj)
27{
28 return container_of(obj,struct class_device,kobj);
29}
30static inline
31struct class_device_attribute *to_class_dev_attr(struct attribute *_attr)
32{
33 return container_of(_attr,struct class_device_attribute,attr);
34}
35
36int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr);
37int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr);
38
39struct firmware_priv {
40 char fw_id[FIRMWARE_NAME_MAX];
41 s32 loading:2;
42 u32 abort:1;
43};
44
45extern struct class firmware_class;
46
47static ssize_t firmware_loading_show(struct class_device *class_dev, char *buf)
48{
49 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
50 return sprintf(buf, "%d\n", fw_priv->loading);
51}
52static ssize_t firmware_loading_store(struct class_device *class_dev,
53 const char *buf, size_t count)
54{
55 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
56 int prev_loading = fw_priv->loading;
57
58 fw_priv->loading = simple_strtol(buf, NULL, 10);
59
60 switch(fw_priv->loading){
61 case -1:
62 /* abort load an panic */
63 break;
64 case 1:
65 /* setup load */
66 break;
67 case 0:
68 if(prev_loading==1){
69 /* finish load and get the device back to working
70 * state */
71 }
72 break;
73 }
74
75 return count;
76}
77static CLASS_DEVICE_ATTR(loading, 0644,
78 firmware_loading_show, firmware_loading_store);
79
80static ssize_t firmware_data_read(struct kobject *kobj,
81 struct bin_attribute *bin_attr,
82 char *buffer, loff_t offset, size_t count)
83{
84 struct class_device *class_dev = to_class_dev(kobj);
85 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
86
87 /* read from the devices firmware memory */
88
89 return count;
90}
91static ssize_t firmware_data_write(struct kobject *kobj,
92 struct bin_attribute *bin_attr,
93 char *buffer, loff_t offset, size_t count)
94{
95 struct class_device *class_dev = to_class_dev(kobj);
96 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
97
98 /* write to the devices firmware memory */
99
100 return count;
101}
102static struct bin_attribute firmware_attr_data = {
103 .attr = {.name = "data", .mode = 0644},
104 .size = 0,
105 .read = firmware_data_read,
106 .write = firmware_data_write,
107};
108static int fw_setup_class_device(struct class_device *class_dev,
109 const char *fw_name,
110 struct device *device)
111{
112 int retval;
113 struct firmware_priv *fw_priv;
114
115 fw_priv = kzalloc(sizeof(struct firmware_priv), GFP_KERNEL);
116 if (!fw_priv) {
117 retval = -ENOMEM;
118 goto out;
119 }
120
121 memset(class_dev, 0, sizeof(*class_dev));
122
123 strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);
124 fw_priv->fw_id[FIRMWARE_NAME_MAX-1] = '\0';
125
126 strncpy(class_dev->class_id, device->bus_id, BUS_ID_SIZE);
127 class_dev->class_id[BUS_ID_SIZE-1] = '\0';
128 class_dev->dev = device;
129
130 class_dev->class = &firmware_class,
131 class_set_devdata(class_dev, fw_priv);
132 retval = class_device_register(class_dev);
133 if (retval){
134 printk(KERN_ERR "%s: class_device_register failed\n",
135 __FUNCTION__);
136 goto error_free_fw_priv;
137 }
138
139 retval = sysfs_create_bin_file(&class_dev->kobj, &firmware_attr_data);
140 if (retval){
141 printk(KERN_ERR "%s: sysfs_create_bin_file failed\n",
142 __FUNCTION__);
143 goto error_unreg_class_dev;
144 }
145
146 retval = class_device_create_file(class_dev,
147 &class_device_attr_loading);
148 if (retval){
149 printk(KERN_ERR "%s: class_device_create_file failed\n",
150 __FUNCTION__);
151 goto error_remove_data;
152 }
153
154 goto out;
155
156error_remove_data:
157 sysfs_remove_bin_file(&class_dev->kobj, &firmware_attr_data);
158error_unreg_class_dev:
159 class_device_unregister(class_dev);
160error_free_fw_priv:
161 kfree(fw_priv);
162out:
163 return retval;
164}
165static void fw_remove_class_device(struct class_device *class_dev)
166{
167 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
168
169 class_device_remove_file(class_dev, &class_device_attr_loading);
170 sysfs_remove_bin_file(&class_dev->kobj, &firmware_attr_data);
171 class_device_unregister(class_dev);
172}
173
174static struct class_device *class_dev;
175
176static struct device my_device = {
177 .bus_id = "my_dev0",
178};
179
180static int __init firmware_sample_init(void)
181{
182 int error;
183
184 device_initialize(&my_device);
185 class_dev = kmalloc(sizeof(struct class_device), GFP_KERNEL);
186 if(!class_dev)
187 return -ENOMEM;
188
189 error = fw_setup_class_device(class_dev, "my_firmware_image",
190 &my_device);
191 if(error){
192 kfree(class_dev);
193 return error;
194 }
195 return 0;
196
197}
198static void __exit firmware_sample_exit(void)
199{
200 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
201 fw_remove_class_device(class_dev);
202 kfree(fw_priv);
203 kfree(class_dev);
204}
205module_init(firmware_sample_init);
206module_exit(firmware_sample_exit);
207
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt
index 461e4f1dbec4..421e7d00ffd0 100644
--- a/Documentation/power/devices.txt
+++ b/Documentation/power/devices.txt
@@ -196,6 +196,11 @@ its parent; and can't be removed or suspended after that parent.
196 196
197The policy is that the device tree should match hardware bus topology. 197The policy is that the device tree should match hardware bus topology.
198(Or at least the control bus, for devices which use multiple busses.) 198(Or at least the control bus, for devices which use multiple busses.)
199In particular, this means that a device registration may fail if the parent of
200the device is suspending (ie. has been chosen by the PM core as the next
201device to suspend) or has already suspended, as well as after all of the other
202devices have been suspended. Device drivers must be prepared to cope with such
203situations.
199 204
200 205
201Suspending Devices 206Suspending Devices