Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16774
b: refs/heads/master
c: 8995b16
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Jan 7, 2006
1 parent 0c14b29 commit 0dba128
Show file tree
Hide file tree
Showing 20 changed files with 354 additions and 139 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fe5dd7c73d328b255286b6b65ca19dd34447f709
refs/heads/master: 8995b161eb142b843094dd614b80e4cce1d66352
1 change: 1 addition & 0 deletions trunk/Documentation/DocBook/kernel-api.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ X!Edrivers/acpi/motherboard.c
X!Edrivers/acpi/bus.c
-->
!Edrivers/acpi/scan.c
!Idrivers/acpi/scan.c
<!-- No correct structured comments
X!Edrivers/acpi/pci_bind.c
-->
Expand Down
4 changes: 4 additions & 0 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,10 @@ running once the system is up.
Limit processor to maximum C-state
max_cstate=9 overrides any DMI blacklist limit.

processor.nocst [HW,ACPI]
Ignore the _CST method to determine C-states,
instead using the legacy FADT method

prompt_ramdisk= [RAM] List of RAM disks to prompt for floppy disk
before loading.
See Documentation/ramdisk.txt.
Expand Down
2 changes: 1 addition & 1 deletion trunk/Documentation/pm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ proceed in the opposite direction.
Q: Who do I contact for additional information about
enabling power management for my specific driver/device?

ACPI Development mailing list: acpi-devel@lists.sourceforge.net
ACPI Development mailing list: linux-acpi@vger.kernel.org

System Interface -- OBSOLETE, DO NOT USE!
----------------*************************
Expand Down
2 changes: 1 addition & 1 deletion trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ S: Supported
ACPI
P: Len Brown
M: len.brown@intel.com
L: acpi-devel@lists.sourceforge.net
L: linux-acpi@vger.kernel.org
W: http://acpi.sourceforge.net/
T: git kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
S: Maintained
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ config ACPI_NUMA
config ACPI_ASUS
tristate "ASUS/Medion Laptop Extras"
depends on X86
default y
---help---
This driver provides support for extra features of ACPI-compatible
ASUS laptops. As some of Medion laptops are made by ASUS, it may also
Expand Down Expand Up @@ -209,7 +208,6 @@ config ACPI_IBM
config ACPI_TOSHIBA
tristate "Toshiba Laptop Extras"
depends on X86
default y
---help---
This driver adds support for access to certain system settings
on "legacy free" Toshiba laptops. These laptops can be recognized by
Expand Down
27 changes: 17 additions & 10 deletions trunk/drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,10 @@ static LIST_HEAD(acpi_bus_drivers);
static DECLARE_MUTEX(acpi_bus_drivers_lock);

/**
* acpi_bus_match
* --------------
* acpi_bus_match - match device IDs to driver's supported IDs
* @device: the device that we are trying to match to a driver
* @driver: driver whose device id table is being checked
*
* Checks the device's hardware (_HID) or compatible (_CID) ids to see if it
* matches the specified driver's criteria.
*/
Expand All @@ -489,8 +491,10 @@ acpi_bus_match(struct acpi_device *device, struct acpi_driver *driver)
}

/**
* acpi_bus_driver_init
* --------------------
* acpi_bus_driver_init - add a device to a driver
* @device: the device to add and initialize
* @driver: driver for the device
*
* Used to initialize a device via its device driver. Called whenever a
* driver is bound to a device. Invokes the driver's add() and start() ops.
*/
Expand Down Expand Up @@ -603,8 +607,9 @@ static int acpi_driver_detach(struct acpi_driver *drv)
}

/**
* acpi_bus_register_driver
* ------------------------
* acpi_bus_register_driver - register a driver with the ACPI bus
* @driver: driver being registered
*
* Registers a driver with the ACPI bus. Searches the namespace for all
* devices that match the driver's criteria and binds. Returns the
* number of devices that were claimed by the driver, or a negative
Expand Down Expand Up @@ -633,8 +638,9 @@ int acpi_bus_register_driver(struct acpi_driver *driver)
EXPORT_SYMBOL(acpi_bus_register_driver);

/**
* acpi_bus_unregister_driver
* --------------------------
* acpi_bus_unregister_driver - unregisters a driver with the APIC bus
* @driver: driver to unregister
*
* Unregisters a driver with the ACPI bus. Searches the namespace for all
* devices that match the driver's criteria and unbinds.
*/
Expand All @@ -660,8 +666,9 @@ int acpi_bus_unregister_driver(struct acpi_driver *driver)
EXPORT_SYMBOL(acpi_bus_unregister_driver);

