You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(78) |
Feb
(97) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(38) |
Jul
(11) |
Aug
(27) |
Sep
(40) |
Oct
(2) |
Nov
(17) |
Dec
(8) |
| 2002 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(480) |
May
(456) |
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(18) |
Nov
(3) |
Dec
(6) |
| 2003 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(147) |
Jul
(7) |
Aug
(3) |
Sep
(235) |
Oct
(10) |
Nov
(2) |
Dec
(1) |
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:56
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/bluetooth In directory usw-pr-cvs1:/tmp/cvs-serv14848/drivers/bluetooth Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/bluetooth added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:54
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/images In directory usw-pr-cvs1:/tmp/cvs-serv22119/arch/ppc/boot/images Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/images added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:54
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/include In directory usw-pr-cvs1:/tmp/cvs-serv22722/arch/ppc/boot/include Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/include added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:54
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/hfs
In directory usw-pr-cvs1:/tmp/cvs-serv27691/hfs
Modified Files:
catalog.c file.c file_cap.c file_hdr.c inode.c
Log Message:
sync 2.4.15 commit 11
Index: catalog.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hfs/catalog.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- catalog.c 25 Feb 2001 23:14:47 -0000 1.1.1.2
+++ catalog.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -100,7 +100,7 @@
static LIST_HEAD(entry_unused);
static struct list_head hash_table[C_HASHSIZE];
-spinlock_t entry_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t entry_lock = SPIN_LOCK_UNLOCKED;
static struct {
int nr_entries;
Index: file.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hfs/file.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- file.c 25 Feb 2001 23:14:47 -0000 1.1.1.2
+++ file.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -32,6 +32,7 @@
/*================ Global variables ================*/
struct file_operations hfs_file_operations = {
+ llseek: generic_file_llseek,
read: hfs_file_read,
write: hfs_file_write,
mmap: generic_file_mmap,
Index: file_cap.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hfs/file_cap.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- file_cap.c 25 Feb 2001 23:14:47 -0000 1.1.1.2
+++ file_cap.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -26,7 +26,8 @@
#include <linux/hfs_fs.h>
/*================ Forward declarations ================*/
-
+static loff_t cap_info_llseek(struct file *, loff_t,
+ int);
static hfs_rwret_t cap_info_read(struct file *, char *,
hfs_rwarg_t, loff_t *);
static hfs_rwret_t cap_info_write(struct file *, const char *,
@@ -45,6 +46,7 @@
/*================ Global variables ================*/
struct file_operations hfs_cap_info_operations = {
+ llseek: cap_info_llseek,
read: cap_info_read,
write: cap_info_write,
fsync: file_fsync,
@@ -83,6 +85,29 @@
hfs_put_nl(hfs_m_to_htime(entry->create_date), meta->fi_ctime);
hfs_put_nl(hfs_m_to_htime(entry->modify_date), meta->fi_mtime);
hfs_put_nl(CURRENT_TIME, meta->fi_utime);
+}
+
+static loff_t cap_info_llseek(struct file *file, loff_t offset, int origin)
+{
+ long long retval;
+
+ switch (origin) {
+ case 2:
+ offset += file->f_dentry->d_inode->i_size;
+ break;
+ case 1:
+ offset += file->f_pos;
+ }
+ retval = -EINVAL;
+ if (offset>=0 && offset<=HFS_FORK_MAX) {
+ if (offset != file->f_pos) {
+ file->f_pos = offset;
+ file->f_reada = 0;
+ file->f_version = ++event;
+ }
+ retval = offset;
+ }
+ return retval;
}
/*
Index: file_hdr.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hfs/file_hdr.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- file_hdr.c 25 Feb 2001 23:14:47 -0000 1.1.1.2
+++ file_hdr.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -39,13 +39,14 @@
#define PRODOSI_AUXTYPE_DIR 0x0200
/*================ Forward declarations ================*/
-
+static loff_t hdr_llseek(struct file *, loff_t, int);
static hfs_rwret_t hdr_read(struct file *, char *, hfs_rwarg_t, loff_t *);
static hfs_rwret_t hdr_write(struct file *, const char *,
hfs_rwarg_t, loff_t *);
/*================ Global variables ================*/
struct file_operations hfs_hdr_operations = {
+ llseek: hdr_llseek,
read: hdr_read,
write: hdr_write,
fsync: file_fsync,
@@ -340,6 +341,29 @@
entry->backup_date = tmp;
hfs_cat_mark_dirty(entry);
}
+}
+
+loff_t hdr_llseek(struct file *file, loff_t offset, int origin)
+{
+ long long retval;
+
+ switch (origin) {
+ case 2:
+ offset += file->f_dentry->d_inode->i_size;
+ break;
+ case 1:
+ offset += file->f_pos;
+ }
+ retval = -EINVAL;
+ if (offset>=0 && offset<file->f_dentry->d_inode->i_size) {
+ if (offset != file->f_pos) {
+ file->f_pos = offset;
+ file->f_reada = 0;
+ file->f_version = ++event;
+ }
+ retval = offset;
+ }
+ return retval;
}
/*
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hfs/inode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- inode.c 25 Feb 2001 23:14:47 -0000 1.1.1.2
+++ inode.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -38,7 +38,7 @@
struct hfs_fork *fk;
struct hfs_cat_entry *entry = HFS_I(inode)->entry;
- if (!IS_NOEXEC(inode) && (fork == HFS_FK_DATA)) {
+ if (fork == HFS_FK_DATA) {
inode->i_mode = S_IRWXUGO | S_IFREG;
} else {
inode->i_mode = S_IRUGO | S_IWUGO | S_IFREG;
@@ -169,7 +169,9 @@
attr->ia_valid &= ~ATTR_SIZE;
}
}
- inode_setattr(inode, attr);
+ error = inode_setattr(inode, attr);
+ if (error)
+ return error;
/* We wouldn't want to mess with the sizes of the other fork */
attr->ia_valid &= ~ATTR_SIZE;
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:48
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm/battery
In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/ospm/battery
Added Files:
Makefile bt.c bt_osl.c
Log Message:
synch 2.4.15 commit 17
--- NEW FILE ---
O_TARGET := ospm_$(notdir $(CURDIR)).o
obj-m := $(O_TARGET)
EXTRA_CFLAGS += $(ACPI_CFLAGS)
obj-y := $(patsubst %.c,%.o,$(wildcard *.c))
include $(TOPDIR)/Rules.make
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: bt.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <acpi.h>
#include "bt.h"
#define _COMPONENT ACPI_BATTERY
MODULE_NAME ("bt")
/****************************************************************************
* Internal Functions
****************************************************************************/
/****************************************************************************
*
* FUNCTION: bt_print
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Prints out information on a specific battery.
*
****************************************************************************/
void
bt_print (
BT_CONTEXT *battery)
{
#ifdef ACPI_DEBUG
acpi_buffer buffer;
PROC_NAME("bt_print");
if (!battery) {
return;
}
buffer.length = 256;
buffer.pointer = acpi_os_callocate(buffer.length);
if (!buffer.pointer) {
return;
}
/*
* Get the full pathname for this ACPI object.
*/
acpi_get_name(battery->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
/*
* Print out basic battery information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Battery[%02x]:[%p] %s\n", battery->device_handle, battery->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| uid[%s] is_present[%d] power_units[%s]\n", battery->uid, battery->is_present, battery->power_units));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
acpi_os_free(buffer.pointer);
#endif /*ACPI_DEBUG*/
return;
}
/****************************************************************************
*
* FUNCTION: bt_get_info
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
* NOTES: Allocates battery_info - which must be freed by the caller.
*
****************************************************************************/
acpi_status
bt_get_info (
BT_CONTEXT *battery,
BT_BATTERY_INFO **battery_info)
{
acpi_status status = AE_OK;
acpi_buffer bif_buffer, package_format, package_data;
acpi_object *package = NULL;
FUNCTION_TRACE("bt_get_info");
if (!battery || !battery_info || *battery_info) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
memset(&bif_buffer, 0, sizeof(acpi_buffer));
/*
* Evalute _BIF:
* -------------
* And be sure to deallocate bif_buffer.pointer!
*/
status = bm_evaluate_object(battery->acpi_handle, "_BIF", NULL,
&bif_buffer);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Extract Package Data:
* ---------------------
* Type-cast this bif_buffer to a package and use helper
* functions to convert results into BT_BATTERY_INFO structure.
* The first attempt is just to get the size of the package
* data; the second gets the data (once we know the required
* bif_buffer size).
*/
status = bm_cast_buffer(&bif_buffer, (void**)&package,
sizeof(acpi_object));
if (ACPI_FAILURE(status)) {
goto end;
}
package_format.length = sizeof("NNNNNNNNNSSSS");
package_format.pointer = "NNNNNNNNNSSSS";
memset(&package_data, 0, sizeof(acpi_buffer));
status = bm_extract_package_data(package, &package_format,
&package_data);
if (status != AE_BUFFER_OVERFLOW) {
if (status == AE_OK) {
status = AE_ERROR;
}
goto end;
}
package_data.pointer = acpi_os_callocate(package_data.length);
if (!package_data.pointer) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
status = bm_extract_package_data(package, &package_format,
&package_data);
if (ACPI_FAILURE(status)) {
acpi_os_free(package_data.pointer);
goto end;
}
*battery_info = package_data.pointer;
end:
acpi_os_free(bif_buffer.pointer);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bt_get_status
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_get_status (
BT_CONTEXT *battery,
BT_BATTERY_STATUS **battery_status)
{
acpi_status status = AE_OK;
acpi_buffer bst_buffer, package_format, package_data;
acpi_object *package = NULL;
FUNCTION_TRACE("bt_get_status");
if (!battery || !battery_status || *battery_status) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
memset(&bst_buffer, 0, sizeof(acpi_buffer));
/*
* Evalute _BST:
* -------------
* And be sure to deallocate bst_buffer.pointer!
*/
status = bm_evaluate_object(battery->acpi_handle, "_BST",
NULL, &bst_buffer);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Extract Package Data:
* ---------------------
* Type-cast this bst_buffer to a package and use helper
* functions to convert results into BT_BATTERY_STATUS structure.
* The first attempt is just to get the size of the package data;
* the second gets the data (once we know the required bst_buffer
* size).
*/
status = bm_cast_buffer(&bst_buffer, (void**)&package,
sizeof(acpi_object));
if (ACPI_FAILURE(status)) {
goto end;
}
package_format.length = sizeof("NNNN");
package_format.pointer = "NNNN";
memset(&package_data, 0, sizeof(acpi_buffer));
status = bm_extract_package_data(package, &package_format,
&package_data);
if (status != AE_BUFFER_OVERFLOW) {
if (status == AE_OK) {
status = AE_ERROR;
}
goto end;
}
package_data.pointer = acpi_os_callocate(package_data.length);
if (!package_data.pointer) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
status = bm_extract_package_data(package, &package_format,
&package_data);
if (ACPI_FAILURE(status)) {
acpi_os_free(package_data.pointer);
goto end;
}
*battery_status = package_data.pointer;
end:
acpi_os_free(bst_buffer.pointer);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bt_check_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_check_device (
BT_CONTEXT *battery)
{
acpi_status status = AE_OK;
BM_DEVICE_STATUS battery_status = BM_STATUS_UNKNOWN;
u32 was_present = FALSE;
BT_BATTERY_INFO *battery_info = NULL;
FUNCTION_TRACE("bt_check_device");
if (!battery) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
was_present = battery->is_present;
/*
* Battery Present?
* ----------------
* Get the device status and check if battery slot is occupied.
*/
status = bm_get_device_status(battery->device_handle, &battery_status);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unable to get battery status.\n"));
return_ACPI_STATUS(status);
}
if (battery_status & BM_STATUS_BATTERY_PRESENT) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery socket occupied.\n"));
battery->is_present = TRUE;
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery socket not occupied.\n"));
battery->is_present = FALSE;
}
/*
* Battery Appeared?
* -----------------
*/
if (!was_present && battery->is_present) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery insertion detected.\n"));
/*
* Units of Power?
* ---------------
* Get the 'units of power', as we'll need this to report
* status information.
*/
status = bt_get_info(battery, &battery_info);
if (ACPI_SUCCESS(status)) {
battery->power_units = (battery_info->power_unit)
? BT_POWER_UNITS_AMPS : BT_POWER_UNITS_WATTS;
acpi_os_free(battery_info);
}
}
/*
* Battery Disappeared?
* --------------------
*/
else if (was_present && !battery->is_present) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Battery removal detected.\n"));
battery->power_units = BT_POWER_UNITS_DEFAULT;
}
return_ACPI_STATUS(status);
}
/*****************************************************************************
*
* FUNCTION: bt_add_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_add_device (
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
BM_DEVICE *device = NULL;
BT_CONTEXT *battery = NULL;
FUNCTION_TRACE("bt_add_device");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding battery device [%02x].\n", device_handle));
if (!context || *context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Get information on this device.
*/
status = bm_get_device_info(device_handle, &device);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Allocate a new BT_CONTEXT structure.
*/
battery = acpi_os_callocate(sizeof(BT_CONTEXT));
if (!battery) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
battery->device_handle = device->handle;
battery->acpi_handle = device->acpi_handle;
strncpy(battery->uid, device->id.uid, sizeof(battery->uid));
battery->power_units = BT_POWER_UNITS_DEFAULT;
battery->is_present = FALSE;
/*
* See if battery is really present.
*/
status = bt_check_device(battery);
if (ACPI_FAILURE(status)) {
goto end;
}
status = bt_osl_add_device(battery);
if (ACPI_FAILURE(status)) {
goto end;
}
*context = battery;
bt_print(battery);
end:
if (ACPI_FAILURE(status)) {
acpi_os_free(battery);
}
return_ACPI_STATUS(status);
}
/*****************************************************************************
*
* FUNCTION: bt_remove_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_remove_device (
void **context)
{
acpi_status status = AE_OK;
BT_CONTEXT *battery = NULL;
FUNCTION_TRACE("bt_remove_device");
if (!context || !*context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
battery = (BT_CONTEXT*)*context;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing battery device [%02x].\n", battery->device_handle));
bt_osl_remove_device(battery);
acpi_os_free(battery);
*context = NULL;
return_ACPI_STATUS(status);
}
/*****************************************************************************
* External Functions
*****************************************************************************/
/*****************************************************************************
*
* FUNCTION: bt_initialize
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_initialize (void)
{
acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("bt_initialize");
memset(&criteria, 0, sizeof(BM_DEVICE_ID));
memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Register driver for driver method battery devices.
*/
MEMCPY(criteria.hid, BT_HID_CM_BATTERY, sizeof(BT_HID_CM_BATTERY));
driver.notify = &bt_notify;
driver.request = &bt_request;
status = bm_register_driver(&criteria, &driver);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bt_terminate
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_terminate (void)
{
acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("bt_terminate");
memset(&criteria, 0, sizeof(BM_DEVICE_ID));
memset(&driver, 0, sizeof(BM_DRIVER));
/*
* Unregister driver for driver method battery devices.
*/
MEMCPY(criteria.hid, BT_HID_CM_BATTERY, sizeof(BT_HID_CM_BATTERY));
driver.notify = &bt_notify;
driver.request = &bt_request;
status = bm_unregister_driver(&criteria, &driver);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bt_notify
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_notify (
BM_NOTIFY notify_type,
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("bt_notify");
if (!context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
switch (notify_type) {
case BM_NOTIFY_DEVICE_ADDED:
status = bt_add_device(device_handle, context);
break;
case BM_NOTIFY_DEVICE_REMOVED:
status = bt_remove_device(context);
break;
case BT_NOTIFY_STATUS_CHANGE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change (_BST) event detected.\n"));
status = bt_osl_generate_event(notify_type,
((BT_CONTEXT*)*context));
break;
case BT_NOTIFY_INFORMATION_CHANGE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Information change (_BIF) event detected.\n"));
status = bt_check_device((BT_CONTEXT*)*context);
if (ACPI_SUCCESS(status)) {
status = bt_osl_generate_event(notify_type,
((BT_CONTEXT*)*context));
}
break;
default:
status = AE_SUPPORT;
break;
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bt_request
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bt_request (
BM_REQUEST *request,
void *context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("bt_request");
/*
* Must have a valid request structure and context.
*/
if (!request || !context)
return_ACPI_STATUS(AE_BAD_PARAMETER);
/*
* Handle request:
* ---------------
*/
switch (request->command) {
default:
status = AE_SUPPORT;
break;
}
request->status = status;
return_ACPI_STATUS(status);
}
--- NEW FILE ---
/******************************************************************************
*
* Module Name: bt_osl.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Changes:
* Brendan Burns <bb...@ws...> 2000-11-15
* - added proc battery interface
* - parse returned data from _BST and _BIF
* Andy Grover <and...@in...> 2000-12-8
* - improved proc interface
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <acpi.h>
#include "bt.h"
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Control Method Battery Driver");
#define BT_PROC_ROOT "battery"
#define BT_PROC_STATUS "status"
#define BT_PROC_INFO "info"
extern struct proc_dir_entry *bm_proc_root;
static struct proc_dir_entry *bt_proc_root = NULL;
/****************************************************************************
*
* FUNCTION: bt_osl_proc_read_info
*
****************************************************************************/
static int
bt_osl_proc_read_info (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
{
BT_CONTEXT *battery = NULL;
BT_BATTERY_INFO *battery_info = NULL;
char *p = page;
int len = 0;
if (!context || (off != 0)) {
goto end;
}
battery = (BT_CONTEXT*)context;
/*
* Battery Present?
* ----------------
*/
if (!battery->is_present) {
p += sprintf(p, "Present: no\n");
goto end;
}
else {
p += sprintf(p, "Present: yes\n");
}
/*
* Get Battery Information:
* ------------------------
*/
if (ACPI_FAILURE(bt_get_info(battery, &battery_info))) {
p += sprintf(p, "Error reading battery information (_BIF)\n");
goto end;
}
if (battery_info->design_capacity == BT_UNKNOWN) {
p += sprintf(p, "Design Capacity: unknown\n");
}
else {
p += sprintf(p, "Design Capacity: %d %sh\n",
(u32)battery_info->design_capacity,
battery->power_units);
}
if (battery_info->last_full_capacity == BT_UNKNOWN) {
p += sprintf(p, "Last Full Capacity: unknown\n");
}
else {
p += sprintf(p, "Last Full Capacity: %d %sh\n",
(u32)battery_info->last_full_capacity,
battery->power_units);
}
if (battery_info->battery_technology == 0) {
p += sprintf(p, "Battery Technology: primary (non-rechargeable)\n");
}
else if (battery_info->battery_technology == 1) {
p += sprintf(p, "Battery Technology: secondary (rechargeable)\n");
}
else {
p += sprintf(p, "Battery Technology: unknown\n");
}
if (battery_info->design_voltage == BT_UNKNOWN) {
p += sprintf(p, "Design Voltage: unknown\n");
}
else {
p += sprintf(p, "Design Voltage: %d mV\n",
(u32)battery_info->design_voltage);
}
p += sprintf(p, "Design Capacity Warning: %d %sh\n",
(u32)battery_info->design_capacity_warning,
battery->power_units);
p += sprintf(p, "Design Capacity Low: %d %sh\n",
(u32)battery_info->design_capacity_low,
battery->power_units);
p += sprintf(p, "Capacity Granularity 1: %d %sh\n",
(u32)battery_info->battery_capacity_granularity_1,
battery->power_units);
p += sprintf(p, "Capacity Granularity 2: %d %sh\n",
(u32)battery_info->battery_capacity_granularity_2,
battery->power_units);
p += sprintf(p, "Model Number: %s\n",
battery_info->model_number);
p += sprintf(p, "Serial Number: %s\n",
battery_info->serial_number);
p += sprintf(p, "Battery Type: %s\n",
battery_info->battery_type);
p += sprintf(p, "OEM Info: %s\n",
battery_info->oem_info);
end:
len = (p - page);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
acpi_os_free(battery_info);
return(len);
}
/****************************************************************************
*
* FUNCTION: bt_osl_proc_read_status
*
****************************************************************************/
static int
bt_osl_proc_read_status (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
{
BT_CONTEXT *battery = NULL;
BT_BATTERY_STATUS *battery_status = NULL;
char *p = page;
int len = 0;
if (!context || (off != 0)) {
goto end;
}
battery = (BT_CONTEXT*)context;
/*
* Battery Present?
* ----------------
*/
if (!battery->is_present) {
p += sprintf(p, "Present: no\n");
goto end;
}
else {
p += sprintf(p, "Present: yes\n");
}
/*
* Get Battery Status:
* -------------------
*/
if (ACPI_FAILURE(bt_get_status(battery, &battery_status))) {
p += sprintf(p, "Error reading battery status (_BST)\n");
goto end;
}
/*
* Store Data:
* -----------
*/
if (!battery_status->state) {
p += sprintf(p, "State: ok\n");
}
else {
if (battery_status->state & 0x1)
p += sprintf(p, "State: discharging\n");
if (battery_status->state & 0x2)
p += sprintf(p, "State: charging\n");
if (battery_status->state & 0x4)
p += sprintf(p, "State: critically low\n");
}
if (battery_status->present_rate == BT_UNKNOWN) {
p += sprintf(p, "Present Rate: unknown\n");
}
else {
p += sprintf(p, "Present Rate: %d %s\n",
(u32)battery_status->present_rate,
battery->power_units);
}
if (battery_status->remaining_capacity == BT_UNKNOWN) {
p += sprintf(p, "Remaining Capacity: unknown\n");
}
else {
p += sprintf(p, "Remaining Capacity: %d %sh\n",
(u32)battery_status->remaining_capacity,
battery->power_units);
}
if (battery_status->present_voltage == BT_UNKNOWN) {
p += sprintf(p, "Battery Voltage: unknown\n");
}
else {
p += sprintf(p, "Battery Voltage: %d mV\n",
(u32)battery_status->present_voltage);
}
end:
len = (p - page);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
acpi_os_free(battery_status);
return(len);
}
/****************************************************************************
*
* FUNCTION: bt_osl_add_device
*
****************************************************************************/
acpi_status
bt_osl_add_device(
BT_CONTEXT *battery)
{
struct proc_dir_entry *proc_entry = NULL;
if (!battery) {
return(AE_BAD_PARAMETER);
}
if (battery->is_present) {
printk("ACPI: Battery socket found, battery present\n");
}
else {
printk("ACPI: Battery socket found, battery absent\n");
}
proc_entry = proc_mkdir(battery->uid, bt_proc_root);
if (!proc_entry) {
return(AE_ERROR);
}
create_proc_read_entry(BT_PROC_STATUS, S_IFREG | S_IRUGO,
proc_entry, bt_osl_proc_read_status, (void*)battery);
create_proc_read_entry(BT_PROC_INFO, S_IFREG | S_IRUGO,
proc_entry, bt_osl_proc_read_info, (void*)battery);
return(AE_OK);
}
/****************************************************************************
*
* FUNCTION: bt_osl_remove_device
*
****************************************************************************/
acpi_status
bt_osl_remove_device (
BT_CONTEXT *battery)
{
char proc_entry[64];
if (!battery) {
return(AE_BAD_PARAMETER);
}
sprintf(proc_entry, "%s/%s", battery->uid, BT_PROC_INFO);
remove_proc_entry(proc_entry, bt_proc_root);
sprintf(proc_entry, "%s/%s", battery->uid, BT_PROC_STATUS);
remove_proc_entry(proc_entry, bt_proc_root);
sprintf(proc_entry, "%s", battery->uid);
remove_proc_entry(proc_entry, bt_proc_root);
return(AE_OK);
}
/****************************************************************************
*
* FUNCTION: bt_osl_generate_event
*
****************************************************************************/
acpi_status
bt_osl_generate_event (
u32 event,
BT_CONTEXT *battery)
{
acpi_status status = AE_OK;
if (!battery) {
return(AE_BAD_PARAMETER);
}
switch (event) {
case BT_NOTIFY_STATUS_CHANGE:
case BT_NOTIFY_INFORMATION_CHANGE:
status = bm_osl_generate_event(battery->device_handle,
BT_PROC_ROOT, battery->uid, event, 0);
break;
default:
return(AE_BAD_PARAMETER);
break;
}
return(status);
}
/****************************************************************************
*
* FUNCTION: bt_osl_init
*
* PARAMETERS: <none>
*
* RETURN: 0: Success
*
* DESCRIPTION: Module initialization.
*
****************************************************************************/
static int __init
bt_osl_init (void)
{
acpi_status status = AE_OK;
/* abort if no busmgr */
if (!bm_proc_root)
return -ENODEV;
bt_proc_root = proc_mkdir(BT_PROC_ROOT, bm_proc_root);
if (!bt_proc_root) {
status = AE_ERROR;
}
else {
status = bt_initialize();
if (ACPI_FAILURE(status)) {
remove_proc_entry(BT_PROC_ROOT, bm_proc_root);
}
}
return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
}
/****************************************************************************
*
* FUNCTION: bt_osl_cleanup
*
* PARAMETERS: <none>
*
* RETURN: <none>
*
* DESCRIPTION: Module cleanup.
*
****************************************************************************/
static void __exit
bt_osl_cleanup (void)
{
bt_terminate();
if (bt_proc_root) {
remove_proc_entry(BT_PROC_ROOT, bm_proc_root);
}
return;
}
module_init(bt_osl_init);
module_exit(bt_osl_cleanup);
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:47
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/prep In directory usw-pr-cvs1:/tmp/cvs-serv22242/arch/ppc/boot/prep Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/prep added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:44
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm/system
In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/ospm/system
Added Files:
Makefile sm.c sm_osl.c
Log Message:
synch 2.4.15 commit 17
--- NEW FILE ---
O_TARGET := ospm_$(notdir $(CURDIR)).o
obj-m := $(O_TARGET)
EXTRA_CFLAGS += $(ACPI_CFLAGS)
obj-y := $(patsubst %.c,%.o,$(wildcard *.c))
include $(TOPDIR)/Rules.make
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: sm.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <acpi.h>
#include "sm.h"
#define _COMPONENT ACPI_SYSTEM
MODULE_NAME ("sm")
/****************************************************************************
* Internal Functions
****************************************************************************/
/****************************************************************************
*
* FUNCTION: sm_print
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Prints out information on a specific system.
*
****************************************************************************/
void
sm_print (
SM_CONTEXT *system)
{
#ifdef ACPI_DEBUG
acpi_buffer buffer;
PROC_NAME("sm_print");
buffer.length = 256;
buffer.pointer = acpi_os_callocate(buffer.length);
if (!buffer.pointer) {
return;
}
/*
* Get the full pathname for this ACPI object.
*/
acpi_get_name(system->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
/*
* Print out basic system information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| System[%02x]:[%p] %s\n", system->device_handle, system->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| states: %cS0 %cS1 %cS2 %cS3 %cS4 %cS5\n", (system->states[0]?'+':'-'), (system->states[1]?'+':'-'), (system->states[2]?'+':'-'), (system->states[3]?'+':'-'), (system->states[4]?'+':'-'), (system->states[5]?'+':'-')));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
acpi_os_free(buffer.pointer);
#endif /*ACPI_DEBUG*/
return;
}
/****************************************************************************
*
* FUNCTION: sm_add_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
sm_add_device(
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
BM_DEVICE *device = NULL;
SM_CONTEXT *system = NULL;
u8 i, type_a, type_b;
FUNCTION_TRACE("sm_add_device");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding system device [%02x].\n", device_handle));
if (!context || *context) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context."));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Allocate a new SM_CONTEXT structure.
*/
system = acpi_os_callocate(sizeof(SM_CONTEXT));
if (!system) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/*
* Get information on this device.
*/
status = bm_get_device_info(device_handle, &device);
if (ACPI_FAILURE(status)) {
goto end;
}
system->device_handle = device->handle;
system->acpi_handle = device->acpi_handle;
/*
* Sx States:
* ----------
* Figure out which Sx states are supported.
*/
for (i=0; i<SM_MAX_SYSTEM_STATES; i++) {
if (ACPI_SUCCESS(acpi_hw_obtain_sleep_type_register_data(
i,
&type_a,
&type_b))) {
system->states[i] = TRUE;
}
}
status = sm_osl_add_device(system);
if (ACPI_FAILURE(status)) {
goto end;
}
*context = system;
sm_print(system);
end:
if (ACPI_FAILURE(status)) {
acpi_os_free(system);
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: sm_remove_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
sm_remove_device (
void **context)
{
acpi_status status = AE_OK;
SM_CONTEXT *system = NULL;
FUNCTION_TRACE("sm_remove_device");
if (!context || !*context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
system = (SM_CONTEXT*)*context;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing system device [%02x].\n", system->device_handle));
status = sm_osl_remove_device(system);
acpi_os_free(system);
*context = NULL;
return_ACPI_STATUS(status);
}
/****************************************************************************
* External Functions
****************************************************************************/
/****************************************************************************
*
* FUNCTION: sm_initialize
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
sm_initialize (void)
{
acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("sm_initialize");
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
/*
* Register driver for the System device.
*/
criteria.type = BM_TYPE_SYSTEM;
driver.notify = &sm_notify;
driver.request = &sm_request;
status = bm_register_driver(&criteria, &driver);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: sm_terminate
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
sm_terminate (void)
{
acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("sm_terminate");
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
/*
* Unregister driver for System devices.
*/
criteria.type = BM_TYPE_SYSTEM;
driver.notify = &sm_notify;
driver.request = &sm_request;
status = bm_unregister_driver(&criteria, &driver);
return_ACPI_STATUS(status);
}
/*****************************************************************************
*
* FUNCTION: sm_notify
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
sm_notify (
BM_NOTIFY notify_type,
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("sm_notify");
if (!context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
switch (notify_type) {
case BM_NOTIFY_DEVICE_ADDED:
status = sm_add_device(device_handle, context);
break;
case BM_NOTIFY_DEVICE_REMOVED:
status = sm_remove_device(context);
break;
default:
status = AE_SUPPORT;
break;
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: sm_request
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
sm_request (
BM_REQUEST *request,
void *context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("sm_request");
/*
* Must have a valid request structure and context.
*/
if (!request || !context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Handle Request:
* ---------------
*/
switch (request->command) {
default:
status = AE_SUPPORT;
break;
}
request->status = status;
return_ACPI_STATUS(status);
}
--- NEW FILE ---
/******************************************************************************
*
* Module Name: sm_osl.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/pm.h>
#include <asm/uaccess.h>
#include <linux/acpi.h>
#include <asm/io.h>
#include <linux/mc146818rtc.h>
#include <linux/delay.h>
#include <acpi.h>
#include "sm.h"
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - ACPI System Driver");
#define SM_PROC_INFO "info"
#define SM_PROC_DSDT "dsdt"
extern struct proc_dir_entry *bm_proc_root;
struct proc_dir_entry *sm_proc_root = NULL;
static void (*sm_pm_power_off)(void) = NULL;
static ssize_t sm_osl_read_dsdt(struct file *, char *, size_t, loff_t *);
static struct file_operations proc_dsdt_operations = {
read: sm_osl_read_dsdt,
};
static acpi_status sm_osl_suspend(u32 state);
struct proc_dir_entry *bm_proc_sleep;
struct proc_dir_entry *bm_proc_alarm;
struct proc_dir_entry *bm_proc_gpe;
static int
sm_osl_proc_read_sleep (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
{
SM_CONTEXT *system = (SM_CONTEXT*) context;
char *str = page;
int len;
int i;
if (!system)
goto end;
if (off != 0)
goto end;
for (i = 0; i <= ACPI_S5; i++) {
if (system->states[i])
str += sprintf(str,"S%d ", i);
}
str += sprintf(str, "\n");
end:
len = (str - page);
if (len < (off + count))
*eof = 1;
*start = page + off;
len -= off;
if (len > count)
len = count;
if (len < 0)
len = 0;
return (len);
}
int sm_osl_proc_write_sleep (struct file *file,
const char *buffer,
unsigned long count,
void *data)
{
SM_CONTEXT *system = (SM_CONTEXT*) data;
char str[10];
char *strend;
unsigned long value;
if (count > (sizeof(str) - 1))
return -EINVAL;
if (copy_from_user(str,buffer,count))
return -EFAULT;
str[count] = '\0';
value = simple_strtoul(str,&strend,0);
if (str == strend)
return -EINVAL;
if (value == 0 || value >= ACPI_S5)
return -EINVAL;
/*
* make sure that the sleep state is supported
*/
if (system->states[value] != TRUE)
return -EINVAL;
sm_osl_suspend(value);
return (count);
}
/****************************************************************************
*
* FUNCTION: sm_osl_proc_read_info
*
****************************************************************************/
static int
sm_osl_proc_read_info (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
{
acpi_status status = AE_OK;
SM_CONTEXT *system = NULL;
char *p = page;
int len;
acpi_system_info system_info;
acpi_buffer buffer;
u32 i = 0;
if (!context) {
goto end;
}
system = (SM_CONTEXT*) context;
/* don't get status more than once for a single proc read */
if (off != 0) {
goto end;
}
/*
* Get ACPI CA Information.
*/
buffer.length = sizeof(system_info);
buffer.pointer = &system_info;
status = acpi_get_system_info(&buffer);
if (ACPI_FAILURE(status)) {
p += sprintf(p, "ACPI-CA Version: unknown\n");
}
else {
p += sprintf(p, "ACPI-CA Version: %x\n",
system_info.acpi_ca_version);
}
p += sprintf(p, "Sx States Supported: ");
for (i=0; i<SM_MAX_SYSTEM_STATES; i++) {
if (system->states[i]) {
p += sprintf(p, "S%d ", i);
}
}
p += sprintf(p, "\n");
end:
len = (p - page);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return(len);
}
/****************************************************************************
*
* FUNCTION: sm_osl_read_dsdt
*
****************************************************************************/
static ssize_t
sm_osl_read_dsdt(
struct file *file,
char *buf,
size_t count,
loff_t *ppos)
{
acpi_buffer acpi_buf;
void *data;
size_t size = 0;
acpi_buf.length = 0;
acpi_buf.pointer = NULL;
/* determine what buffer size we will need */
if (acpi_get_table(ACPI_TABLE_DSDT, 1, &acpi_buf) != AE_BUFFER_OVERFLOW) {
return 0;
}
acpi_buf.pointer = kmalloc(acpi_buf.length, GFP_KERNEL);
if (!acpi_buf.pointer) {
return -ENOMEM;
}
/* get the table for real */
if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_DSDT, 1, &acpi_buf))) {
kfree(acpi_buf.pointer);
return 0;
}
if (*ppos < acpi_buf.length) {
data = acpi_buf.pointer + file->f_pos;
size = acpi_buf.length - file->f_pos;
if (size > count)
size = count;
if (copy_to_user(buf, data, size)) {
kfree(acpi_buf.pointer);
return -EFAULT;
}
}
kfree(acpi_buf.pointer);
*ppos += size;
return size;
}
static int
sm_osl_proc_read_alarm (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
{
char *str = page;
int len;
u32 sec,min,hr;
u32 day,mo,yr;
if (off != 0) goto out;
spin_lock(&rtc_lock);
sec = CMOS_READ(RTC_SECONDS_ALARM);
min = CMOS_READ(RTC_MINUTES_ALARM);
hr = CMOS_READ(RTC_HOURS_ALARM);
#if 0
/* if I ever get an FACP with proper values, maybe I'll enable this code */
if (acpi_gbl_FADT->day_alrm)
day = CMOS_READ(acpi_gbl_FADT->day_alrm);
else
day = CMOS_READ(RTC_DAY_OF_MONTH);
if (acpi_gbl_FADT->mon_alrm)
mo = CMOS_READ(acpi_gbl_FADT->mon_alrm);
else
mo = CMOS_READ(RTC_MONTH);;
if (acpi_gbl_FADT->century)
yr = CMOS_READ(acpi_gbl_FADT->century) * 100 + CMOS_READ(RTC_YEAR);
else
yr = CMOS_READ(RTC_YEAR);
#else
day = CMOS_READ(RTC_DAY_OF_MONTH);
mo = CMOS_READ(RTC_MONTH);
yr = CMOS_READ(RTC_YEAR);
#endif
spin_unlock(&rtc_lock);
BCD_TO_BIN(sec);
BCD_TO_BIN(min);
BCD_TO_BIN(hr);
BCD_TO_BIN(day);
BCD_TO_BIN(mo);
BCD_TO_BIN(yr);
str += sprintf(str,"%4.4u-",yr);
str += (mo > 12) ?
sprintf(str,"**-") :
sprintf(str,"%2.2u-",mo);
str += (day > 31) ?
sprintf(str,"** ") :
sprintf(str,"%2.2u ",day);
str += (hr > 23) ?
sprintf(str,"**:") :
sprintf(str,"%2.2u:",hr);
str += (min > 59) ?
sprintf(str,"**:") :
sprintf(str,"%2.2u:",min);
str += (sec > 59) ?
sprintf(str,"**\n") :
sprintf(str,"%2.2u\n",sec);
out:
len = str - page;
if (len < count) *eof = 1;
else if (len > count) len = count;
if (len < 0) len = 0;
*start = page;
return len;
}
static int get_date_field(char **str, u32 *value)
{
char *next,*strend;
int error = -EINVAL;
/* try to find delimeter, only to insert null;
* the end of string won't have one, but is still valid
*/
next = strpbrk(*str,"- :");
if (next) *next++ = '\0';
*value = simple_strtoul(*str,&strend,10);
/* signal success if we got a good digit */
if (strend != *str) error = 0;
if (next) *str = next;
return error;
}
int sm_osl_proc_write_alarm (
struct file *file,
const char *buffer,
unsigned long count,
void *data)
{
char buf[30];
char *str = buf;
u32 sec,min,hr;
u32 day,mo,yr;
int adjust = 0;
unsigned char rtc_control;
int error = -EINVAL;
if (count > sizeof(buf) - 1) return -EINVAL;
if (copy_from_user(str,buffer,count)) return -EFAULT;
str[count] = '\0';
/* check for time adjustment */
if (str[0] == '+') {
str++;
adjust = 1;
}
if ((error = get_date_field(&str,&yr))) goto out;
if ((error = get_date_field(&str,&mo))) goto out;
if ((error = get_date_field(&str,&day))) goto out;
if ((error = get_date_field(&str,&hr))) goto out;
if ((error = get_date_field(&str,&min))) goto out;
if ((error = get_date_field(&str,&sec))) goto out;
if (sec > 59) {
min += 1;
sec -= 60;
}
if (min > 59) {
hr += 1;
min -= 60;
}
if (hr > 23) {
day += 1;
hr -= 24;
}
if (day > 31) {
mo += 1;
day -= 31;
}
if (mo > 12) {
yr += 1;
mo -= 12;
}
spin_lock_irq(&rtc_lock);
rtc_control = CMOS_READ(RTC_CONTROL);
if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
BIN_TO_BCD(yr);
BIN_TO_BCD(mo);
BIN_TO_BCD(day);
BIN_TO_BCD(hr);
BIN_TO_BCD(min);
BIN_TO_BCD(sec);
}
if (adjust) {
yr += CMOS_READ(RTC_YEAR);
mo += CMOS_READ(RTC_MONTH);
day += CMOS_READ(RTC_DAY_OF_MONTH);
hr += CMOS_READ(RTC_HOURS);
min += CMOS_READ(RTC_MINUTES);
sec += CMOS_READ(RTC_SECONDS);
}
spin_unlock_irq(&rtc_lock);
if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
BCD_TO_BIN(yr);
BCD_TO_BIN(mo);
BCD_TO_BIN(day);
BCD_TO_BIN(hr);
BCD_TO_BIN(min);
BCD_TO_BIN(sec);
}
if (sec > 59) {
min++;
sec -= 60;
}
if (min > 59) {
hr++;
min -= 60;
}
if (hr > 23) {
day++;
hr -= 24;
}
if (day > 31) {
mo++;
day -= 31;
}
if (mo > 12) {
yr++;
mo -= 12;
}
if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
BIN_TO_BCD(yr);
BIN_TO_BCD(mo);
BIN_TO_BCD(day);
BIN_TO_BCD(hr);
BIN_TO_BCD(min);
BIN_TO_BCD(sec);
}
spin_lock_irq(&rtc_lock);
/* write the fields the rtc knows about */
CMOS_WRITE(hr,RTC_HOURS_ALARM);
CMOS_WRITE(min,RTC_MINUTES_ALARM);
CMOS_WRITE(sec,RTC_SECONDS_ALARM);
/* If the system supports an enhanced alarm, it will have non-zero
* offsets into the CMOS RAM here.
* Which for some reason are pointing to the RTC area of memory.
*/
#if 0
if (acpi_gbl_FADT->day_alrm) CMOS_WRITE(day,acpi_gbl_FADT->day_alrm);
if (acpi_gbl_FADT->mon_alrm) CMOS_WRITE(mo,acpi_gbl_FADT->mon_alrm);
if (acpi_gbl_FADT->century) CMOS_WRITE(yr / 100,acpi_gbl_FADT->century);
#endif
/* enable the rtc alarm interrupt */
if (!(rtc_control & RTC_AIE)) {
rtc_control |= RTC_AIE;
CMOS_WRITE(rtc_control,RTC_CONTROL);
CMOS_READ(RTC_INTR_FLAGS);
}
/* unlock the lock on the rtc now that we're done with it */
spin_unlock_irq(&rtc_lock);
acpi_hw_register_bit_access(ACPI_WRITE,ACPI_MTX_LOCK, RTC_EN, 1);
file->f_pos += count;
error = 0;
out:
return error ? error : count;
}
static int
sm_osl_proc_read_gpe(
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
{
char *str = page;
int size;
int length;
int i;
u32 addr,data;
if (off) goto out;
if (acpi_gbl_FADT->V1_gpe0blk) {
length = acpi_gbl_FADT->gpe0blk_len / 2;
str += sprintf(str,"GPE0: ");
for (i = length; i > 0; i--) {
addr = GPE0_EN_BLOCK | (i - 1);
data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
str += sprintf(str,"%2.2x ",data);
}
str += sprintf(str,"\n");
str += sprintf(str,"Status: ");
for (i = length; i > 0; i--) {
addr = GPE0_STS_BLOCK | (i - 1);
data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
str += sprintf(str,"%2.2x ",data);
}
str += sprintf(str,"\n");
}
if (acpi_gbl_FADT->V1_gpe1_blk) {
length = acpi_gbl_FADT->gpe1_blk_len / 2;
str += sprintf(str,"GPE1: ");
for (i = length; i > 0; i--) {
addr = GPE1_EN_BLOCK | (i - 1);
data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
str += sprintf(str,"%2.2x",data);
}
str += sprintf(str,"\n");
str += sprintf(str,"Status: ");
for (i = length; i > 0; i--) {
addr = GPE1_STS_BLOCK | (i - 1);
data = acpi_hw_register_read(ACPI_MTX_LOCK,addr);
str += sprintf(str,"%2.2x",data);
}
str += sprintf(str,"\n");
}
out:
size = str - page;
if (size < count) *eof = 1;
else if (size > count) size = count;
if (size < 0) size = 0;
*start = page;
return size;
}
static int
sm_osl_proc_write_gpe (
struct file *file,
const char *buffer,
unsigned long count,
void *data)
{
char buf[256];
char *str = buf;
char *next;
int error = -EINVAL;
u32 addr,value = 0;
if (count > sizeof(buf) + 1) return -EINVAL;
if (copy_from_user(str,buffer,count)) return -EFAULT;
str[count] = '\0';
/* set addr to which block to refer to */
if (!strncmp(str,"GPE0 ",5)) addr = GPE0_EN_BLOCK;
else if (!strncmp(str,"GPE1 ",5)) addr = GPE1_EN_BLOCK;
else goto out;
str += 5;
/* set low order bits to index of bit to set */
addr |= simple_strtoul(str,&next,0);
if (next == str) goto out;
if (next) {
str = ++next;
value = simple_strtoul(str,&next,0);
if (next == str) value = 1;
}
value = acpi_hw_register_bit_access(ACPI_WRITE,ACPI_MTX_LOCK,addr,(value ? 1 : 0));
error = 0;
out:
return error ? error : count;
}
/****************************************************************************
*
* FUNCTION: sm_osl_suspend
*
* PARAMETERS: %state: Sleep state to enter. Assumed that caller has filtered
* out bogus values, so it's one of S1, S2, S3 or S4
*
* RETURN: ACPI_STATUS, whether or not we successfully entered and
* exited sleep.
*
* DESCRIPTION:
* This function is the meat of the sleep routine, as far as the ACPI-CA is
* concerned.
*
* See Chapter 9 of the ACPI 2.0 spec for details concerning the methodology here.
*
* It will do the following things:
* - Call arch-specific routines to save the processor and kernel state
* - Call acpi_enter_sleep_state to actually go to sleep
* ....
* When we wake back up, we will:
* - Restore the processor and kernel state
* - Return to the user
*
* By having this routine in here, it hides it from every part of the CA,
* so it can remain OS-independent. The only function that calls this is
* sm_proc_write_sleep, which gets the sleep state to enter from the user.
*
****************************************************************************/
static acpi_status
sm_osl_suspend(u32 state)
{
acpi_status status = AE_ERROR;
unsigned long wakeup_address;
/* get out if state is invalid */
if (state < ACPI_S1 || state > ACPI_S5)
goto acpi_sleep_done;
/* make sure we don't get any suprises */
disable();
/* TODO: save device state and suspend them */
/* save the processor state to memory if going into S2 or S3;
* save it to disk if going into S4.
* Also, set the FWV if going into an STR state
*/
if (state == ACPI_S2 || state == ACPI_S3) {
#ifdef DONT_USE_UNTIL_LOWLEVEL_CODE_EXISTS
wakeup_address = acpi_save_state_mem((unsigned long)&&acpi_sleep_done);
if (!wakeup_address) goto acpi_sleep_done;
acpi_set_firmware_waking_vector(
(ACPI_PHYSICAL_ADDRESS)wakeup_address);
#endif
} else if (state == ACPI_S4)
#ifdef DONT_USE_UNTIL_LOWLEVEL_CODE_EXISTS
if (acpi_save_state_disk((unsigned long)&&acpi_sleep_done))
goto acpi_sleep_done;
#endif
/* set status, since acpi_enter_sleep_state won't return unless something
* goes wrong, or it's just S1.
*/
status = AE_OK;
mdelay(10);
status = acpi_enter_sleep_state(state);
acpi_sleep_done:
/* pause for a bit to allow devices to come back on */
mdelay(10);
/* make sure that the firmware waking vector is reset */
acpi_set_firmware_waking_vector((ACPI_PHYSICAL_ADDRESS)0);
acpi_leave_sleep_state(state);
/* TODO: resume devices and restore their state */
enable();
return status;
}
/****************************************************************************
*
* FUNCTION: sm_osl_power_down
*
****************************************************************************/
void
sm_osl_power_down (void)
{
/* Power down the system (S5 = soft off). */
sm_osl_suspend(ACPI_S5);
}
/****************************************************************************
*
* FUNCTION: sm_osl_add_device
*
****************************************************************************/
acpi_status
sm_osl_add_device(
SM_CONTEXT *system)
{
u32 i = 0;
struct proc_dir_entry *bm_proc_dsdt;
if (!system) {
return(AE_BAD_PARAMETER);
}
printk("ACPI: System firmware supports");
for (i=0; i<SM_MAX_SYSTEM_STATES; i++) {
if (system->states[i]) {
printk(" S%d", i);
}
}
printk("\n");
if (system->states[ACPI_STATE_S5]) {
sm_pm_power_off = pm_power_off;
pm_power_off = sm_osl_power_down;
}
create_proc_read_entry(SM_PROC_INFO, S_IRUGO,
sm_proc_root, sm_osl_proc_read_info, (void*)system);
bm_proc_sleep = create_proc_read_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
sm_proc_root, sm_osl_proc_read_sleep, (void*)system);
if (bm_proc_sleep)
bm_proc_sleep->write_proc = sm_osl_proc_write_sleep;
bm_proc_alarm = create_proc_read_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR,
sm_proc_root,sm_osl_proc_read_alarm, NULL);
if (bm_proc_alarm)
bm_proc_alarm->write_proc = sm_osl_proc_write_alarm;
bm_proc_gpe = create_proc_read_entry("gpe", S_IFREG | S_IRUGO | S_IWUSR,
sm_proc_root,sm_osl_proc_read_gpe,NULL);
if (bm_proc_gpe)
bm_proc_gpe->write_proc = sm_osl_proc_write_gpe;
/*
* Get a wakeup address for use when we come back from sleep.
* At least on IA-32, this needs to be in low memory.
* When sleep is supported on other arch's, then we may want
* to move this out to another place, but GFP_LOW should suffice
* for now.
*/
#if 0
if (system->states[ACPI_S3] || system->states[ACPI_S4]) {
acpi_wakeup_address = (unsigned long)virt_to_phys(get_free_page(GFP_LOWMEM));
printk(KERN_INFO "ACPI: Have wakeup address 0x%8.8x\n",acpi_wakeup_address);
}
#endif
/*
* This returns more than a page, so we need to use our own file ops,
* not proc's generic ones
*/
bm_proc_dsdt = create_proc_entry(SM_PROC_DSDT, S_IRUSR, sm_proc_root);
if (bm_proc_dsdt) {
bm_proc_dsdt->proc_fops = &proc_dsdt_operations;
}
return(AE_OK);
}
/****************************************************************************
*
* FUNCTION: sm_osl_remove_device
*
****************************************************************************/
acpi_status
sm_osl_remove_device (
SM_CONTEXT *system)
{
if (!system) {
return(AE_BAD_PARAMETER);
}
remove_proc_entry(SM_PROC_INFO, sm_proc_root);
remove_proc_entry(SM_PROC_DSDT, sm_proc_root);
return(AE_OK);
}
/****************************************************************************
*
* FUNCTION: sm_osl_generate_event
*
****************************************************************************/
acpi_status
sm_osl_generate_event (
u32 event,
SM_CONTEXT *system)
{
acpi_status status = AE_OK;
if (!system) {
return(AE_BAD_PARAMETER);
}
switch (event) {
default:
return(AE_BAD_PARAMETER);
break;
}
return(status);
}
/****************************************************************************
*
* FUNCTION: sm_osl_init
*
* PARAMETERS: <none>
*
* RETURN: 0: Success
*
* DESCRIPTION: Module initialization.
*
****************************************************************************/
static int __init
sm_osl_init (void)
{
acpi_status status = AE_OK;
/* abort if no busmgr */
if (!bm_proc_root)
return -ENODEV;
sm_proc_root = bm_proc_root;
if (!sm_proc_root) {
status = AE_ERROR;
}
else {
status = sm_initialize();
}
return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
}
/****************************************************************************
*
* FUNCTION: sm_osl_cleanup
*
* PARAMETERS: <none>
*
* RETURN: <none>
*
* DESCRIPTION: Module cleanup.
*
****************************************************************************/
static void __exit
sm_osl_cleanup (void)
{
sm_terminate();
return;
}
module_init(sm_osl_init);
module_exit(sm_osl_cleanup);
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:44
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/common In directory usw-pr-cvs1:/tmp/cvs-serv22661/arch/ppc/boot/common Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/common added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:44
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/common In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/common Removed Files: Makefile cmalloc.c cmclib.c cmcopy.c cmdebug.c cmdelete.c cmeval.c cmglobal.c cminit.c cmobject.c cmutils.c cmxface.c Log Message: synch 2.4.15 commit 17 --- Makefile DELETED --- --- cmalloc.c DELETED --- --- cmclib.c DELETED --- --- cmcopy.c DELETED --- --- cmdebug.c DELETED --- --- cmdelete.c DELETED --- --- cmeval.c DELETED --- --- cmglobal.c DELETED --- --- cminit.c DELETED --- --- cmobject.c DELETED --- --- cmutils.c DELETED --- --- cmxface.c DELETED --- |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:44
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/math-emu In directory usw-pr-cvs1:/tmp/cvs-serv19010/arch/mips/math-emu Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/math-emu added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:41
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/bfs
In directory usw-pr-cvs1:/tmp/cvs-serv25633/bfs
Modified Files:
file.c inode.c
Log Message:
synch 2.4.15 commit 9
Index: file.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/bfs/file.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- file.c 14 Jan 2001 16:39:49 -0000 1.1.1.1
+++ file.c 9 Apr 2002 13:01:37 -0000 1.2
@@ -19,6 +19,7 @@
#endif
struct file_operations bfs_file_operations = {
+ llseek: generic_file_llseek,
read: generic_file_read,
write: generic_file_write,
mmap: generic_file_mmap,
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/bfs/inode.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- inode.c 14 Jan 2001 16:39:50 -0000 1.1.1.1
+++ inode.c 9 Apr 2002 13:01:37 -0000 1.2
@@ -19,6 +19,7 @@
MODULE_AUTHOR("Tigran A. Aivazian <ti...@ve...>");
MODULE_DESCRIPTION("SCO UnixWare BFS filesystem for Linux");
+MODULE_LICENSE("GPL");
EXPORT_NO_SYMBOLS;
#undef DEBUG
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:41
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm In directory usw-pr-cvs1:/tmp/cvs-serv9012/drivers/acpi/ospm Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:41
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/chrp In directory usw-pr-cvs1:/tmp/cvs-serv22582/arch/ppc/boot/chrp Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/chrp added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:40
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/s390/math-emu In directory usw-pr-cvs1:/tmp/cvs-serv26140/arch/s390/math-emu Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/s390/math-emu added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:40
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/pmac In directory usw-pr-cvs1:/tmp/cvs-serv22202/arch/ppc/boot/pmac Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/pmac added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:39
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/cramfs
In directory usw-pr-cvs1:/tmp/cvs-serv25633/cramfs
Modified Files:
Makefile README inode.c uncompress.c
Removed Files:
cramfs.h
Log Message:
synch 2.4.15 commit 9
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/cramfs/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile 14 Jan 2001 16:40:09 -0000 1.1.1.1
+++ Makefile 9 Apr 2002 13:01:37 -0000 1.2
@@ -4,11 +4,10 @@
O_TARGET := cramfs.o
-obj-y := inode.o uncompress.o inflate/zlib.o
+obj-y := inode.o uncompress.o
obj-m := $(O_TARGET)
-include $(TOPDIR)/Rules.make
+CFLAGS_uncompress.o := -I $(TOPDIR)/fs/inflate_fs
-inflate/zlib.o:
- make -C inflate
+include $(TOPDIR)/Rules.make
Index: README
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/cramfs/README,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- README 14 Jan 2001 16:40:11 -0000 1.1.1.1
+++ README 9 Apr 2002 13:01:37 -0000 1.2
@@ -14,11 +14,11 @@
<directory_structure>
<data>
-<superblock>: struct cramfs_super (see cramfs.h).
+<superblock>: struct cramfs_super (see cramfs_fs.h).
<directory_structure>:
For each file:
- struct cramfs_inode (see cramfs.h).
+ struct cramfs_inode (see cramfs_fs.h).
Filename. Not generally null-terminated, but it is
null-padded to a multiple of 4 bytes.
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/cramfs/inode.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- inode.c 14 Jan 2001 16:40:10 -0000 1.1.1.1
+++ inode.c 9 Apr 2002 13:01:37 -0000 1.2
@@ -17,10 +17,16 @@
#include <linux/init.h>
#include <linux/string.h>
#include <linux/locks.h>
+#include <linux/blkdev.h>
+#include <linux/cramfs_fs.h>
#include <asm/uaccess.h>
-#include "cramfs.h"
+#define CRAMFS_SB_MAGIC u.cramfs_sb.magic
+#define CRAMFS_SB_SIZE u.cramfs_sb.size
+#define CRAMFS_SB_BLOCKS u.cramfs_sb.blocks
+#define CRAMFS_SB_FILES u.cramfs_sb.files
+#define CRAMFS_SB_FLAGS u.cramfs_sb.flags
static struct super_operations cramfs_ops;
static struct inode_operations cramfs_dir_inode_operations;
@@ -40,6 +46,8 @@
inode->i_mode = cramfs_inode->mode;
inode->i_uid = cramfs_inode->uid;
inode->i_size = cramfs_inode->size;
+ inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
+ inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_gid = cramfs_inode->gid;
inode->i_ino = CRAMINO(cramfs_inode);
/* inode->i_nlink is left 1 - arguably wrong for directories,
@@ -100,7 +108,11 @@
static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned int len)
{
struct buffer_head * bh_array[BLKS_PER_BUF];
- unsigned i, blocknr, buffer;
+ struct buffer_head * read_array[BLKS_PER_BUF];
+ unsigned i, blocknr, buffer, unread;
+ unsigned long devsize;
+ int major, minor;
+
char *data;
if (!len)
@@ -123,9 +135,34 @@
return read_buffers[i] + blk_offset;
}
+ devsize = ~0UL;
+ major = MAJOR(sb->s_dev);
+ minor = MINOR(sb->s_dev);
+
+ if (blk_size[major])
+ devsize = blk_size[major][minor] >> 2;
+
/* Ok, read in BLKS_PER_BUF pages completely first. */
- for (i = 0; i < BLKS_PER_BUF; i++)
- bh_array[i] = bread(sb->s_dev, blocknr + i, PAGE_CACHE_SIZE);
+ unread = 0;
+ for (i = 0; i < BLKS_PER_BUF; i++) {
+ struct buffer_head *bh;
+
+ bh = NULL;
+ if (blocknr + i < devsize) {
+ bh = getblk(sb->s_dev, blocknr + i, PAGE_CACHE_SIZE);
+ if (!buffer_uptodate(bh))
+ read_array[unread++] = bh;
+ }
+ bh_array[i] = bh;
+ }
+
+ if (unread) {
+ ll_rw_block(READ, unread, read_array);
+ do {
+ unread--;
+ wait_on_buffer(read_array[unread]);
+ } while (unread);
+ }
/* Ok, copy them to the staging area without sleeping. */
buffer = next_buffer;
@@ -138,7 +175,7 @@
struct buffer_head * bh = bh_array[i];
if (bh) {
memcpy(data, bh->b_data, PAGE_CACHE_SIZE);
- bforget(bh);
+ brelse(bh);
} else
memset(data, 0, PAGE_CACHE_SIZE);
data += PAGE_CACHE_SIZE;
@@ -167,36 +204,51 @@
/* Do sanity checks on the superblock */
if (super.magic != CRAMFS_MAGIC) {
- printk("wrong magic\n");
- goto out;
- }
- if (memcmp(super.signature, CRAMFS_SIGNATURE, sizeof(super.signature))) {
- printk("wrong signature\n");
- goto out;
+ /* check at 512 byte offset */
+ memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
+ if (super.magic != CRAMFS_MAGIC) {
+ printk(KERN_ERR "cramfs: wrong magic\n");
+ goto out;
+ }
}
+
+ /* get feature flags first */
if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) {
- printk("unsupported filesystem features\n");
+ printk(KERN_ERR "cramfs: unsupported filesystem features\n");
goto out;
}
/* Check that the root inode is in a sane state */
if (!S_ISDIR(super.root.mode)) {
- printk("root is not a directory\n");
+ printk(KERN_ERR "cramfs: root is not a directory\n");
goto out;
}
root_offset = super.root.offset << 2;
+ if (super.flags & CRAMFS_FLAG_FSID_VERSION_2) {
+ sb->CRAMFS_SB_SIZE=super.size;
+ sb->CRAMFS_SB_BLOCKS=super.fsid.blocks;
+ sb->CRAMFS_SB_FILES=super.fsid.files;
+ } else {
+ sb->CRAMFS_SB_SIZE=1<<28;
+ sb->CRAMFS_SB_BLOCKS=0;
+ sb->CRAMFS_SB_FILES=0;
+ }
+ sb->CRAMFS_SB_MAGIC=super.magic;
+ sb->CRAMFS_SB_FLAGS=super.flags;
if (root_offset == 0)
- printk(KERN_INFO "cramfs: note: empty filesystem");
- else if (root_offset != sizeof(struct cramfs_super)) {
- printk("bad root offset %lu\n", root_offset);
+ printk(KERN_INFO "cramfs: empty filesystem");
+ else if (!(super.flags & CRAMFS_FLAG_SHIFTED_ROOT_OFFSET) &&
+ ((root_offset != sizeof(struct cramfs_super)) &&
+ (root_offset != 512 + sizeof(struct cramfs_super))))
+ {
+ printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset);
goto out;
}
/* Set it all up.. */
- sb->s_op = &cramfs_ops;
+ sb->s_op = &cramfs_ops;
sb->s_root = d_alloc_root(get_cramfs_inode(sb, &super.root));
retval = sb;
-
out:
return retval;
}
@@ -205,8 +257,10 @@
{
buf->f_type = CRAMFS_MAGIC;
buf->f_bsize = PAGE_CACHE_SIZE;
+ buf->f_blocks = sb->CRAMFS_SB_BLOCKS;
buf->f_bfree = 0;
buf->f_bavail = 0;
+ buf->f_files = sb->CRAMFS_SB_FILES;
buf->f_ffree = 0;
buf->f_namelen = 255;
return 0;
@@ -271,14 +325,20 @@
static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry)
{
unsigned int offset = 0;
+ int sorted = dir->i_sb->CRAMFS_SB_FLAGS & CRAMFS_FLAG_SORTED_DIRS;
while (offset < dir->i_size) {
struct cramfs_inode *de;
char *name;
- int namelen;
+ int namelen, retval;
de = cramfs_read(dir->i_sb, OFFSET(dir) + offset, sizeof(*de)+256);
name = (char *)(de+1);
+
+ /* Try to take advantage of sorted directories */
+ if (sorted && (dentry->d_name.name[0] < name[0]))
+ break;
+
namelen = de->namelen << 2;
offset += sizeof(*de) + namelen;
@@ -295,10 +355,16 @@
}
if (namelen != dentry->d_name.len)
continue;
- if (memcmp(dentry->d_name.name, name, namelen))
+ retval = memcmp(dentry->d_name.name, name, namelen);
+ if (retval > 0)
continue;
- d_add(dentry, get_cramfs_inode(dir->i_sb, de));
- return NULL;
+ if (!retval) {
+ d_add(dentry, get_cramfs_inode(dir->i_sb, de));
+ return NULL;
+ }
+ /* else (retval < 0) */
+ if (sorted)
+ break;
}
d_add(dentry, NULL);
return NULL;
@@ -308,6 +374,7 @@
{
struct inode *inode = page->mapping->host;
u32 maxblock, bytes_filled;
+ void *pgdata;
maxblock = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
bytes_filled = 0;
@@ -321,15 +388,18 @@
start_offset = *(u32 *) cramfs_read(sb, blkptr_offset-4, 4);
compr_len = (*(u32 *) cramfs_read(sb, blkptr_offset, 4)
- start_offset);
+ pgdata = kmap(page);
if (compr_len == 0)
; /* hole */
else
- bytes_filled = cramfs_uncompress_block(page_address(page),
+ bytes_filled = cramfs_uncompress_block(pgdata,
PAGE_CACHE_SIZE,
cramfs_read(sb, start_offset, compr_len),
compr_len);
- }
- memset(page_address(page) + bytes_filled, 0, PAGE_CACHE_SIZE - bytes_filled);
+ } else
+ pgdata = kmap(page);
+ memset(pgdata + bytes_filled, 0, PAGE_CACHE_SIZE - bytes_filled);
+ kunmap(page);
flush_dcache_page(page);
SetPageUptodate(page);
UnlockPage(page);
@@ -376,3 +446,5 @@
module_init(init_cramfs_fs)
module_exit(exit_cramfs_fs)
+MODULE_LICENSE("GPL");
+
Index: uncompress.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/cramfs/uncompress.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- uncompress.c 14 Jan 2001 16:40:11 -0000 1.1.1.1
+++ uncompress.c 9 Apr 2002 13:01:37 -0000 1.2
@@ -16,8 +16,9 @@
*/
#include <linux/kernel.h>
-
-#include "inflate/zlib.h"
+#include <linux/errno.h>
+#include <linux/vmalloc.h>
+#include <linux/zlib_fs.h>
static z_stream stream;
static int initialized;
@@ -33,14 +34,14 @@
stream.next_out = dst;
stream.avail_out = dstlen;
- err = cramfs_inflateReset(&stream);
+ err = zlib_fs_inflateReset(&stream);
if (err != Z_OK) {
- printk("cramfs_inflateReset error %d\n", err);
- cramfs_inflateEnd(&stream);
- cramfs_inflateInit(&stream);
+ printk("zlib_fs_inflateReset error %d\n", err);
+ zlib_fs_inflateEnd(&stream);
+ zlib_fs_inflateInit(&stream);
}
- err = cramfs_inflate(&stream, Z_FINISH);
+ err = zlib_fs_inflate(&stream, Z_FINISH);
if (err != Z_STREAM_END)
goto err;
return stream.total_out;
@@ -54,16 +55,23 @@
int cramfs_uncompress_init(void)
{
if (!initialized++) {
+ stream.workspace = vmalloc(zlib_fs_inflate_workspacesize());
+ if ( !stream.workspace ) {
+ initialized = 0;
+ return -ENOMEM;
+ }
stream.next_in = NULL;
stream.avail_in = 0;
- cramfs_inflateInit(&stream);
+ zlib_fs_inflateInit(&stream);
}
return 0;
}
int cramfs_uncompress_exit(void)
{
- if (!--initialized)
- cramfs_inflateEnd(&stream);
+ if (!--initialized) {
+ zlib_fs_inflateEnd(&stream);
+ vfree(stream.workspace);
+ }
return 0;
}
--- cramfs.h DELETED ---
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:39
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/kdb In directory usw-pr-cvs1:/tmp/cvs-serv8888/drivers/acpi/kdb Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/acpi/kdb added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:39
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/gt64120 In directory usw-pr-cvs1:/tmp/cvs-serv19272/arch/mips/gt64120 Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/gt64120 added to the repository |
Update of /cvsroot/linux-vax/kernel-2.4/fs/cramfs/inflate In directory usw-pr-cvs1:/tmp/cvs-serv25633/cramfs/inflate Removed Files: Makefile adler32.c infblock.c infblock.h infcodes.c infcodes.h inffast.c inffast.h inffixed.h inflate.c inftrees.c inftrees.h infutil.c infutil.h uncompr.c zconf.h zlib.h zutil.h Log Message: synch 2.4.15 commit 9 --- Makefile DELETED --- --- adler32.c DELETED --- --- infblock.c DELETED --- --- infblock.h DELETED --- --- infcodes.c DELETED --- --- infcodes.h DELETED --- --- inffast.c DELETED --- --- inffast.h DELETED --- --- inffixed.h DELETED --- --- inflate.c DELETED --- --- inftrees.c DELETED --- --- inftrees.h DELETED --- --- infutil.c DELETED --- --- infutil.h DELETED --- --- uncompr.c DELETED --- --- zconf.h DELETED --- --- zlib.h DELETED --- --- zutil.h DELETED --- |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:28
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/debugger In directory usw-pr-cvs1:/tmp/cvs-serv9102/drivers/acpi/debugger Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/acpi/debugger added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:22
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/ddb5476 In directory usw-pr-cvs1:/tmp/cvs-serv18537/arch/mips/ddb5476 Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/ddb5476 added to the repository |
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/interpreter In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/interpreter Removed Files: Makefile amconfig.c amconvrt.c amcreate.c amdyadic.c amfield.c amfldio.c ammisc.c ammonad.c amnames.c amprep.c amregion.c amresnte.c amresolv.c amresop.c amstore.c amstoren.c amstorob.c amsystem.c amutils.c amxface.c Log Message: synch 2.4.15 commit 17 --- Makefile DELETED --- --- amconfig.c DELETED --- --- amconvrt.c DELETED --- --- amcreate.c DELETED --- --- amdyadic.c DELETED --- --- amfield.c DELETED --- --- amfldio.c DELETED --- --- ammisc.c DELETED --- --- ammonad.c DELETED --- --- amnames.c DELETED --- --- amprep.c DELETED --- --- amregion.c DELETED --- --- amresnte.c DELETED --- --- amresolv.c DELETED --- --- amresop.c DELETED --- --- amstore.c DELETED --- --- amstoren.c DELETED --- --- amstorob.c DELETED --- --- amsystem.c DELETED --- --- amutils.c DELETED --- --- amxface.c DELETED --- |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:17
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000 In directory usw-pr-cvs1:/tmp/cvs-serv19086/arch/mips/au1000 Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000 added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:13:17
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/tree In directory usw-pr-cvs1:/tmp/cvs-serv22290/arch/ppc/boot/tree Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/tree added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:09:00
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/hpfs
In directory usw-pr-cvs1:/tmp/cvs-serv27691/hpfs
Modified Files:
anode.c dir.c file.c inode.c super.c
Log Message:
sync 2.4.15 commit 11
Index: anode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hpfs/anode.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- anode.c 14 Jan 2001 16:27:34 -0000 1.1.1.1
+++ anode.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -161,6 +161,7 @@
if ((a == node && fnod) || na == -1) return se;
c2 = 0;
while (up != -1) {
+ struct anode *new_anode;
if (s->s_hpfs_chk)
if (hpfs_stop_cycles(s, up, &c1, &c2, "hpfs_add_sector_to_btree #2")) return -1;
if (up != node || !fnod) {
@@ -194,7 +195,8 @@
mark_buffer_dirty(bh);
brelse(bh);
a = na;
- if ((anode = hpfs_alloc_anode(s, a, &na, &bh))) {
+ if ((new_anode = hpfs_alloc_anode(s, a, &na, &bh))) {
+ anode = new_anode;
/*anode->up = up != -1 ? up : ra;*/
anode->btree.internal = 1;
anode->btree.n_used_nodes = 1;
@@ -282,7 +284,7 @@
if (s->s_hpfs_chk)
if (hpfs_stop_cycles(s, ano, &d1, &d2, "hpfs_remove_btree #1"))
return;
- anode = hpfs_map_anode(s, ano, &bh);
+ if (!(anode = hpfs_map_anode(s, ano, &bh))) return;
btree1 = &anode->btree;
level++;
pos = 0;
@@ -291,14 +293,14 @@
hpfs_free_sectors(s, btree1->u.external[i].disk_secno, btree1->u.external[i].length);
go_up:
if (!level) return;
+ brelse(bh);
if (s->s_hpfs_chk)
if (hpfs_stop_cycles(s, ano, &c1, &c2, "hpfs_remove_btree #2")) return;
- brelse(bh);
hpfs_free_sectors(s, ano, 1);
oano = ano;
ano = anode->up;
if (--level) {
- anode = hpfs_map_anode(s, ano, &bh);
+ if (!(anode = hpfs_map_anode(s, ano, &bh))) return;
btree1 = &anode->btree;
} else btree1 = btree;
for (i = 0; i < btree1->n_used_nodes; i++) {
Index: dir.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hpfs/dir.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- dir.c 14 Jan 2001 16:27:36 -0000 1.1.1.1
+++ dir.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -212,7 +212,7 @@
hpfs_lock_iget(dir->i_sb, de->directory || (de->ea_size && dir->i_sb->s_hpfs_eas) ? 1 : 2);
if (!(result = iget(dir->i_sb, ino))) {
hpfs_unlock_iget(dir->i_sb);
- hpfs_error(result->i_sb, "hpfs_lookup: can't get inode");
+ hpfs_error(dir->i_sb, "hpfs_lookup: can't get inode");
goto bail1;
}
if (!de->directory) result->i_hpfs_parent_dir = dir->i_ino;
Index: file.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hpfs/file.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- file.c 14 Jan 2001 16:27:42 -0000 1.1.1.1
+++ file.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -11,6 +11,8 @@
#include <linux/smp_lock.h>
#include "hpfs_fn.h"
+#define BLOCKS(size) (((size) + 511) >> 9)
+
/* HUH? */
int hpfs_open(struct inode *i, struct file *f)
{
@@ -46,7 +48,7 @@
unsigned n, disk_secno;
struct fnode *fnode;
struct buffer_head *bh;
- if (((inode->i_size + 511) >> 9) <= file_secno) return 0;
+ if (BLOCKS(inode->u.hpfs_i.mmu_private) <= file_secno) return 0;
n = file_secno - inode->i_hpfs_file_sec;
if (n < inode->i_hpfs_n_secs) return inode->i_hpfs_disk_sec + n;
if (!(fnode = hpfs_map_fnode(inode->i_sb, inode->i_ino, &bh))) return 0;
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hpfs/inode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- inode.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ inode.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -12,6 +12,7 @@
static struct file_operations hpfs_file_ops =
{
+ llseek: generic_file_llseek,
read: generic_file_read,
write: hpfs_file_write,
mmap: generic_file_mmap,
@@ -299,10 +300,12 @@
{
struct inode *inode = dentry->d_inode;
int error;
- if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) return -EINVAL;
+ if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size)
+ return -EINVAL;
if (inode->i_sb->s_hpfs_root == inode->i_ino) return -EINVAL;
if ((error = inode_change_ok(inode, attr))) return error;
- inode_setattr(inode, attr);
+ error = inode_setattr(inode, attr);
+ if (error) return error;
hpfs_write_inode(inode);
return 0;
}
Index: super.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/hpfs/super.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- super.c 14 Jan 2001 16:27:44 -0000 1.1.1.1
+++ super.c 9 Apr 2002 13:11:18 -0000 1.2
@@ -212,6 +212,8 @@
return 0;
}
else if (!strcmp(p, "case")) {
+ if (!rhs || !*rhs)
+ return 0;
if (!strcmp(rhs, "lower"))
*lowercase = 1;
else if (!strcmp(rhs, "asis"))
@@ -220,6 +222,8 @@
return 0;
}
else if (!strcmp(p, "conv")) {
+ if (!rhs || !*rhs)
+ return 0;
if (!strcmp(rhs, "binary"))
*conv = CONV_BINARY;
else if (!strcmp(rhs, "text"))
@@ -230,6 +234,8 @@
return 0;
}
else if (!strcmp(p, "check")) {
+ if (!rhs || !*rhs)
+ return 0;
if (!strcmp(rhs, "none"))
*chk = 0;
else if (!strcmp(rhs, "normal"))
@@ -240,6 +246,8 @@
return 0;
}
else if (!strcmp(p, "errors")) {
+ if (!rhs || !*rhs)
+ return 0;
if (!strcmp(rhs, "continue"))
*errs = 0;
else if (!strcmp(rhs, "remount-ro"))
@@ -250,6 +258,8 @@
return 0;
}
else if (!strcmp(p, "eas")) {
+ if (!rhs || !*rhs)
+ return 0;
if (!strcmp(rhs, "no"))
*eas = 0;
else if (!strcmp(rhs, "ro"))
@@ -260,6 +270,8 @@
return 0;
}
else if (!strcmp(p, "chkdsk")) {
+ if (!rhs || !*rhs)
+ return 0;
if (!strcmp(rhs, "no"))
*chkdsk = 0;
else if (!strcmp(rhs, "errors"))
|