Skip to content

Commit

Permalink
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/gregkh/driver-core-2.6

* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (44 commits)
  debugfs: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  sysfs: remove "last sysfs file:" line from the oops messages
  drivers/base/memory.c: fix warning due to "memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION"
  memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION
  SYSFS: Fix erroneous comments for sysfs_update_group().
  driver core: remove the driver-model structures from the documentation
  driver core: Add the device driver-model structures to kerneldoc
  Translated Documentation/email-clients.txt
  RAW driver: Remove call to kobject_put().
  reboot: disable usermodehelper to prevent fs access
  efivars: prevent oops on unload when efi is not enabled
  Allow setting of number of raw devices as a module parameter
  Introduce CONFIG_GOOGLE_FIRMWARE
  driver: Google Memory Console
  driver: Google EFI SMI
  x86: Better comments for get_bios_ebda()
  x86: get_bios_ebda_length()
  misc: fix ti-st build issues
  params.c: Use new strtobool function to process boolean inputs
  debugfs: move to new strtobool
  ...

Fix up trivial conflicts in fs/debugfs/file.c due to the same patch
being applied twice, and an unrelated cleanup nearby.
  • Loading branch information
Linus Torvalds committed May 20, 2011
2 parents 1477fcc + c42d223 commit 39ab05c
Show file tree
Hide file tree
Showing 45 changed files with 1,847 additions and 365 deletions.
18 changes: 9 additions & 9 deletions Documentation/ABI/testing/sysfs-firmware-dmi
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ Description:

DMI is structured as a large table of entries, where
each entry has a common header indicating the type and
length of the entry, as well as 'handle' that is
supposed to be unique amongst all entries.
length of the entry, as well as a firmware-provided
'handle' that is supposed to be unique amongst all
entries.

Some entries are required by the specification, but many
others are optional. In general though, users should
never expect to find a specific entry type on their
system unless they know for certain what their firmware
is doing. Machine to machine will vary.
is doing. Machine to machine experiences will vary.

Multiple entries of the same type are allowed. In order
to handle these duplicate entry types, each entry is
Expand Down Expand Up @@ -67,25 +68,24 @@ Description:
and the two terminating nul characters.
type : The type of the entry. This value is the same
as found in the directory name. It indicates
how the rest of the entry should be
interpreted.
how the rest of the entry should be interpreted.
instance: The instance ordinal of the entry for the
given type. This value is the same as found
in the parent directory name.
position: The position of the entry within the entirety
of the entirety.
position: The ordinal position (zero-based) of the entry
within the entirety of the DMI entry table.

=== Entry Specialization ===

Some entry types may have other information available in
sysfs.
sysfs. Not all types are specialized.

--- Type 15 - System Event Log ---

This entry allows the firmware to export a log of
events the system has taken. This information is
typically backed by nvram, but the implementation
details are abstracted by this table. This entries data
details are abstracted by this table. This entry's data
is exported in the directory:

/sys/firmware/dmi/entries/15-0/system_event_log
Expand Down
58 changes: 58 additions & 0 deletions Documentation/ABI/testing/sysfs-firmware-gsmi
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
What: /sys/firmware/gsmi
Date: March 2011
Contact: Mike Waychison <mikew@google.com>
Description:
Some servers used internally at Google have firmware
that provides callback functionality via explicit SMI
triggers. Some of the callbacks are similar to those
provided by the EFI runtime services page, but due to
historical reasons this different entry-point has been
used.

The gsmi driver implements the kernel's abstraction for
these firmware callbacks. Currently, this functionality
is limited to handling the system event log and getting
access to EFI-style variables stored in nvram.

Layout:

/sys/firmware/gsmi/vars:

This directory has the same layout (and
underlying implementation as /sys/firmware/efi/vars.
See Documentation/ABI/*/sysfs-firmware-efi-vars
for more information on how to interact with
this structure.

/sys/firmware/gsmi/append_to_eventlog - write-only:

This file takes a binary blob and passes it onto
the firmware to be timestamped and appended to
the system eventlog. The binary format is
interpreted by the firmware and may change from
platform to platform. The only kernel-enforced
requirement is that the blob be prefixed with a
32bit host-endian type used as part of the
firmware call.

/sys/firmware/gsmi/clear_config - write-only:

Writing any value to this file will cause the
entire firmware configuration to be reset to
"factory defaults". Callers should assume that
a reboot is required for the configuration to be
cleared.

/sys/firmware/gsmi/clear_eventlog - write-only:

This file is used to clear out a portion/the
whole of the system event log. Values written
should be values between 1 and 100 inclusive (in
ASCII) representing the fraction of the log to
clear. Not all platforms support fractional
clearing though, and this writes to this file
will error out if the firmware doesn't like your
submitted fraction.

Callers should assume that a reboot is needed
for this operation to complete.
7 changes: 7 additions & 0 deletions Documentation/ABI/testing/sysfs-firmware-log
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
What: /sys/firmware/log
Date: February 2011
Contact: Mike Waychison <mikew@google.com>
Description:
The /sys/firmware/log is a binary file that represents a
read-only copy of the firmware's log if one is
available.
8 changes: 8 additions & 0 deletions Documentation/ABI/testing/sysfs-kernel-fscaps
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
What: /sys/kernel/fscaps
Date: February 2011
KernelVersion: 2.6.38
Contact: Ludwig Nussel <ludwig.nussel@suse.de>
Description
Shows whether file system capabilities are honored
when executing a binary

6 changes: 3 additions & 3 deletions Documentation/DocBook/device-drivers.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ X!Iinclude/linux/kobject.h

<chapter id="devdrivers">
<title>Device drivers infrastructure</title>
<sect1><title>The Basic Device Driver-Model Structures </title>
!Iinclude/linux/device.h
</sect1>
<sect1><title>Device Drivers Base</title>
<!--
X!Iinclude/linux/device.h
-->
!Edrivers/base/driver.c
!Edrivers/base/core.c
!Edrivers/base/class.c
Expand Down
19 changes: 1 addition & 18 deletions Documentation/driver-model/bus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,7 @@ Bus Types

Definition
~~~~~~~~~~

struct bus_type {
char * name;

struct subsystem subsys;
struct kset drivers;
struct kset devices;

struct bus_attribute * bus_attrs;
struct device_attribute * dev_attrs;
struct driver_attribute * drv_attrs;

int (*match)(struct device * dev, struct device_driver * drv);
int (*hotplug) (struct device *dev, char **envp,
int num_envp, char *buffer, int buffer_size);
int (*suspend)(struct device * dev, pm_message_t state);
int (*resume)(struct device * dev);
};
See the kerneldoc for the struct bus_type.

int bus_register(struct bus_type * bus);

Expand Down
17 changes: 1 addition & 16 deletions Documentation/driver-model/class.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,7 @@ The device class structure looks like:
typedef int (*devclass_add)(struct device *);
typedef void (*devclass_remove)(struct device *);

struct device_class {
char * name;
rwlock_t lock;
u32 devnum;
struct list_head node;

struct list_head drivers;
struct list_head intf_list;

struct driver_dir_entry dir;
struct driver_dir_entry device_dir;
struct driver_dir_entry driver_dir;

devclass_add add_device;
devclass_remove remove_device;
};
See the kerneldoc for the struct class.

A typical device class definition would look like:

Expand Down
91 changes: 1 addition & 90 deletions Documentation/driver-model/device.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,96 +2,7 @@
The Basic Device Structure
~~~~~~~~~~~~~~~~~~~~~~~~~~

struct device {
struct list_head g_list;
struct list_head node;
struct list_head bus_list;
struct list_head driver_list;
struct list_head intf_list;
struct list_head children;
struct device * parent;

char name[DEVICE_NAME_SIZE];
char bus_id[BUS_ID_SIZE];

spinlock_t lock;
atomic_t refcount;

struct bus_type * bus;
struct driver_dir_entry dir;

u32 class_num;

struct device_driver *driver;
void *driver_data;
void *platform_data;

u32 current_state;
unsigned char *saved_state;

void (*release)(struct device * dev);
};

Fields
~~~~~~
g_list: Node in the global device list.

node: Node in device's parent's children list.

bus_list: Node in device's bus's devices list.

driver_list: Node in device's driver's devices list.

intf_list: List of intf_data. There is one structure allocated for
each interface that the device supports.

children: List of child devices.

parent: *** FIXME ***

name: ASCII description of device.
Example: " 3Com Corporation 3c905 100BaseTX [Boomerang]"

bus_id: ASCII representation of device's bus position. This
field should be a name unique across all devices on the
bus type the device belongs to.

Example: PCI bus_ids are in the form of
<bus number>:<slot number>.<function number>
This name is unique across all PCI devices in the system.

lock: Spinlock for the device.

refcount: Reference count on the device.

bus: Pointer to struct bus_type that device belongs to.

dir: Device's sysfs directory.

class_num: Class-enumerated value of the device.

driver: Pointer to struct device_driver that controls the device.

driver_data: Driver-specific data.

platform_data: Platform data specific to the device.

Example: for devices on custom boards, as typical of embedded
and SOC based hardware, Linux often uses platform_data to point
to board-specific structures describing devices and how they
are wired. That can include what ports are available, chip
variants, which GPIO pins act in what additional roles, and so
on. This shrinks the "Board Support Packages" (BSPs) and
minimizes board-specific #ifdefs in drivers.

current_state: Current power state of the device.

saved_state: Pointer to saved state of the device. This is usable by
the device driver controlling the device.

release: Callback to free the device after all references have
gone away. This should be set by the allocator of the
device (i.e. the bus driver that discovered the device).
See the kerneldoc for the struct device.


Programming Interface
Expand Down
18 changes: 1 addition & 17 deletions Documentation/driver-model/driver.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@

Device Drivers

struct device_driver {
char * name;
struct bus_type * bus;

struct completion unloaded;
struct kobject kobj;
list_t devices;

struct module *owner;

int (*probe) (struct device * dev);
int (*remove) (struct device * dev);

int (*suspend) (struct device * dev, pm_message_t state);
int (*resume) (struct device * dev);
};

See the kerneldoc for the struct device_driver.


Allocation
Expand Down
Loading

0 comments on commit 39ab05c

Please sign in to comment.