/**
* acpi_bus_find_driver
* --------------------
* acpi_bus_find_driver - check if there is a driver installed for the device
* @device: device that we are trying to find a supporting driver for
*
* Parses the list of registered drivers looking for a driver applicable for
* the specified device.
*/
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/acpi/tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#define PREFIX "ACPI: "

#define ACPI_MAX_TABLES 256
#define ACPI_MAX_TABLES 128

static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
[ACPI_TABLE_UNKNOWN] = "????",
Expand Down Expand Up @@ -74,7 +74,7 @@ struct acpi_table_sdt {
static unsigned long sdt_pa; /* Physical Address */
static unsigned long sdt_count; /* Table count */

static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES];
static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES] __initdata;

void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr)
{
Expand Down
10 changes: 10 additions & 0 deletions trunk/drivers/mmc/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@ static void mmc_decode_csd(struct mmc_card *card)
csd->capacity = (1 + m) << (e + 2);

csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
} else {
/*
* We only understand CSD structure v1.1 and v1.2.
Expand Down Expand Up @@ -579,6 +584,11 @@ static void mmc_decode_csd(struct mmc_card *card)
csd->capacity = (1 + m) << (e + 2);

csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
}
}

Expand Down
175 changes: 113 additions & 62 deletions trunk/drivers/mmc/mmc_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct mmc_blk_data {

unsigned int usage;
unsigned int block_bits;
unsigned int read_only;
};

static DECLARE_MUTEX(open_lock);
Expand Down Expand Up @@ -85,12 +86,6 @@ static void mmc_blk_put(struct mmc_blk_data *md)
up(&open_lock);
}

static inline int mmc_blk_readonly(struct mmc_card *card)
{
return mmc_card_readonly(card) ||
!(card->csd.cmdclass & CCC_BLOCK_WRITE);
}

static int mmc_blk_open(struct inode *inode, struct file *filp)
{
struct mmc_blk_data *md;
Expand All @@ -102,8 +97,7 @@ static int mmc_blk_open(struct inode *inode, struct file *filp)
check_disk_change(inode->i_bdev);
ret = 0;

if ((filp->f_mode & FMODE_WRITE) &&
mmc_blk_readonly(md->queue.card))
if ((filp->f_mode & FMODE_WRITE) && md->read_only)
ret = -EROFS;
}

Expand Down Expand Up @@ -299,6 +293,12 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)

static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))];

static inline int mmc_blk_readonly(struct mmc_card *card)
{
return mmc_card_readonly(card) ||
!(card->csd.cmdclass & CCC_BLOCK_WRITE);
}

static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
{
struct mmc_blk_data *md;
Expand All @@ -310,64 +310,121 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
__set_bit(devidx, dev_use);

md = kmalloc(sizeof(struct mmc_blk_data), GFP_KERNEL);
if (md) {
memset(md, 0, sizeof(struct mmc_blk_data));
if (!md) {
ret = -ENOMEM;
goto out;
}

md->disk = alloc_disk(1 << MMC_SHIFT);
if (md->disk == NULL) {
kfree(md);
md = ERR_PTR(-ENOMEM);
goto out;
}
memset(md, 0, sizeof(struct mmc_blk_data));

spin_lock_init(&md->lock);
md->usage = 1;
/*
* Set the read-only status based on the supported commands
* and the write protect switch.
*/
md->read_only = mmc_blk_readonly(card);

ret = mmc_init_queue(&md->queue, card, &md->lock);
if (ret) {
put_disk(md->disk);
kfree(md);
md = ERR_PTR(ret);
goto out;
/*
* Figure out a workable block size. MMC cards have:
* - two block sizes, one for read and one for write.
* - may support partial reads and/or writes
* (allows block sizes smaller than specified)
*/
md->block_bits = card->csd.read_blkbits;
if (card->csd.write_blkbits != card->csd.read_blkbits) {
if (card->csd.write_blkbits < card->csd.read_blkbits &&
card->csd.read_partial) {
/*
* write block size is smaller than read block
* size, but we support partial reads, so choose
* the smaller write block size.
*/
md->block_bits = card->csd.write_blkbits;
} else if (card->csd.write_blkbits > card->csd.read_blkbits &&
card->csd.write_partial) {
/*
* read block size is smaller than write block
* size, but we support partial writes. Use read
* block size.
*/
} else {
/*
* We don't support this configuration for writes.
*/
printk(KERN_ERR "%s: unable to select block size for "
"writing (rb%u wb%u rp%u wp%u)\n",
md->disk->disk_name,
1 << card->csd.read_blkbits,
1 << card->csd.write_blkbits,
card->csd.read_partial,
card->csd.write_partial);
md->read_only = 1;
}
md->queue.prep_fn = mmc_blk_prep_rq;
md->queue.issue_fn = mmc_blk_issue_rq;
md->queue.data = md;
}

md->disk->major = major;
md->disk->first_minor = devidx << MMC_SHIFT;
md->disk->fops = &mmc_bdops;
md->disk->private_data = md;
md->disk->queue = md->queue.queue;
md->disk->driverfs_dev = &card->dev;
/*
* Refuse to allow block sizes smaller than 512 bytes.
*/
if (md->block_bits < 9) {
printk(KERN_ERR "%s: unable to support block size %u\n",
mmc_card_id(card), 1 << md->block_bits);
ret = -EINVAL;
goto err_kfree;
}

/*
* As discussed on lkml, GENHD_FL_REMOVABLE should:
*
* - be set for removable media with permanent block devices
* - be unset for removable block devices with permanent media
*
* Since MMC block devices clearly fall under the second
* case, we do not set GENHD_FL_REMOVABLE. Userspace
* should use the block device creation/destruction hotplug
* messages to tell when the card is present.
*/
md->disk = alloc_disk(1 << MMC_SHIFT);
if (md->disk == NULL) {
ret = -ENOMEM;
goto err_kfree;
}

sprintf(md->disk->disk_name, "mmcblk%d", devidx);
sprintf(md->disk->devfs_name, "mmc/blk%d", devidx);
spin_lock_init(&md->lock);
md->usage = 1;

md->block_bits = card->csd.read_blkbits;
ret = mmc_init_queue(&md->queue, card, &md->lock);
if (ret)
goto err_putdisk;

blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
md->queue.prep_fn = mmc_blk_prep_rq;
md->queue.issue_fn = mmc_blk_issue_rq;
md->queue.data = md;

/*
* The CSD capacity field is in units of read_blkbits.
* set_capacity takes units of 512 bytes.
*/
set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9));
}
out:
md->disk->major = major;
md->disk->first_minor = devidx << MMC_SHIFT;
md->disk->fops = &mmc_bdops;
md->disk->private_data = md;
md->disk->queue = md->queue.queue;
md->disk->driverfs_dev = &card->dev;

/*
* As discussed on lkml, GENHD_FL_REMOVABLE should:
*
* - be set for removable media with permanent block devices
* - be unset for removable block devices with permanent media
*
* Since MMC block devices clearly fall under the second
* case, we do not set GENHD_FL_REMOVABLE. Userspace
* should use the block device creation/destruction hotplug
* messages to tell when the card is present.
*/

sprintf(md->disk->disk_name, "mmcblk%d", devidx);
sprintf(md->disk->devfs_name, "mmc/blk%d", devidx);

blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);

/*
* The CSD capacity field is in units of read_blkbits.
* set_capacity takes units of 512 bytes.
*/
set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9));
return md;

err_putdisk:
put_disk(md->disk);
err_kfree:
kfree(md);
out:
return ERR_PTR(ret);
}

static int
Expand Down Expand Up @@ -403,12 +460,6 @@ static int mmc_blk_probe(struct mmc_card *card)
if (!(card->csd.cmdclass & CCC_BLOCK_READ))
return -ENODEV;

if (card->csd.read_blkbits < 9) {
printk(KERN_WARNING "%s: read blocksize too small (%u)\n",
mmc_card_id(card), 1 << card->csd.read_blkbits);
return -ENODEV;
}

md = mmc_blk_alloc(card);
if (IS_ERR(md))
return PTR_ERR(md);
Expand All @@ -419,7 +470,7 @@ static int mmc_blk_probe(struct mmc_card *card)

printk(KERN_INFO "%s: %s %s %luKiB %s\n",
md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
get_capacity(md->disk) >> 1, mmc_blk_readonly(card)?"(ro)":"");
get_capacity(md->disk) >> 1, md->read_only ? "(ro)" : "");

mmc_set_drvdata(card, md);
add_disk(md->disk);
Expand Down
Loading

0 comments on commit 0dba128

Please sign in to comment.