Commit 39ab05c8 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'driver-core-next' of...

Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/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.
parents 1477fcc2 c42d2237
...@@ -14,14 +14,15 @@ Description: ...@@ -14,14 +14,15 @@ Description:
DMI is structured as a large table of entries, where DMI is structured as a large table of entries, where
each entry has a common header indicating the type and each entry has a common header indicating the type and
length of the entry, as well as 'handle' that is length of the entry, as well as a firmware-provided
supposed to be unique amongst all entries. 'handle' that is supposed to be unique amongst all
entries.
Some entries are required by the specification, but many Some entries are required by the specification, but many
others are optional. In general though, users should others are optional. In general though, users should
never expect to find a specific entry type on their never expect to find a specific entry type on their
system unless they know for certain what their firmware 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 Multiple entries of the same type are allowed. In order
to handle these duplicate entry types, each entry is to handle these duplicate entry types, each entry is
...@@ -67,25 +68,24 @@ Description: ...@@ -67,25 +68,24 @@ Description:
and the two terminating nul characters. and the two terminating nul characters.
type : The type of the entry. This value is the same type : The type of the entry. This value is the same
as found in the directory name. It indicates as found in the directory name. It indicates
how the rest of the entry should be how the rest of the entry should be interpreted.
interpreted.
instance: The instance ordinal of the entry for the instance: The instance ordinal of the entry for the
given type. This value is the same as found given type. This value is the same as found
in the parent directory name. in the parent directory name.
position: The position of the entry within the entirety position: The ordinal position (zero-based) of the entry
of the entirety. within the entirety of the DMI entry table.
=== Entry Specialization === === Entry Specialization ===
Some entry types may have other information available in Some entry types may have other information available in
sysfs. sysfs. Not all types are specialized.
--- Type 15 - System Event Log --- --- Type 15 - System Event Log ---
This entry allows the firmware to export a log of This entry allows the firmware to export a log of
events the system has taken. This information is events the system has taken. This information is
typically backed by nvram, but the implementation 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: is exported in the directory:
/sys/firmware/dmi/entries/15-0/system_event_log /sys/firmware/dmi/entries/15-0/system_event_log
......
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.
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.
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
...@@ -96,10 +96,10 @@ X!Iinclude/linux/kobject.h ...@@ -96,10 +96,10 @@ X!Iinclude/linux/kobject.h
<chapter id="devdrivers"> <chapter id="devdrivers">
<title>Device drivers infrastructure</title> <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> <sect1><title>Device Drivers Base</title>
<!--
X!Iinclude/linux/device.h
-->
!Edrivers/base/driver.c !Edrivers/base/driver.c
!Edrivers/base/core.c !Edrivers/base/core.c
!Edrivers/base/class.c !Edrivers/base/class.c
......
...@@ -3,24 +3,7 @@ Bus Types ...@@ -3,24 +3,7 @@ Bus Types
Definition Definition
~~~~~~~~~~ ~~~~~~~~~~
See the kerneldoc for the struct bus_type.
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);
};
int bus_register(struct bus_type * bus); int bus_register(struct bus_type * bus);
......
...@@ -27,22 +27,7 @@ The device class structure looks like: ...@@ -27,22 +27,7 @@ The device class structure looks like:
typedef int (*devclass_add)(struct device *); typedef int (*devclass_add)(struct device *);
typedef void (*devclass_remove)(struct device *); typedef void (*devclass_remove)(struct device *);
struct device_class { See the kerneldoc for the struct 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;
};
A typical device class definition would look like: A typical device class definition would look like:
......
...@@ -2,96 +2,7 @@ ...@@ -2,96 +2,7 @@
The Basic Device Structure The Basic Device Structure
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
struct device { See the kerneldoc for the 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).
Programming Interface Programming Interface
......
Device Drivers Device Drivers
struct device_driver { See the kerneldoc for the 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);
};
Allocation Allocation
......
...@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a ...@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a
fork. So if you have any comments or updates for this file, please try fork. So if you have any comments or updates for this file, please try
to update the original English file first. to update the original English file first.
Last Updated: 2008/10/24 Last Updated: 2011/03/31
================================== ==================================
これは、 これは、
linux-2.6.28/Documentation/HOWTO linux-2.6.38/Documentation/HOWTO
の和訳です。 の和訳です。
翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
翻訳日: 2008/10/24 翻訳日: 2011/3/28
翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
校正者: 松倉さん <nbh--mats at nifty dot com> 校正者: 松倉さん <nbh--mats at nifty dot com>
小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
...@@ -256,8 +256,8 @@ Linux カーネルの開発プロセスは現在幾つかの異なるメイン ...@@ -256,8 +256,8 @@ Linux カーネルの開発プロセスは現在幾つかの異なるメイン
- メインの 2.6.x カーネルツリー - メインの 2.6.x カーネルツリー
- 2.6.x.y -stable カーネルツリー - 2.6.x.y -stable カーネルツリー
- 2.6.x -git カーネルパッチ - 2.6.x -git カーネルパッチ
- 2.6.x -mm カーネルパッチ
- サブシステム毎のカーネルツリーとパッチ - サブシステム毎のカーネルツリーとパッチ
- 統合テストのための 2.6.x -next カーネルツリー
2.6.x カーネルツリー 2.6.x カーネルツリー
----------------- -----------------
...@@ -268,9 +268,9 @@ Linux カーネルの開発プロセスは現在幾つかの異なるメイン ...@@ -268,9 +268,9 @@ Linux カーネルの開発プロセスは現在幾つかの異なるメイン
- 新しいカーネルがリリースされた直後に、2週間の特別期間が設けられ、 - 新しいカーネルがリリースされた直後に、2週間の特別期間が設けられ、
この期間中に、メンテナ達は Linus に大きな差分を送ることができます。 この期間中に、メンテナ達は Linus に大きな差分を送ることができます。
このような差分は通常 -mm カーネルに数週間含まれてきたパッチです。 このような差分は通常 -next カーネルに数週間含まれてきたパッチです。
大きな変更は git(カーネルのソース管理ツール、詳細は 大きな変更は git(カーネルのソース管理ツール、詳細は
http://git.or.cz/ 参照) を使って送るのが好ましいやり方ですが、パッ http://git-scm.com/ 参照) を使って送るのが好ましいやり方ですが、パッ
チファイルの形式のまま送るのでも十分です。 チファイルの形式のまま送るのでも十分です。
- 2週間後、-rc1 カーネルがリリースされ、この後にはカーネル全体の安定 - 2週間後、-rc1 カーネルがリリースされ、この後にはカーネル全体の安定
...@@ -333,86 +333,44 @@ git リポジトリで管理されているLinus のカーネルツリーの毎 ...@@ -333,86 +333,44 @@ git リポジトリで管理されているLinus のカーネルツリーの毎
れは -rc カーネルと比べて、パッチが大丈夫かどうかも確認しないで自動的 れは -rc カーネルと比べて、パッチが大丈夫かどうかも確認しないで自動的
に生成されるので、より実験的です。 に生成されるので、より実験的です。
2.6.x -mm カーネルパッチ
------------------------
Andrew Morton によってリリースされる実験的なカーネルパッチ群です。
Andrew は個別のサブシステムカーネルツリーとパッチを全て集めてきて
linux-kernel メーリングリストで収集された多数のパッチと同時に一つにま
とめます。
このツリーは新機能とパッチが検証される場となります。ある期間の間パッチ
が -mm に入って価値を証明されたら、Andrew やサブシステムメンテナが、
メインラインへ入れるように Linus にプッシュします。
メインカーネルツリーに含めるために Linus に送る前に、すべての新しいパッ
チが -mm ツリーでテストされることが強く推奨されています。マージウィン
ドウが開く前に -mm ツリーに現れなかったパッチはメインラインにマージさ
れることは困難になります。
これらのカーネルは安定して動作すべきシステムとして使うのには適切ではあ
りませんし、カーネルブランチの中でももっとも動作にリスクが高いものです。
もしあなたが、カーネル開発プロセスの支援をしたいと思っているのであれば、
どうぞこれらのカーネルリリースをテストに使ってみて、そしてもし問題があ
れば、またもし全てが正しく動作したとしても、linux-kernel メーリングリ
ストにフィードバックを提供してください。
すべての他の実験的パッチに加えて、これらのカーネルは通常リリース時点で
メインラインの -git カーネルに含まれる全ての変更も含んでいます。
-mm カーネルは決まったスケジュールではリリースされません、しかし通常幾
つかの -mm カーネル (1 から 3 が普通)が各-rc カーネルの間にリリースさ
れます。
サブシステム毎のカーネルツリーとパッチ サブシステム毎のカーネルツリーとパッチ
------------------------------------------- -------------------------------------------
カーネルの様々な領域で何が起きているかを見られるようにするため、多くの それぞれのカーネルサブシステムのメンテナ達は --- そして多くのカーネル
カーネルサブシステム開発者は彼らの開発ツリーを公開しています。これらの サブシステムの開発者達も --- 各自の最新の開発状況をソースリポジトリに
ツリーは説明したように -mm カーネルリリースに入れ込まれます。 公開しています。そのため、自分とは異なる領域のカーネルで何が起きている
かを他の人が見られるようになっています。開発が早く進んでいる領域では、
以下はさまざまなカーネルツリーの中のいくつかのリスト- 開発者は自身の投稿がどのサブシステムカーネルツリーを元にしているか質問
されるので、その投稿とすでに進行中の他の作業との衝突が避けられます。
git ツリー-
- Kbuild の開発ツリー、Sam Ravnborg <sam@ravnborg.org> 大部分のこれらのリポジトリは git ツリーです。しかしその他の SCM や
git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git quilt シリーズとして公開されているパッチキューも使われています。これら
のサブシステムリポジトリのアドレスは MAINTAINERS ファイルにリストされ
- ACPI の開発ツリー、 Len Brown <len.brown@intel.com> ています。これらの多くは http://git.kernel.org/ で参照することができま
git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git す。
- Block の開発ツリー、Jens Axboe <axboe@suse.de>
git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
- DRM の開発ツリー、Dave Airlie <airlied@linux.ie>
git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
- ia64 の開発ツリー、Tony Luck <tony.luck@intel.com>
git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
- infiniband, Roland Dreier <rolandd@cisco.com>
git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
- libata, Jeff Garzik <jgarzik@pobox.com>
git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
- ネットワークドライバ, Jeff Garzik <jgarzik@pobox.com>
git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
- pcmcia, Dominik Brodowski <linux@dominikbrodowski.net>
git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
- SCSI, James Bottomley <James.Bottomley@hansenpartnership.com>
git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
- x86, Ingo Molnar <mingo@elte.hu>
git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
quilt ツリー-
- USB, ドライバコアと I2C, Greg Kroah-Hartman <gregkh@suse.de>
kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
その他のカーネルツリーは http://git.kernel.org/ と MAINTAINERS ファ 提案されたパッチがこのようなサブシステムツリーにコミットされる前に、メー
イルに一覧表があります。 リングリストで事前にレビューにかけられます(以下の対応するセクションを
参照)。いくつかのカーネルサブシステムでは、このレビューは patchwork
というツールによって追跡されます。Patchwork は web インターフェイスに
よってパッチ投稿の表示、パッチへのコメント付けや改訂などができ、そして
メンテナはパッチに対して、レビュー中、受付済み、拒否というようなマーク
をつけることができます。大部分のこれらの patchwork のサイトは
http://patchwork.kernel.org/ でリストされています。
統合テストのための 2.6.x -next カーネルツリー
---------------------------------------------
サブシステムツリーの更新内容がメインラインの 2.6.x ツリーにマージされ
る前に、それらは統合テストされる必要があります。この目的のため、実質的
に全サブシステムツリーからほぼ毎日プルされてできる特別なテスト用のリ
ポジトリが存在します-
http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git
http://linux.f-seidel.de/linux-next/pmwiki/
このやり方によって、-next カーネルは次のマージ機会でどんなものがメイン
ラインカーネルにマージされるか、おおまかなの展望を提供します。-next
カーネルの実行テストを行う冒険好きなテスターは大いに歓迎されます
バグレポート バグレポート
------------- -------------
...@@ -673,10 +631,9 @@ Linux カーネルコミュニティは、一度に大量のコードの塊を ...@@ -673,10 +631,9 @@ Linux カーネルコミュニティは、一度に大量のコードの塊を
じところからスタートしたのですから。 じところからスタートしたのですから。
Paolo Ciarrocchi に感謝、彼は彼の書いた "Development Process" Paolo Ciarrocchi に感謝、彼は彼の書いた "Development Process"
(http://linux.tar.bz/articles/2.6-development_process)セクショ (http://lwn.net/Articles/94386/) セクションをこのテキストの原型にする
ンをこのテキストの原型にすることを許可してくれました。 ことを許可してくれました。Rundy Dunlap と Gerrit Huizenga はメーリング
Rundy Dunlap と Gerrit Huizenga はメーリングリストでやるべきこととやっ リストでやるべきこととやってはいけないことのリストを提供してくれました。
てはいけないことのリストを提供してくれました。
以下の人々のレビュー、コメント、貢献に感謝。 以下の人々のレビュー、コメント、貢献に感謝。
Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers, Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers,
Vojtech Pavlik, Jan Kara, Josh Boyer, Kees Cook, Andrew Morton, Andi Vojtech Pavlik, Jan Kara, Josh Boyer, Kees Cook, Andrew Morton, Andi
......
锘?Chinese translated version of Documentation/email-clients.txt
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer: Harry Wei <harryxiyou@gmail.com>
---------------------------------------------------------------------
Documentation/email-clients.txt ???涓????缈昏??
濡??????宠??璁烘????存?版???????????瀹癸??璇风?存?ヨ??绯诲?????妗g??缁存?よ?????濡????浣?浣跨?ㄨ?辨??
浜ゆ???????伴?剧??璇?锛?涔????浠ュ??涓???????缁存?よ??姹???┿??濡???????缈昏????存?颁???????舵?????缈?
璇?瀛???ㄩ??棰?锛?璇疯??绯讳腑??????缁存?よ?????
涓???????缁存?よ??锛? 璐惧??濞? Harry Wei <harryxiyou@gmail.com>
涓???????缈昏?????锛? 璐惧??濞? Harry Wei <harryxiyou@gmail.com>
涓?????????¤?????锛? Yinglin Luan <synmyth@gmail.com>
Xiaochen Wang <wangxiaochen0@gmail.com>
yaxinsn <yaxinsn@163.com>
浠ヤ??涓烘?f??
---------------------------------------------------------------------
Linux???浠跺?㈡?风?????缃?淇℃??
======================================================================
?????????缃?
----------------------------------------------------------------------
Linux?????歌ˉ涓???????杩????浠惰?????浜ょ??锛????濂芥??琛ヤ??浣?涓洪??浠朵????????宓?????????????浜?缁存?よ??
??ユ?堕??浠讹??浣???????浠剁?????瀹规?煎??搴?璇ユ??"text/plain"?????惰??锛????浠朵????????涓?璧???????锛?
???涓鸿??浼?浣胯ˉ涓????寮???ㄩ?ㄥ????ㄨ??璁鸿??绋?涓???????寰???伴?俱??
??ㄦ?ュ?????Linux?????歌ˉ涓???????浠跺?㈡?风????ㄥ?????琛ヤ????跺??璇ュ??浜?????????????濮???舵?????渚?濡?锛?
浠?浠?涓???芥?瑰?????????????ゅ?惰〃绗???????绌烘?硷???????虫????ㄦ??涓?琛????寮?澶存?????缁?灏俱??
涓?瑕????杩?"format=flowed"妯″????????琛ヤ?????杩???蜂??寮?璧蜂?????棰????浠ュ?????瀹崇?????琛????
涓?瑕?璁╀????????浠跺?㈡?风??杩?琛??????ㄦ?㈣?????杩???蜂??浼???村??浣????琛ヤ?????
???浠跺?㈡?风??涓???芥?瑰???????????瀛?绗????缂??????瑰?????瑕??????????琛ヤ???????芥??ASCII??????UTF-8缂??????瑰??锛?
濡????浣?浣跨??UTF-8缂??????瑰???????????浠讹????d??浣?灏?浼???垮??涓?浜??????藉????????瀛?绗???????棰????
???浠跺?㈡?风??搴?璇ュ舰???骞朵??淇???? References: ?????? In-Reply-To: ???棰?锛???d??
???浠惰??棰?灏变??浼?涓???????
澶???剁??甯?(?????????璐寸??甯?)???甯镐????界?ㄤ??琛ヤ??锛????涓哄?惰〃绗?浼?杞????涓虹┖??笺??浣跨??xclipboard, xclip
??????xcutsel涔?璁稿??浠ワ??浣???????濂芥??璇?涓?涓?????????垮??浣跨?ㄥ????剁??甯????
涓?瑕???ㄤ娇???PGP/GPG缃插????????浠朵腑??????琛ヤ?????杩???蜂??浣垮??寰?澶???????涓???借?诲??????????ㄤ??浣????琛ヤ?????
锛?杩?涓????棰?搴?璇ユ?????浠ヤ慨澶????锛?
??ㄧ???????搁??浠跺??琛ㄥ?????琛ヤ??涔????锛?缁????宸卞?????涓?涓?琛ヤ?????涓?涓???????涓绘??锛?淇?瀛???ユ?跺?扮??
???浠讹??灏?琛ヤ?????'patch'??戒护???涓?锛?濡??????????浜?锛????缁??????搁??浠跺??琛ㄥ????????
涓?浜????浠跺?㈡?风?????绀?
----------------------------------------------------------------------
杩????缁???轰??浜?璇?缁????MUA???缃????绀猴?????浠ョ?ㄤ??缁?Linux?????稿?????琛ヤ?????杩?浜?骞朵???????虫??
?????????杞?浠跺?????缃???荤?????
璇存??锛?
TUI = 浠ユ?????涓哄?虹???????ㄦ?锋?ュ??
GUI = ??惧舰?????㈢?ㄦ?锋?ュ??
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Alpine (TUI)
???缃????椤癸??
???"Sending Preferences"??ㄥ??锛?
- "Do Not Send Flowed Text"蹇?椤诲?????
- "Strip Whitespace Before Sending"蹇?椤诲?抽??
褰???????浠舵?讹????????搴?璇ユ?惧?ㄨˉ涓?浼???虹?扮????版?癸????跺?????涓?CTRL-R缁???????锛?浣挎??瀹????
琛ヤ?????浠跺????ュ?伴??浠朵腑???
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Evolution (GUI)
涓?浜?寮????????????????浣跨?ㄥ????????琛ヤ??
褰??????╅??浠堕??椤癸??Preformat
浠?Format->Heading->Preformatted (Ctrl-7)??????宸ュ?锋??
??跺??浣跨??锛?
Insert->Text File... (Alt-n x)?????ヨˉ涓????浠躲??
浣?杩????浠?"diff -Nru old.c new.c | xclip"锛???????Preformat锛???跺??浣跨?ㄤ腑??撮??杩?琛?绮?甯????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kmail (GUI)
涓?浜?寮????????????????浣跨?ㄥ????????琛ヤ?????
榛?璁よ?剧疆涓?涓?HTML??煎??????????????锛?涓?瑕??????ㄥ?????
褰?涔????涓?灏????浠剁????跺??锛???ㄩ??椤逛?????涓?瑕??????╄????ㄦ?㈣????????涓????缂虹?瑰氨???浣???ㄩ??浠朵腑杈???ョ??浠讳????????
??戒??浼?琚??????ㄦ?㈣??锛????姝や??蹇?椤诲?ㄥ?????琛ヤ??涔?????????ㄦ?㈣????????绠?????????规??灏辨???????ㄨ????ㄦ?㈣????ヤ功??????浠讹??
??跺?????瀹?淇?瀛?涓鸿??绋裤??涓????浣???ㄨ??绋夸腑???娆℃??寮?瀹?锛?瀹?宸茬????ㄩ?ㄨ????ㄦ?㈣??浜?锛???d??浣???????浠惰?界?舵病???
?????╄????ㄦ?㈣??锛?浣????杩?涓?浼?澶卞?诲凡???????????ㄦ?㈣?????
??ㄩ??浠剁??搴????锛??????ヨˉ涓?涔????锛???句??甯哥?ㄧ??琛ヤ??瀹????绗?锛?涓?涓?杩?瀛????(---)???
??跺?????"Message"????????$??锛??????╂????ユ??浠讹????ョ????????浣????琛ヤ?????浠躲??杩????涓?涓?棰?澶???????椤癸??浣????浠?
???杩?瀹????缃?浣???????浠跺缓绔?宸ュ?锋????????锛?杩????浠ュ甫涓?"insert file"??炬?????
浣????浠ュ????ㄥ?伴??杩?GPG???璁伴??浠讹??浣???????宓?琛ヤ?????濂戒??瑕?浣跨??GPG???璁板??浠????浣?涓哄??宓??????????绛惧??琛ヤ??锛?
褰?浠?GPG涓???????7浣?缂??????朵??浣夸??浠?????????村??澶???????
濡????浣????瑕?浠ラ??浠剁??褰㈠????????琛ヤ??锛???d??灏卞?抽????瑰?婚??浠讹????跺?????涓?灞???э??绐????"Suggest automatic
display"锛?杩???峰??宓????浠舵?村?规??璁╄?昏???????般??
褰?浣?瑕?淇?瀛?灏?瑕?????????????宓???????琛ヤ??锛?浣????浠ヤ??娑???????琛ㄧ????奸????╁?????琛ヤ????????浠讹????跺????冲?婚?????
"save as"???浣????浠ヤ娇??ㄤ??涓?娌℃????存?圭????????琛ヤ????????浠讹??濡????瀹????浠ユ?g‘???褰㈠??缁???????褰?浣?姝g????ㄥ??
???宸辩??绐???d??涓?瀵????锛???f?舵病??????椤瑰??浠ヤ??瀛????浠?--宸茬?????涓?涓?杩???风??bug琚?姹???ュ?颁??kmail???bugzilla
骞朵??甯????杩?灏?浼?琚?澶??????????浠舵??浠ュ?????瀵规??涓???ㄦ?峰??璇诲???????????琚?淇?瀛????锛????浠ュ?????浣???虫?????浠跺????跺?板?朵????版?癸??
浣?涓?寰?涓????浠?浠????????????逛负缁?????????翠?????璇汇??
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lotus Notes (GUI)
涓?瑕?浣跨?ㄥ?????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mutt (TUI)
寰?澶?Linux寮????浜哄??浣跨??mutt瀹㈡?风??锛????浠ヨ?????瀹????瀹?宸ヤ????????甯告??浜????
Mutt涓????甯?缂?杈????锛????浠ヤ??绠′??浣跨?ㄤ??涔?缂?杈???ㄩ?戒??搴?璇ュ甫????????ㄦ??琛????澶у????扮??杈???ㄩ?藉甫???
涓?涓?"insert file"???椤癸??瀹????浠ラ??杩?涓???瑰?????浠跺??瀹圭????瑰???????ユ??浠躲??
'vim'浣?涓?mutt???缂?杈????锛?
set editor="vi"
濡????浣跨??xclip锛???插?ヤ互涓???戒护
:set paste
???涓????涔??????????shift-insert??????浣跨??
:r filename
濡??????宠?????琛ヤ??浣?涓哄??宓??????????
(a)ttach宸ヤ?????寰?濂斤??涓?甯????"set paste"???
???缃????椤癸??
瀹?搴?璇ヤ互榛?璁よ?剧疆???褰㈠??宸ヤ?????
??惰??锛????"send_charset"璁剧疆涓?"us-ascii::utf-8"涔????涓?涓?涓???????涓绘?????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pine (TUI)
Pine杩???绘??涓?浜?绌烘?煎????????棰?锛?浣????杩?浜???板?ㄥ??璇ラ?借??淇?澶?浜????
濡???????浠ワ??璇蜂娇???alpine(pine???缁ф?胯??)
???缃????椤癸??
- ???杩?????????????瑕?娑???ゆ??绋???????
- "no-strip-whitespace-before-send"???椤逛????????瑕???????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sylpheed (GUI)
- ???宓??????????浠ュ??濂界??宸ヤ??锛???????浣跨?ㄩ??浠讹?????
- ???璁镐娇??ㄥ????ㄧ??缂?杈???ㄣ??
- 瀵逛?????褰?杈?澶???堕??甯告?????
- 濡???????杩?non-SSL杩???ワ?????娉?浣跨??TLS SMTP?????????
- ??ㄧ?????绐???d腑???涓?涓?寰??????ㄧ??ruler bar???
- 缁???板?????涓?娣诲????板??灏变??浼?姝g‘???浜?瑙f?剧ず??????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thunderbird (GUI)
榛?璁ゆ????典??锛?thunderbird寰?瀹规??????????????锛?浣????杩????涓?浜???规?????浠ュ己??跺?????寰???村ソ???
- ??ㄧ?ㄦ?峰????疯?剧疆???锛?缁???????瀵诲??锛?涓?瑕???????"Compose messages in HTML format"???
- 缂?杈?浣????Thunderbird???缃?璁剧疆??ヤ娇瀹?涓?瑕????琛?浣跨??锛?user_pref("mailnews.wraplength", 0);
- 缂?杈?浣????Thunderbird???缃?璁剧疆锛?浣垮??涓?瑕?浣跨??"format=flowed"??煎??锛?user_pref("mailnews.
send_plaintext_flowed", false);
- 浣????瑕?浣?Thunderbird???涓洪???????煎????瑰??锛?
濡????榛?璁ゆ????典??浣?涔??????????HTML??煎??锛???d?????寰???俱??浠?浠?浠????棰???????涓????妗?涓???????"Preformat"??煎?????
濡????榛?璁ゆ????典??浣?涔??????????????????煎??锛?浣?涓?寰????瀹???逛负HTML??煎??锛?浠?浠?浣?涓轰??娆℃?х??锛???ヤ功?????扮??娑????锛?
??跺??寮哄?朵娇瀹??????版???????煎??锛???????瀹?灏变?????琛????瑕?瀹???板??锛???ㄥ??淇$????炬??涓?浣跨??shift?????ヤ娇瀹????涓?HTML
??煎??锛???跺?????棰???????涓????妗?涓???????"Preformat"??煎?????
- ???璁镐娇??ㄥ????ㄧ??缂?杈????锛?
???瀵?Thunderbird???琛ヤ?????绠?????????规??灏辨??浣跨?ㄤ??涓?"external editor"??╁??锛???跺??浣跨?ㄤ????????娆㈢??
$EDITOR??ヨ?诲???????????骞惰ˉ涓???版?????涓????瑕?瀹???板??锛????浠ヤ??杞藉苟涓?瀹?瑁?杩?涓???╁??锛???跺??娣诲??涓?涓?浣跨?ㄥ?????
??????View->Toolbars->Customize...??????褰?浣?涔????淇℃???????跺??浠?浠???瑰?诲??灏卞??浠ヤ?????
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TkRat (GUI)
???浠ヤ娇??ㄥ?????浣跨??"Insert file..."??????澶???ㄧ??缂?杈???ㄣ??
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gmail (Web GUI)
涓?瑕?浣跨?ㄥ????????琛ヤ?????
Gmail缃?椤靛?㈡?风???????ㄥ?版????惰〃绗?杞????涓虹┖??笺??
??界?跺?惰〃绗?杞????涓虹┖??奸??棰????浠ヨ??澶???ㄧ??杈???ㄨВ??筹???????跺??杩?浼?浣跨?ㄥ??杞???㈣?????姣?琛???????涓?78涓?瀛?绗????
???涓?涓????棰????Gmail杩?浼????浠讳??涓????ASCII???瀛?绗????淇℃????逛负base64缂???????瀹????涓?瑗垮????????娆ф床浜虹?????瀛????
###
...@@ -234,7 +234,6 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt ...@@ -234,7 +234,6 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n",
str, err, ++die_counter); str, err, ++die_counter);
sysfs_printk_last_file();
/* trap and error numbers are mostly meaningless on ARM */ /* trap and error numbers are mostly meaningless on ARM */
ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV); ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV);
......
...@@ -143,7 +143,6 @@ int die(const char *str, struct pt_regs *regs, long err) ...@@ -143,7 +143,6 @@ int die(const char *str, struct pt_regs *regs, long err)
#endif #endif
printk("%s\n", ppc_md.name ? ppc_md.name : ""); printk("%s\n", ppc_md.name ? ppc_md.name : "");
sysfs_printk_last_file();
if (notify_die(DIE_OOPS, str, regs, err, 255, if (notify_die(DIE_OOPS, str, regs, err, 255,
SIGSEGV) == NOTIFY_STOP) SIGSEGV) == NOTIFY_STOP)
return 1; return 1;
......
...@@ -87,7 +87,6 @@ void die(const char * str, struct pt_regs * regs, long err) ...@@ -87,7 +87,6 @@ void die(const char * str, struct pt_regs * regs, long err)
bust_spinlocks(1); bust_spinlocks(1);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
sysfs_printk_last_file();
print_modules(); print_modules();
show_regs(regs); show_regs(regs);
......
...@@ -192,7 +192,6 @@ static int __die(const char *str, int err, struct thread_info *thread, ...@@ -192,7 +192,6 @@ static int __die(const char *str, int err, struct thread_info *thread,
printk(KERN_EMERG "Internal error: %s: %x [#%d]\n", printk(KERN_EMERG "Internal error: %s: %x [#%d]\n",
str, err, ++die_counter); str, err, ++die_counter);
sysfs_printk_last_file();
/* trap and error numbers are mostly meaningless on UniCore */ /* trap and error numbers are mostly meaningless on UniCore */
ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, \ ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, \
......
...@@ -4,16 +4,40 @@ ...@@ -4,16 +4,40 @@
#include <asm/io.h> #include <asm/io.h>
/* /*
* there is a real-mode segmented pointer pointing to the * Returns physical address of EBDA. Returns 0 if there is no EBDA.
* 4K EBDA area at 0x40E.
*/ */
static inline unsigned int get_bios_ebda(void) static inline unsigned int get_bios_ebda(void)
{ {
/*
* There is a real-mode segmented pointer pointing to the
* 4K EBDA area at 0x40E.
*/
unsigned int address = *(unsigned short *)phys_to_virt(0x40E); unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
address <<= 4; address <<= 4;
return address; /* 0 means none */ return address; /* 0 means none */
} }
/*
* Return the sanitized length of the EBDA in bytes, if it exists.
*/
static inline unsigned int get_bios_ebda_length(void)
{
unsigned int address;
unsigned int length;
address = get_bios_ebda();
if (!address)
return 0;
/* EBDA length is byte 0 of the EBDA (stored in KiB) */
length = *(unsigned char *)phys_to_virt(address);
length <<= 10;
/* Trim the length if it extends beyond 640KiB */
length = min_t(unsigned int, (640 * 1024) - address, length);
return length;
}
void reserve_ebda_region(void); void reserve_ebda_region(void);
#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION #ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
......
...@@ -263,7 +263,6 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) ...@@ -263,7 +263,6 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
printk("DEBUG_PAGEALLOC"); printk("DEBUG_PAGEALLOC");
#endif #endif
printk("\n"); printk("\n");
sysfs_printk_last_file();
if (notify_die(DIE_OOPS, str, regs, err, if (notify_die(DIE_OOPS, str, regs, err,
current->thread.trap_no, SIGSEGV) == NOTIFY_STOP) current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
return 1; return 1;
......
...@@ -400,7 +400,7 @@ static void device_remove_groups(struct device *dev, ...@@ -400,7 +400,7 @@ static void device_remove_groups(struct device *dev,
static int device_add_attrs(struct device *dev) static int device_add_attrs(struct device *dev)
{ {
struct class *class = dev->class; struct class *class = dev->class;
struct device_type *type = dev->type; const struct device_type *type = dev->type;
int error; int error;
if (class) { if (class) {
...@@ -440,7 +440,7 @@ static int device_add_attrs(struct device *dev) ...@@ -440,7 +440,7 @@ static int device_add_attrs(struct device *dev)
static void device_remove_attrs(struct device *dev) static void device_remove_attrs(struct device *dev)
{ {
struct class *class = dev->class; struct class *class = dev->class;
struct device_type *type = dev->type; const struct device_type *type = dev->type;
device_remove_groups(dev, dev->groups); device_remove_groups(dev, dev->groups);
...@@ -1314,8 +1314,7 @@ EXPORT_SYMBOL_GPL(put_device); ...@@ -1314,8 +1314,7 @@ EXPORT_SYMBOL_GPL(put_device);
EXPORT_SYMBOL_GPL(device_create_file); EXPORT_SYMBOL_GPL(device_create_file);
EXPORT_SYMBOL_GPL(device_remove_file); EXPORT_SYMBOL_GPL(device_remove_file);
struct root_device struct root_device {
{
struct device dev; struct device dev;
struct module *owner; struct module *owner;
}; };
......
...@@ -245,6 +245,10 @@ int device_attach(struct device *dev) ...@@ -245,6 +245,10 @@ int device_attach(struct device *dev)
device_lock(dev); device_lock(dev);
if (dev->driver) { if (dev->driver) {
if (klist_node_attached(&dev->p->knode_driver)) {
ret = 1;
goto out_unlock;
}
ret = device_bind_driver(dev); ret = device_bind_driver(dev);
if (ret == 0) if (ret == 0)
ret = 1; ret = 1;
...@@ -257,6 +261,7 @@ int device_attach(struct device *dev) ...@@ -257,6 +261,7 @@ int device_attach(struct device *dev)
ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
} }
out_unlock:
device_unlock(dev); device_unlock(dev);
return ret; return ret;
} }
...@@ -408,17 +413,16 @@ void *dev_get_drvdata(const struct device *dev) ...@@ -408,17 +413,16 @@ void *dev_get_drvdata(const struct device *dev)
} }
EXPORT_SYMBOL(dev_get_drvdata); EXPORT_SYMBOL(dev_get_drvdata);
void dev_set_drvdata(struct device *dev, void *data) int dev_set_drvdata(struct device *dev, void *data)
{ {
int error; int error;
if (!dev)
return;
if (!dev->p) { if (!dev->p) {
error = device_private_init(dev); error = device_private_init(dev);
if (error) if (error)
return; return error;
} }
dev->p->driver_data = data; dev->p->driver_data = data;
return 0;
} }
EXPORT_SYMBOL(dev_set_drvdata); EXPORT_SYMBOL(dev_set_drvdata);
...@@ -48,7 +48,8 @@ static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj) ...@@ -48,7 +48,8 @@ static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
return MEMORY_CLASS_NAME; return MEMORY_CLASS_NAME;
} }
static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uevent_env *env) static int memory_uevent(struct kset *kset, struct kobject *obj,
struct kobj_uevent_env *env)
{ {
int retval = 0; int retval = 0;
...@@ -228,10 +229,11 @@ int memory_isolate_notify(unsigned long val, void *v) ...@@ -228,10 +229,11 @@ int memory_isolate_notify(unsigned long val, void *v)
* OK to have direct references to sparsemem variables in here. * OK to have direct references to sparsemem variables in here.
*/ */
static int static int
memory_section_action(unsigned long phys_index, unsigned long action) memory_block_action(unsigned long phys_index, unsigned long action)
{ {
int i; int i;
unsigned long start_pfn, start_paddr; unsigned long start_pfn, start_paddr;
unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
struct page *first_page; struct page *first_page;
int ret; int ret;
...@@ -243,7 +245,7 @@ memory_section_action(unsigned long phys_index, unsigned long action) ...@@ -243,7 +245,7 @@ memory_section_action(unsigned long phys_index, unsigned long action)
* that way. * that way.
*/ */
if (action == MEM_ONLINE) { if (action == MEM_ONLINE) {
for (i = 0; i < PAGES_PER_SECTION; i++) { for (i = 0; i < nr_pages; i++) {
if (PageReserved(first_page+i)) if (PageReserved(first_page+i))
continue; continue;
...@@ -257,12 +259,12 @@ memory_section_action(unsigned long phys_index, unsigned long action) ...@@ -257,12 +259,12 @@ memory_section_action(unsigned long phys_index, unsigned long action)
switch (action) { switch (action) {
case MEM_ONLINE: case MEM_ONLINE:
start_pfn = page_to_pfn(first_page); start_pfn = page_to_pfn(first_page);
ret = online_pages(start_pfn, PAGES_PER_SECTION); ret = online_pages(start_pfn, nr_pages);
break; break;
case MEM_OFFLINE: case MEM_OFFLINE:
start_paddr = page_to_pfn(first_page) << PAGE_SHIFT; start_paddr = page_to_pfn(first_page) << PAGE_SHIFT;
ret = remove_memory(start_paddr, ret = remove_memory(start_paddr,
PAGES_PER_SECTION << PAGE_SHIFT); nr_pages << PAGE_SHIFT);
break; break;
default: default:
WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: " WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
...@@ -276,7 +278,7 @@ memory_section_action(unsigned long phys_index, unsigned long action) ...@@ -276,7 +278,7 @@ memory_section_action(unsigned long phys_index, unsigned long action)
static int memory_block_change_state(struct memory_block *mem, static int memory_block_change_state(struct memory_block *mem,
unsigned long to_state, unsigned long from_state_req) unsigned long to_state, unsigned long from_state_req)
{ {
int i, ret = 0; int ret = 0;
mutex_lock(&mem->state_mutex); mutex_lock(&mem->state_mutex);
...@@ -288,20 +290,11 @@ static int memory_block_change_state(struct memory_block *mem, ...@@ -288,20 +290,11 @@ static int memory_block_change_state(struct memory_block *mem,
if (to_state == MEM_OFFLINE) if (to_state == MEM_OFFLINE)
mem->state = MEM_GOING_OFFLINE; mem->state = MEM_GOING_OFFLINE;
for (i = 0; i < sections_per_block; i++) { ret = memory_block_action(mem->start_section_nr, to_state);
ret = memory_section_action(mem->start_section_nr + i,
to_state);
if (ret)
break;
}
if (ret) {
for (i = 0; i < sections_per_block; i++)
memory_section_action(mem->start_section_nr + i,
from_state_req);
if (ret)
mem->state = from_state_req; mem->state = from_state_req;
} else else
mem->state = to_state; mem->state = to_state;
out: out:
......
...@@ -192,18 +192,18 @@ EXPORT_SYMBOL_GPL(platform_device_alloc); ...@@ -192,18 +192,18 @@ EXPORT_SYMBOL_GPL(platform_device_alloc);
int platform_device_add_resources(struct platform_device *pdev, int platform_device_add_resources(struct platform_device *pdev,
const struct resource *res, unsigned int num) const struct resource *res, unsigned int num)
{ {
struct resource *r; struct resource *r = NULL;
if (!res) if (res) {
return 0; r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL);
if (!r)
r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL); return -ENOMEM;
if (r) {
pdev->resource = r;
pdev->num_resources = num;
return 0;
} }
return -ENOMEM;
kfree(pdev->resource);
pdev->resource = r;
pdev->num_resources = num;
return 0;
} }
EXPORT_SYMBOL_GPL(platform_device_add_resources); EXPORT_SYMBOL_GPL(platform_device_add_resources);
...@@ -220,17 +220,17 @@ EXPORT_SYMBOL_GPL(platform_device_add_resources); ...@@ -220,17 +220,17 @@ EXPORT_SYMBOL_GPL(platform_device_add_resources);
int platform_device_add_data(struct platform_device *pdev, const void *data, int platform_device_add_data(struct platform_device *pdev, const void *data,
size_t size) size_t size)
{ {
void *d; void *d = NULL;
if (!data) if (data) {
return 0; d = kmemdup(data, size, GFP_KERNEL);
if (!d)
d = kmemdup(data, size, GFP_KERNEL); return -ENOMEM;
if (d) {
pdev->dev.platform_data = d;
return 0;
} }
return -ENOMEM;
kfree(pdev->dev.platform_data);
pdev->dev.platform_data = d;
return 0;
} }
EXPORT_SYMBOL_GPL(platform_device_add_data); EXPORT_SYMBOL_GPL(platform_device_add_data);
......
...@@ -523,7 +523,7 @@ config RAW_DRIVER ...@@ -523,7 +523,7 @@ config RAW_DRIVER
with the O_DIRECT flag. with the O_DIRECT flag.
config MAX_RAW_DEVS config MAX_RAW_DEVS
int "Maximum number of RAW devices to support (1-8192)" int "Maximum number of RAW devices to support (1-65536)"
depends on RAW_DRIVER depends on RAW_DRIVER
default "256" default "256"
help help
......
...@@ -806,29 +806,41 @@ static const struct file_operations oldmem_fops = { ...@@ -806,29 +806,41 @@ static const struct file_operations oldmem_fops = {
}; };
#endif #endif
static ssize_t kmsg_write(struct file *file, const char __user *buf, static ssize_t kmsg_writev(struct kiocb *iocb, const struct iovec *iv,
size_t count, loff_t *ppos) unsigned long count, loff_t pos)
{ {
char *tmp; char *line, *p;
ssize_t ret; int i;
ssize_t ret = -EFAULT;
size_t len = iov_length(iv, count);
tmp = kmalloc(count + 1, GFP_KERNEL); line = kmalloc(len + 1, GFP_KERNEL);
if (tmp == NULL) if (line == NULL)
return -ENOMEM; return -ENOMEM;
ret = -EFAULT;
if (!copy_from_user(tmp, buf, count)) { /*
tmp[count] = 0; * copy all vectors into a single string, to ensure we do
ret = printk("%s", tmp); * not interleave our log line with other printk calls
if (ret > count) */
/* printk can add a prefix */ p = line;
ret = count; for (i = 0; i < count; i++) {
if (copy_from_user(p, iv[i].iov_base, iv[i].iov_len))
goto out;
p += iv[i].iov_len;
} }
kfree(tmp); p[0] = '\0';
ret = printk("%s", line);
/* printk can add a prefix */
if (ret > len)
ret = len;
out:
kfree(line);
return ret; return ret;
} }
static const struct file_operations kmsg_fops = { static const struct file_operations kmsg_fops = {
.write = kmsg_write, .aio_write = kmsg_writev,
.llseek = noop_llseek, .llseek = noop_llseek,
}; };
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/vmalloc.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -30,10 +31,15 @@ struct raw_device_data { ...@@ -30,10 +31,15 @@ struct raw_device_data {
}; };
static struct class *raw_class; static struct class *raw_class;
static struct raw_device_data raw_devices[MAX_RAW_MINORS]; static struct raw_device_data *raw_devices;
static DEFINE_MUTEX(raw_mutex); static DEFINE_MUTEX(raw_mutex);
static const struct file_operations raw_ctl_fops; /* forward declaration */ static const struct file_operations raw_ctl_fops; /* forward declaration */
static int max_raw_minors = MAX_RAW_MINORS;
module_param(max_raw_minors, int, 0);
MODULE_PARM_DESC(max_raw_minors, "Maximum number of raw devices (1-65536)");
/* /*
* Open/close code for raw IO. * Open/close code for raw IO.
* *
...@@ -125,7 +131,7 @@ static int bind_set(int number, u64 major, u64 minor) ...@@ -125,7 +131,7 @@ static int bind_set(int number, u64 major, u64 minor)
struct raw_device_data *rawdev; struct raw_device_data *rawdev;
int err = 0; int err = 0;
if (number <= 0 || number >= MAX_RAW_MINORS) if (number <= 0 || number >= max_raw_minors)
return -EINVAL; return -EINVAL;
if (MAJOR(dev) != major || MINOR(dev) != minor) if (MAJOR(dev) != major || MINOR(dev) != minor)
...@@ -312,14 +318,27 @@ static int __init raw_init(void) ...@@ -312,14 +318,27 @@ static int __init raw_init(void)
dev_t dev = MKDEV(RAW_MAJOR, 0); dev_t dev = MKDEV(RAW_MAJOR, 0);
int ret; int ret;
ret = register_chrdev_region(dev, MAX_RAW_MINORS, "raw"); if (max_raw_minors < 1 || max_raw_minors > 65536) {
printk(KERN_WARNING "raw: invalid max_raw_minors (must be"
" between 1 and 65536), using %d\n", MAX_RAW_MINORS);
max_raw_minors = MAX_RAW_MINORS;
}
raw_devices = vmalloc(sizeof(struct raw_device_data) * max_raw_minors);
if (!raw_devices) {
printk(KERN_ERR "Not enough memory for raw device structures\n");
ret = -ENOMEM;
goto error;
}
memset(raw_devices, 0, sizeof(struct raw_device_data) * max_raw_minors);
ret = register_chrdev_region(dev, max_raw_minors, "raw");
if (ret) if (ret)
goto error; goto error;
cdev_init(&raw_cdev, &raw_fops); cdev_init(&raw_cdev, &raw_fops);
ret = cdev_add(&raw_cdev, dev, MAX_RAW_MINORS); ret = cdev_add(&raw_cdev, dev, max_raw_minors);
if (ret) { if (ret) {
kobject_put(&raw_cdev.kobj);
goto error_region; goto error_region;
} }
...@@ -336,8 +355,9 @@ static int __init raw_init(void) ...@@ -336,8 +355,9 @@ static int __init raw_init(void)
return 0; return 0;
error_region: error_region:
unregister_chrdev_region(dev, MAX_RAW_MINORS); unregister_chrdev_region(dev, max_raw_minors);
error: error:
vfree(raw_devices);
return ret; return ret;
} }
...@@ -346,7 +366,7 @@ static void __exit raw_exit(void) ...@@ -346,7 +366,7 @@ static void __exit raw_exit(void)
device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); device_destroy(raw_class, MKDEV(RAW_MAJOR, 0));
class_destroy(raw_class); class_destroy(raw_class);
cdev_del(&raw_cdev); cdev_del(&raw_cdev);
unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS); unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), max_raw_minors);
} }
module_init(raw_init); module_init(raw_init);
......
...@@ -157,4 +157,6 @@ config SIGMA ...@@ -157,4 +157,6 @@ config SIGMA
If unsure, say N here. Drivers that need these helpers will select If unsure, say N here. Drivers that need these helpers will select
this option automatically. this option automatically.
source "drivers/firmware/google/Kconfig"
endmenu endmenu
...@@ -13,3 +13,5 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o ...@@ -13,3 +13,5 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o
obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o
obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
obj-$(CONFIG_SIGMA) += sigma.o obj-$(CONFIG_SIGMA) += sigma.o
obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
...@@ -677,8 +677,8 @@ create_efivars_bin_attributes(struct efivars *efivars) ...@@ -677,8 +677,8 @@ create_efivars_bin_attributes(struct efivars *efivars)
return 0; return 0;
out_free: out_free:
kfree(efivars->new_var); kfree(efivars->del_var);
efivars->new_var = NULL; efivars->del_var = NULL;
kfree(efivars->new_var); kfree(efivars->new_var);
efivars->new_var = NULL; efivars->new_var = NULL;
return error; return error;
...@@ -803,6 +803,8 @@ efivars_init(void) ...@@ -803,6 +803,8 @@ efivars_init(void)
ops.set_variable = efi.set_variable; ops.set_variable = efi.set_variable;
ops.get_next_variable = efi.get_next_variable; ops.get_next_variable = efi.get_next_variable;
error = register_efivars(&__efivars, &ops, efi_kobj); error = register_efivars(&__efivars, &ops, efi_kobj);
if (error)
goto err_put;
/* Don't forget the systab entry */ /* Don't forget the systab entry */
error = sysfs_create_group(efi_kobj, &efi_subsys_attr_group); error = sysfs_create_group(efi_kobj, &efi_subsys_attr_group);
...@@ -810,18 +812,25 @@ efivars_init(void) ...@@ -810,18 +812,25 @@ efivars_init(void)
printk(KERN_ERR printk(KERN_ERR
"efivars: Sysfs attribute export failed with error %d.\n", "efivars: Sysfs attribute export failed with error %d.\n",
error); error);
unregister_efivars(&__efivars); goto err_unregister;
kobject_put(efi_kobj);
} }
return 0;
err_unregister:
unregister_efivars(&__efivars);
err_put:
kobject_put(efi_kobj);
return error; return error;
} }
static void __exit static void __exit
efivars_exit(void) efivars_exit(void)
{ {
unregister_efivars(&__efivars); if (efi_enabled) {
kobject_put(efi_kobj); unregister_efivars(&__efivars);
kobject_put(efi_kobj);
}
} }
module_init(efivars_init); module_init(efivars_init);
......
config GOOGLE_FIRMWARE
bool "Google Firmware Drivers"
depends on X86
default n
help
These firmware drivers are used by Google's servers. They are
only useful if you are working directly on one of their
proprietary servers. If in doubt, say "N".
menu "Google Firmware Drivers"
depends on GOOGLE_FIRMWARE
config GOOGLE_SMI
tristate "SMI interface for Google platforms"
depends on ACPI && DMI
select EFI_VARS
help
Say Y here if you want to enable SMI callbacks for Google
platforms. This provides an interface for writing to and
clearing the EFI event log and reading and writing NVRAM
variables.
config GOOGLE_MEMCONSOLE
tristate "Firmware Memory Console"
depends on DMI
help
This option enables the kernel to search for a firmware log in
the EBDA on Google servers. If found, this log is exported to
userland in the file /sys/firmware/log.
endmenu
obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
/*
* Copyright 2010 Google Inc. All Rights Reserved.
* Author: dlaurie@google.com (Duncan Laurie)
*
* Re-worked to expose sysfs APIs by mikew@google.com (Mike Waychison)
*
* EFI SMI interface for Google platforms
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/spinlock.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/ioctl.h>
#include <linux/acpi.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <linux/dmi.h>
#include <linux/kdebug.h>
#include <linux/reboot.h>
#include <linux/efi.h>
#define GSMI_SHUTDOWN_CLEAN 0 /* Clean Shutdown */
/* TODO(mikew@google.com): Tie in HARDLOCKUP_DETECTOR with NMIWDT */
#define GSMI_SHUTDOWN_NMIWDT 1 /* NMI Watchdog */
#define GSMI_SHUTDOWN_PANIC 2 /* Panic */
#define GSMI_SHUTDOWN_OOPS 3 /* Oops */
#define GSMI_SHUTDOWN_DIE 4 /* Die -- No longer meaningful */
#define GSMI_SHUTDOWN_MCE 5 /* Machine Check */
#define GSMI_SHUTDOWN_SOFTWDT 6 /* Software Watchdog */
#define GSMI_SHUTDOWN_MBE 7 /* Uncorrected ECC */
#define GSMI_SHUTDOWN_TRIPLE 8 /* Triple Fault */
#define DRIVER_VERSION "1.0"
#define GSMI_GUID_SIZE 16
#define GSMI_BUF_SIZE 1024
#define GSMI_BUF_ALIGN sizeof(u64)
#define GSMI_CALLBACK 0xef
/* SMI return codes */
#define GSMI_SUCCESS 0x00
#define GSMI_UNSUPPORTED2 0x03
#define GSMI_LOG_FULL 0x0b
#define GSMI_VAR_NOT_FOUND 0x0e
#define GSMI_HANDSHAKE_SPIN 0x7d
#define GSMI_HANDSHAKE_CF 0x7e
#define GSMI_HANDSHAKE_NONE 0x7f
#define GSMI_INVALID_PARAMETER 0x82
#define GSMI_UNSUPPORTED 0x83
#define GSMI_BUFFER_TOO_SMALL 0x85
#define GSMI_NOT_READY 0x86
#define GSMI_DEVICE_ERROR 0x87
#define GSMI_NOT_FOUND 0x8e
#define QUIRKY_BOARD_HASH 0x78a30a50
/* Internally used commands passed to the firmware */
#define GSMI_CMD_GET_NVRAM_VAR 0x01
#define GSMI_CMD_GET_NEXT_VAR 0x02
#define GSMI_CMD_SET_NVRAM_VAR 0x03
#define GSMI_CMD_SET_EVENT_LOG 0x08
#define GSMI_CMD_CLEAR_EVENT_LOG 0x09
#define GSMI_CMD_CLEAR_CONFIG 0x20
#define GSMI_CMD_HANDSHAKE_TYPE 0xC1
/* Magic entry type for kernel events */
#define GSMI_LOG_ENTRY_TYPE_KERNEL 0xDEAD
/* SMI buffers must be in 32bit physical address space */
struct gsmi_buf {
u8 *start; /* start of buffer */
size_t length; /* length of buffer */
dma_addr_t handle; /* dma allocation handle */
u32 address; /* physical address of buffer */
};
struct gsmi_device {
struct platform_device *pdev; /* platform device */
struct gsmi_buf *name_buf; /* variable name buffer */
struct gsmi_buf *data_buf; /* generic data buffer */
struct gsmi_buf *param_buf; /* parameter buffer */
spinlock_t lock; /* serialize access to SMIs */
u16 smi_cmd; /* SMI command port */
int handshake_type; /* firmware handler interlock type */
struct dma_pool *dma_pool; /* DMA buffer pool */
} gsmi_dev;
/* Packed structures for communicating with the firmware */
struct gsmi_nvram_var_param {
efi_guid_t guid;
u32 name_ptr;
u32 attributes;
u32 data_len;
u32 data_ptr;
} __packed;
struct gsmi_get_next_var_param {
u8 guid[GSMI_GUID_SIZE];
u32 name_ptr;
u32 name_len;
} __packed;
struct gsmi_set_eventlog_param {
u32 data_ptr;
u32 data_len;
u32 type;
} __packed;
/* Event log formats */
struct gsmi_log_entry_type_1 {
u16 type;
u32 instance;
} __packed;
/*
* Some platforms don't have explicit SMI handshake
* and need to wait for SMI to complete.
*/
#define GSMI_DEFAULT_SPINCOUNT 0x10000
static unsigned int spincount = GSMI_DEFAULT_SPINCOUNT;
module_param(spincount, uint, 0600);
MODULE_PARM_DESC(spincount,
"The number of loop iterations to use when using the spin handshake.");
static struct gsmi_buf *gsmi_buf_alloc(void)
{
struct gsmi_buf *smibuf;
smibuf = kzalloc(sizeof(*smibuf), GFP_KERNEL);
if (!smibuf) {
printk(KERN_ERR "gsmi: out of memory\n");
return NULL;
}
/* allocate buffer in 32bit address space */
smibuf->start = dma_pool_alloc(gsmi_dev.dma_pool, GFP_KERNEL,
&smibuf->handle);
if (!smibuf->start) {
printk(KERN_ERR "gsmi: failed to allocate name buffer\n");
kfree(smibuf);
return NULL;
}
/* fill in the buffer handle */
smibuf->length = GSMI_BUF_SIZE;
smibuf->address = (u32)virt_to_phys(smibuf->start);
return smibuf;
}
static void gsmi_buf_free(struct gsmi_buf *smibuf)
{
if (smibuf) {
if (smibuf->start)
dma_pool_free(gsmi_dev.dma_pool, smibuf->start,
smibuf->handle);
kfree(smibuf);
}
}
/*
* Make a call to gsmi func(sub). GSMI error codes are translated to
* in-kernel errnos (0 on success, -ERRNO on error).
*/
static int gsmi_exec(u8 func, u8 sub)
{
u16 cmd = (sub << 8) | func;
u16 result = 0;
int rc = 0;
/*
* AH : Subfunction number
* AL : Function number
* EBX : Parameter block address
* DX : SMI command port
*
* Three protocols here. See also the comment in gsmi_init().
*/
if (gsmi_dev.handshake_type == GSMI_HANDSHAKE_CF) {
/*
* If handshake_type == HANDSHAKE_CF then set CF on the
* way in and wait for the handler to clear it; this avoids
* corrupting register state on those chipsets which have
* a delay between writing the SMI trigger register and
* entering SMM.
*/
asm volatile (
"stc\n"
"outb %%al, %%dx\n"
"1: jc 1b\n"
: "=a" (result)
: "0" (cmd),
"d" (gsmi_dev.smi_cmd),
"b" (gsmi_dev.param_buf->address)
: "memory", "cc"
);
} else if (gsmi_dev.handshake_type == GSMI_HANDSHAKE_SPIN) {
/*
* If handshake_type == HANDSHAKE_SPIN we spin a
* hundred-ish usecs to ensure the SMI has triggered.
*/
asm volatile (
"outb %%al, %%dx\n"
"1: loop 1b\n"
: "=a" (result)
: "0" (cmd),
"d" (gsmi_dev.smi_cmd),
"b" (gsmi_dev.param_buf->address),
"c" (spincount)
: "memory", "cc"
);
} else {
/*
* If handshake_type == HANDSHAKE_NONE we do nothing;
* either we don't need to or it's legacy firmware that
* doesn't understand the CF protocol.
*/
asm volatile (
"outb %%al, %%dx\n\t"
: "=a" (result)
: "0" (cmd),
"d" (gsmi_dev.smi_cmd),
"b" (gsmi_dev.param_buf->address)
: "memory", "cc"
);
}
/* check return code from SMI handler */
switch (result) {
case GSMI_SUCCESS:
break;
case GSMI_VAR_NOT_FOUND:
/* not really an error, but let the caller know */
rc = 1;
break;
case GSMI_INVALID_PARAMETER:
printk(KERN_ERR "gsmi: exec 0x%04x: Invalid parameter\n", cmd);
rc = -EINVAL;
break;
case GSMI_BUFFER_TOO_SMALL:
printk(KERN_ERR "gsmi: exec 0x%04x: Buffer too small\n", cmd);
rc = -ENOMEM;
break;
case GSMI_UNSUPPORTED:
case GSMI_UNSUPPORTED2:
if (sub != GSMI_CMD_HANDSHAKE_TYPE)
printk(KERN_ERR "gsmi: exec 0x%04x: Not supported\n",
cmd);
rc = -ENOSYS;
break;
case GSMI_NOT_READY:
printk(KERN_ERR "gsmi: exec 0x%04x: Not ready\n", cmd);
rc = -EBUSY;
break;
case GSMI_DEVICE_ERROR:
printk(KERN_ERR "gsmi: exec 0x%04x: Device error\n", cmd);
rc = -EFAULT;
break;
case GSMI_NOT_FOUND:
printk(KERN_ERR "gsmi: exec 0x%04x: Data not found\n", cmd);
rc = -ENOENT;
break;
case GSMI_LOG_FULL:
printk(KERN_ERR "gsmi: exec 0x%04x: Log full\n", cmd);
rc = -ENOSPC;
break;
case GSMI_HANDSHAKE_CF:
case GSMI_HANDSHAKE_SPIN:
case GSMI_HANDSHAKE_NONE:
rc = result;
break;
default:
printk(KERN_ERR "gsmi: exec 0x%04x: Unknown error 0x%04x\n",
cmd, result);
rc = -ENXIO;
}
return rc;
}
/* Return the number of unicode characters in data */
static size_t
utf16_strlen(efi_char16_t *data, unsigned long maxlength)
{
unsigned long length = 0;
while (*data++ != 0 && length < maxlength)
length++;
return length;
}
static efi_status_t gsmi_get_variable(efi_char16_t *name,
efi_guid_t *vendor, u32 *attr,
unsigned long *data_size,
void *data)
{
struct gsmi_nvram_var_param param = {
.name_ptr = gsmi_dev.name_buf->address,
.data_ptr = gsmi_dev.data_buf->address,
.data_len = (u32)*data_size,
};
efi_status_t ret = EFI_SUCCESS;
unsigned long flags;
size_t name_len = utf16_strlen(name, GSMI_BUF_SIZE / 2);
int rc;
if (name_len >= GSMI_BUF_SIZE / 2)
return EFI_BAD_BUFFER_SIZE;
spin_lock_irqsave(&gsmi_dev.lock, flags);
/* Vendor guid */
memcpy(&param.guid, vendor, sizeof(param.guid));
/* variable name, already in UTF-16 */
memset(gsmi_dev.name_buf->start, 0, gsmi_dev.name_buf->length);
memcpy(gsmi_dev.name_buf->start, name, name_len * 2);
/* data pointer */
memset(gsmi_dev.data_buf->start, 0, gsmi_dev.data_buf->length);
/* parameter buffer */
memset(gsmi_dev.param_buf->start, 0, gsmi_dev.param_buf->length);
memcpy(gsmi_dev.param_buf->start, &param, sizeof(param));
rc = gsmi_exec(GSMI_CALLBACK, GSMI_CMD_GET_NVRAM_VAR);
if (rc < 0) {
printk(KERN_ERR "gsmi: Get Variable failed\n");
ret = EFI_LOAD_ERROR;
} else if (rc == 1) {
/* variable was not found */
ret = EFI_NOT_FOUND;
} else {
/* Get the arguments back */
memcpy(&param, gsmi_dev.param_buf->start, sizeof(param));
/* The size reported is the min of all of our buffers */
*data_size = min(*data_size, gsmi_dev.data_buf->length);
*data_size = min_t(unsigned long, *data_size, param.data_len);
/* Copy data back to return buffer. */
memcpy(data, gsmi_dev.data_buf->start, *data_size);
/* All variables are have the following attributes */
*attr = EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS;
}
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
return ret;
}
static efi_status_t gsmi_get_next_variable(unsigned long *name_size,
efi_char16_t *name,
efi_guid_t *vendor)
{
struct gsmi_get_next_var_param param = {
.name_ptr = gsmi_dev.name_buf->address,
.name_len = gsmi_dev.name_buf->length,
};
efi_status_t ret = EFI_SUCCESS;
int rc;
unsigned long flags;
/* For the moment, only support buffers that exactly match in size */
if (*name_size != GSMI_BUF_SIZE)
return EFI_BAD_BUFFER_SIZE;
/* Let's make sure the thing is at least null-terminated */
if (utf16_strlen(name, GSMI_BUF_SIZE / 2) == GSMI_BUF_SIZE / 2)
return EFI_INVALID_PARAMETER;
spin_lock_irqsave(&gsmi_dev.lock, flags);
/* guid */
memcpy(&param.guid, vendor, sizeof(param.guid));
/* variable name, already in UTF-16 */
memcpy(gsmi_dev.name_buf->start, name, *name_size);
/* parameter buffer */
memset(gsmi_dev.param_buf->start, 0, gsmi_dev.param_buf->length);
memcpy(gsmi_dev.param_buf->start, &param, sizeof(param));
rc = gsmi_exec(GSMI_CALLBACK, GSMI_CMD_GET_NEXT_VAR);
if (rc < 0) {
printk(KERN_ERR "gsmi: Get Next Variable Name failed\n");
ret = EFI_LOAD_ERROR;
} else if (rc == 1) {
/* variable not found -- end of list */
ret = EFI_NOT_FOUND;
} else {
/* copy variable data back to return buffer */
memcpy(&param, gsmi_dev.param_buf->start, sizeof(param));
/* Copy the name back */
memcpy(name, gsmi_dev.name_buf->start, GSMI_BUF_SIZE);
*name_size = utf16_strlen(name, GSMI_BUF_SIZE / 2) * 2;
/* copy guid to return buffer */
memcpy(vendor, &param.guid, sizeof(param.guid));
ret = EFI_SUCCESS;
}
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
return ret;
}
static efi_status_t gsmi_set_variable(efi_char16_t *name,
efi_guid_t *vendor,
unsigned long attr,
unsigned long data_size,
void *data)
{
struct gsmi_nvram_var_param param = {
.name_ptr = gsmi_dev.name_buf->address,
.data_ptr = gsmi_dev.data_buf->address,
.data_len = (u32)data_size,
.attributes = EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
};
size_t name_len = utf16_strlen(name, GSMI_BUF_SIZE / 2);
efi_status_t ret = EFI_SUCCESS;
int rc;
unsigned long flags;
if (name_len >= GSMI_BUF_SIZE / 2)
return EFI_BAD_BUFFER_SIZE;
spin_lock_irqsave(&gsmi_dev.lock, flags);
/* guid */
memcpy(&param.guid, vendor, sizeof(param.guid));
/* variable name, already in UTF-16 */
memset(gsmi_dev.name_buf->start, 0, gsmi_dev.name_buf->length);
memcpy(gsmi_dev.name_buf->start, name, name_len * 2);
/* data pointer */
memset(gsmi_dev.data_buf->start, 0, gsmi_dev.data_buf->length);
memcpy(gsmi_dev.data_buf->start, data, data_size);
/* parameter buffer */
memset(gsmi_dev.param_buf->start, 0, gsmi_dev.param_buf->length);
memcpy(gsmi_dev.param_buf->start, &param, sizeof(param));
rc = gsmi_exec(GSMI_CALLBACK, GSMI_CMD_SET_NVRAM_VAR);
if (rc < 0) {
printk(KERN_ERR "gsmi: Set Variable failed\n");
ret = EFI_INVALID_PARAMETER;
}
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
return ret;
}
static const struct efivar_operations efivar_ops = {
.get_variable = gsmi_get_variable,
.set_variable = gsmi_set_variable,
.get_next_variable = gsmi_get_next_variable,
};
static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t count)
{
struct gsmi_set_eventlog_param param = {
.data_ptr = gsmi_dev.data_buf->address,
};
int rc = 0;
unsigned long flags;
/* Pull the type out */
if (count < sizeof(u32))
return -EINVAL;
param.type = *(u32 *)buf;
count -= sizeof(u32);
buf += sizeof(u32);
/* The remaining buffer is the data payload */
if (count > gsmi_dev.data_buf->length)
return -EINVAL;
param.data_len = count - sizeof(u32);
spin_lock_irqsave(&gsmi_dev.lock, flags);
/* data pointer */
memset(gsmi_dev.data_buf->start, 0, gsmi_dev.data_buf->length);
memcpy(gsmi_dev.data_buf->start, buf, param.data_len);
/* parameter buffer */
memset(gsmi_dev.param_buf->start, 0, gsmi_dev.param_buf->length);
memcpy(gsmi_dev.param_buf->start, &param, sizeof(param));
rc = gsmi_exec(GSMI_CALLBACK, GSMI_CMD_SET_EVENT_LOG);
if (rc < 0)
printk(KERN_ERR "gsmi: Set Event Log failed\n");
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
return rc;
}
static struct bin_attribute eventlog_bin_attr = {
.attr = {.name = "append_to_eventlog", .mode = 0200},
.write = eventlog_write,
};
static ssize_t gsmi_clear_eventlog_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
int rc;
unsigned long flags;
unsigned long val;
struct {
u32 percentage;
u32 data_type;
} param;
rc = strict_strtoul(buf, 0, &val);
if (rc)
return rc;
/*
* Value entered is a percentage, 0 through 100, anything else
* is invalid.
*/
if (val > 100)
return -EINVAL;
/* data_type here selects the smbios event log. */
param.percentage = val;
param.data_type = 0;
spin_lock_irqsave(&gsmi_dev.lock, flags);
/* parameter buffer */
memset(gsmi_dev.param_buf->start, 0, gsmi_dev.param_buf->length);
memcpy(gsmi_dev.param_buf->start, &param, sizeof(param));
rc = gsmi_exec(GSMI_CALLBACK, GSMI_CMD_CLEAR_EVENT_LOG);
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
if (rc)
return rc;
return count;
}
static struct kobj_attribute gsmi_clear_eventlog_attr = {
.attr = {.name = "clear_eventlog", .mode = 0200},
.store = gsmi_clear_eventlog_store,
};
static ssize_t gsmi_clear_config_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
int rc;
unsigned long flags;
spin_lock_irqsave(&gsmi_dev.lock, flags);
/* clear parameter buffer */
memset(gsmi_dev.param_buf->start, 0, gsmi_dev.param_buf->length);
rc = gsmi_exec(GSMI_CALLBACK, GSMI_CMD_CLEAR_CONFIG);
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
if (rc)
return rc;
return count;
}
static struct kobj_attribute gsmi_clear_config_attr = {
.attr = {.name = "clear_config", .mode = 0200},
.store = gsmi_clear_config_store,
};
static const struct attribute *gsmi_attrs[] = {
&gsmi_clear_config_attr.attr,
&gsmi_clear_eventlog_attr.attr,
NULL,
};
static int gsmi_shutdown_reason(int reason)
{
struct gsmi_log_entry_type_1 entry = {
.type = GSMI_LOG_ENTRY_TYPE_KERNEL,
.instance = reason,
};
struct gsmi_set_eventlog_param param = {
.data_len = sizeof(entry),
.type = 1,
};
static int saved_reason;
int rc = 0;
unsigned long flags;
/* avoid duplicate entries in the log */
if (saved_reason & (1 << reason))
return 0;
spin_lock_irqsave(&gsmi_dev.lock, flags);
saved_reason |= (1 << reason);
/* data pointer */
memset(gsmi_dev.data_buf->start, 0, gsmi_dev.data_buf->length);
memcpy(gsmi_dev.data_buf->start, &entry, sizeof(entry));
/* parameter buffer */
param.data_ptr = gsmi_dev.data_buf->address;
memset(gsmi_dev.param_buf->start, 0, gsmi_dev.param_buf->length);
memcpy(gsmi_dev.param_buf->start, &param, sizeof(param));
rc = gsmi_exec(GSMI_CALLBACK, GSMI_CMD_SET_EVENT_LOG);
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
if (rc < 0)
printk(KERN_ERR "gsmi: Log Shutdown Reason failed\n");
else
printk(KERN_EMERG "gsmi: Log Shutdown Reason 0x%02x\n",
reason);
return rc;
}
static int gsmi_reboot_callback(struct notifier_block *nb,
unsigned long reason, void *arg)
{
gsmi_shutdown_reason(GSMI_SHUTDOWN_CLEAN);
return NOTIFY_DONE;
}
static struct notifier_block gsmi_reboot_notifier = {
.notifier_call = gsmi_reboot_callback
};
static int gsmi_die_callback(struct notifier_block *nb,
unsigned long reason, void *arg)
{
if (reason == DIE_OOPS)
gsmi_shutdown_reason(GSMI_SHUTDOWN_OOPS);
return NOTIFY_DONE;
}
static struct notifier_block gsmi_die_notifier = {
.notifier_call = gsmi_die_callback
};
static int gsmi_panic_callback(struct notifier_block *nb,
unsigned long reason, void *arg)
{
gsmi_shutdown_reason(GSMI_SHUTDOWN_PANIC);
return NOTIFY_DONE;
}
static struct notifier_block gsmi_panic_notifier = {
.notifier_call = gsmi_panic_callback,
};
/*
* This hash function was blatantly copied from include/linux/hash.h.
* It is used by this driver to obfuscate a board name that requires a
* quirk within this driver.
*
* Please do not remove this copy of the function as any changes to the
* global utility hash_64() function would break this driver's ability
* to identify a board and provide the appropriate quirk -- mikew@google.com
*/
static u64 __init local_hash_64(u64 val, unsigned bits)
{
u64 hash = val;
/* Sigh, gcc can't optimise this alone like it does for 32 bits. */
u64 n = hash;
n <<= 18;
hash -= n;
n <<= 33;
hash -= n;
n <<= 3;
hash += n;
n <<= 3;
hash -= n;
n <<= 4;
hash += n;
n <<= 2;
hash += n;
/* High bits are more random, so use them. */
return hash >> (64 - bits);
}
static u32 __init hash_oem_table_id(char s[8])
{
u64 input;
memcpy(&input, s, 8);
return local_hash_64(input, 32);
}
static struct dmi_system_id gsmi_dmi_table[] __initdata = {
{
.ident = "Google Board",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Google, Inc."),
},
},
{}
};
MODULE_DEVICE_TABLE(dmi, gsmi_dmi_table);
static __init int gsmi_system_valid(void)
{
u32 hash;
if (!dmi_check_system(gsmi_dmi_table))
return -ENODEV;
/*
* Only newer firmware supports the gsmi interface. All older
* firmware that didn't support this interface used to plug the
* table name in the first four bytes of the oem_table_id field.
* Newer firmware doesn't do that though, so use that as the
* discriminant factor. We have to do this in order to
* whitewash our board names out of the public driver.
*/
if (!strncmp(acpi_gbl_FADT.header.oem_table_id, "FACP", 4)) {
printk(KERN_INFO "gsmi: Board is too old\n");
return -ENODEV;
}
/* Disable on board with 1.0 BIOS due to Google bug 2602657 */
hash = hash_oem_table_id(acpi_gbl_FADT.header.oem_table_id);
if (hash == QUIRKY_BOARD_HASH) {
const char *bios_ver = dmi_get_system_info(DMI_BIOS_VERSION);
if (strncmp(bios_ver, "1.0", 3) == 0) {
pr_info("gsmi: disabled on this board's BIOS %s\n",
bios_ver);
return -ENODEV;
}
}
/* check for valid SMI command port in ACPI FADT */
if (acpi_gbl_FADT.smi_command == 0) {
pr_info("gsmi: missing smi_command\n");
return -ENODEV;
}
/* Found */
return 0;
}
static struct kobject *gsmi_kobj;
static struct efivars efivars;
static __init int gsmi_init(void)
{
unsigned long flags;
int ret;
ret = gsmi_system_valid();
if (ret)
return ret;
gsmi_dev.smi_cmd = acpi_gbl_FADT.smi_command;
/* register device */
gsmi_dev.pdev = platform_device_register_simple("gsmi", -1, NULL, 0);
if (IS_ERR(gsmi_dev.pdev)) {
printk(KERN_ERR "gsmi: unable to register platform device\n");
return PTR_ERR(gsmi_dev.pdev);
}
/* SMI access needs to be serialized */
spin_lock_init(&gsmi_dev.lock);
/* SMI callbacks require 32bit addresses */
gsmi_dev.pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
gsmi_dev.pdev->dev.dma_mask =
&gsmi_dev.pdev->dev.coherent_dma_mask;
ret = -ENOMEM;
gsmi_dev.dma_pool = dma_pool_create("gsmi", &gsmi_dev.pdev->dev,
GSMI_BUF_SIZE, GSMI_BUF_ALIGN, 0);
if (!gsmi_dev.dma_pool)
goto out_err;
/*
* pre-allocate buffers because sometimes we are called when
* this is not feasible: oops, panic, die, mce, etc
*/
gsmi_dev.name_buf = gsmi_buf_alloc();
if (!gsmi_dev.name_buf) {
printk(KERN_ERR "gsmi: failed to allocate name buffer\n");
goto out_err;
}
gsmi_dev.data_buf = gsmi_buf_alloc();
if (!gsmi_dev.data_buf) {
printk(KERN_ERR "gsmi: failed to allocate data buffer\n");
goto out_err;
}
gsmi_dev.param_buf = gsmi_buf_alloc();
if (!gsmi_dev.param_buf) {
printk(KERN_ERR "gsmi: failed to allocate param buffer\n");
goto out_err;
}
/*
* Determine type of handshake used to serialize the SMI
* entry. See also gsmi_exec().
*
* There's a "behavior" present on some chipsets where writing the
* SMI trigger register in the southbridge doesn't result in an
* immediate SMI. Rather, the processor can execute "a few" more
* instructions before the SMI takes effect. To ensure synchronous
* behavior, implement a handshake between the kernel driver and the
* firmware handler to spin until released. This ioctl determines
* the type of handshake.
*
* NONE: The firmware handler does not implement any
* handshake. Either it doesn't need to, or it's legacy firmware
* that doesn't know it needs to and never will.
*
* CF: The firmware handler will clear the CF in the saved
* state before returning. The driver may set the CF and test for
* it to clear before proceeding.
*
* SPIN: The firmware handler does not implement any handshake
* but the driver should spin for a hundred or so microseconds
* to ensure the SMI has triggered.
*
* Finally, the handler will return -ENOSYS if
* GSMI_CMD_HANDSHAKE_TYPE is unimplemented, which implies
* HANDSHAKE_NONE.
*/
spin_lock_irqsave(&gsmi_dev.lock, flags);
gsmi_dev.handshake_type = GSMI_HANDSHAKE_SPIN;
gsmi_dev.handshake_type =
gsmi_exec(GSMI_CALLBACK, GSMI_CMD_HANDSHAKE_TYPE);
if (gsmi_dev.handshake_type == -ENOSYS)
gsmi_dev.handshake_type = GSMI_HANDSHAKE_NONE;
spin_unlock_irqrestore(&gsmi_dev.lock, flags);
/* Remove and clean up gsmi if the handshake could not complete. */
if (gsmi_dev.handshake_type == -ENXIO) {
printk(KERN_INFO "gsmi version " DRIVER_VERSION
" failed to load\n");
ret = -ENODEV;
goto out_err;
}
printk(KERN_INFO "gsmi version " DRIVER_VERSION " loaded\n");
/* Register in the firmware directory */
ret = -ENOMEM;
gsmi_kobj = kobject_create_and_add("gsmi", firmware_kobj);
if (!gsmi_kobj) {
printk(KERN_INFO "gsmi: Failed to create firmware kobj\n");
goto out_err;
}
/* Setup eventlog access */
ret = sysfs_create_bin_file(gsmi_kobj, &eventlog_bin_attr);
if (ret) {
printk(KERN_INFO "gsmi: Failed to setup eventlog");
goto out_err;
}
/* Other attributes */
ret = sysfs_create_files(gsmi_kobj, gsmi_attrs);
if (ret) {
printk(KERN_INFO "gsmi: Failed to add attrs");
goto out_err;
}
if (register_efivars(&efivars, &efivar_ops, gsmi_kobj)) {
printk(KERN_INFO "gsmi: Failed to register efivars\n");
goto out_err;
}
register_reboot_notifier(&gsmi_reboot_notifier);
register_die_notifier(&gsmi_die_notifier);
atomic_notifier_chain_register(&panic_notifier_list,
&gsmi_panic_notifier);
return 0;
out_err:
kobject_put(gsmi_kobj);
gsmi_buf_free(gsmi_dev.param_buf);
gsmi_buf_free(gsmi_dev.data_buf);
gsmi_buf_free(gsmi_dev.name_buf);
if (gsmi_dev.dma_pool)
dma_pool_destroy(gsmi_dev.dma_pool);
platform_device_unregister(gsmi_dev.pdev);
pr_info("gsmi: failed to load: %d\n", ret);
return ret;
}
static void __exit gsmi_exit(void)
{
unregister_reboot_notifier(&gsmi_reboot_notifier);
unregister_die_notifier(&gsmi_die_notifier);
atomic_notifier_chain_unregister(&panic_notifier_list,
&gsmi_panic_notifier);
unregister_efivars(&efivars);
kobject_put(gsmi_kobj);
gsmi_buf_free(gsmi_dev.param_buf);
gsmi_buf_free(gsmi_dev.data_buf);
gsmi_buf_free(gsmi_dev.name_buf);
dma_pool_destroy(gsmi_dev.dma_pool);
platform_device_unregister(gsmi_dev.pdev);
}
module_init(gsmi_init);
module_exit(gsmi_exit);
MODULE_AUTHOR("Google, Inc.");
MODULE_LICENSE("GPL");
/*
* memconsole.c
*
* Infrastructure for importing the BIOS memory based console
* into the kernel log ringbuffer.
*
* Copyright 2010 Google Inc. All rights reserved.
*/
#include <linux/ctype.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/kobject.h>
#include <linux/module.h>
#include <linux/dmi.h>
#include <asm/bios_ebda.h>
#define BIOS_MEMCONSOLE_V1_MAGIC 0xDEADBABE
#define BIOS_MEMCONSOLE_V2_MAGIC (('M')|('C'<<8)|('O'<<16)|('N'<<24))
struct biosmemcon_ebda {
u32 signature;
union {
struct {
u8 enabled;
u32 buffer_addr;
u16 start;
u16 end;
u16 num_chars;
u8 wrapped;
} __packed v1;
struct {
u32 buffer_addr;
/* Misdocumented as number of pages! */
u16 num_bytes;
u16 start;
u16 end;
} __packed v2;
};
} __packed;
static char *memconsole_baseaddr;
static size_t memconsole_length;
static ssize_t memconsole_read(struct file *filp, struct kobject *kobp,
struct bin_attribute *bin_attr, char *buf,
loff_t pos, size_t count)
{
return memory_read_from_buffer(buf, count, &pos, memconsole_baseaddr,
memconsole_length);
}
static struct bin_attribute memconsole_bin_attr = {
.attr = {.name = "log", .mode = 0444},
.read = memconsole_read,
};
static void found_v1_header(struct biosmemcon_ebda *hdr)
{
printk(KERN_INFO "BIOS console v1 EBDA structure found at %p\n", hdr);
printk(KERN_INFO "BIOS console buffer at 0x%.8x, "
"start = %d, end = %d, num = %d\n",
hdr->v1.buffer_addr, hdr->v1.start,
hdr->v1.end, hdr->v1.num_chars);
memconsole_length = hdr->v1.num_chars;
memconsole_baseaddr = phys_to_virt(hdr->v1.buffer_addr);
}
static void found_v2_header(struct biosmemcon_ebda *hdr)
{
printk(KERN_INFO "BIOS console v2 EBDA structure found at %p\n", hdr);
printk(KERN_INFO "BIOS console buffer at 0x%.8x, "
"start = %d, end = %d, num_bytes = %d\n",
hdr->v2.buffer_addr, hdr->v2.start,
hdr->v2.end, hdr->v2.num_bytes);
memconsole_length = hdr->v2.end - hdr->v2.start;
memconsole_baseaddr = phys_to_virt(hdr->v2.buffer_addr
+ hdr->v2.start);
}
/*
* Search through the EBDA for the BIOS Memory Console, and
* set the global variables to point to it. Return true if found.
*/
static bool found_memconsole(void)
{
unsigned int address;
size_t length, cur;
address = get_bios_ebda();
if (!address) {
printk(KERN_INFO "BIOS EBDA non-existent.\n");
return false;
}
/* EBDA length is byte 0 of EBDA (in KB) */
length = *(u8 *)phys_to_virt(address);
length <<= 10; /* convert to bytes */
/*
* Search through EBDA for BIOS memory console structure
* note: signature is not necessarily dword-aligned
*/
for (cur = 0; cur < length; cur++) {
struct biosmemcon_ebda *hdr = phys_to_virt(address + cur);
/* memconsole v1 */
if (hdr->signature == BIOS_MEMCONSOLE_V1_MAGIC) {
found_v1_header(hdr);
return true;
}
/* memconsole v2 */
if (hdr->signature == BIOS_MEMCONSOLE_V2_MAGIC) {
found_v2_header(hdr);
return true;
}
}
printk(KERN_INFO "BIOS console EBDA structure not found!\n");
return false;
}
static struct dmi_system_id memconsole_dmi_table[] __initdata = {
{
.ident = "Google Board",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Google, Inc."),
},
},
{}
};
MODULE_DEVICE_TABLE(dmi, memconsole_dmi_table);
static int __init memconsole_init(void)
{
int ret;
if (!dmi_check_system(memconsole_dmi_table))
return -ENODEV;
if (!found_memconsole())
return -ENODEV;
memconsole_bin_attr.size = memconsole_length;
ret = sysfs_create_bin_file(firmware_kobj, &memconsole_bin_attr);
return ret;
}
static void __exit memconsole_exit(void)
{
sysfs_remove_bin_file(firmware_kobj, &memconsole_bin_attr);
}
module_init(memconsole_init);
module_exit(memconsole_exit);
MODULE_AUTHOR("Google, Inc.");
MODULE_LICENSE("GPL");
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
menu "Texas Instruments shared transport line discipline" menu "Texas Instruments shared transport line discipline"
config TI_ST config TI_ST
tristate "Shared transport core driver" tristate "Shared transport core driver"
depends on RFKILL depends on NET && GPIOLIB
select FW_LOADER select FW_LOADER
help help
This enables the shared transport core driver for TI This enables the shared transport core driver for TI
......
...@@ -43,13 +43,15 @@ static void add_channel_to_table(struct st_data_s *st_gdata, ...@@ -43,13 +43,15 @@ static void add_channel_to_table(struct st_data_s *st_gdata,
pr_info("%s: id %d\n", __func__, new_proto->chnl_id); pr_info("%s: id %d\n", __func__, new_proto->chnl_id);
/* list now has the channel id as index itself */ /* list now has the channel id as index itself */
st_gdata->list[new_proto->chnl_id] = new_proto; st_gdata->list[new_proto->chnl_id] = new_proto;
st_gdata->is_registered[new_proto->chnl_id] = true;
} }
static void remove_channel_from_table(struct st_data_s *st_gdata, static void remove_channel_from_table(struct st_data_s *st_gdata,
struct st_proto_s *proto) struct st_proto_s *proto)
{ {
pr_info("%s: id %d\n", __func__, proto->chnl_id); pr_info("%s: id %d\n", __func__, proto->chnl_id);
st_gdata->list[proto->chnl_id] = NULL; /* st_gdata->list[proto->chnl_id] = NULL; */
st_gdata->is_registered[proto->chnl_id] = false;
} }
/* /*
...@@ -104,7 +106,7 @@ void st_send_frame(unsigned char chnl_id, struct st_data_s *st_gdata) ...@@ -104,7 +106,7 @@ void st_send_frame(unsigned char chnl_id, struct st_data_s *st_gdata)
if (unlikely if (unlikely
(st_gdata == NULL || st_gdata->rx_skb == NULL (st_gdata == NULL || st_gdata->rx_skb == NULL
|| st_gdata->list[chnl_id] == NULL)) { || st_gdata->is_registered[chnl_id] == false)) {
pr_err("chnl_id %d not registered, no data to send?", pr_err("chnl_id %d not registered, no data to send?",
chnl_id); chnl_id);
kfree_skb(st_gdata->rx_skb); kfree_skb(st_gdata->rx_skb);
...@@ -141,14 +143,15 @@ void st_reg_complete(struct st_data_s *st_gdata, char err) ...@@ -141,14 +143,15 @@ void st_reg_complete(struct st_data_s *st_gdata, char err)
unsigned char i = 0; unsigned char i = 0;
pr_info(" %s ", __func__); pr_info(" %s ", __func__);
for (i = 0; i < ST_MAX_CHANNELS; i++) { for (i = 0; i < ST_MAX_CHANNELS; i++) {
if (likely(st_gdata != NULL && st_gdata->list[i] != NULL && if (likely(st_gdata != NULL &&
st_gdata->list[i]->reg_complete_cb != NULL)) { st_gdata->is_registered[i] == true &&
st_gdata->list[i]->reg_complete_cb != NULL)) {
st_gdata->list[i]->reg_complete_cb st_gdata->list[i]->reg_complete_cb
(st_gdata->list[i]->priv_data, err); (st_gdata->list[i]->priv_data, err);
pr_info("protocol %d's cb sent %d\n", i, err); pr_info("protocol %d's cb sent %d\n", i, err);
if (err) { /* cleanup registered protocol */ if (err) { /* cleanup registered protocol */
st_gdata->protos_registered--; st_gdata->protos_registered--;
st_gdata->list[i] = NULL; st_gdata->is_registered[i] = false;
} }
} }
} }
...@@ -475,9 +478,9 @@ void kim_st_list_protocols(struct st_data_s *st_gdata, void *buf) ...@@ -475,9 +478,9 @@ void kim_st_list_protocols(struct st_data_s *st_gdata, void *buf)
{ {
seq_printf(buf, "[%d]\nBT=%c\nFM=%c\nGPS=%c\n", seq_printf(buf, "[%d]\nBT=%c\nFM=%c\nGPS=%c\n",
st_gdata->protos_registered, st_gdata->protos_registered,
st_gdata->list[0x04] != NULL ? 'R' : 'U', st_gdata->is_registered[0x04] == true ? 'R' : 'U',
st_gdata->list[0x08] != NULL ? 'R' : 'U', st_gdata->is_registered[0x08] == true ? 'R' : 'U',
st_gdata->list[0x09] != NULL ? 'R' : 'U'); st_gdata->is_registered[0x09] == true ? 'R' : 'U');
} }
/********************************************************************/ /********************************************************************/
...@@ -504,7 +507,7 @@ long st_register(struct st_proto_s *new_proto) ...@@ -504,7 +507,7 @@ long st_register(struct st_proto_s *new_proto)
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
} }
if (st_gdata->list[new_proto->chnl_id] != NULL) { if (st_gdata->is_registered[new_proto->chnl_id] == true) {
pr_err("chnl_id %d already registered", new_proto->chnl_id); pr_err("chnl_id %d already registered", new_proto->chnl_id);
return -EALREADY; return -EALREADY;
} }
...@@ -563,7 +566,7 @@ long st_register(struct st_proto_s *new_proto) ...@@ -563,7 +566,7 @@ long st_register(struct st_proto_s *new_proto)
/* check for already registered once more, /* check for already registered once more,
* since the above check is old * since the above check is old
*/ */
if (st_gdata->list[new_proto->chnl_id] != NULL) { if (st_gdata->is_registered[new_proto->chnl_id] == true) {
pr_err(" proto %d already registered ", pr_err(" proto %d already registered ",
new_proto->chnl_id); new_proto->chnl_id);
return -EALREADY; return -EALREADY;
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sysfs.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -381,7 +381,13 @@ static int uio_get_minor(struct uio_device *idev) ...@@ -381,7 +381,13 @@ static int uio_get_minor(struct uio_device *idev)
retval = -ENOMEM; retval = -ENOMEM;
goto exit; goto exit;
} }
idev->minor = id & MAX_ID_MASK; if (id < UIO_MAX_DEVICES) {
idev->minor = id;
} else {
dev_err(idev->dev, "too many uio devices\n");
retval = -EINVAL;
idr_remove(&uio_idr, id);
}
exit: exit:
mutex_unlock(&minor_lock); mutex_unlock(&minor_lock);
return retval; return retval;
...@@ -587,14 +593,12 @@ static ssize_t uio_write(struct file *filep, const char __user *buf, ...@@ -587,14 +593,12 @@ static ssize_t uio_write(struct file *filep, const char __user *buf,
static int uio_find_mem_index(struct vm_area_struct *vma) static int uio_find_mem_index(struct vm_area_struct *vma)
{ {
int mi;
struct uio_device *idev = vma->vm_private_data; struct uio_device *idev = vma->vm_private_data;
for (mi = 0; mi < MAX_UIO_MAPS; mi++) { if (vma->vm_pgoff < MAX_UIO_MAPS) {
if (idev->info->mem[mi].size == 0) if (idev->info->mem[vma->vm_pgoff].size == 0)
return -1; return -1;
if (vma->vm_pgoff == mi) return (int)vma->vm_pgoff;
return mi;
} }
return -1; return -1;
} }
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
#define PCI_VENDOR_ID_HILSCHER 0x15CF #define PCI_VENDOR_ID_HILSCHER 0x15CF
#define PCI_DEVICE_ID_HILSCHER_NETX 0x0000 #define PCI_DEVICE_ID_HILSCHER_NETX 0x0000
#define PCI_DEVICE_ID_HILSCHER_NETPLC 0x0010
#define PCI_SUBDEVICE_ID_NETPLC_RAM 0x0000
#define PCI_SUBDEVICE_ID_NETPLC_FLASH 0x0001
#define PCI_SUBDEVICE_ID_NXSB_PCA 0x3235 #define PCI_SUBDEVICE_ID_NXSB_PCA 0x3235
#define PCI_SUBDEVICE_ID_NXPCA 0x3335 #define PCI_SUBDEVICE_ID_NXPCA 0x3335
...@@ -66,6 +69,10 @@ static int __devinit netx_pci_probe(struct pci_dev *dev, ...@@ -66,6 +69,10 @@ static int __devinit netx_pci_probe(struct pci_dev *dev,
bar = 0; bar = 0;
info->name = "netx"; info->name = "netx";
break; break;
case PCI_DEVICE_ID_HILSCHER_NETPLC:
bar = 0;
info->name = "netplc";
break;
default: default:
bar = 2; bar = 2;
info->name = "netx_plx"; info->name = "netx_plx";
...@@ -133,6 +140,18 @@ static struct pci_device_id netx_pci_ids[] = { ...@@ -133,6 +140,18 @@ static struct pci_device_id netx_pci_ids[] = {
.subvendor = 0, .subvendor = 0,
.subdevice = 0, .subdevice = 0,
}, },
{
.vendor = PCI_VENDOR_ID_HILSCHER,
.device = PCI_DEVICE_ID_HILSCHER_NETPLC,
.subvendor = PCI_VENDOR_ID_HILSCHER,
.subdevice = PCI_SUBDEVICE_ID_NETPLC_RAM,
},
{
.vendor = PCI_VENDOR_ID_HILSCHER,
.device = PCI_DEVICE_ID_HILSCHER_NETPLC,
.subvendor = PCI_VENDOR_ID_HILSCHER,
.subdevice = PCI_SUBDEVICE_ID_NETPLC_FLASH,
},
{ {
.vendor = PCI_VENDOR_ID_PLX, .vendor = PCI_VENDOR_ID_PLX,
.device = PCI_DEVICE_ID_PLX_9030, .device = PCI_DEVICE_ID_PLX_9030,
......
...@@ -189,6 +189,10 @@ static int uio_pdrv_genirq_remove(struct platform_device *pdev) ...@@ -189,6 +189,10 @@ static int uio_pdrv_genirq_remove(struct platform_device *pdev)
uio_unregister_device(priv->uioinfo); uio_unregister_device(priv->uioinfo);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
priv->uioinfo->handler = NULL;
priv->uioinfo->irqcontrol = NULL;
kfree(priv); kfree(priv);
return 0; return 0;
} }
......
...@@ -428,7 +428,7 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf, ...@@ -428,7 +428,7 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
char buf[32]; char buf[32];
int buf_size; size_t buf_size;
bool bv; bool bv;
u32 *val = file->private_data; u32 *val = file->private_data;
......
...@@ -24,13 +24,6 @@ ...@@ -24,13 +24,6 @@
#include "sysfs.h" #include "sysfs.h"
/* used in crash dumps to help with debugging */
static char last_sysfs_file[PATH_MAX];
void sysfs_printk_last_file(void)
{
printk(KERN_EMERG "last sysfs file: %s\n", last_sysfs_file);
}
/* /*
* There's one sysfs_buffer for each open file and one * There's one sysfs_buffer for each open file and one
* sysfs_open_dirent for each sysfs_dirent with one or more open * sysfs_open_dirent for each sysfs_dirent with one or more open
...@@ -337,11 +330,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file) ...@@ -337,11 +330,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
struct sysfs_buffer *buffer; struct sysfs_buffer *buffer;
const struct sysfs_ops *ops; const struct sysfs_ops *ops;
int error = -EACCES; int error = -EACCES;
char *p;
p = d_path(&file->f_path, last_sysfs_file, sizeof(last_sysfs_file));
if (!IS_ERR(p))
memmove(last_sysfs_file, p, strlen(p) + 1);
/* need attr_sd for attr and ops, its parent for kobj */ /* need attr_sd for attr and ops, its parent for kobj */
if (!sysfs_get_active(attr_sd)) if (!sysfs_get_active(attr_sd))
......
...@@ -101,9 +101,9 @@ int sysfs_create_group(struct kobject *kobj, ...@@ -101,9 +101,9 @@ int sysfs_create_group(struct kobject *kobj,
} }
/** /**
* sysfs_update_group - given a directory kobject, create an attribute group * sysfs_update_group - given a directory kobject, update an attribute group
* @kobj: The kobject to create the group on * @kobj: The kobject to update the group on
* @grp: The attribute group to create * @grp: The attribute group to update
* *
* This function updates an attribute group. Unlike * This function updates an attribute group. Unlike
* sysfs_create_group(), it will explicitly not warn or error if any * sysfs_create_group(), it will explicitly not warn or error if any
......
...@@ -47,6 +47,38 @@ extern int __must_check bus_create_file(struct bus_type *, ...@@ -47,6 +47,38 @@ extern int __must_check bus_create_file(struct bus_type *,
struct bus_attribute *); struct bus_attribute *);
extern void bus_remove_file(struct bus_type *, struct bus_attribute *); extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
/**
* struct bus_type - The bus type of the device
*
* @name: The name of the bus.
* @bus_attrs: Default attributes of the bus.
* @dev_attrs: Default attributes of the devices on the bus.
* @drv_attrs: Default attributes of the device drivers on the bus.
* @match: Called, perhaps multiple times, whenever a new device or driver
* is added for this bus. It should return a nonzero value if the
* given device can be handled by the given driver.
* @uevent: Called when a device is added, removed, or a few other things
* that generate uevents to add the environment variables.
* @probe: Called when a new device or driver add to this bus, and callback
* the specific driver's probe to initial the matched device.
* @remove: Called when a device removed from this bus.
* @shutdown: Called at shut-down time to quiesce the device.
* @suspend: Called when a device on this bus wants to go to sleep mode.
* @resume: Called to bring a device on this bus out of sleep mode.
* @pm: Power management operations of this bus, callback the specific
* device driver's pm-ops.
* @p: The private data of the driver core, only the driver core can
* touch this.
*
* A bus is a channel between the processor and one or more devices. For the
* purposes of the device model, all devices are connected via a bus, even if
* it is an internal, virtual, "platform" bus. Buses can plug into each other.
* A USB controller is usually a PCI device, for example. The device model
* represents the actual connections between buses and the devices they control.
* A bus is represented by the bus_type structure. It contains the name, the
* default attributes, the bus' methods, PM operations, and the driver core's
* private data.
*/
struct bus_type { struct bus_type {
const char *name; const char *name;
struct bus_attribute *bus_attrs; struct bus_attribute *bus_attrs;
...@@ -119,6 +151,37 @@ extern int bus_unregister_notifier(struct bus_type *bus, ...@@ -119,6 +151,37 @@ extern int bus_unregister_notifier(struct bus_type *bus,
extern struct kset *bus_get_kset(struct bus_type *bus); extern struct kset *bus_get_kset(struct bus_type *bus);
extern struct klist *bus_get_device_klist(struct bus_type *bus); extern struct klist *bus_get_device_klist(struct bus_type *bus);
/**
* struct device_driver - The basic device driver structure
* @name: Name of the device driver.
* @bus: The bus which the device of this driver belongs to.
* @owner: The module owner.
* @mod_name: Used for built-in modules.
* @suppress_bind_attrs: Disables bind/unbind via sysfs.
* @of_match_table: The open firmware table.
* @probe: Called to query the existence of a specific device,
* whether this driver can work with it, and bind the driver
* to a specific device.
* @remove: Called when the device is removed from the system to
* unbind a device from this driver.
* @shutdown: Called at shut-down time to quiesce the device.
* @suspend: Called to put the device to sleep mode. Usually to a
* low power state.
* @resume: Called to bring a device from sleep mode.
* @groups: Default attributes that get created by the driver core
* automatically.
* @pm: Power management operations of the device which matched
* this driver.
* @p: Driver core's private data, no one other than the driver
* core can touch this.
*
* The device driver-model tracks all of the drivers known to the system.
* The main reason for this tracking is to enable the driver core to match
* up drivers with new devices. Once drivers are known objects within the
* system, however, a number of other things become possible. Device drivers
* can export information and configuration variables that are independent
* of any specific device.
*/
struct device_driver { struct device_driver {
const char *name; const char *name;
struct bus_type *bus; struct bus_type *bus;
...@@ -185,8 +248,34 @@ struct device *driver_find_device(struct device_driver *drv, ...@@ -185,8 +248,34 @@ struct device *driver_find_device(struct device_driver *drv,
struct device *start, void *data, struct device *start, void *data,
int (*match)(struct device *dev, void *data)); int (*match)(struct device *dev, void *data));
/* /**
* device classes * struct class - device classes
* @name: Name of the class.
* @owner: The module owner.
* @class_attrs: Default attributes of this class.
* @dev_attrs: Default attributes of the devices belong to the class.
* @dev_bin_attrs: Default binary attributes of the devices belong to the class.
* @dev_kobj: The kobject that represents this class and links it into the hierarchy.
* @dev_uevent: Called when a device is added, removed from this class, or a
* few other things that generate uevents to add the environment
* variables.
* @devnode: Callback to provide the devtmpfs.
* @class_release: Called to release this class.
* @dev_release: Called to release the device.
* @suspend: Used to put the device to sleep mode, usually to a low power
* state.
* @resume: Used to bring the device from the sleep mode.
* @ns_type: Callbacks so sysfs can detemine namespaces.
* @namespace: Namespace of the device belongs to this class.
* @pm: The default device power management operations of this class.
* @p: The private data of the driver core, no one other than the
* driver core can touch this.
*
* A class is a higher-level view of a device that abstracts out low-level
* implementation details. Drivers may see a SCSI disk or an ATA disk, but,
* at the class level, they are all simply disks. Classes allow user space
* to work with devices based on what they do, rather than how they are
* connected or how they work.
*/ */
struct class { struct class {
const char *name; const char *name;
...@@ -401,6 +490,65 @@ struct device_dma_parameters { ...@@ -401,6 +490,65 @@ struct device_dma_parameters {
unsigned long segment_boundary_mask; unsigned long segment_boundary_mask;
}; };
/**
* struct device - The basic device structure
* @parent: The device's "parent" device, the device to which it is attached.
* In most cases, a parent device is some sort of bus or host
* controller. If parent is NULL, the device, is a top-level device,
* which is not usually what you want.
* @p: Holds the private data of the driver core portions of the device.
* See the comment of the struct device_private for detail.
* @kobj: A top-level, abstract class from which other classes are derived.
* @init_name: Initial name of the device.
* @type: The type of device.
* This identifies the device type and carries type-specific
* information.
* @mutex: Mutex to synchronize calls to its driver.
* @bus: Type of bus device is on.
* @driver: Which driver has allocated this
* @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.
* @power: For device power management.
* See Documentation/power/devices.txt for details.
* @pwr_domain: Provide callbacks that are executed during system suspend,
* hibernation, system resume and during runtime PM transitions
* along with subsystem-level and driver-level callbacks.
* @numa_node: NUMA node this device is close to.
* @dma_mask: Dma mask (if dma'ble device).
* @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
* hardware supports 64-bit addresses for consistent allocations
* such descriptors.
* @dma_parms: A low level driver may set these to teach IOMMU code about
* segment limitations.
* @dma_pools: Dma pools (if dma'ble device).
* @dma_mem: Internal for coherent mem override.
* @archdata: For arch-specific additions.
* @of_node: Associated device tree node.
* @of_match: Matching of_device_id from driver.
* @devt: For creating the sysfs "dev".
* @devres_lock: Spinlock to protect the resource of the device.
* @devres_head: The resources list of the device.
* @knode_class: The node used to add the device to the class list.
* @class: The class of the device.
* @groups: Optional attribute groups.
* @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).
*
* At the lowest level, every device in a Linux system is represented by an
* instance of struct device. The device structure contains the information
* that the device model core needs to model the system. Most subsystems,
* however, track additional information about the devices they host. As a
* result, it is rare for devices to be represented by bare device structures;
* instead, that structure, like kobject structures, is usually embedded within
* a higher-level representation of the device.
*/
struct device { struct device {
struct device *parent; struct device *parent;
...@@ -408,7 +556,7 @@ struct device { ...@@ -408,7 +556,7 @@ struct device {
struct kobject kobj; struct kobject kobj;
const char *init_name; /* initial name of the device */ const char *init_name; /* initial name of the device */
struct device_type *type; const struct device_type *type;
struct mutex mutex; /* mutex to synchronize calls to struct mutex mutex; /* mutex to synchronize calls to
* its driver. * its driver.
...@@ -556,7 +704,7 @@ extern int device_move(struct device *dev, struct device *new_parent, ...@@ -556,7 +704,7 @@ extern int device_move(struct device *dev, struct device *new_parent,
extern const char *device_get_devnode(struct device *dev, extern const char *device_get_devnode(struct device *dev,
mode_t *mode, const char **tmp); mode_t *mode, const char **tmp);
extern void *dev_get_drvdata(const struct device *dev); extern void *dev_get_drvdata(const struct device *dev);
extern void dev_set_drvdata(struct device *dev, void *data); extern int dev_set_drvdata(struct device *dev, void *data);
/* /*
* Root device objects for grouping under /sys/devices * Root device objects for grouping under /sys/devices
...@@ -610,7 +758,7 @@ extern int (*platform_notify)(struct device *dev); ...@@ -610,7 +758,7 @@ extern int (*platform_notify)(struct device *dev);
extern int (*platform_notify_remove)(struct device *dev); extern int (*platform_notify_remove)(struct device *dev);
/** /*
* get_device - atomically increment the reference count for the device. * get_device - atomically increment the reference count for the device.
* *
*/ */
...@@ -734,13 +882,17 @@ do { \ ...@@ -734,13 +882,17 @@ do { \
#endif #endif
/* /*
* dev_WARN() acts like dev_printk(), but with the key difference * dev_WARN*() acts like dev_printk(), but with the key difference
* of using a WARN/WARN_ON to get the message out, including the * of using a WARN/WARN_ON to get the message out, including the
* file/line information and a backtrace. * file/line information and a backtrace.
*/ */
#define dev_WARN(dev, format, arg...) \ #define dev_WARN(dev, format, arg...) \
WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
#define dev_WARN_ONCE(dev, condition, format, arg...) \
WARN_ONCE(condition, "Device %s\n" format, \
dev_driver_string(dev), ## arg)
/* Create alias, so I can be autoloaded. */ /* Create alias, so I can be autoloaded. */
#define MODULE_ALIAS_CHARDEV(major,minor) \ #define MODULE_ALIAS_CHARDEV(major,minor) \
MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
......
...@@ -176,7 +176,6 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, ...@@ -176,7 +176,6 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
const unsigned char *name); const unsigned char *name);
struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
void sysfs_put(struct sysfs_dirent *sd); void sysfs_put(struct sysfs_dirent *sd);
void sysfs_printk_last_file(void);
/* Called to clear a ns tag when it is no longer valid */ /* Called to clear a ns tag when it is no longer valid */
void sysfs_exit_ns(enum kobj_ns_type type, const void *tag); void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
...@@ -348,10 +347,6 @@ static inline int __must_check sysfs_init(void) ...@@ -348,10 +347,6 @@ static inline int __must_check sysfs_init(void)
return 0; return 0;
} }
static inline void sysfs_printk_last_file(void)
{
}
#endif /* CONFIG_SYSFS */ #endif /* CONFIG_SYSFS */
#endif /* _SYSFS_H_ */ #endif /* _SYSFS_H_ */
...@@ -140,12 +140,12 @@ extern long st_unregister(struct st_proto_s *); ...@@ -140,12 +140,12 @@ extern long st_unregister(struct st_proto_s *);
*/ */
struct st_data_s { struct st_data_s {
unsigned long st_state; unsigned long st_state;
struct tty_struct *tty;
struct sk_buff *tx_skb; struct sk_buff *tx_skb;
#define ST_TX_SENDING 1 #define ST_TX_SENDING 1
#define ST_TX_WAKEUP 2 #define ST_TX_WAKEUP 2
unsigned long tx_state; unsigned long tx_state;
struct st_proto_s *list[ST_MAX_CHANNELS]; struct st_proto_s *list[ST_MAX_CHANNELS];
bool is_registered[ST_MAX_CHANNELS];
unsigned long rx_state; unsigned long rx_state;
unsigned long rx_count; unsigned long rx_count;
struct sk_buff *rx_skb; struct sk_buff *rx_skb;
...@@ -155,6 +155,7 @@ struct st_data_s { ...@@ -155,6 +155,7 @@ struct st_data_s {
unsigned char protos_registered; unsigned char protos_registered;
unsigned long ll_state; unsigned long ll_state;
void *kim_data; void *kim_data;
struct tty_struct *tty;
}; };
/* /*
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/kexec.h> #include <linux/kexec.h>
#include <linux/profile.h> #include <linux/profile.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/capability.h>
#define KERNEL_ATTR_RO(_name) \ #define KERNEL_ATTR_RO(_name) \
static struct kobj_attribute _name##_attr = __ATTR_RO(_name) static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
...@@ -131,6 +132,14 @@ KERNEL_ATTR_RO(vmcoreinfo); ...@@ -131,6 +132,14 @@ KERNEL_ATTR_RO(vmcoreinfo);
#endif /* CONFIG_KEXEC */ #endif /* CONFIG_KEXEC */
/* whether file capabilities are enabled */
static ssize_t fscaps_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", file_caps_enabled);
}
KERNEL_ATTR_RO(fscaps);
/* /*
* Make /sys/kernel/notes give the raw contents of our kernel .notes section. * Make /sys/kernel/notes give the raw contents of our kernel .notes section.
*/ */
...@@ -158,6 +167,7 @@ struct kobject *kernel_kobj; ...@@ -158,6 +167,7 @@ struct kobject *kernel_kobj;
EXPORT_SYMBOL_GPL(kernel_kobj); EXPORT_SYMBOL_GPL(kernel_kobj);
static struct attribute * kernel_attrs[] = { static struct attribute * kernel_attrs[] = {
&fscaps_attr.attr,
#if defined(CONFIG_HOTPLUG) #if defined(CONFIG_HOTPLUG)
&uevent_seqnum_attr.attr, &uevent_seqnum_attr.attr,
&uevent_helper_attr.attr, &uevent_helper_attr.attr,
......
...@@ -314,6 +314,7 @@ void kernel_restart_prepare(char *cmd) ...@@ -314,6 +314,7 @@ void kernel_restart_prepare(char *cmd)
{ {
blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
system_state = SYSTEM_RESTART; system_state = SYSTEM_RESTART;
usermodehelper_disable();
device_shutdown(); device_shutdown();
syscore_shutdown(); syscore_shutdown();
} }
...@@ -343,6 +344,7 @@ static void kernel_shutdown_prepare(enum system_states state) ...@@ -343,6 +344,7 @@ static void kernel_shutdown_prepare(enum system_states state)
blocking_notifier_call_chain(&reboot_notifier_list, blocking_notifier_call_chain(&reboot_notifier_list,
(state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL); (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);
system_state = state; system_state = state;
usermodehelper_disable();
device_shutdown(); device_shutdown();
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment